ipe::Object Class Referenceabstract
Ipe Objects

`#include <ipeobject.h>`

Inherited by ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.

## Public Types

enum | Type { EGroup, EPath, EText, EImage, EReference }

## Public Member Functions

virtual | ~Object ()=0
virtual void | accept (Visitor &visitor) const =0
virtual Object * | clone () const =0
virtual Group * | asGroup ()
virtual const Group * | asGroup () const
virtual Text * | asText ()
virtual Path * | asPath ()
virtual Image * | asImage ()
virtual Reference * | asReference ()
virtual Type | type () const =0
virtual TPinned | pinned () const
void | setPinned (TPinned pin)
TTransformations | transformations () const
void | setTransformations (TTransformations trans)
void | setMatrix (const Matrix &matrix)
const Matrix & | matrix () const
virtual bool | setAttribute (Property prop, Attribute value)
virtual Attribute | getAttribute (Property prop) const noexcept
virtual void | saveAsXml (Stream &stream, String layer) const =0
virtual void | draw (Painter &painter) const =0
virtual void | drawSimple (Painter &painter) const =0
virtual double | distance (const Vector &v, const Matrix &m, double bound) const =0
virtual void | addToBBox (Rect &box, const Matrix &m, bool cp) const =0
virtual void | snapVtx (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
virtual void | snapCtl (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

## Protected Member Functions

| Object ()
| Object (const AllAttributes &attr)
| Object (const Object &rhs)
| Object (const XmlAttributes &attr)
void | saveAttributesAsXml (Stream &stream, String layer) const

## Static Protected Member Functions

static void | checkSymbol (Kind kind, Attribute attr, const Cascade *sheet, AttributeSeq &seq)

## Protected Attributes

Matrix | iMatrix
TPinned | iPinned: 8
TTransformations | iTransformations: 8

## Detailed Description

Base class for all Ipe objects, composite or leaf.

All objects are derived from this class. It provides functionality common to all objects, and carries the standard attributes.

All Object's provide a constant time copy constructor (and a virtual Object::clone() method). Objects of non-constant size realize this by separating the implementation and using reference counting. In particular, copying a composite object does not create new copies of the components.

Object has only three attributes: the transformation matrix, the pinning status, and the allowed transformations.

If an object is pinned, it cannot be moved at all (or only in the non-pinned direction) from the Ipe user interface.

Restricting the allowed transformations works somewhat differently: It doesn't stop transformations being applied to the object, but they only effect the position of the reference point (the origin of the object coordinate system), and (if transformations() == ETransformationsRigidMotions) the orientation of the object coordinate system.

## Member Enumeration Documentation

## Type

enum ipe::Object::Type

Enumerator
EGroup |
EPath |
EText |
EImage |
EReference |

## Constructor & Destructor Documentation

## ~Object()

Object::~Object | ( |  | ) |

pure virtual

Pure virtual destructor.

## Object() [1/4]

Object::Object | ( |  | ) |

explicit protected

Create object with identity matrix, no pinning, all transformations.

References ipe::ENoPin, ipe::ETransformationsAffine, iPinned, and iTransformations.

Referenced by matrix().

## Object() [2/4]

Object::Object | ( | const AllAttributes & | attr | ) |

explicit protected

Create object by taking pinning/transforming from attr and setting identity matrix.

References iPinned, ipe::AllAttributes::iPinned, iTransformations, and ipe::AllAttributes::iTransformations.

## Object() [3/4]

Object::Object | ( | const Object & | rhs | ) |

protected

Copy constructor.

References iMatrix, iPinned, and iTransformations.

## Object() [4/4]

Object::Object | ( | const XmlAttributes & | attr | ) |

explicit protected

Construct from XML stream.

## Member Function Documentation

## accept()

virtual void ipe::Object::accept | ( | Visitor & | visitor | ) | const

pure virtual

Calls visitXXX method of the visitor.

Implemented in ipe::Path, ipe::Group, ipe::Text, ipe::Reference, and ipe::Image.

Referenced by ipe::PdfWriter::createPageView(), ipe::PdfPainter::doDrawSymbol(), ipe::Document::findBitmaps(), ipe::Latex::scanObject(), ipe::BitmapFinder::scanPage(), and ipe::Latex::scanPage().

## clone()

virtual Object* ipe::Object::clone | ( |  | ) | const

pure virtual

Make a copy of this object (constant-time).

Implemented in ipe::Group, ipe::Reference, ipe::Text, ipe::Path, and ipe::Image.

Referenced by ipe::Symbol::operator=(), and ipe::Symbol::Symbol().

## asGroup() [1/2]

Group * Object::asGroup | ( |  | ) |

virtual

Return pointer to this object if it is an Group, nullptr otherwise.

Reimplemented in ipe::Group.

Referenced by ipe::PdfWriter::createPageView().

## asGroup() [2/2]

const Group * Object::asGroup | ( |  | ) | const

virtual

Return pointer to this object if it is an Group, nullptr otherwise.

Reimplemented in ipe::Group.

## asText()

Text * Object::asText | ( |  | ) |

virtual

Return pointer to this object if it is an Text, nullptr otherwise.

Reimplemented in ipe::Text.

## asPath()

Path * Object::asPath | ( |  | ) |

virtual

Return pointer to this object if it is an Path, nullptr otherwise.

Reimplemented in ipe::Path.

## asImage()

Image * Object::asImage | ( |  | ) |

virtual

Return pointer to this object if it is an Image , nullptr otherwise.

Reimplemented in ipe::Image.

## asReference()

Reference * Object::asReference | ( |  | ) |

virtual

Return pointer to this object if it is an Ref, nullptr otherwise.

Reimplemented in ipe::Reference.

## type()

virtual Type ipe::Object::type | ( |  | ) | const

pure virtual

Implemented in ipe::Group, ipe::Reference, ipe::Text, ipe::Path, and ipe::Image.

## pinned()

TPinned Object::pinned | ( |  | ) | const

virtual

Return pinning mode of the object.

Reimplemented in ipe::Group.

References iPinned.

Referenced by getAttribute(), ipe::Group::pinned(), ipe::Group::push_back(), and ipe::TransformTool::TransformTool().

## setPinned()

void Object::setPinned | ( | TPinned | pin | ) |

Set pinning mode of the object.

References iPinned.

## transformations()

TTransformations ipe::Object::transformations | ( |  | ) | const

inline

Return allowed transformations of the object.

References iTransformations, matrix(), setMatrix(), and setTransformations().

Referenced by ipe::Image::draw(), ipe::Text::draw(), ipe::Reference::draw(), ipe::Group::draw(), ipe::Path::draw(), ipe::Image::drawSimple(), ipe::Text::drawSimple(), ipe::Group::drawSimple(), ipe::Path::drawSimple(), and ipe::Text::setAttribute().

## setTransformations()

void Object::setTransformations | ( | TTransformations | trans | ) |

Set allowed transformations of the object.

References iTransformations.

Referenced by ipe::Text::setAttribute(), and transformations().

## setMatrix()

void Object::setMatrix | ( | const Matrix & | matrix | ) |

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.

References iMatrix, and matrix().

Referenced by ipe::Page::applyTitleStyle(), ipe::Page::transform(), and transformations().

## matrix()

const Matrix& ipe::Object::matrix | ( |  | ) | const

inline

Return transformation matrix.

References addToBBox(), checkStyle(), checkSymbol(), distance(), draw(), drawSimple(), getAttribute(), iMatrix, Object(), saveAsXml(), saveAttributesAsXml(), setAttribute(), snapBnd(), snapCtl(), and snapVtx().

Referenced by ipe::Image::addToBBox(), ipe::Reference::addToBBox(), ipe::Group::addToBBox(), ipe::Path::addToBBox(), ipe::Text::checkStyle(), ipe::Image::distance(), ipe::Reference::distance(), ipe::Group::distance(), ipe::Path::distance(), ipe::Image::draw(), ipe::Text::draw(), ipe::Reference::draw(), ipe::Group::draw(), ipe::Path::draw(), ipe::Image::drawSimple(), ipe::Text::drawSimple(), ipe::Reference::drawSimple(), ipe::Group::drawSimple(), ipe::Path::drawSimple(), setMatrix(), ipe::Group::snapBnd(), ipe::Path::snapBnd(), ipe::Image::snapCtl(), ipe::Text::snapCtl(), ipe::Group::snapCtl(), ipe::Path::snapCtl(), ipe::Reference::snapVtx(), ipe::Group::snapVtx(), ipe::Path::snapVtx(), and transformations().

## setAttribute()

bool Object::setAttribute | ( | Property | prop,
|  | Attribute | value
| ) |  |

virtual

Set an attribute on this object.

Returns true if an attribute was actually changed.

Reimplemented in ipe::Group, ipe::Path, ipe::Reference, and ipe::Text.

References ipe::EPropPinned, ipe::EPropTransformations, iPinned, ipe::Attribute::isEnum(), iTransformations, ipe::Attribute::pinned(), and ipe::Attribute::transformations().

Referenced by matrix(), ipe::Text::setAttribute(), ipe::Reference::setAttribute(), ipe::Path::setAttribute(), ipe::Group::setAttribute(), and ipe::Page::setAttribute().

## getAttribute()

Attribute Object::getAttribute | ( | Property | prop | ) | const

virtual noexcept

Get setting of an attribute of this object.

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

Reimplemented in ipe::Group, ipe::Path, ipe::Reference, and ipe::Text.

References ipe::EPropPinned, ipe::EPropTransformations, iTransformations, pinned(), and ipe::Attribute::UNDEFINED().

Referenced by ipe::Text::getAttribute(), ipe::Reference::getAttribute(), ipe::Path::getAttribute(), ipe::Group::getAttribute(), and matrix().

## saveAsXml()

virtual void ipe::Object::saveAsXml | ( | Stream & | stream,
|  | String | layer
| ) |  | const

pure virtual

Save the object in XML format.

Implemented in ipe::Path, ipe::Group, ipe::Reference, ipe::Text, and ipe::Image.

Referenced by matrix().

## draw()

virtual void ipe::Object::draw | ( | Painter & | painter | ) | const

pure virtual

Draw the object.

Implemented in ipe::Path, ipe::Group, ipe::Reference, ipe::Text, and ipe::Image.

Referenced by ipe::PdfPainter::doDrawSymbol(), ipe::Painter::doDrawSymbol(), ipe::Path::drawArrow(), ipe::CanvasBase::drawObjects(), matrix(), ipe::Thumbnail::render(), ipe::Thumbnail::saveRender(), and ipe::PdfWriter::~PdfWriter().

## drawSimple()

virtual void ipe::Object::drawSimple | ( | Painter & | painter | ) | const

pure virtual

Draw simple version for selecting and transforming.

Implemented in ipe::Path, ipe::Group, ipe::Reference, ipe::Text, and ipe::Image.

Referenced by ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::TransformTool::draw(), and matrix().

## distance()

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

pure virtual

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

Implemented in ipe::Path, ipe::Group, ipe::Text, ipe::Reference, and ipe::Image.

Referenced by ipe::Page::distance(), and matrix().

## addToBBox()

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

pure 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).

Implemented in ipe::Path, ipe::Group, ipe::Text, ipe::Reference, and ipe::Image.

Referenced by matrix(), and ipe::SelectTool::mouseButton().

## snapVtx()

void Object::snapVtx | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | pos,
|  | double & | bound
| ) |  | const

