Inherits IpeFillable.
This object follows the PDF rendering model, but is actually a bit more complicated since we add new subtypes: arcs, parabolas, uniform B-splines (in PDF, all of these are converted to cubic Bezier splines). Unlike Ipe 5, we can now represent objects consisting of more than one subpath. Note that Ipe 5's spline and arc objects are now represented as IpePath objects.
A path object consists of a set of subpaths (IpeSubPath), each of which is either open or closed, and which are rendered by stroking and filling as a whole. The distinction between open and closed is meaningful for stroking only, for filling any open subpath is implicitely closed. Stroking a set of subpaths is identical to stroking them individually. This is not true for filling: using several subpaths, one can construct objects with holes, and more complicated pattern. The filling algorithm is the even-odd rule of PDF: To determine whether a point lies inside the filled shape, draw a ray from that point in any direction, and count the number of path segments that cross the ray. If this number is odd, the point is inside; if even, the point is outside. (IpePath objects can also render using the winding fill rule by setting the StrokeStyle attribute. This isn't really supported by the Ipe user interface, which doesn't show the orientation of paths.)
A subpath consists of a sequence of segments. (A complete ellipse and a closed B-spline curve can appear as special cases of subpaths that cannot be further decomposed into segments.) Segments are either straight, a quadratic Bezier spline, a cubic Bezier spline, an elliptic arc, or a uniform cubic B-spline. The segmented subpath class IpeSegmentSubPath returns segments as IpePathSegment (but they are not internally stored that way).
IpePath::IpePath | ( | IpeRepository * | rep, | |
const IpeXmlAttributes & | attr, | |||
IpeString | data | |||
) | [explicit] |
Construct from XML data.
IpePath::IpePath | ( | const IpeAllAttributes & | attr | ) | [explicit] |
Create empty path object, and null/default attributes.
IpePath::IpePath | ( | const IpeAllAttributes & | attr, | |
const IpeRect & | rect | |||
) | [explicit] |
Create a rectangle.
IpePath::IpePath | ( | const IpeAllAttributes & | attr, | |
const IpeSegment & | seg | |||
) | [explicit] |
Create a single line segment from seg.iP
to seg.iQ
.
IpePath::IpePath | ( | const IpeAllAttributes & | attr, | |
const IpeVector & | center, | |||
double | radius | |||
) | [explicit] |
Create circle with center and radius.
IpePath::IpePath | ( | const IpeAllAttributes & | attr, | |
const IpeVector & | center, | |||
double | radius, | |||
double | alpha0, | |||
double | alpha1 | |||
) | [explicit] |
Create circular arc with center, radius, between given angles.
If alpha1 is larger than alpha0, the arc is oriented positively, otherwise negatively.
IpePath::IpePath | ( | const IpePath & | rhs | ) |
Copy constructor (takes care of reference counting).
IpePath::~IpePath | ( | ) |
Destructor (takes care of reference counting).
IpeObject * IpePath::Clone | ( | ) | const [virtual] |
IpePath * IpePath::AsPath | ( | ) | [virtual] |
void IpePath::SaveAsXml | ( | IpePainter & | painter, | |
IpeStream & | stream, | |||
IpeString | layer | |||
) | const [virtual] |
void IpePath::Draw | ( | IpePainter & | painter | ) | const [virtual] |
void IpePath::Accept | ( | IpeVisitor & | visitor | ) | const [virtual] |
Extend box to include the object transformed by m.
For Ipe objects in a page, don't call this directly. The IpePgObject caches the bounding box, so it is far more efficient to call IpePgObject::BBox.
If called with an empty box, the result of this function is a tight bounding box for the object, with a little leeway in case the boundary is determined by a spline (it has to be approximated to perform this operation).
Implements IpeObject.
Return distance of transformed object to point v. If larger than bound, can just return bound.
Implements IpeObject.
void IpePath::SnapVtx | ( | const IpeVector & | mouse, | |
const IpeMatrix & | m, | |||
IpeVector & | pos, | |||
double & | bound | |||
) | const [virtual] |
Compute possible vertex snapping position for transformed object.
Looks only for positions closer than bound. If successful, modify pos and bound.
Implements IpeObject.
void IpePath::SnapBnd | ( | const IpeVector & | mouse, | |
const IpeMatrix & | m, | |||
IpeVector & | pos, | |||
double & | bound | |||
) | const [virtual] |
Compute boundary snapping position for transformed object.
Looks only for positions closer than bound. If successful, modify pos and bound. The default implementation does nothing.
Reimplemented from IpeObject.
void IpePath::CheckStyle | ( | const IpeStyleSheet * | sheet, | |
IpeAttributeSeq & | seq | |||
) | const [virtual] |
IpeAttribute IpePath::ForwardArrow | ( | ) | const [inline] |
Return arrow of the object.
IpeAttribute IpePath::BackwardArrow | ( | ) | const [inline] |
Return backward arrow of the object.
void IpePath::SetForwardArrow | ( | IpeAttribute | size | ) |
Set forward arrow (if the object can take it).
void IpePath::SetBackwardArrow | ( | IpeAttribute | size | ) |
Set backward arrow (if the object can take it).
void IpePath::DrawArrow | ( | IpePainter & | painter, | |
IpeVector | pos, | |||
IpeAngle | alpha, | |||
IpeAttribute | size | |||
) | [static] |
Draw an arrow of size with tip at v1 directed from v0 to v1.
int IpePath::NumSubPaths | ( | ) | const [inline] |
Return number of subpaths.
const IpeSubPath* IpePath::SubPath | ( | int | i | ) | const [inline] |
Return subpath.
void IpePath::AddSubPath | ( | IpeSubPath * | sp | ) |
Add a subpath to object.
This can only be used directly after the creation of this path object. Once the object has been copied or assigned, this method will panic.
IpePath takes ownership of the subpath.