Ipelib

Classes | Public Types | Public Member Functions | List of all members
ipe::Group Class Reference
Ipe Objects

`#include <ipegroup.h>`

Inherits ipe::Object.

## Public Types
typedef List::const_iterator | const_iterator
Public Types inherited from ipe::Object
enum | Type { EGroup, EPath, EText, EImage, EReference }

## Public Member Functions
| Group ()
| Group (const Group &rhs)
virtual | ~Group ()
| Group (const XmlAttributes &attr)
Group & | operator= (const Group &rhs)
virtual Object * | clone () const
virtual Group * | asGroup ()
virtual const Group * | asGroup () const
virtual Type | type () const
virtual TPinned | pinned () const
virtual void | accept (Visitor &visitor) const
virtual void | saveAsXml (Stream &stream, String layer) const
virtual void | draw (Painter &painter) const
virtual void | drawSimple (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) 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
const Shape & | clip () const
void | setClip (const Shape &clip)
String | url () const
void | setUrl (String url)
int | count () const
const Object * | object (int i) const
const_iterator | begin () const
const_iterator | end () const
void | push_back (Object *)
void | saveComponentsAsXml (Stream &stream) const
virtual void | checkStyle (const Cascade *sheet, AttributeSeq &seq) const
virtual Attribute | getAttribute (Property prop) const noexcept
virtual bool | setAttribute (Property prop, Attribute value)
Public Member Functions inherited from ipe::Object
virtual | ~Object ()=0
virtual Text * | asText ()
virtual Path * | asPath ()
virtual Image * | asImage ()
virtual Reference * | asReference ()
void | setPinned (TPinned pin)
TTransformations | transformations () const
void | setTransformations (TTransformations trans)
void | setMatrix (const Matrix &matrix)
const Matrix & | matrix () const

## Additional Inherited Members
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
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
TPinned | iPinned: 8
TTransformations | iTransformations: 8

## Detailed Description

The group object.

Ipe objects can be grouped together, and the resulting composite can be used like any Ipe object.

This is an application of the "Composite" pattern.

## Member Typedef Documentation

## ◆ const_iterator

typedef List::const_iterator ipe::Group::const_iterator

## Constructor & Destructor Documentation

## ◆ Group() [1/3]

Group::Group | ( |  | ) |
| explicit

Create empty group (objects can be added later).

Referenced by clone().

## ◆ Group() [2/3]

Group::Group | ( | const Group & | rhs | ) |

Copy constructor. Constant time — components are not copied!

## ◆ ~Group()

Group::~Group | ( |  | ) |
| virtual

Destructor.

## ◆ Group() [3/3]

Group::Group | ( | const XmlAttributes & | attr | ) |
| explicit

Create empty group with these attributes (objects can be added later).

References clip(), ipe::ENoPin, ipe::XmlAttributes::has(), ipe::Shape::load(), and ipe::Attribute::NORMAL().

## Member Function Documentation

## ◆ operator=()

Group & Group::operator= | ( | const Group & | rhs | ) |

Assignment operator (constant-time).

## ◆ clone()

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

Clone a group object (constant-time).

Implements ipe::Object.

References Group().

## ◆ asGroup() [1/2]

Group * Group::asGroup | ( |  | ) |
| virtual

Return pointer to this object.

Reimplemented from ipe::Object.

## ◆ asGroup() [2/2]

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

Return pointer to this object.

Reimplemented from ipe::Object.

## ◆ type()

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

Implements ipe::Object.

References ipe::Object::EGroup.

## ◆ pinned()

TPinned Group::pinned | ( |  | ) | const
| virtual

Return total pinning status of group and its elements.

Reimplemented from ipe::Object.

References ipe::Object::pinned().

## ◆ accept()

void Group::accept | ( | Visitor & | visitor | ) | const
| virtual

Call visitGroup of visitor.

Implements ipe::Object.

References ipe::Visitor::visitGroup().

## ◆ saveAsXml()

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

Save the object in XML format.

Implements ipe::Object.

References ipe::Painter::cascade(), ipe::Shape::countSubPaths(), ipe::String::empty(), ipe::Attribute::isNormal(), ipe::Stream::putXmlString(), ipe::Shape::save(), ipe::Object::saveAttributesAsXml(), saveComponentsAsXml(), ipe::Attribute::string(), ipe::Vector::x, and ipe::Vector::y.

## ◆ draw()

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

Draw the object.

Implements ipe::Object.