virtual

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 in ipe::Path, ipe::Group, and ipe::Reference.

Referenced by matrix(), and ipe::Page::snapVtx().

## snapCtl()

void Object::snapCtl | ( | const Vector & | mouse,
|  | const Matrix & | m,
|  | Vector & | pos,
|  | double & | bound
| ) |  | const

virtual

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 in ipe::Path, ipe::Group, ipe::Text, and ipe::Image.

Referenced by matrix(), and ipe::Page::snapCtl().

## snapBnd()

void Object::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 in ipe::Path, ipe::Group, and ipe::Reference.

References ipe::Visitor::~Visitor().

Referenced by matrix(), and ipe::Page::snapBnd().

## checkStyle()

void Object::checkStyle | ( | const Cascade * | sheet,
|  | AttributeSeq & | seq
| ) |  | const

virtual

Check all symbolic attributes.

Reimplemented in ipe::Group, ipe::Path, ipe::Reference, and ipe::Text.

Referenced by ipe::Document::checkStyle(), and matrix().

## saveAttributesAsXml()

void Object::saveAttributesAsXml | ( | Stream & | stream,
|  | String | layer
| ) |  | const

protected

Write layer, pin, transformations, matrix to XML stream.

References ipe::EFixedPin, ipe::EHorizontalPin, ipe::String::empty(), ipe::ENoPin, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, ipe::EVerticalPin, iMatrix, iPinned, ipe::Matrix::isIdentity(), and iTransformations.

Referenced by matrix(), ipe::Image::saveAsXml(), ipe::Text::saveAsXml(), ipe::Reference::saveAsXml(), ipe::Group::saveAsXml(), and ipe::Path::saveAsXml().

## checkSymbol()

void Object::checkSymbol | ( | Kind | kind,
|  | Attribute | attr,
|  | const Cascade * | sheet,
|  | AttributeSeq & | seq
| ) |  |

static protected

Check whether attribute is either absolute or defined in the style sheet cascade sheet. Add attr to seq if this is not the case.

References ipe::Cascade::findDefinition(), and ipe::Attribute::isSymbolic().

Referenced by ipe::Text::checkStyle(), ipe::Reference::checkStyle(), ipe::Path::checkStyle(), and matrix().

## Member Data Documentation

## iMatrix

Matrix ipe::Object::iMatrix

protected

Referenced by matrix(), Object(), saveAttributesAsXml(), and setMatrix().

## iPinned

TPinned ipe::Object::iPinned

protected

Referenced by ipe::Group::end(), Object(), pinned(), saveAttributesAsXml(), setAttribute(), and setPinned().

## iTransformations

TTransformations ipe::Object::iTransformations

protected

Referenced by ipe::Text::checkStyle(), getAttribute(), Object(), saveAttributesAsXml(), setAttribute(), setTransformations(), ipe::Text::Text(), and transformations().

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

- ipeobject.h
- ipeobject.cpp