]> Shamusworld >> Repos - architektonas/blob - src/base/rs_information.h.bak
Start of bringing back missing forms/dialogs
[architektonas] / src / base / rs_information.h.bak
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
36 /**
37  * Class for getting information about entities. This includes
38  * also things like the end point of an element which is 
39  * nearest to a given coordinate.
40  * There's no interaction handled in this class.
41  * This class is bound to an entity container.
42  *
43  * @author Andrew Mustun
44  */
45 class RS_Information {
46 public:
47     RS_Information(RS_EntityContainer& entityContainer);
48
49         static bool isDimension(RS2::EntityType type);
50         static bool isTrimmable(RS_Entity* e);
51         static bool isTrimmable(RS_Entity* e1, RS_Entity* e2);
52
53     Vector getNearestEndpoint(const Vector& point,
54                                  double* dist = NULL) const;
55     Vector getNearestPointOnEntity(const Vector& point,
56                                           bool onEntity=true, 
57                                       double* dist = NULL,
58                                       RS_Entity** entity=NULL) const;
59     RS_Entity* getNearestEntity(const Vector& point,
60                                 double* dist = NULL,
61                                 RS2::ResolveLevel level=RS2::ResolveAll) const;
62
63     static VectorSolutions getIntersection(RS_Entity* e1,
64             RS_Entity* e2,
65             bool onEntities = false);
66
67     static VectorSolutions getIntersectionLineLine(RS_Line* e1,
68             RS_Line* e2);
69
70     static VectorSolutions getIntersectionLineArc(RS_Line* line,
71             RS_Arc* arc);
72
73     static VectorSolutions getIntersectionArcArc(RS_Arc* e1,
74             RS_Arc* e2);
75     
76         static VectorSolutions getIntersectionLineEllipse(RS_Line* line,
77             RS_Ellipse* ellipse);
78
79     static bool isPointInsideContour(const Vector& point,
80                                      RS_EntityContainer* contour,
81                                                                          bool* onContour=NULL);
82         
83 protected:
84     RS_EntityContainer* container;
85 };
86
87
88
89 #endif