4 #include "rs_atomicentity.h"
8 * Holds the data that defines a solid.
14 * Default constructor. Leaves the data object uninitialized.
17 for (int i=0; i<4; ++i) {
18 corner[i] = Vector(false);
23 * Constructor for a solid with 3 corners.
25 RS_SolidData(const Vector& corner1,
26 const Vector& corner2,
27 const Vector& corner3) {
32 corner[3] = Vector(false);
36 * Constructor for a solid with 4 corners.
38 RS_SolidData(const Vector& corner1,
39 const Vector& corner2,
40 const Vector& corner3,
41 const Vector& corner4) {
49 friend class RS_Solid;
51 friend std::ostream& operator << (std::ostream& os,
52 const RS_SolidData& pd) {
54 for (int i=0; i<4; i++) {
66 * Class for a solid entity (e.g. dimension arrows).
68 * @author Andrew Mustun
70 class RS_Solid: public RS_AtomicEntity
73 RS_Solid(RS_EntityContainer* parent,
74 const RS_SolidData& d);
76 virtual RS_Entity* clone() {
77 RS_Solid* s = new RS_Solid(*this);
82 /** @return RS_ENTITY_POINT */
83 virtual RS2::EntityType rtti() const {
84 return RS2::EntitySolid;
88 * @return Start point of the entity.
90 virtual Vector getStartpoint() const {
94 * @return End point of the entity.
96 virtual Vector getEndpoint() const {
101 /** @return Copy of data that defines the point. */
102 RS_SolidData getData() const {
106 /** @return true if this is a triangle. */
108 return !data.corner[3].valid;
111 Vector getCorner(int num);
113 void shapeArrow(const Vector & point, double angle, double arrowSize);
115 virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
116 virtual Vector getNearestPointOnEntity(const Vector & coord,
117 bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
118 virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
119 virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
120 virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
122 virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
123 RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
125 virtual void move(Vector offset);
126 virtual void rotate(Vector center, double angle);
127 virtual void scale(Vector center, Vector factor);
128 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
130 // virtual void draw(RS_Painter* painter, RS_GraphicView* view, double patternOffset=0.0);
131 virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0);
133 friend std::ostream & operator<<(std::ostream & os, const RS_Solid & p);
135 /** Recalculates the borders of this entity. */
136 virtual void calculateBorders ();