Ipelib
Public Member Functions | Static Public Member Functions | List of all members
ipe::Path Class Reference

#include <ipepath.h>

Inherits ipe::Object.

Public Member Functions

 Path (const AllAttributes &attr, const Shape &shape, bool withArrows=false)
 
virtual Objectclone () const override
 
virtual PathasPath () 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 Shapeshape () const
 
void setShape (const Shape &shape)
 
- Public Member Functions inherited from ipe::Object
virtual ~Object ()=0
 
virtual GroupasGroup ()
 
virtual const GroupasGroup () const
 
virtual TextasText ()
 
virtual ImageasImage ()
 
virtual ReferenceasReference ()
 
virtual TPinned pinned () const
 
void setPinned (TPinned pin)
 
TTransformations transformations () const
 
void setTransformations (TTransformations trans)
 
const Matrixmatrix () const
 
void setCustom (Attribute value)
 
Attribute getCustom () const noexcept
 

Static Public Member Functions

static Pathcreate (const XmlAttributes &attr, String data)
 
static void drawArrow (Painter &painter, Vector pos, Angle alpha, Attribute shape, Attribute size, double radius)
 

Additional Inherited Members

- Public Types inherited from ipe::Object
enum  Type {
  EGroup , EPath , EText , EImage ,
  EReference
}
 
- Protected Member Functions inherited from ipe::Object
 Object ()
 
 Object (const AllAttributes &attr)
 
 Object (const Object &rhs)
 
 Object (const XmlAttributes &attr)
 
void saveAttributesAsXml (Stream &stream, String layer) const
 
Matrix effectiveMatrix (const Matrix &m, const Vector &pos=Vector::ZERO) const noexcept
 
- Static Protected Member Functions inherited from ipe::Object
static void checkSymbol (Kind kind, Attribute attr, const Cascade *sheet, AttributeSeq &seq)
 
- Protected Attributes inherited from ipe::Object
Matrix iMatrix
 
Attribute iCustom
 
TPinned iPinned: 8
 
TTransformations iTransformations: 8
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Path()

Path::Path ( const AllAttributes attr,
const Shape shape,
bool  withArrows = false 
)
explicit

Create for given shape.

Referenced by clone(), and create().

Member Function Documentation

◆ create()

Path * Path::create ( const XmlAttributes attr,
String  data 
)
static

Construct from XML data.

References Path().

Referenced by ipe::ObjectFactory::createObject().

◆ clone()

Object * Path::clone ( ) const
overridevirtual

Return a clone (constant-time).

Implements ipe::Object.

References Path().

◆ asPath()

Path * Path::asPath ( )
overridevirtual

Return pointer to this object.

Reimplemented from ipe::Object.

◆ type()

Object::Type Path::type ( ) const
overridevirtual

Implements ipe::Object.

References ipe::Object::EPath.

◆ setPathMode()

void Path::setPathMode ( TPathMode  pm)

Set whether object will be stroked and filled.

Referenced by setAttribute().

◆ setStroke()

void Path::setStroke ( Attribute  stroke)

Set stroke color.

References stroke().

Referenced by setAttribute().

◆ setFill()

void Path::setFill ( Attribute  fill)

Set fill color.

References fill().

Referenced by setAttribute().

◆ setPen()

void Path::setPen ( Attribute  pen)

Set pen.

References pen().

Referenced by setAttribute().

◆ setDashStyle()

void Path::setDashStyle ( Attribute  dash)

Set dash style.

Referenced by setAttribute().

◆ setLineCap()

void Path::setLineCap ( TLineCap  s)

Set line cap style.

◆ setLineJoin()

void Path::setLineJoin ( TLineJoin  s)

Set line join style.

◆ setFillRule()

void Path::setFillRule ( TFillRule  s)

Set fill rule.

◆ setOpacity()

void Path::setOpacity ( Attribute  opaq)

Set opacity of the object.

Referenced by setAttribute().

◆ setStrokeOpacity()

void Path::setStrokeOpacity ( Attribute  opaq)

Set stroke opacity of the object.

Referenced by setAttribute().

◆ setTiling()

void Path::setTiling ( Attribute  til)

Set tiling pattern of the object.

Resets gradient fill.

References ipe::Attribute::NORMAL().

Referenced by setAttribute().

◆ setGradient()

void Path::setGradient ( Attribute  grad)

Set gradient fill of the object.

Resets tiling pattern.

References ipe::Attribute::NORMAL().

Referenced by setAttribute().

◆ opacity()

Attribute ipe::Path::opacity ( ) const
inline

Return opacity of the opject.

Referenced by setAttribute().

◆ strokeOpacity()

Attribute ipe::Path::strokeOpacity ( ) const
inline

Return stroke opacity of the opject.

Referenced by setAttribute().

◆ tiling()

Attribute ipe::Path::tiling ( ) const
inline

