# IpeObject Class Reference
[Ipe Objects]

Base class for all Ipe objects, composite or leaf. More...

Inherited by IpeFillable, IpeImage, IpeMark, IpeReference, and IpeText.

List of all members.

## Public Member Functions

- virtual ~IpeObject ()=0
- virtual void Accept (IpeVisitor &visitor) const=0
- virtual IpeObject * Clone () const=0
- virtual IpeFillable * AsFillable ()
- virtual IpeGroup * AsGroup ()
- virtual IpeText * AsText ()
- virtual IpeMark * AsMark ()
- virtual IpePath * AsPath ()
- virtual IpeImage * AsImage ()
- virtual IpeReference * AsReference ()
- virtual void SaveAsXml (IpePainter &painter, IpeStream &stream, IpeString layer) const=0
- virtual void Draw (IpePainter &painter) const=0
- virtual double Distance (const IpeVector &v, const IpeMatrix &m, double bound) const=0
- virtual void AddToBBox (IpeRect &box, const IpeMatrix &m) const=0
- virtual void AddToGraphicBBox (IpeRect &box, IpeStyleSheet *sheet, IpeMatrix &m) const
- virtual void SnapVtx (const IpeVector &mouse, const IpeMatrix &m, IpeVector &pos, double &bound) const=0
- virtual void CheckStyle (const IpeStyleSheet *sheet, IpeAttributeSeq &seq) const
- virtual void SnapBnd (const IpeVector &mouse, const IpeMatrix &m, IpeVector &pos, double &bound) const
- void SetStroke (IpeAttribute stroke)
- void SetMatrix (const IpeMatrix &matrix)
- IpeAttribute Stroke () const
- const IpeMatrix & Matrix () const

## Static Public Member Functions

- bool SnapVertex (const IpeVector &mouse, const IpeVector &v, IpeVector &pos, double &bound)

## Protected Member Functions

- IpeObject ()
- IpeObject (const IpeAllAttributes &attr)
- IpeObject (IpeRepository *rep, const IpeXmlAttributes &attr)
- IpeObject (const IpeObject &rhs)
- void SaveAttributesAsXml (IpePainter &painter, IpeStream &stream, IpeString layer) const

## Static Protected Member Functions

- void CheckSymbol (IpeAttribute attr, const IpeStyleSheet *sheet, IpeAttributeSeq &seq)

## Detailed Description

Base class for all Ipe objects, composite or leaf.

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

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

The common attributes are stroke and fill color, line style and width, and the transformation matrix for coordinates.

## Constructor & Destructor Documentation

IpeObject::~IpeObject | ( |  | ) | `[pure virtual]`

| Pure virtual destructor.

IpeObject::IpeObject | ( |  | ) | `[explicit, protected]`

| Create object with null stroke and identity matrix.

IpeObject::IpeObject | ( | const IpeAllAttributes & | attr | ) | `[explicit, protected]`

| Create object by taking stroke color from attr and setting identity matrix.

IpeObject::IpeObject | ( | IpeRepository * | rep,
|  | const IpeXmlAttributes & | attr
| ) | `[explicit, protected]`

| Construct from XML stream.

IpeObject::IpeObject | ( | const IpeObject & | rhs | ) | `[protected]`

| Copy constructor.

## Member Function Documentation

virtual void IpeObject::Accept | ( | IpeVisitor & | visitor | ) | const`[pure virtual]`

| Calls VisitXXX method of the visitor. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

virtual IpeObject* IpeObject::Clone | ( |  | ) | const`[pure virtual]`

| Make a (shallow) copy of this object. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

IpeFillable * IpeObject::AsFillable | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeFillable, 0 otherwise. Reimplemented in IpeFillable.

IpeGroup * IpeObject::AsGroup | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeGroup, 0 otherwise. Reimplemented in IpeGroup.

IpeText * IpeObject::AsText | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeText, 0 otherwise. Reimplemented in IpeText.