References ipe::Painter::addClipPath(), addToBBox(), begin(), ipe::Rect::center(), end(), ipe::ETransformationsTranslations, ipe::Rect::height(), ipe::Object::matrix(), ipe::Painter::matrix(), ipe::Painter::newPath(), ipe::Painter::pop(), ipe::Painter::popMatrix(), ipe::Painter::push(), ipe::Painter::pushMatrix(), ipe::Painter::transform(), ipe::Object::transformations(), ipe::Painter::untransform(), and ipe::Rect::width().

## ◆ drawSimple()

void Group::drawSimple | ( | Painter & | painter | ) | const
| virtual

Draw simple version for selecting and transforming.

Implements ipe::Object.

References ipe::Painter::addClipPath(), begin(), end(), ipe::Object::matrix(), ipe::Painter::newPath(), ipe::Painter::pop(), ipe::Painter::popMatrix(), ipe::Painter::push(), ipe::Painter::pushMatrix(), ipe::Painter::transform(), ipe::Object::transformations(), and ipe::Painter::untransform().

## ◆ addToBBox()

void Group::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.

References ipe::Rect::addRect(), begin(), ipe::Rect::clipTo(), end(), and ipe::Object::matrix().

Referenced by draw().

## ◆ distance()

double Group::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.

References begin(), end(), and ipe::Object::matrix().

## ◆ snapVtx()

void Group::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 from ipe::Object.

References begin(), end(), and ipe::Object::matrix().

## ◆ snapCtl()

void Group::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 from ipe::Object.

References begin(), end(), and ipe::Object::matrix().

## ◆ snapBnd()

void Group::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.

References begin(), end(), and ipe::Object::matrix().

## ◆ clip()

const Shape& ipe::Group::clip | ( |  | ) | const
| inline

References setClip().

Referenced by Group(), and setClip().

## ◆ setClip()

void Group::setClip | ( | const Shape & | clip | ) |

Set clip path for this group.

Any previously set clip path is deleted.

References clip().

Referenced by clip().

## ◆ url()

String ipe::Group::url | ( |  | ) | const
| inline

References setUrl().

Referenced by ipe::PdfWriter::createPageView(), and setUrl().

## ◆ setUrl()

void Group::setUrl | ( | String | url | ) |

Set link destination to use this group as a hyperlink.

References url().

Referenced by url().

## ◆ count()

int ipe::Group::count | ( |  | ) | const
| inline

Return number of component objects.

## ◆ object()

const Object* ipe::Group::object | ( | int | i | ) | const
| inline

Return object at index i.

## ◆ begin()

const_iterator ipe::Group::begin | ( |  | ) | const
| inline

Return iterator for first object.

Referenced by addToBBox(), checkStyle(), distance(), draw(), drawSimple(), saveComponentsAsXml(), snapBnd(), snapCtl(), snapVtx(), ipe::Latex::takeResources(), and ipe::BitmapFinder::visitGroup().

## ◆ end()

const_iterator ipe::Group::end | ( |  | ) | const
| inline

Return iterator for end of sequence.

References checkStyle(), getAttribute(), ipe::Object::iPinned, push_back(), saveComponentsAsXml(), and setAttribute().

Referenced by addToBBox(), checkStyle(), distance(), draw(), drawSimple(), saveComponentsAsXml(), snapBnd(), snapCtl(), snapVtx(), ipe::Latex::takeResources(), and ipe::BitmapFinder::visitGroup().

## ◆ push_back()

void Group::push_back | ( | Object * | obj | ) |

Add an object.

Takes ownership of the object. This will panic if the object shares its implementation! The method is only useful right after construction of the group.

References ipe::Object::pinned().

Referenced by end(), and ipe::ImlParser::parseObject().

## ◆ saveComponentsAsXml()

void Group::saveComponentsAsXml | ( | Stream & | stream | ) | const

Save all the components, one by one, in XML format.

References begin(), and end().

Referenced by end(), and saveAsXml().

## ◆ checkStyle()

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

Check all symbolic attributes.

Reimplemented from ipe::Object.

References begin(), and end().

Referenced by end().

## ◆ getAttribute()

Attribute Group::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 from ipe::Object.

References ipe::EPropDecoration, and ipe::Object::getAttribute().

Referenced by end().

## ◆ setAttribute()

bool Group::setAttribute | ( | Property | prop,
|  | Attribute | value
| ) |  |
| virtual

Set attribute on all children.

Reimplemented from ipe::Object.

References ipe::EPropDecoration, ipe::EPropPinned, ipe::EPropTransformations, and ipe::Object::setAttribute().

Referenced by end().

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

- ipegroup.h
- ipegroup.cpp