Return tiling pattern.

Referenced by setAttribute().

◆ gradient()

Attribute ipe::Path::gradient ( ) const
inline

Return gradient fill.

Referenced by setAttribute().

◆ pathMode()

TPathMode ipe::Path::pathMode ( ) const
inline

Is the object stroked and filled?

Referenced by setAttribute().

◆ stroke()

Attribute ipe::Path::stroke ( ) const
inline

Return stroke color.

Referenced by setAttribute(), and setStroke().

◆ fill()

Attribute ipe::Path::fill ( ) const
inline

Return object fill color.

Referenced by setAttribute(), and setFill().

◆ pen()

Attribute ipe::Path::pen ( ) const
inline

Return object pen.

Referenced by setAttribute(), and setPen().

◆ dashStyle()

Attribute ipe::Path::dashStyle ( ) const
inline

Return object line style.

Referenced by setAttribute().

◆ lineCap()

TLineCap ipe::Path::lineCap ( ) const
inline

Return line cap style.

Referenced by draw().

◆ lineJoin()

TLineJoin ipe::Path::lineJoin ( ) const
inline

Return line join style.

Referenced by draw().

◆ fillRule()

TFillRule ipe::Path::fillRule ( ) const
inline

Return fill rule.

Referenced by draw().

◆ saveAsXml()

void Path::saveAsXml ( Stream stream,
String  layer 
) const
overridevirtual

◆ draw()

void Path::draw ( Painter painter) const
overridevirtual

◆ drawSimple()

void Path::drawSimple ( Painter painter) const
overridevirtual

◆ accept()

void Path::accept ( Visitor visitor) const
overridevirtual

Call visitPath of visitor.

Implements ipe::Object.

References ipe::Visitor::visitPath().

◆ addToBBox()

void Path::addToBBox ( Rect box,
const Matrix m,
bool  cp 
) const
overridevirtual

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::effectiveMatrix().

◆ distance()

double Path::distance ( const Vector v,
const Matrix m,
double  bound 
) const
overridevirtual

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::effectiveMatrix().

◆ snapVtx()

void Path::snapVtx ( const Vector mouse,
const Matrix m,
Vector pos,
double &  bound 
) const
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::effectiveMatrix(), and ipe::Shape::snapVtx().

◆ snapCtl()

void Path::snapCtl ( const Vector mouse,
const Matrix m,
Vector pos,
double &  bound 
) const
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::effectiveMatrix(), and ipe::Shape::snapVtx().

◆ snapBnd()

void Path::snapBnd ( const Vector mouse,
const Matrix m,
Vector pos,
double &  bound 
) const
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::effectiveMatrix(), and ipe::Shape::snapBnd().

◆ checkStyle()

void Path::checkStyle ( const Cascade sheet,
AttributeSeq seq 
) const
overridevirtual

◆ setMatrix()

void Path::setMatrix ( const Matrix matrix)
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::matrix(), and ipe::Object::setMatrix().

◆ setAttribute()

bool Path::setAttribute ( Property  prop,
Attribute  value 
)
overridevirtual

◆ getAttribute()

Attribute Path::getAttribute ( Property  prop) const
overridevirtualnoexcept

◆ arrow()

bool ipe::Path::arrow ( ) const
inline

Does object have an arrow?

Referenced by setArrow(), and setRarrow().

◆ rArrow()

bool ipe::Path::rArrow ( ) const
inline

Does object have a reverse arrow?

◆ arrowShape()

Attribute ipe::Path::arrowShape ( ) const
inline

Return shape of arrow.

◆ rArrowShape()

Attribute ipe::Path::rArrowShape ( ) const
inline

Return shape of reverse arrow.

◆ arrowSize()

Attribute ipe::Path::arrowSize ( ) const
inline

Return size of arrow.

◆ rArrowSize()

Attribute ipe::Path::rArrowSize ( ) const
inline

Return size of reverse arrow.

◆ setArrow()

void Path::setArrow ( bool  arrow,
Attribute  shape,
Attribute  size 
)

Set forward arrow.

References arrow(), ipe::Attribute::isMidArrow(), shape(), and ipe::size().

◆ setRarrow()

void Path::setRarrow ( bool  arrow,
Attribute  shape,
Attribute  size 
)

Set backward arrow (if the object can take it).

References arrow(), ipe::Attribute::isMidArrow(), shape(), and ipe::size().

◆ drawArrow()

void Path::drawArrow ( Painter painter,
Vector  pos,
Angle  angle,
Attribute  shape,
Attribute  size,
double  radius 
)
static

◆ shape()

const Shape& ipe::Path::shape ( ) const
inline

Return shape of the path object.

Referenced by drawArrow(), setArrow(), setRarrow(), and setShape().

◆ setShape()

void Path::setShape ( const Shape shape)

References shape().


The documentation for this class was generated from the following files: