Ipelib
|
#include <ipepath.h>
Inherits ipe::Object.
Public Member Functions | |
Path (const AllAttributes &attr, const Shape &shape, bool withArrows=false) | |
virtual Object * | clone () const override |
virtual Path * | asPath () override |
virtual Type | type () const override |
void | setPathMode (TPathMode pm) |
void | setStroke (Attribute stroke) |
void | setFill (Attribute fill) |
void | setPen (Attribute pen) |
void | setDashStyle (Attribute dash) |
void | setLineCap (TLineCap s) |
void | setLineJoin (TLineJoin s) |
void | setFillRule (TFillRule s) |
void | setOpacity (Attribute opaq) |
void | setStrokeOpacity (Attribute opaq) |
void | setTiling (Attribute a) |
void | setGradient (Attribute a) |
Attribute | opacity () const |
Attribute | strokeOpacity () const |
Attribute | tiling () const |
Attribute | gradient () const |
TPathMode | pathMode () const |
Attribute | stroke () const |
Attribute | fill () const |
Attribute | pen () const |
Attribute | dashStyle () const |
TLineCap | lineCap () const |
TLineJoin | lineJoin () const |
TFillRule | fillRule () const |
virtual void | saveAsXml (Stream &stream, String layer) const override |
virtual void | draw (Painter &painter) const override |
virtual void | drawSimple (Painter &painter) const override |
virtual void | accept (Visitor &visitor) const override |
virtual void | addToBBox (Rect &box, const Matrix &m, bool cp) const override |
virtual double | distance (const Vector &v, const Matrix &m, double bound) const override |
virtual void | snapVtx (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const override |
virtual void | snapCtl (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const override |
virtual void | snapBnd (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const override |
virtual void | checkStyle (const Cascade *sheet, AttributeSeq &seq) const override |
virtual void | setMatrix (const Matrix &matrix) override |
virtual bool | setAttribute (Property prop, Attribute value) override |
virtual Attribute | getAttribute (Property prop) const noexcept override |
bool | arrow () const |
bool | rArrow () const |
Attribute | arrowShape () const |
Attribute | rArrowShape () const |
Attribute | arrowSize () const |
Attribute | rArrowSize () const |
void | setArrow (bool arrow, Attribute shape, Attribute size) |
void | setRarrow (bool arrow, Attribute shape, Attribute size) |
const Shape & | shape () const |
void | setShape (const Shape &shape) |
![]() | |
virtual | ~Object ()=0 |
virtual Group * | asGroup () |
virtual const Group * | asGroup () const |
virtual Text * | asText () |
virtual Image * | asImage () |
virtual Reference * | asReference () |
virtual TPinned | pinned () const |
void | setPinned (TPinned pin) |
TTransformations | transformations () const |
void | setTransformations (TTransformations trans) |
const Matrix & | matrix () const |
Static Public Member Functions | |
static Path * | create (const XmlAttributes &attr, String data) |
static void | drawArrow (Painter &painter, Vector pos, Angle alpha, Attribute shape, Attribute size, double radius) |
Additional Inherited Members | |
![]() | |
enum | Type { EGroup, EPath, EText, EImage, EReference } |
![]() | |
Object () | |
Object (const AllAttributes &attr) | |
Object (const Object &rhs) | |
Object (const XmlAttributes &attr) | |
void | saveAttributesAsXml (Stream &stream, String layer) const |
![]() | |
static void | checkSymbol (Kind kind, Attribute attr, const Cascade *sheet, AttributeSeq &seq) |
![]() | |
Matrix | iMatrix |
TPinned | iPinned: 8 |
TTransformations | iTransformations: 8 |
The path object (polylines, polygons, and generalizations).
This object represents any vector graphics. The geometry is contained in a Shape.
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. (Path objects can also render using the winding fill rule by setting the fillRule attribute. This isn't really supported by the Ipe user interface, which doesn't show the orientation of paths.)
If the path consists of a single line segment and is filled only, then it is not drawn at all. This can be used to draw arrow heads without bodies. The fill color is used to draw the arrows in this case.
|
explicit |
|
static |
Construct from XML data.
|
overridevirtual |
Return a clone (constant-time).
Implements ipe::Object.
References ipe::SubPath::asCurve(), ipe::SubPath::closed(), ipe::CurveSegment::countCP(), ipe::Curve::countSegments(), ipe::Shape::countSubPaths(), ipe::CurveSegment::cp(), ipe::CurveSegment::EArc, ipe::CurveSegment::ESegment, ipe::Matrix::inverse(), ipe::CurveSegment::last(), ipe::Matrix::linear(), ipe::CurveSegment::matrix(), ipe::Object::matrix(), Path(), ipe::Curve::segment(), ipe::Shape::subPath(), and ipe::CurveSegment::type().
|
overridevirtual |
Return pointer to this object.
Reimplemented from ipe::Object.
|
overridevirtual |
Implements ipe::Object.
References ipe::Object::EPath.
void Path::setPathMode | ( | TPathMode | pm | ) |
Set whether object will be stroked and filled.
Referenced by setAttribute().
void Path::setStroke | ( | Attribute | stroke | ) |
void Path::setFill | ( | Attribute | fill | ) |
void Path::setPen | ( | Attribute | pen | ) |
void Path::setDashStyle | ( | Attribute | dash | ) |
Set dash style.
Referenced by setAttribute().
void Path::setLineCap | ( | TLineCap | s | ) |
Set line cap style.
void Path::setLineJoin | ( | TLineJoin | s | ) |
Set line join style.
void Path::setFillRule | ( | TFillRule | s | ) |
Set fill rule.
void Path::setOpacity | ( | Attribute | opaq | ) |
Set opacity of the object.
Referenced by setAttribute().
void Path::setStrokeOpacity | ( | Attribute | opaq | ) |
Set stroke opacity of the object.
Referenced by setAttribute().
void Path::setTiling | ( | Attribute | til | ) |
Set tiling pattern of the object.
Resets gradient fill.
References ipe::Attribute::NORMAL().
Referenced by setAttribute().
void Path::setGradient | ( | Attribute | grad | ) |
Set gradient fill of the object.
Resets tiling pattern.
References ipe::Attribute::NORMAL().
Referenced by setAttribute().
|
inline |
Return opacity of the opject.
Referenced by getAttribute(), and setAttribute().
|
inline |
Return stroke opacity of the opject.
Referenced by getAttribute(), and setAttribute().
|
inline |
Return tiling pattern.
Referenced by getAttribute(), and setAttribute().
|
inline |
Return gradient fill.
References accept(), addToBBox(), arrow(), arrowShape(), arrowSize(), checkStyle(), dashStyle(), distance(), draw(), drawArrow(), drawSimple(), fill(), fillRule(), getAttribute(), lineCap(), lineJoin(), ipe::Object::matrix(), pathMode(), pen(), rArrow(), rArrowShape(), rArrowSize(), saveAsXml(), setArrow(), setAttribute(), setMatrix(), setRarrow(), ipe::size(), snapBnd(), snapCtl(), snapVtx(), and stroke().
Referenced by getAttribute(), and setAttribute().
|
inline |
Is the object stroked and filled?
Referenced by gradient(), and setAttribute().
|
inline |
Return stroke color.
Referenced by getAttribute(), gradient(), setAttribute(), and setStroke().
|
inline |
Return object fill color.
Referenced by getAttribute(), gradient(), setAttribute(), and setFill().
|
inline |
Return object pen.
Referenced by getAttribute(), gradient(), setAttribute(), and setPen().
|
inline |
Return object line style.
Referenced by getAttribute(), gradient(), and setAttribute().
|
inline |
Return line cap style.
Referenced by draw(), and gradient().
|
inline |
Return line join style.
Referenced by draw(), and gradient().
|
inline |
Return fill rule.
Referenced by draw(), and gradient().
Save the object in XML format.
Implements ipe::Object.
References ipe::EDefaultCap, ipe::EDefaultJoin, ipe::EEvenOddRule, ipe::EStrokedAndFilled, ipe::EWindRule, ipe::Attribute::isNormal(), ipe::Attribute::OPAQUE(), ipe::Shape::save(), ipe::Object::saveAttributesAsXml(), ipe::String::size(), ipe::Attribute::string(), and ipe::String::substr().
Referenced by gradient().
|
overridevirtual |
Draw the object.
Implements ipe::Object.
References ipe::SubPath::asCurve(), ipe::Shape::draw(), drawArrow(), ipe::Painter::drawPath(), ipe::EFilledOnly, ipe::EStrokedAndFilled, ipe::EStrokedOnly, fillRule(), ipe::IPE_PI, ipe::Attribute::isArcArrow(), ipe::Attribute::isNormal(), ipe::Shape::isSegment(), ipe::Matrix::linear(), lineCap(), lineJoin(), ipe::CurveSegment::matrix(), ipe::Object::matrix(), ipe::Painter::matrix(), ipe::Painter::newPath(), ipe::Painter::pop(), ipe::Painter::popMatrix(), ipe::Painter::push(), ipe::Painter::pushMatrix(), ipe::Curve::segment(), ipe::Painter::setDashStyle(), ipe::Painter::setFill(), ipe::Painter::setFillRule(), ipe::Painter::setGradient(), ipe::Painter::setLineCap(), ipe::Painter::setLineJoin(), ipe::Painter::setOpacity(), ipe::Painter::setPen(), ipe::Painter::setStroke(), ipe::Painter::setStrokeOpacity(), ipe::Painter::setTiling(), ipe::Shape::subPath(), ipe::Painter::transform(), ipe::Object::transformations(), ipe::Matrix::translation(), and ipe::Painter::untransform().
Referenced by gradient().
|
overridevirtual |
Draw simple version for selecting and transforming.
Implements ipe::Object.
References ipe::Shape::draw(), ipe::Painter::drawPath(), ipe::EStrokedOnly, ipe::Object::matrix(), ipe::Painter::newPath(), ipe::Painter::popMatrix(), ipe::Painter::pushMatrix(), ipe::Painter::transform(), ipe::Object::transformations(), and ipe::Painter::untransform().
Referenced by gradient().
|
overridevirtual |
Call visitPath of visitor.
Implements ipe::Object.
References ipe::Visitor::visitPath().
Referenced by gradient().
Extend box to include the object transformed by m.
For objects in a page, don't call this directly. The Page caches the bounding box of each object, so it is far more efficient to call Page::bbox.
Control points that lie outside the visual object are included if cp is true.
If called with an empty box and cp == false
, 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 ipe::Object.
References ipe::Shape::addToBBox(), and ipe::Object::matrix().
Referenced by gradient().
Return distance of transformed object to point v. If larger than bound, can just return bound.
Implements ipe::Object.
References ipe::Shape::distance(), and ipe::Object::matrix().
Referenced by gradient().
|
overridevirtual |
Compute vertex 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 ipe::Object.
References ipe::Object::matrix(), and ipe::Shape::snapVtx().
Referenced by gradient().
|
overridevirtual |
Compute control point 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 ipe::Object.
References ipe::Object::matrix(), and ipe::Shape::snapVtx().
Referenced by gradient().
|
overridevirtual |
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 ipe::Object.
References ipe::Object::matrix(), and ipe::Shape::snapBnd().
Referenced by gradient().
|
overridevirtual |
Check all symbolic attributes.
Reimplemented from ipe::Object.
References ipe::Object::checkSymbol(), ipe::EArrowSize, ipe::EColor, ipe::EDashStyle, ipe::EGradient, ipe::EOpacity, ipe::EPen, ipe::ESymbol, ipe::ETiling, and ipe::Attribute::isNormal().
Referenced by gradient().
|
overridevirtual |
Set the transformation matrix.
Don't use this on an Object in a Page, because it wouldn't invalidate its bounding box. Call Page::transform instead.
Reimplemented from ipe::Object.
References ipe::Object::setMatrix().
Referenced by gradient().
Set an attribute on this object.
Returns true if an attribute was actually changed.
Reimplemented from ipe::Object.
References ipe::Attribute::boolean(), dashStyle(), ipe::EPropDashStyle, ipe::EPropFArrow, ipe::EPropFArrowShape, ipe::EPropFArrowSize, ipe::EPropFillColor, ipe::EPropFillRule, ipe::EPropGradient, ipe::EPropLineCap, ipe::EPropLineJoin, ipe::EPropOpacity, ipe::EPropPathMode, ipe::EPropPen, ipe::EPropRArrow, ipe::EPropRArrowShape, ipe::EPropRArrowSize, ipe::EPropStrokeColor, ipe::EPropStrokeOpacity, ipe::EPropTiling, fill(), ipe::Attribute::fillRule(), gradient(), ipe::Attribute::isEnum(), ipe::Attribute::isMidArrow(), ipe::Attribute::lineCap(), ipe::Attribute::lineJoin(), opacity(), pathMode(), ipe::Attribute::pathMode(), pen(), ipe::Object::setAttribute(), setDashStyle(), setFill(), setGradient(), setOpacity(), setPathMode(), setPen(), setStroke(), setStrokeOpacity(), setTiling(), stroke(), strokeOpacity(), and tiling().
Referenced by gradient().
Get setting of an attribute of this object.
If object does not have this attribute, returnes "undefined" attribute.
Reimplemented from ipe::Object.
References ipe::Attribute::Boolean(), dashStyle(), ipe::EPropDashStyle, ipe::EPropFArrow, ipe::EPropFArrowShape, ipe::EPropFArrowSize, ipe::EPropFillColor, ipe::EPropFillRule, ipe::EPropGradient, ipe::EPropLineCap, ipe::EPropLineJoin, ipe::EPropOpacity, ipe::EPropPathMode, ipe::EPropPen, ipe::EPropRArrow, ipe::EPropRArrowShape, ipe::EPropRArrowSize, ipe::EPropStrokeColor, ipe::EPropStrokeOpacity, ipe::EPropTiling, fill(), ipe::Object::getAttribute(), gradient(), opacity(), pen(), stroke(), strokeOpacity(), and tiling().
Referenced by gradient().
|
inline |
Does object have an arrow?
Referenced by gradient(), setArrow(), and setRarrow().
|
inline |
Does object have a reverse arrow?
Referenced by gradient().
|
inline |
Return shape of arrow.
Referenced by gradient().
|
inline |
Return shape of reverse arrow.
Referenced by gradient().
|
inline |
Return size of arrow.
Referenced by gradient().
|
inline |
Return size of reverse arrow.
Referenced by gradient().
Set forward arrow.
References arrow(), ipe::Attribute::isMidArrow(), shape(), and ipe::size().
Referenced by gradient().
Set backward arrow (if the object can take it).
References arrow(), ipe::Attribute::isMidArrow(), shape(), and ipe::size().
Referenced by gradient().
|
static |
Draw an arrow of size with tip at pos directed in direction angle.
References ipe::Attribute::ARROW_FARC(), ipe::Attribute::ARROW_FPTARC(), ipe::Attribute::ARROW_PTARC(), ipe::Arc::beginp(), ipe::Painter::cascade(), ipe::Painter::closePath(), ipe::Object::draw(), ipe::Painter::drawArc(), ipe::Painter::drawPath(), ipe::EArrowSize, ipe::Arc::endp(), ipe::EStrokedAndFilled, ipe::ETransformationsRigidMotions, ipe::Cascade::find(), ipe::Cascade::findSymbol(), ipe::Symbol::iObject, ipe::Attribute::isArcArrow(), ipe::Painter::lineTo(), ipe::Painter::moveTo(), ipe::Painter::newPath(), ipe::Attribute::number(), ipe::Painter::pen(), ipe::Painter::pop(), ipe::Painter::popMatrix(), ipe::Painter::push(), ipe::Painter::pushMatrix(), ipe::Painter::setFill(), ipe::Painter::setStroke(), ipe::Painter::setSymFill(), ipe::Painter::setSymPen(), ipe::Painter::setSymStroke(), ipe::Painter::stroke(), ipe::Fixed::toDouble(), ipe::Painter::transform(), ipe::Painter::translate(), and ipe::Painter::untransform().
Referenced by draw(), and gradient().
|
inline |
Return shape of the path object.
References Path(), and setShape().
Referenced by setArrow(), setRarrow(), and setShape().