+++ /dev/null
-#ifndef __SOLID_H__
-#define __SOLID_H__
-
-#include "atomicentity.h"
-#include "vector.h"
-
-/**
- * Holds the data that defines a solid.
- */
-class SolidData
-{
- public:
- /**
- * Default constructor. Leaves the data object uninitialized.
- */
- SolidData()
- {
- for(int i=0; i<4; ++i)
- corner[i] = Vector(false);
- }
-
- /**
- * Constructor for a solid with 3 corners.
- */
- SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3)
- {
- corner[0] = corner1;
- corner[1] = corner2;
- corner[2] = corner3;
- corner[3] = Vector(false);
- }
-
- /**
- * Constructor for a solid with 4 corners.
- */
- SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3, const Vector & corner4)
- {
- corner[0] = corner1;
- corner[1] = corner2;
- corner[2] = corner3;
- corner[3] = corner4;
- }
-
- friend class Solid;
-
- friend std::ostream & operator<<(std::ostream & os, const SolidData & pd)
- {
- os << "(";
-
- for(int i=0; i<4; i++)
- os << pd.corner[i];
-
- os << ")";
- return os;
- }
-
- private:
- Vector corner[4];
-};
-
-/**
- * Class for a solid entity (e.g. dimension arrows).
- *
- * @author Andrew Mustun
- */
-class Solid: public AtomicEntity
-{
- public:
- Solid(EntityContainer * parent, const SolidData & d);
-
- virtual Entity * clone();
- virtual RS2::EntityType rtti() const;
- virtual Vector getStartpoint() const;
- virtual Vector getEndpoint() const;
- SolidData getData() const;
- bool isTriangle();
- Vector getCorner(int num);
- void shapeArrow(const Vector & point, double angle, double arrowSize);
-
- virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
- double * dist = NULL, Entity ** entity = NULL);
- virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
- RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
- virtual void move(Vector offset);
- virtual void rotate(Vector center, double angle);
- virtual void scale(Vector center, Vector factor);
- virtual void mirror(Vector axisPoint1, Vector axisPoint2);
- virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
-
- friend std::ostream & operator<<(std::ostream & os, const Solid & p);
-
- /** Recalculates the borders of this entity. */
- virtual void calculateBorders ();
-
- protected:
- SolidData data;
-};
-
-#endif