#include <rs_entity.h>
Inheritance diagram for RS_Entity:

Public Member Functions | |
| RS_Entity (RS_EntityContainer *parent=NULL) | |
| Default constructor. | |
| virtual | ~RS_Entity () |
| Destructor. | |
| void | init () |
| Initialisation. | |
| virtual void | initId () |
| Gives this entity a new unique id. | |
| virtual RS_Entity * | clone ()=0 |
| virtual void | copyPropertiesFrom (RS_Entity *e) |
| virtual void | reparent (RS_EntityContainer *parent) |
| void | resetBorders () |
| Resets the borders of this element. | |
| virtual RS2::EntityType | rtti () const |
| Must be overwritten to return the rtti of this entity (e.g. | |
| virtual RS2::UndoableType | undoRtti () const |
| Identify all entities as undoable entities. | |
| unsigned long int | getId () const |
| virtual int | count ()=0 |
| This method must be overwritten in subclasses and return the number of atomic entities in this entity. | |
| virtual int | countDeep ()=0 |
| This method must be overwritten in subclasses and return the number of atomic entities in this entity including sub containers. | |
| virtual double | getLength () |
| Implementations must return the total length of the entity or a negative number if the entity has no length (e.g. | |
| RS_EntityContainer * | getParent () const |
| void | setParent (RS_EntityContainer *p) |
| Reparents this entity. | |
| RS_Graphic * | getGraphic () |
| RS_Block * | getBlock () |
| RS_Insert * | getInsert () |
| RS_Entity * | getBlockOrInsert () |
| RS_Document * | getDocument () |
| void | setLayer (const RS_String &name) |
| Sets the layer of this entity to the layer with the given name. | |
| void | setLayer (RS_Layer *l) |
| Sets the layer of this entity to the layer given. | |
| void | setLayerToActive () |
| Sets the layer of this entity to the current layer of the graphic this entity is in. | |
| RS_Layer * | getLayer (bool resolve=true) const |
| Returns a pointer to the layer this entity is on or NULL. | |
| void | setPen (const RS_Pen &pen) |
| Sets the explicit pen for this entity or a pen with special attributes such as BY_LAYER, . | |
| void | setPenToActive () |
| Sets the pen of this entity to the current pen of the graphic this entity is in. | |
| RS_Pen | getPen (bool resolve=true) const |
| Gets the pen needed to draw this entity. | |
| virtual bool | isContainer () const =0 |
| Must be overwritten to return true if an entity type is a container for other entities (e.g. | |
| virtual bool | isAtomic () const =0 |
| Must be overwritten to return true if an entity type is an atomic entity. | |
| virtual bool | isEdge () const |
| Must be overwritten to return true if an entity type is a potential edge entity of a contour. | |
| virtual bool | isDocument () const |
| virtual bool | setSelected (bool select) |
| Selects or deselects this entity. | |
| virtual bool | toggleSelected () |
| Toggles select on this entity. | |
| virtual bool | isSelected () const |
| virtual bool | isParentSelected () |
| virtual bool | isProcessed () const |
| virtual void | setProcessed (bool on) |
| Sets or resets the processed flag of this entity. | |
| virtual bool | isInWindow (const RS_Vector &v1, const RS_Vector &v2) |
| virtual bool | hasEndpointsWithinWindow (const RS_Vector &, const RS_Vector &) |
| virtual bool | isVisible () |
| Is this entity visible? | |
| virtual void | setVisible (bool v) |
| virtual void | setHighlighted (bool on) |
| Sets the highlight status of the entity. | |
| virtual bool | isHighlighted () |
| virtual bool | isLocked () |
| virtual void | undoStateChanged (bool undone) |
| Called when the undo state changed. | |
| virtual bool | isUndone () const |
| virtual void | update () |
| Can be implemented by child classes to update the entities temporary subentities. | |
| virtual void | setUpdateEnabled (bool on) |
| RS_Vector | getMin () const |
| This method doesn't do any calculations. | |
| RS_Vector | getMax () const |
| This method doesn't do any calculations. | |
| RS_Vector | getSize () const |
| This method returns the difference of max and min returned by the above functions. | |
| void | addGraphicVariable (const RS_String &key, double val, int code) |
| Sets a variable value for the parent graphic object. | |
| void | addGraphicVariable (const RS_String &key, int val, int code) |
| Sets a variable value for the parent graphic object. | |
| void | addGraphicVariable (const RS_String &key, const RS_String &val, int code) |
| Sets a variable value for the parent graphic object. | |
| double | getGraphicVariableDouble (const RS_String &key, double def) |
| A safe member function to return the given variable. | |
| int | getGraphicVariableInt (const RS_String &key, int def) |
| A safe member function to return the given variable. | |
| RS_String | getGraphicVariableString (const RS_String &key, const RS_String &def) |
| A safe member function to return the given variable. | |
| RS2::Unit | getGraphicUnit () |
| virtual RS_VectorSolutions | getRefPoints () |
| Must be overwritten to get all reference points of the entity. | |
| virtual RS_Vector | getNearestEndpoint (const RS_Vector &coord, double *dist=NULL)=0 |
| Must be overwritten to get the closest endpoint to the given coordinate for this entity. | |
| virtual RS_Vector | getNearestPointOnEntity (const RS_Vector &, bool onEntity=true, double *dist=NULL, RS_Entity **entity=NULL)=0 |
| Must be overwritten to get the closest coordinate to the given coordinate which is on this entity. | |
| virtual RS_Vector | getNearestCenter (const RS_Vector &coord, double *dist=NULL)=0 |
| Must be overwritten to get the (nearest) center point to the given coordinate for this entity. | |
| virtual RS_Vector | getNearestMiddle (const RS_Vector &coord, double *dist=NULL)=0 |
| Must be overwritten to get the (nearest) middle point to the given coordinate for this entity. | |
| virtual RS_Vector | getNearestDist (double distance, const RS_Vector &coord, double *dist=NULL)=0 |
| Must be overwritten to get the nearest point with a given distance to the endpoint to the given coordinate for this entity. | |
| virtual RS_Vector | getNearestDist (double, bool) |
| Must be overwritten to get the point with a given distance to the start- or endpoint to the given coordinate for this entity. | |
| virtual RS_Vector | getNearestRef (const RS_Vector &coord, double *dist=NULL) |
| Must be overwritten to get the nearest reference point for this entity. | |
| virtual RS_Vector | getNearestSelectedRef (const RS_Vector &coord, double *dist=NULL) |
| Gets the nearest reference point of this entity if it is selected. | |
| virtual double | getDistanceToPoint (const RS_Vector &coord, RS_Entity **entity=NULL, RS2::ResolveLevel level=RS2::ResolveNone, double solidDist=RS_MAXDOUBLE)=0 |
| Must be overwritten to get the shortest distance between this entity and a coordinate. | |
| virtual bool | isPointOnEntity (const RS_Vector &coord, double tolerance=RS_TOLERANCE) |
| virtual RS2::Side | getSideOfPoint (const RS_Vector &coord)=0 |
| Implementations must return RS2::RightHand if coord is on the right hand side of this entity, RS2::LeftHand if it is on the left hand side and RS2::NoSide otherwise (on entity, entity has no side, . | |
| virtual void | move (const RS_Vector &offset)=0 |
| Implementations must move the entity by the given vector. | |
| virtual void | rotate (const RS_Vector ¢er, double angle)=0 |
| Implementations must rotate the entity by the given angle around the given center. | |
| virtual void | scale (const RS_Vector ¢er, const RS_Vector &factor)=0 |
| Implementations must scale the entity by the given factors. | |
| virtual void | scale (const RS_Vector ¢er, double factor) |
| Acts like scale(RS_Vector) but with equal factors. | |
| virtual void | mirror (const RS_Vector &axisPoint1, const RS_Vector &axisPoint2)=0 |
| Implementations must mirror the entity by the given axis. | |
| virtual void | stretch (const RS_Vector &firstCorner, const RS_Vector &secondCorner, const RS_Vector &offset) |
| Implementations must stretch the given range of the entity by the given offset. | |
| virtual void | moveRef (const RS_Vector &, const RS_Vector &) |
| Implementations must drag the reference point(s) of all (sub-)entities that are very close to ref by offset. | |
| virtual void | moveSelectedRef (const RS_Vector &, const RS_Vector &) |
| Implementations must drag the reference point(s) of selected (sub-)entities that are very close to ref by offset. | |
| virtual void | draw (RS_Painter *painter, RS_GraphicView *view, double patternOffset=0.0)=0 |
| Implementations must draw the entity on the given device. | |
| double | getStyleFactor (RS_GraphicView *view) |
| virtual RS_Variant | getVariable (const RS_String &name, const RS_Variant &def=RS_Variant()) |
| Returns the variable with the given name or 'def'. | |
| virtual RS_StringList | getAllVariableNames () |
| virtual void | setVariable (const RS_String &name, const RS_Variant &value) |
| Sets the variable with the given name to the given value. | |
| virtual void | deleteVariable (const RS_String &name) |
| Deletes the variable with the given name. | |
| virtual void | calculateBorders ()=0 |
| Recalculates the borders of this entity. | |
Protected Attributes | |
| RS_EntityContainer * | parent |
| Entity's parent entity or NULL is this entity has no parent. | |
| RS_Vector | minV |
| minimum coordinates | |
| RS_Vector | maxV |
| maximum coordinates | |
| RS_Layer * | layer |
| Pointer to layer. | |
| unsigned long int | id |
| Entity id. | |
| RS_Pen | pen |
| pen (attributes) for this entity | |
| bool | updateEnabled |
| auto updating enabled? | |
..)
|
|
Default constructor.
|
|
||||||||||||||||
|
Sets a variable value for the parent graphic object.
|
|
||||||||||||||||
|
Sets a variable value for the parent graphic object.
|
|
||||||||||||||||
|
Sets a variable value for the parent graphic object.
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
Must be overwritten to get the shortest distance between this entity and a coordinate.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Hatch, RS_Image, RS_Line, RS_Point, and RS_Solid. |
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
A safe member function to return the given variable.
|
|
||||||||||||
|
A safe member function to return the given variable.
|
|
||||||||||||
|
A safe member function to return the given variable.
|
|
|
|
|
|
|
|
|
Returns a pointer to the layer this entity is on or NULL. resolve true: if the layer is ByBlock, the layer of the block this entity is in is returned. false: the layer of the entity is returned.
|
|
|
Implementations must return the total length of the entity or a negative number if the entity has no length (e.g. a text or hatch). Reimplemented in RS_Arc, RS_Circle, RS_Dimension, RS_EntityContainer, RS_Hatch, RS_Image, RS_Leader, RS_Line, and RS_Text. |
|
|
This method doesn't do any calculations.
|
|
|
This method doesn't do any calculations.
|
|
||||||||||||
|
Must be overwritten to get the (nearest) center point to the given coordinate for this entity.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, RS_Solid, and RS_Spline. |
|
||||||||||||
|
Must be overwritten to get the point with a given distance to the start- or endpoint to the given coordinate for this entity.
|
|
||||||||||||||||
|
Must be overwritten to get the nearest point with a given distance to the endpoint to the given coordinate for this entity.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, RS_Solid, and RS_Spline. |
|
||||||||||||
|
Must be overwritten to get the closest endpoint to the given coordinate for this entity.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, RS_Solid, and RS_Spline. |
|
||||||||||||
|
Must be overwritten to get the (nearest) middle point to the given coordinate for this entity.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, RS_Solid, and RS_Spline. |
|
||||||||||||||||||||
|
Must be overwritten to get the closest coordinate to the given coordinate which is on this entity.
Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, and RS_Solid. |
|
||||||||||||
|
Must be overwritten to get the nearest reference point for this entity.
Reimplemented in RS_Dimension, RS_EntityContainer, RS_Insert, RS_Leader, RS_Polyline, RS_Spline, and RS_Text. |
|
||||||||||||
|
Gets the nearest reference point of this entity if it is selected. Containers re-implement this method to return the nearest reference point of a selected sub entity.
Reimplemented in RS_Dimension, RS_EntityContainer, RS_Leader, RS_Polyline, and RS_Spline. |
|
|
|
|
|
Gets the pen needed to draw this entity. The attributes can also come from the layer this entity is on if the flags are set accordingly.
|
|
|
Implementations must return RS2::RightHand if coord is on the right hand side of this entity, RS2::LeftHand if it is on the left hand side and RS2::NoSide otherwise (on entity, entity has no side, . .). Implemented in RS_Arc, RS_Circle, RS_ConstructionLine, RS_Ellipse, RS_EntityContainer, RS_Image, RS_Line, RS_Point, and RS_Solid. |
|
|
This method returns the difference of max and min returned by the above functions.
|
|
|
|
|
||||||||||||
|
Returns the variable with the given name or 'def'.
|
|
|
Initialisation. Called from all constructors. |
|
|
Must be overwritten to return true if an entity type is a container for other entities (e.g. polyline, group, ...). Implemented in RS_AtomicEntity, RS_EntityContainer, and RS_Hatch. |
|
|
Reimplemented in RS_Document. |
|
|
Must be overwritten to return true if an entity type is a potential edge entity of a contour. By default this returns false. |
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
Reimplemented in RS_Ellipse. |
|
|
|
|
|
|
|
|
Reimplemented from RS_Undoable. |
|
|
Is this entity visible?
Reimplemented in RS_Insert. |
|
|
Must be overwritten to return the rtti of this entity (e.g. Reimplemented in RS_Arc, RS_Block, RS_Circle, RS_ConstructionLine, RS_DimAligned, RS_DimAngular, RS_DimDiametric, RS_DimLinear, RS_DimRadial, RS_Ellipse, RS_EntityContainer, RS_FontChar, RS_Graphic, RS_Hatch, RS_Image, RS_Insert, RS_Leader, RS_Line, RS_Point, RS_Polyline, RS_Solid, RS_Spline, and RS_Text. |
|
||||||||||||
|
Acts like scale(RS_Vector) but with equal factors. Equal to scale(center, RS_Vector(factor, factor)). |
|
|
Sets the highlight status of the entity. Highlighted entities usually indicate a feedback to a user action. |
|
|
Sets the layer of this entity to the current layer of the graphic this entity is in. If this entity (and none of its parents) are in a graphic the layer is set to NULL. |
|
|
Sets the explicit pen for this entity or a pen with special attributes such as BY_LAYER, .
|
|
|
Sets the pen of this entity to the current pen of the graphic this entity is in. If this entity (and none of its parents) are in a graphic the pen is not changed. |
|
|
Sets or resets the processed flag of this entity.
Reimplemented in RS_EntityContainer. |
|
|
Selects or deselects this entity.
Reimplemented in RS_EntityContainer. |
|
||||||||||||
|
Sets the variable with the given name to the given value. A previously existing variable with the same name is overwritten.
|
|
||||||||||||||||
|
Implementations must stretch the given range of the entity by the given offset. This default implementation moves the whole entity if it is completely inside the given range. Reimplemented in RS_Arc, RS_DimAligned, RS_DimLinear, RS_EntityContainer, RS_Hatch, RS_Leader, RS_Line, RS_Polyline, and RS_Text. |
|
|
Identify all entities as undoable entities.
Reimplemented from RS_Undoable. |
|
|
Called when the undo state changed.
Reimplemented from RS_Undoable. Reimplemented in RS_EntityContainer. |
|
|
Can be implemented by child classes to update the entities temporary subentities. update() is called if the entity's paramters or undo state changed. Reimplemented in RS_EntityContainer, RS_Hatch, RS_Image, RS_Insert, RS_Leader, RS_Spline, and RS_Text. |
1.4.4