1 /****************************************************************************
2 ** $Id: rs_point.h 1938 2004-12-09 23:09:53Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the qcadlib Library project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
30 #include "rs_atomicentity.h"
33 * Holds the data that defines a point.
38 RS_PointData(const Vector & pos)
43 friend std::ostream & operator<<(std::ostream & os, const RS_PointData & pd)
45 os << "(" << pd.pos << ")";
53 * Class for a point entity.
55 * @author Andrew Mustun
57 class RS_Point: public RS_AtomicEntity
60 RS_Point(RS_EntityContainer * parent, const RS_PointData & d);
62 virtual RS_Entity * clone();
63 virtual RS2::EntityType rtti() const;
64 virtual Vector getStartpoint() const;
65 virtual Vector getEndpoint() const;
66 virtual void moveStartpoint(const Vector & pos);
67 RS_PointData getData() const;
68 virtual VectorSolutions getRefPoints();
70 void setPos(const Vector & pos);
72 virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
73 virtual Vector getNearestPointOnEntity(const Vector & coord,
74 bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
75 virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
76 virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
77 virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
78 virtual double getDistanceToPoint(const Vector& coord, RS_Entity ** entity = NULL,
79 RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
81 virtual void move(Vector offset);
82 virtual void rotate(Vector center, double angle);
83 virtual void scale(Vector center, Vector factor);
84 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
86 // virtual void draw(RS_Painter * painter, RS_GraphicView * view, double patternOffset = 0.0);
87 virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0);
89 friend std::ostream & operator<<(std::ostream & os, const RS_Point & p);
91 /** Recalculates the borders of this entity. */
92 virtual void calculateBorders();