]> Shamusworld >> Repos - architektonas/blob - src/base/rs_information.h
Initial import
[architektonas] / src / base / rs_information.h
1 /****************************************************************************
2 ** $Id: rs_information.h 1926 2004-11-20 00:42:21Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the qcadlib Library project.
7 **
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.
12 **
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.
16 **
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.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef RS_INFORMATION_H
28 #define RS_INFORMATION_H
29
30 #include "rs_entitycontainer.h"
31 #include "rs_line.h"
32 #include "rs_arc.h"
33
34 /**
35  * Class for getting information about entities. This includes
36  * also things like the end point of an element which is
37  * nearest to a given coordinate.
38  * There's no interaction handled in this class.
39  * This class is bound to an entity container.
40  *
41  * @author Andrew Mustun
42  */
43 class RS_Information
44 {
45         public:
46                 RS_Information(RS_EntityContainer & entityContainer);
47
48                 static bool isDimension(RS2::EntityType type);
49                 static bool isTrimmable(RS_Entity * e);
50                 static bool isTrimmable(RS_Entity * e1, RS_Entity * e2);
51
52                 Vector getNearestEndpoint(const Vector & point, double * dist = NULL) const;
53                 Vector getNearestPointOnEntity(const Vector & point, bool onEntity = true,
54                         double * dist = NULL, RS_Entity ** entity = NULL) const;
55                 RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL,
56                         RS2::ResolveLevel level = RS2::ResolveAll) const;
57
58                 static VectorSolutions getIntersection(RS_Entity * e1, RS_Entity * e2, bool onEntities = false);
59                 static VectorSolutions getIntersectionLineLine(RS_Line * e1, RS_Line * e2);
60                 static VectorSolutions getIntersectionLineArc(RS_Line * line, RS_Arc * arc);
61                 static VectorSolutions getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2);
62                 static VectorSolutions getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse);
63
64                 static bool isPointInsideContour(const Vector & point, RS_EntityContainer * contour,
65                         bool * onContour = NULL);
66
67         protected:
68                 RS_EntityContainer * container;
69 };
70
71 #endif