kig
ObjectImp Class Reference
#include <object_imp.h>

Detailed Description
The ObjectImp class represents the behaviour of an object after it is calculated.This means how to draw() it, whether it claims to contain a certain point etc. It is also the class where the ObjectType's get their information from.
Definition at line 218 of file object_imp.h.
Public Member Functions | |
| virtual Coordinate | attachPoint () const =0 |
| virtual bool | canFillInNextEscape () const |
| virtual bool | contains (const Coordinate &p, int width, const KigWidget &si) const =0 |
| virtual ObjectImp * | copy () const =0 |
| virtual void | draw (KigPainter &p) const =0 |
| virtual bool | equals (const ObjectImp &rhs) const =0 |
| virtual void | fillInNextEscape (QString &s, const KigDocument &) const |
| int | getPropGid (const char *pname) const |
| int | getPropLid (int propgid) const |
| const char * | getPropName (int propgid) const |
| virtual const char * | iconForProperty (int which) const |
| virtual const ObjectImpType * | impRequirementForProperty (int which) const |
| bool | inherits (const ObjectImpType *t) const |
| virtual bool | inRect (const Rect &r, int width, const KigWidget &si) const =0 |
| virtual bool | isCache () const |
| virtual bool | isPropertyDefinedOnOrThroughThisImp (int which) const |
| virtual int | numberOfProperties () const |
| virtual const QByteArrayList | properties () const |
| virtual const QByteArrayList | propertiesInternalNames () const |
| virtual ObjectImp * | property (int which, const KigDocument &d) const |
| virtual Rect | surroundingRect () const =0 |
| virtual ObjectImp * | transform (const Transformation &t) const =0 |
| virtual const ObjectImpType * | type () const =0 |
| bool | valid () const |
| virtual void | visit (ObjectImpVisitor *vtor) const =0 |
| virtual | ~ObjectImp () |
Static Public Member Functions | |
| static const ObjectImpType * | stype () |
Protected Member Functions | |
| ObjectImp () | |
Constructor & Destructor Documentation
| ObjectImp::ObjectImp | ( | ) | [protected] |
Definition at line 33 of file object_imp.cc.
| ObjectImp::~ObjectImp | ( | ) | [virtual] |
Definition at line 37 of file object_imp.cc.
Member Function Documentation
| virtual Coordinate ObjectImp::attachPoint | ( | ) | const [pure virtual] |
Returns a reference point where to attach labels; when this returns an invalidCoord then the attachment is either not done at all, or done in a specific way (like for curves, or for points) The treatment of points could also take advantage of this attachment mechanism.
If this method returns a valid Coordinate, then this is interpreted as a pivot point for the label, which can still be moved relative to that point, but follows the object when the object changes. In practice a new RelativePointType is created (position of the string), this type in turn depends on the object (to get its attachPoint) and two DoubleImp that are interpreted as relative displacement (x and y)
Implemented in BogusImp, CurveImp, AngleImp, PointImp, PolygonImp, and TextImp.
| bool ObjectImp::canFillInNextEscape | ( | ) | const [virtual] |
Reimplemented in InvalidImp, DoubleImp, IntImp, StringImp, and PointImp.
Definition at line 176 of file object_imp.cc.
| virtual bool ObjectImp::contains | ( | const Coordinate & | p, | |
| int | width, | |||
| const KigWidget & | si | |||
| ) | const [pure virtual] |
Implemented in BogusImp, CircleImp, ConicImp, ConicArcImp, CubicImp, SegmentImp, RayImp, LineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, and TextImp.
| virtual ObjectImp* ObjectImp::copy | ( | ) | const [pure virtual] |
Returns a copy of this ObjectImp.
The copy is an exact copy. Changes to the copy don't affect the original.
Implemented in InvalidImp, DoubleImp, IntImp, StringImp, HierarchyImp, TransformationImp, TestResultImp, CircleImp, ConicImpCart, ConicImpPolar, ConicArcImp, CubicImp, CurveImp, SegmentImp, RayImp, LineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
| virtual void ObjectImp::draw | ( | KigPainter & | p | ) | const [pure virtual] |
| virtual bool ObjectImp::equals | ( | const ObjectImp & | rhs | ) | const [pure virtual] |
Returns true if this ObjectImp is equal to rhs.
This function checks whether rhs is of the same ObjectImp type, and whether it contains the same data as this ObjectImp.
For internal use only.
It is used e.g. by the KigCommand stuff to see what the user has changed during a move.
Implemented in InvalidImp, DoubleImp, IntImp, StringImp, HierarchyImp, TransformationImp, TestResultImp, CircleImp, ConicImp, CubicImp, AbstractLineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, and TextImp.
| void ObjectImp::fillInNextEscape | ( | QString & | s, | |
| const KigDocument & | ||||
| ) | const [virtual] |
Reimplemented in InvalidImp, DoubleImp, IntImp, StringImp, and PointImp.
Definition at line 46 of file object_imp.cc.
| int ObjectImp::getPropGid | ( | const char * | pname | ) | const |
Definition at line 317 of file object_imp.cc.
| int ObjectImp::getPropLid | ( | int | propgid | ) | const |
mp: The following three methods (getPropLid, getPropGid, getPropName) deal with the properties of ObjectImp(s).
the properties architecture (vectors of properties associated to each Imp) didn't work at all in situation when a node in the object hierarchy of which a properties is used changes it's Imp dynamically. An example of this is a python script that constructs a "hyperbolic segment" in the half-plane model of hyperbolic geometry, that results in a circular arc or a segment depending on the relative position of the two end-points. A workaround for this problem is to maintain two numberings for a property: the "local" id (Lid) is the index in the property vector associated to an ObjectImp, it makes only sense relatively to a specific ObjectImp; the "global" id (Gid) is a global numbering generated runtime and distinguishing properties only based on their internal name. A property node must only use the global numbering, so that when the parent changes it's Imp, the correct property (if it exists) of the new Imp will be used. the association of Gid to properties is constructed runtime whenever a new property is first used by populating a static vector (see object_imp.cc). The conversion Gid->Lid requires a vector search, so that a caching mechanism has been set up in the ObjectPropertyCalcer that stores the Lid and recalculates it when the typeid of the ObjectImp of the parent changes.
getPropLid: returns the local numbering corresponding to a Gid getPropGid: returns the Gid of a property given its internal name getPropName: returns the internal name of a property given its Gid
Note: in object_hierarchy.cc the class "FetchPropertyNode" is quite similar to "ObjectPropertyCalcer", and thus is similarly restructured. However the caching mechanism has not been setup in this case. It seems that "FetchPropertyNode" is only used for the "drawprelim" in constructions that involve a macro that in turn involves a property, so perhaps the caching is not that important.
Definition at line 331 of file object_imp.cc.
| const char * ObjectImp::getPropName | ( | int | propgid | ) | const |
Definition at line 340 of file object_imp.cc.
| const char * ObjectImp::iconForProperty | ( | int | which | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 171 of file object_imp.cc.
| const ObjectImpType * ObjectImp::impRequirementForProperty | ( | int | which | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 76 of file object_imp.cc.
| bool ObjectImp::inherits | ( | const ObjectImpType * | t | ) | const |
Returns true if this ObjectImp inherits the ObjectImp type represented by t.
E.g. you can check whether an ObjectImp is a LineImp by doing:
if( object.inherits( LineImp::stype() )
Definition at line 263 of file object_imp.cc.
| bool ObjectImp::isCache | ( | ) | const [virtual] |
For internal use only.
Return true if this imp is just a cache imp.
This means that it will never be considered to be stored in a file or in an ObjectHierarchy. This is useful for objects which cannot (easily and usefully) be (de)serialized, like e.g. PythonCompiledScriptImp. For normal objects, the default implementation returns false, which is fine.
Definition at line 290 of file object_imp.cc.
| bool ObjectImp::isPropertyDefinedOnOrThroughThisImp | ( | int | which | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 310 of file object_imp.cc.
| int ObjectImp::numberOfProperties | ( | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 58 of file object_imp.cc.
| const QByteArrayList ObjectImp::properties | ( | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 51 of file object_imp.cc.
| const QByteArrayList ObjectImp::propertiesInternalNames | ( | ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 63 of file object_imp.cc.
| ObjectImp * ObjectImp::property | ( | int | which, | |
| const KigDocument & | d | |||
| ) | const [virtual] |
Reimplemented in TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, AbstractLineImp, SegmentImp, RayImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 70 of file object_imp.cc.
| const ObjectImpType * ObjectImp::stype | ( | ) | [static] |
The ObjectImpType representing the base ObjectImp class.
All other ObjectImp's inherit from this type.
Reimplemented in BogusImp, InvalidImp, DoubleImp, IntImp, StringImp, HierarchyImp, TransformationImp, TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, CurveImp, AbstractLineImp, SegmentImp, RayImp, LineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, BogusPointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
Definition at line 268 of file object_imp.cc.
| virtual Rect ObjectImp::surroundingRect | ( | ) | const [pure virtual] |
| virtual ObjectImp* ObjectImp::transform | ( | const Transformation & | t | ) | const [pure virtual] |
| virtual const ObjectImpType* ObjectImp::type | ( | ) | const [pure virtual] |
Returns the lowermost ObjectImpType that this object is an instantiation of.
E.g. if you want to get a string containing the internal name of the type of an object, you can do:
std::string typename = object.type()->internalName();
Implemented in InvalidImp, DoubleImp, IntImp, StringImp, HierarchyImp, TransformationImp, TestResultImp, CircleImp, ConicImp, ConicArcImp, CubicImp, SegmentImp, RayImp, LineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, BogusPointImp, PolygonImp, TextImp, NumericTextImp, and BoolTextImp.
| bool ObjectImp::valid | ( | ) | const |
Returns true if this is a valid ObjectImp.
If you want to return an invalid ObjectImp, you should return an InvalidImp instance.
Reimplemented in CircleImp, ConicImp, ArcImp, PolygonImp, and TextImp.
Definition at line 41 of file object_imp.cc.
| virtual void ObjectImp::visit | ( | ObjectImpVisitor * | vtor | ) | const [pure virtual] |
Implemented in InvalidImp, DoubleImp, IntImp, StringImp, HierarchyImp, TransformationImp, TestResultImp, CircleImp, ConicImp, CubicImp, SegmentImp, RayImp, LineImp, LocusImp, AngleImp, VectorImp, ArcImp, PointImp, PolygonImp, and TextImp.
The documentation for this class was generated from the following files:
KDE 4.2 API Reference