return center;
}
+ bool Ellipse::IsConnectable() const
+ {
+ /* cannot be a connector */
+ return false;
+ }
+
Path::Path(pointf* points, int pointCount)
{
/* copy over the points */
return _points[_pointCount - 1];
}
-
Bezier::Bezier(pointf* points, int pointCount, bool filled):
Path(points, pointCount),
_filled(filled)
/* just return the middle point */
return _points[_pointCount / 2];
}
+
+ bool Bezier::IsConnectable() const
+ {
+ /* can be a connector */
+ return true;
+ }
void Bezier::Print(GVJ_t* job, pointf first, pointf last) const
{
return center;
}
+ bool Polygon::IsConnectable() const
+ {
+ /* cannot be a connector */
+ return false;
+ }
+
void Polygon::Print(GVJ_t* job, pointf first, pointf last) const
{
gvputs(job, "<Geom>\n");
return _points[_pointCount / 2];
}
+ bool Polyline::IsConnectable() const
+ {
+ /* cannot be a connector */
+ return false;
+ }
+
void Polyline::Print(GVJ_t* job, pointf first, pointf last) const
{
gvputs(job, "<Geom>\n");
return _geom->GetCenter();
}
+ bool Graphic::IsConnectable() const
+ {
+ return _geom->IsConnectable();
+ }
+
void Graphic::Print(GVJ_t* job, pointf first, pointf last) const
{
if (_line)
virtual pointf GetFirst() const = 0; /* first point -- used by edge logic */
virtual pointf GetLast() const = 0; /* last point -- used by edge logic */
virtual pointf GetCenter() const = 0; /* midpoint of the path -- used by text logic */
+ virtual bool IsConnectable() const = 0; /* whether this geom can be turned into a connector -- used by edge logic */
/* given first (lower left) and last points (upper right), output the geometry */
virtual void Print(GVJ_t* job, pointf first, pointf last) const = 0;
{
public:
Ellipse(pointf* points, bool filled);
- void Print(GVJ_t* job, pointf first, pointf last) const;
- boxf GetBounds() const;
- pointf GetFirst() const;
- pointf GetLast() const;
- pointf GetCenter() const;
-
+ virtual boxf GetBounds() const;
+ virtual pointf GetFirst() const;
+ virtual pointf GetLast() const;
+ virtual pointf GetCenter() const;
+ virtual bool IsConnectable() const;
+
+ void Print(GVJ_t* job, pointf first, pointf last) const;
+
private:
bool _filled;
pointf _points[2];
Path(pointf* points, int pointCount);
~Path();
- boxf GetBounds() const;
- pointf GetFirst() const;
- pointf GetLast() const;
+ virtual boxf GetBounds() const;
+ virtual pointf GetFirst() const;
+ virtual pointf GetLast() const;
protected:
pointf* _points;
public:
Bezier(pointf* points, int pointCount, bool filled);
- pointf GetCenter() const;
-
- void Print(GVJ_t* job, pointf first, pointf last) const;
+ virtual pointf GetCenter() const;
+ virtual bool IsConnectable() const;
+
+ virtual void Print(GVJ_t* job, pointf first, pointf last) const;
+
private:
bool _filled;
};
public:
Polygon(pointf* points, int pointCount, bool filled);
- pointf GetCenter() const;
-
- void Print(GVJ_t* job, pointf first, pointf last) const;
+ virtual pointf GetCenter() const;
+ virtual bool IsConnectable() const;
+ virtual void Print(GVJ_t* job, pointf first, pointf last) const;
+
private:
bool _filled;
};
public:
Polyline(pointf* points, int pointCount);
- pointf GetCenter() const;
+ virtual pointf GetCenter() const;
+ virtual bool IsConnectable() const;
void Print(GVJ_t* job, pointf first, pointf last) const;
+
};
/* Line, Fill and Geom details for each Graphviz graphic */
pointf GetFirst() const;
pointf GetLast() const;
pointf GetCenter() const;
+ bool IsConnectable() const;
void Print(GVJ_t* job, pointf first, pointf last) const;
NodeIds::const_iterator beginId = _nodeIds.find(job->obj->u.e->tail);
NodeIds::const_iterator endId = _nodeIds.find(job->obj->u.e->head);
- /* output first shape as an edge shape */
- PrintEdgeShape(job, _graphics[0], beginId == _nodeIds.end() ? 0 : beginId->second, endId == _nodeIds.end() ? 0 : endId->second);
+ /* output first connectable shape as an edge shape, all else as regular outer shapes */
+ bool firstConnector = true;
+ for (Graphics::const_iterator nextGraphic = _graphics.begin(), lastGraphic = _graphics.end(); nextGraphic != lastGraphic; ++nextGraphic)
+ if (firstConnector && (*nextGraphic)->IsConnectable())
+ {
+ PrintEdgeShape(job, _graphics[0], beginId == _nodeIds.end() ? 0 : beginId->second, endId == _nodeIds.end() ? 0 : endId->second);
+ firstConnector = false;
+ }
+ else
+ PrintOuterShape(job, *nextGraphic);
+
}
ClearGraphicsAndTexts();
}