Ipelib: ipe::Curve Class Reference

Ipelib

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions | List of all members
ipe::Curve Class Reference
Ipe Geometry

`#include <ipeshape.h>`

Inherits ipe::SubPath.

## Public Member Functions
| Curve ()
virtual Type | type () const
virtual bool | closed () const
virtual const Curve * | asCurve () const
virtual void | save (Stream &stream) const
virtual void | draw (Painter &painter) 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, bool cp) const
virtual void | snapBnd (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
int | countSegments () const
CurveSegment | segment (int i) const
CurveSegment | closingSegment (Vector u[2]) const
void | appendSegment (const Vector &v0, const Vector &v1)
void | appendArc (const Matrix &m, const Vector &v0, const Vector &v1)
void | appendSpline (const std::vector< Vector > &v)
void | appendOldSpline (const std::vector< Vector > &v)
void | setClosed (bool closed)
Public Member Functions inherited from ipe::SubPath
virtual | ~SubPath ()=0
virtual const Ellipse * | asEllipse () const
virtual const ClosedSpline * | asClosedSpline () const

## Additional Inherited Members
Public Types inherited from ipe::SubPath
enum | Type { ECurve, EEllipse, EClosedSpline }

## Detailed Description

Subpath consisting of a sequence of CurveSegment's.

## Constructor & Destructor Documentation

Curve::Curve | ( |  | ) |

Create an empty, open subpath.

Referenced by ipe::CurveSegment::snapBnd().

## Member Function Documentation

SubPath::Type Curve::type | ( |  | ) | const
| virtual

Return type of this subpath.

Implements ipe::SubPath.

virtual bool ipe::Curve::closed | ( |  | ) | const
| inlinevirtual

Is this subpath closed?

Default implementation returns `true`.

Reimplemented from ipe::SubPath.

References ipe::CurveSegment::addToBBox(), ipe::CurveSegment::cp(), ipe::CurveSegment::distance(), ipe::CurveSegment::draw(), ipe::CurveSegment::snapBnd(), and ipe::CurveSegment::snapVtx().

const Curve * Curve::asCurve | ( |  | ) | const
| virtual

Return this object as an Curve, or else 0.

Reimplemented from ipe::SubPath.

void Curve::save | ( | Stream & | stream | ) | const
| virtual

Save subpath to XML stream.

Implements ipe::SubPath.

References ipe::CurveSegment::EArc, ipe::CurveSegment::EOldSpline, ipe::CurveSegment::ESegment, and ipe::CurveSegment::ESpline.

void Curve::draw | ( | Painter & | painter | ) | const
| virtual

Draw subpath (does not call drawPath()).

Implements ipe::SubPath.

References ipe::Painter::closePath(), and ipe::Painter::moveTo().

void Curve::addToBBox | ( | Rect & | box,
|  | const Matrix & | m,
|  | bool | cp
| ) |  | const
| virtual

Add subpath to box.

Implements ipe::SubPath.

double Curve::distance | ( | const Vector & | v,
|  | const Matrix & | m,
|  | double | bound
| ) |  | const
| virtual

Return distance from v to subpath transformed by m.

Implements ipe::SubPath.

void Curve::snapVtx | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | pos,
|  | double & | bound,
|  | bool | cp
| ) |  | const
| virtual

Snap to vertex.

Implements ipe::SubPath.

References ipe::CanvasBase::pos().

void Curve::snapBnd | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | pos,
|  | double & | bound
| ) |  | const
| virtual

Snap to boundary of subpath.

Implements ipe::SubPath.

int ipe::Curve::countSegments | ( |  | ) | const
| inline

Return number of segments. This does not include the closing segment for a closed path.

Referenced by ipe::Shape::isSegment().

CurveSegment Curve::segment | ( | int | i | ) | const

Return segment.

If i is negative, elements from the end are returned. The closing segment of a closed path is not accessible this way (use closingSegment() instead)!

Referenced by ipe::Path::clone(), ipe::Path::draw(), and ipe::Shape::isSegment().

CurveSegment Curve::closingSegment | ( | Vector | u[2] | ) | const

Returns the closing segment of a closed path.

Since the closing segment isn't actually stored inside this object, you have to provide a length-2 vector for the control points.

This method panics if the Curve is not closed.

References ipe::CurveSegment::ESegment, and ipe::SubPath::~SubPath().

void Curve::appendSegment | ( | const Vector & | v0,
|  | const Vector & | v1
| ) |  |

Append a straight segment to the subpath.

References ipe::CurveSegment::ESegment.

Referenced by ipe::Shape::load(), and ipe::Shape::Shape().

void Curve::appendArc | ( | const Matrix & | m,
|  | const Vector & | v0,
|  | const Vector & | v1
| ) |  |

Append elliptic arc to the subpath.

References appendSpline(), ipe::CurveSegment::EArc, ipe::CurveSegment::EOldSpline, and ipe::CurveSegment::ESpline.

Referenced by ipe::Shape::load(), and ipe::Shape::Shape().

void ipe::Curve::appendSpline | ( | const std::vector< Vector > & | v | ) |
| inline

References ipe::CurveSegment::ESpline.

Referenced by appendArc(), and ipe::Shape::load().

void ipe::Curve::appendOldSpline | ( | const std::vector< Vector > & | v | ) |
| inline

References ipe::CurveSegment::EOldSpline.

Referenced by ipe::Shape::load().

void Curve::setClosed | ( | bool | closed | ) |

Set whether subpath is closed or not.

Referenced by ipe::Shape::load(), and ipe::Shape::Shape().

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

- ipeshape.h
- ipeshape.cpp