Ipelib

- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# ipe::Path Class Reference
Ipe Objects

The path object (polylines, polygons, and generalizations). More...

`#include <ipepath.h>`

Inherits ipe::Object.

List of all members.

## Public Member Functions

- Path (const AllAttributes &attr, const Shape &shape, bool withArrows=false)
- virtual Object * clone () const
- virtual Path * asPath ()
- virtual Type type () const
- 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 setTiling (Attribute a)
- void setGradient (Attribute a)
- Attribute opacity () 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
- virtual void draw (Painter &painter) const
- virtual void drawSimple (Painter &painter) const
- virtual void accept (Visitor &visitor) const
- virtual void addToBBox (Rect &box, const Matrix &m, bool cp) const
- virtual double distance (const Vector &v, const Matrix &m, double bound) const
- virtual void snapVtx (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
- virtual void snapBnd (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
- virtual void checkStyle (const Cascade *sheet, AttributeSeq &seq) const
- virtual bool setAttribute (Property prop, Attribute value, Attribute stroke, Attribute fill)
- virtual Attribute getAttribute (Property prop)
- 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)

## 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)

## 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 | ( | const AllAttributes & | attr,
|  | const Shape & | shape,
|  | bool | withArrows = `false`
| ) |  | `[explicit]`

Create for given shape.

## Member Function Documentation

Path * Path::create | ( | const XmlAttributes & | attr,
|  | String | data
| ) |  | `[static]`

Construct from XML data.

Object * Path::clone | ( |  | ) | const`[virtual]`

Return a clone (constant-time).

Implements ipe::Object.

Path * Path::asPath | ( |  | ) | `[virtual]`

Return pointer to this object.

Reimplemented from ipe::Object.

Object::Type Path::type | ( |  | ) | const`[virtual]`

Implements ipe::Object.

void Path::setPathMode | ( | TPathMode | pm | ) |

Set whether object will be stroked and filled.

void Path::setStroke | ( | Attribute | stroke | ) |

Set stroke color.

void Path::setFill | ( | Attribute | fill | ) |

Set fill color.

void Path::setPen | ( | Attribute | pen | ) |

Set pen.

void Path::setDashStyle | ( | Attribute | dash | ) |

Set dash style.

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.

void Path::setTiling | ( | Attribute | til | ) |

Set tiling pattern of the object.

Resets gradient fill.

void Path::setGradient | ( | Attribute | grad | ) |

Set gradient fill of the object.

Resets tiling pattern.

Attribute ipe::Path::opacity | ( |  | ) | const`[inline]`

Return opacity of the opject.

Attribute ipe::Path::tiling | ( |  | ) | const`[inline]`

Return tiling pattern.

Attribute ipe::Path::gradient | ( |  | ) | const`[inline]`

Return gradient fill.

TPathMode ipe::Path::pathMode | ( |  | ) | const`[inline]`

Is the object stroked and filled?

Attribute ipe::Path::stroke | ( |  | ) | const`[inline]`

Return stroke color.

Attribute ipe::Path::fill | ( |  | ) | const`[inline]`

Return object fill color.

Attribute ipe::Path::pen | ( |  | ) | const`[inline]`

Return object pen.

Attribute ipe::Path::dashStyle | ( |  | ) | const`[inline]`

Return object line style.

TLineCap ipe::Path::lineCap | ( |  | ) | const`[inline]`

Return line cap style.

TLineJoin ipe::Path::lineJoin | ( |  | ) | const`[inline]`

Return line join style.

TFillRule ipe::Path::fillRule | ( |  | ) | const`[inline]`

Return fill rule.

void Path::saveAsXml | ( | Stream & | stream,
|  | String | layer
| ) |  | const`[virtual]`

Save the object in XML format.

Implements ipe::Object.

void Path::draw | ( | Painter & | painter | ) | const`[virtual]`

Draw the object.

Implements ipe::Object.

void Path::drawSimple | ( | Painter & | painter | ) | const`[virtual]`

Draw simple version for selecting and transforming.

Implements ipe::Object.

void Path::accept | ( | Visitor & | visitor | ) | const`[virtual]`

Call visitPath of visitor.

Implements ipe::Object.

void Path::addToBBox | ( | Rect & | box,
|  | const Matrix & | m,
|  | bool | cp
| ) |  | const`[virtual]`

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.

double Path::distance | ( | const Vector & | v,
|  | const Matrix & | m,
|  | double | bound
| ) |  | const`[virtual]`

Return distance of transformed object to point v. If larger than bound, can just return bound.

Implements ipe::Object.

void Path::snapVtx | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | 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 ipe::Object.

void Path::snapBnd | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | 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 ipe::Object.

void Path::checkStyle | ( | const Cascade * | sheet,
|  | AttributeSeq & | seq
| ) |  | const`[virtual]`

Check all symbolic attributes.

Reimplemented from ipe::Object.

bool Path::setAttribute | ( | Property | prop,
|  | Attribute | value,
|  | Attribute | stroke,
|  | Attribute | fill
| ) |  | `[virtual]`

Set an attribute on this object.

Returns true if an attribute was actually changed. The arguments stroke and fill are only used then prop is EPropPathMode, and stroking or filling is added to an object that didn't have it before.

Reimplemented from ipe::Object.

Attribute Path::getAttribute | ( | Property | prop | ) | `[virtual]`

Get setting of an attribute of this object.

If object does not have this attribute, returnes "undefined" attribute.

Reimplemented from ipe::Object.

bool ipe::Path::arrow | ( |  | ) | const`[inline]`

Does object have an arrow?

bool ipe::Path::rArrow | ( |  | ) | const`[inline]`

Does object have a reverse arrow?

Attribute ipe::Path::arrowShape | ( |  | ) | const`[inline]`

Return shape of arrow.

Attribute ipe::Path::rArrowShape | ( |  | ) | const`[inline]`

Return shape of reverse arrow.

Attribute ipe::Path::arrowSize | ( |  | ) | const`[inline]`

Return size of arrow.

Attribute ipe::Path::rArrowSize | ( |  | ) | const`[inline]`

Return size of reverse arrow.

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

Set forward arrow.

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

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

void Path::drawArrow | ( | Painter & | painter,
|  | Vector | pos,
|  | Angle | angle,
|  | Attribute | shape,
|  | Attribute | size,
|  | double | radius
| ) |  | `[static]`

Draw an arrow of size with tip at pos directed in direction angle.

const Shape& ipe::Path::shape | ( |  | ) | const`[inline]`

Return shape of the path object.

void Path::setShape | ( | const Shape & | shape | ) |

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

- ipepath.h
- ipepath.cpp