IpeMark * IpeObject::AsMark | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeMark, 0 otherwise. Reimplemented in IpeMark.

IpePath * IpeObject::AsPath | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpePath, 0 otherwise. Reimplemented in IpePath.

IpeImage * IpeObject::AsImage | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeImage , 0 otherwise. Reimplemented in IpeImage.

IpeReference * IpeObject::AsReference | ( |  | ) | `[virtual]`

| Return pointer to this object if it is an IpeRef, 0 otherwise. Reimplemented in IpeReference.

virtual void IpeObject::SaveAsXml | ( | IpePainter & | painter,
|  | IpeStream & | stream,
|  | IpeString | layer
| ) | const`[pure virtual]`

| Save the object in XML format. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

virtual void IpeObject::Draw | ( | IpePainter & | painter | ) | const`[pure virtual]`

| Draw the object. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

virtual double IpeObject::Distance | ( | const IpeVector & | v,
|  | const IpeMatrix & | m,
|  | double | bound
| ) | const`[pure virtual]`

| Return distance of transformed object to point v. If larger than bound, can just return bound. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

virtual void IpeObject::AddToBBox | ( | IpeRect & | box,
|  | const IpeMatrix & | m
| ) | const`[pure virtual]`

Extend box to include the object transformed by m.

For Ipe objects in a page, don't call this directly. The IpePgObject caches the bounding box, so it is far more efficient to call IpePgObject::BBox.

If called with an empty box, 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 IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

void IpeObject::AddToGraphicBBox | ( | IpeRect & | box,
|  | IpeStyleSheet * | sheet,
|  | IpeMatrix & | m
| ) | const`[virtual]`

| Extend box to include the graphic representation of the object. Unlike AddToBBox, this function takes into account the graphic representation of the object, that is, its line width, arrow size, mark size, etc. The default implementation calls AddToBBox.

virtual void IpeObject::SnapVtx | ( | const IpeVector & | mouse,
|  | const IpeMatrix & | m,
|  | IpeVector & | pos,
|  | double & | bound
| ) | const`[pure virtual]`

| Compute possible vertex snapping position for transformed object. Looks only for positions closer than bound. If successful, modify pos and bound. Implemented in IpeGroup, IpeImage, IpeMark, IpePath, IpeReference, and IpeText.

void IpeObject::CheckStyle | ( | const IpeStyleSheet * | sheet,
|  | IpeAttributeSeq & | seq
| ) | const`[virtual]`

| Check symbolic attributes of object. Reimplemented in IpeGroup, IpeMark, IpeFillable, IpePath, IpeReference, and IpeText.

void IpeObject::SnapBnd | ( | const IpeVector & | mouse,
|  | const IpeMatrix & | m,
|  | IpeVector & | 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 IpeGroup, IpePath, and IpeReference.

void IpeObject::SetStroke | ( | IpeAttribute | stroke | ) |

| Set stroke color.

void IpeObject::SetMatrix | ( | const IpeMatrix & | matrix | ) |

| Set the transformation matrix. Don't use this on the IpeObject in an IpePgObject, because it wouldn't invalidate its bounding box. Call IpePgObject::Transform instead.

IpeAttribute IpeObject::Stroke | ( |  | ) | const`[inline]`

| Return object stroke color.

const IpeMatrix & IpeObject::Matrix | ( |  | ) | const`[inline]`

| Return transformation matrix.

bool IpeObject::SnapVertex | ( | const IpeVector & | mouse,
|  | const IpeVector & | v,
|  | IpeVector & | pos,
|  | double & | bound
| ) | `[static]`

| Snap to nearby vertex. If distance between mouse and v is less than bound, set pos to v and bound to the distance, and return `true`.

void IpeObject::SaveAttributesAsXml | ( | IpePainter & | painter,
|  | IpeStream & | stream,
|  | IpeString | layer
| ) | const`[protected]`

| Write layer, stroke and matrix to XML stream.

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

- ipeobj.h
- ipeobj.cpp