boolean PSLink::Definition (ostream& out) { LinkComp* comp = (LinkComp*) GetSubject(); Graphic* link = comp->GetGraphic(); Line* line = comp->GetLine(); Transformer* link_t = link->GetTransformer(); Transformer* line_t = line->GetTransformer(); Transformer* temp_t = new Transformer(line_t); Resource::ref(link_t); temp_t->postmultiply(*link_t); link->SetTransformer(temp_t); Coord x0, y0, x1, y1; line->GetOriginal(x0, y0, x1, y1); out << "Begin " << MARK << " Line\n"; MinGS(out); out << MARK << "\n"; out << x0 << " " << y0 << " " << x1 << " " << y1 << " Line\n"; out << "End\n\n"; link->SetTransformer(link_t); Resource::unref(link_t); Resource::unref(temp_t); return out.good(); }
LinkComp::LinkComp (Line* line) { if (line != nil) { Coord x0, y0, x1, y1; float fx0, fy0, fx1, fy1; line->GetOriginal(x0, y0, x1, y1); Transformer* t = line->GetTransformer(); Graphic* parent = new Picture(line); parent->SetTransformer(nil); if (t == nil) { fx0 = x0; fy0 = y0; fx1 = x1; fy1 = y1; } else { t->Transform(float(x0), float(y0), fx0, fy0); t->Transform(float(x1), float(y1), fx1, fy1); } delete line; line = new Line(0, 0, 1, 1); InitLine(line, fx0, fy0, fx1, fy1); PinGraphic* pg1 = new PinGraphic; PinGraphic* pg2 = new PinGraphic; pg1->SetBrush(psnonebr); pg2->SetBrush(psnonebr); pg1->Translate(fx0, fy0); pg2->Translate(fx1, fy1); _conn1 = new PinComp(pg1); _conn2 = new PinComp(pg2); parent->Append(line, pg1, pg2); SetGraphic(parent); } }
void LinkComp::Read (istream& in) { GraphicComp::Read(in); Line* line = new Line(0, 0, 1, 1); Transformer* t = ReadTransformer(in); line->SetTransformer(t); Unref(t); _conn1 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); _conn2 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); Graphic* parent = new Picture; parent->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); parent->SetColors(fg, bg); parent->SetBrush(ReadBrush(in)); t = ReadTransformer(in); parent->SetTransformer(t); Unref(t); parent->Append(line, _conn1->GetGraphic(), _conn2->GetGraphic()); SetGraphic(parent); }