Ipelib
|
#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) |
virtual void | setMatrix (const Matrix &matrix) |
const Matrix & | matrix () const |
virtual bool | setAttribute (Property prop, Attribute value) |
virtual Attribute | getAttribute (Property prop) const noexcept |
void | setCustom (Attribute value) |
Attribute | getCustom () 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 |
Matrix | effectiveMatrix (const Matrix &m, const Vector &pos=Vector::ZERO) const noexcept |
Static Protected Member Functions | |
static void | checkSymbol (Kind kind, Attribute attr, const Cascade *sheet, AttributeSeq &seq) |
Protected Attributes | |
Matrix | iMatrix |
Attribute | iCustom |
TPinned | iPinned: 8 |
TTransformations | iTransformations: 8 |
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 |
|
pure virtual |
Pure virtual destructor.
|
explicitprotected |
Create object with identity matrix, no pinning, all transformations.
References ipe::ENoPin, ipe::ETransformationsAffine, iCustom, iPinned, iTransformations, and ipe::Attribute::UNDEFINED().
|
explicitprotected |
Create object by taking pinning/transforming from attr and setting identity matrix.
References iCustom, ipe::AllAttributes::iPinned, iPinned, ipe::AllAttributes::iTransformations, iTransformations, and ipe::Attribute::UNDEFINED().
|
protected |
Copy constructor.
References iCustom, iMatrix, iPinned, and iTransformations.
|
explicitprotected |
Construct from XML stream.
References ipe::EFixedPin, ipe::EHorizontalPin, ipe::String::empty(), ipe::ENoPin, ipe::ETransformationsAffine, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, ipe::EVerticalPin, ipe::XmlAttributes::has(), iCustom, iMatrix, iPinned, iTransformations, and ipe::Attribute::UNDEFINED().
|
pure virtual |
Calls visitXXX method of the visitor.
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::PdfWriter::createPageView(), ipe::Document::findBitmaps(), ipe::PdfWriter::PdfWriter(), ipe::Latex::scanObject(), ipe::BitmapFinder::scanPage(), and ipe::Latex::scanPage().
|
pure virtual |
Make a copy of this object (constant-time).
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::Symbol::operator=(), and ipe::Symbol::Symbol().
|
virtual |
Return pointer to this object if it is an Group, nullptr otherwise.
Reimplemented in ipe::Group.
Referenced by ipe::PdfWriter::createPageView().
|
virtual |
Return pointer to this object if it is an Group, nullptr otherwise.
Reimplemented in ipe::Group.
|
virtual |
|
virtual |
|
virtual |
Return pointer to this object if it is an Image , nullptr otherwise.
Reimplemented in ipe::Image.
|
virtual |
Return pointer to this object if it is an Ref, nullptr otherwise.
Reimplemented in ipe::Reference.
|
pure virtual |
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
|
virtual |
Return pinning mode of the object.
Reimplemented in ipe::Group.
References iPinned.
Referenced by ipe::Group::pinned(), ipe::Group::push_back(), and ipe::TransformTool::TransformTool().
|
inline |
Return allowed transformations of the object.
References iTransformations.
Referenced by ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Group::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), ipe::Path::drawSimple(), and ipe::Text::setAttribute().
void Object::setTransformations | ( | TTransformations | trans | ) |
Set allowed transformations of the object.
References iTransformations.
Referenced by ipe::Text::setAttribute().
|
virtual |
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.
Reimplemented in ipe::Path.
References iMatrix, and matrix().
Referenced by ipe::Page::applyTitleStyle(), ipe::Path::setMatrix(), and ipe::Page::transform().
|
inline |
Return transformation matrix.
References iMatrix.
Referenced by ipe::Reference::addToBBox(), ipe::Reference::distance(), ipe::Group::draw(), ipe::Reference::draw(), ipe::Text::draw(), ipe::Image::draw(), ipe::Path::draw(), ipe::Group::drawSimple(), ipe::Reference::drawSimple(), ipe::Text::drawSimple(), ipe::Image::drawSimple(), ipe::Path::drawSimple(), setMatrix(), ipe::Path::setMatrix(), ipe::Text::snapCtl(), and ipe::Reference::snapVtx().
Set an attribute on this object.
Returns true if an attribute was actually changed.
Reimplemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
References ipe::EPropPinned, ipe::EPropTransformations, iPinned, ipe::Attribute::isEnum(), iTransformations, ipe::Attribute::pinned(), and ipe::Attribute::transformations().
Referenced by ipe::Page::setAttribute(), ipe::Group::setAttribute(), ipe::Reference::setAttribute(), ipe::Text::setAttribute(), ipe::Image::setAttribute(), and ipe::Path::setAttribute().
Get setting of an attribute of this object.
If object does not have this attribute, returnes "undefined" attribute.
Reimplemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
References ipe::EPropPinned, ipe::EPropTransformations, and ipe::Attribute::UNDEFINED().
Referenced by ipe::Group::getAttribute(), ipe::Reference::getAttribute(), ipe::Text::getAttribute(), ipe::Image::getAttribute(), and ipe::Path::getAttribute().
void Object::setCustom | ( | Attribute | value | ) |
Set the 'custom' attribute (not used by Ipe, for users and ipelets)
References iCustom, and ipe::Attribute::isString().
|
noexcept |
Return value of the 'custom' attribute.
References iCustom.
Save the object in XML format.
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
|
pure virtual |
Draw the object.
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::Painter::doDrawSymbol(), ipe::PdfPainter::doDrawSymbol(), ipe::Path::drawArrow(), ipe::CanvasBase::drawObjects(), ipe::PdfWriter::PdfWriter(), ipe::Thumbnail::render(), and ipe::Thumbnail::saveRender().
|
pure virtual |
Draw simple version for selecting and transforming.
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::PanTool::draw(), ipe::SelectTool::draw(), ipe::TransformTool::draw(), ipe::Reference::drawSimple(), and ipe::CanvasBase::drawTool().
|
pure virtual |
Return distance of transformed object to point v. If larger than bound, can just return bound.
Implemented in ipe::Path, ipe::Image, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::Page::distance().
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::Image, ipe::Text, ipe::Path, ipe::Reference, and ipe::Group.
Referenced by ipe::SelectTool::mouseButton().
|
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::Reference, and ipe::Group.
Referenced by ipe::Page::snapVtx().
|
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::Image, ipe::Text, and ipe::Group.
Referenced by ipe::Page::snapCtl().
|
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::Reference, and ipe::Group.
Referenced by ipe::Page::snapBnd().
|
virtual |
Check all symbolic attributes.
Reimplemented in ipe::Path, ipe::Text, ipe::Reference, and ipe::Group.
Referenced by ipe::Document::checkStyle().
Write layer, pin, transformations, matrix to XML stream.
References ipe::EFixedPin, ipe::EHorizontalPin, ipe::String::empty(), ipe::ENoPin, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, ipe::EVerticalPin, iCustom, iMatrix, iPinned, ipe::Matrix::isIdentity(), iTransformations, ipe::Attribute::string(), and ipe::Attribute::UNDEFINED().
Referenced by ipe::Group::saveAsXml(), ipe::Reference::saveAsXml(), ipe::Text::saveAsXml(), ipe::Image::saveAsXml(), and ipe::Path::saveAsXml().
|
staticprotected |
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::Reference::checkStyle(), ipe::Text::checkStyle(), and ipe::Path::checkStyle().
|
protectednoexcept |
Return the matrix transforming the object's geometry.
This takes into account the object's transformations
References ipe::Matrix::a, ipe::Vector::angle(), ipe::ETransformationsAffine, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, and ipe::Matrix::translation().
Referenced by ipe::Group::addToBBox(), ipe::Path::addToBBox(), ipe::Image::addToBBox(), ipe::Group::distance(), ipe::Image::distance(), ipe::Path::distance(), ipe::Group::snapBnd(), ipe::Path::snapBnd(), ipe::Group::snapCtl(), ipe::Image::snapCtl(), ipe::Path::snapCtl(), ipe::Group::snapVtx(), and ipe::Path::snapVtx().
|
protected |
Referenced by matrix(), Object(), saveAttributesAsXml(), and setMatrix().
|
protected |
Referenced by getCustom(), Object(), saveAttributesAsXml(), and setCustom().
|
protected |
Referenced by Object(), pinned(), saveAttributesAsXml(), setAttribute(), and setPinned().
|
protected |
Referenced by Object(), saveAttributesAsXml(), setAttribute(), setTransformations(), ipe::Text::Text(), and transformations().