Ipelib
|
Base class for all Ipe objects, composite or leaf. More...
#include <ipeobject.h>
Inherited by ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
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.
enum ipe::Object::Type |
Object::~Object | ( | ) | [pure virtual] |
Pure virtual destructor.
Object::Object | ( | ) | [explicit, protected] |
Create object with identity matrix, no pinning, all transformations.
Object::Object | ( | const AllAttributes & | attr | ) | [explicit, protected] |
Create object by taking pinning/transforming from attr and setting identity matrix.
Object::Object | ( | const Object & | rhs | ) | [protected] |
Copy constructor.
Object::Object | ( | const XmlAttributes & | attr | ) | [explicit, protected] |
Construct from XML stream.
virtual void ipe::Object::accept | ( | Visitor & | visitor | ) | const [pure virtual] |
Calls visitXXX method of the visitor.
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
virtual Object* ipe::Object::clone | ( | ) | const [pure virtual] |
Make a copy of this object (constant-time).
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
Group * Object::asGroup | ( | ) | [virtual] |
Return pointer to this object if it is an Group, 0 otherwise.
Reimplemented in ipe::Group.
Text * Object::asText | ( | ) | [virtual] |
Path * Object::asPath | ( | ) | [virtual] |
Image * Object::asImage | ( | ) | [virtual] |
Return pointer to this object if it is an Image , 0 otherwise.
Reimplemented in ipe::Image.
Reference * Object::asReference | ( | ) | [virtual] |
Return pointer to this object if it is an Ref, 0 otherwise.
Reimplemented in ipe::Reference.
virtual Type ipe::Object::type | ( | ) | const [pure virtual] |
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
TPinned Object::pinned | ( | ) | const [virtual] |
Return pinning mode of the object.
Reimplemented in ipe::Group.
void Object::setPinned | ( | TPinned | pin | ) |
Set pinning mode of the object.
TTransformations ipe::Object::transformations | ( | ) | const [inline] |
Return allowed transformations of the object.
void Object::setTransformations | ( | TTransformations | trans | ) |
Set allowed transformations of the object.
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.
const Matrix& ipe::Object::matrix | ( | ) | const [inline] |
Return transformation matrix.
bool Object::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 in ipe::Group, ipe::Path, ipe::Reference, and ipe::Text.
Get setting of an attribute of this object.
If object does not have this attribute, returnes "undefined" attribute.
Reimplemented in ipe::Path, ipe::Reference, and ipe::Text.
Save the object in XML format.
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
virtual void ipe::Object::draw | ( | Painter & | painter | ) | const [pure virtual] |
Draw the object.
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
virtual void ipe::Object::drawSimple | ( | Painter & | painter | ) | const [pure virtual] |
Draw simple version for selecting and transforming.
Implemented in ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
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::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
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::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
virtual void ipe::Object::snapVtx | ( | const Vector & | mouse, |
const Matrix & | m, | ||
Vector & | 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 ipe::Group, ipe::Image, ipe::Path, ipe::Reference, and ipe::Text.
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.
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::Group, ipe::Path, and ipe::Reference.
Write layer, pin, transformations, matrix to XML stream.
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.
Matrix ipe::Object::iMatrix [protected] |
TPinned ipe::Object::iPinned [protected] |
TTransformations ipe::Object::iTransformations [protected] |