X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_solid.h;h=d2f8761a020c36a131d685f9e35724f55d72f2b1;hb=d774c2655ba2c3657a565f325411144452392277;hp=49120cd00daf19248503640fb4250f28bf0edc64;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/base/rs_solid.h b/src/base/rs_solid.h index 49120cd..d2f8761 100644 --- a/src/base/rs_solid.h +++ b/src/base/rs_solid.h @@ -1,29 +1,3 @@ -/**************************************************************************** -** $Id: rs_solid.h 2371 2005-04-29 11:44:39Z andrew $ -** -** Copyright (C) 2001-2003 RibbonSoft. All rights reserved. -** -** This file is part of the qcadlib Library project. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** Licensees holding valid qcadlib Professional Edition licenses may use -** this file in accordance with the qcadlib Commercial License -** Agreement provided with the Software. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.ribbonsoft.com for further details. -** -** Contact info@ribbonsoft.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - #ifndef RS_SOLID_H #define RS_SOLID_H @@ -35,57 +9,53 @@ */ class RS_SolidData { -public: - /** - * Default constructor. Leaves the data object uninitialized. - */ - RS_SolidData() { - for (int i=0; i<4; ++i) { - corner[i] = Vector(false); - } - } - - /** - * Constructor for a solid with 3 corners. - */ - RS_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. - */ - RS_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 RS_Solid; - - friend std::ostream& operator << (std::ostream& os, - const RS_SolidData& pd) { - os << "("; - for (int i=0; i<4; i++) { - os << pd.corner[i]; - } - os << ")"; - return os; - } - -private: - Vector corner[4]; + public: + /** + * Default constructor. Leaves the data object uninitialized. + */ + RS_SolidData() + { + for(int i=0; i<4; ++i) + corner[i] = Vector(false); + } + + /** + * Constructor for a solid with 3 corners. + */ + RS_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. + */ + RS_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 RS_Solid; + + friend std::ostream & operator<<(std::ostream & os, const RS_SolidData & pd) + { + os << "("; + + for(int i=0; i<4; i++) + os << pd.corner[i]; + + os << ")"; + return os; + } + + private: + Vector corner[4]; }; /** @@ -95,75 +65,39 @@ private: */ class RS_Solid: public RS_AtomicEntity { -public: - RS_Solid(RS_EntityContainer* parent, - const RS_SolidData& d); - - virtual RS_Entity* clone() { - RS_Solid* s = new RS_Solid(*this); - s->initId(); - return s; - } - - /** @return RS_ENTITY_POINT */ - virtual RS2::EntityType rtti() const { - return RS2::EntitySolid; - } - - /** - * @return Start point of the entity. - */ - virtual Vector getStartpoint() const { - return Vector(false); - } - /** - * @return End point of the entity. - */ - virtual Vector getEndpoint() const { - return Vector(false); - } - - - /** @return Copy of data that defines the point. */ - RS_SolidData getData() const { - return data; - } - - /** @return true if this is a triangle. */ - bool isTriangle() { - return !data.corner[3].valid; - } - - 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, RS_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, RS_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(RS_Painter* painter, RS_GraphicView* view, double patternOffset=0.0); - virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0); - - friend std::ostream & operator<<(std::ostream & os, const RS_Solid & p); - - /** Recalculates the borders of this entity. */ - virtual void calculateBorders (); - -protected: - RS_SolidData data; - //Vector point; + public: + RS_Solid(RS_EntityContainer * parent, const RS_SolidData & d); + + virtual RS_Entity * clone(); + virtual RS2::EntityType rtti() const; + virtual Vector getStartpoint() const; + virtual Vector getEndpoint() const; + RS_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, RS_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, RS_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 RS_Solid & p); + + /** Recalculates the borders of this entity. */ + virtual void calculateBorders (); + + protected: + RS_SolidData data; }; #endif