42cf5bc1 |
1 | // Created on: 1993-07-06 |
2 | // Created by: Yves FRICAUD |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _BRepMAT2d_BisectingLocus_HeaderFile |
18 | #define _BRepMAT2d_BisectingLocus_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <MAT2d_Tool2d.hxx> |
42cf5bc1 |
25 | #include <MAT2d_DataMapOfBiIntInteger.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <MAT_Side.hxx> |
28 | #include <GeomAbs_JoinType.hxx> |
29 | #include <MAT_DataMapOfIntegerBasicElt.hxx> |
30 | class MAT_Graph; |
31 | class BRepMAT2d_Explorer; |
32 | class MAT_BasicElt; |
33 | class Geom2d_Geometry; |
34 | class gp_Pnt2d; |
35 | class MAT_Node; |
36 | class Bisector_Bisec; |
37 | class MAT_Arc; |
38 | |
39 | |
40 | //! BisectingLocus generates and contains the Bisecting_Locus |
41 | //! of a set of lines from Geom2d, defined by <ExploSet>. |
42 | //! |
43 | //! If the set of lines contains closed lines: |
44 | //! ------------------------------------------ |
45 | //! These lines cut the plane in areas. |
46 | //! One map can be computed for each area. |
47 | //! |
48 | //! Bisecting locus computes a map in an area. |
49 | //! The area is defined by a side (MAT_Left,MAT_Right) |
50 | //! on one of the closed lines. |
51 | //! |
52 | //! If the set of lines contains only open lines: |
53 | //! -------------------------------------------- |
54 | //! the map recovers all the plane. |
55 | //! |
56 | //! Warning: Assume the orientation of the closed lines are |
57 | //! compatible. |
58 | //! |
59 | //! Assume the explo contains only lines located in the |
60 | //! area where the bisecting locus will be computed. |
61 | //! |
62 | //! Assume a line don't cross itself or an other line. |
63 | //! |
64 | //! Remark: |
65 | //! the curves coming from the explorer can be |
66 | //! decomposed in different parts. It the case for the |
67 | //! curves other than circles or lines. |
68 | //! |
69 | //! The map of bisecting locus is described by a graph. |
70 | //! - The BasicsElements correspond to elements on |
71 | //! the figure described by the Explorer from BRepMAT2d. |
72 | //! - The Arcs correspond to the bisectors. |
73 | //! - The Nodes are the extremities of the arcs. |
74 | class BRepMAT2d_BisectingLocus |
75 | { |
76 | public: |
77 | |
78 | DEFINE_STANDARD_ALLOC |
79 | |
80 | |
81 | Standard_EXPORT BRepMAT2d_BisectingLocus(); |
82 | |
83 | //! Computation of the Bisector_Locus in a set of Lines |
84 | //! defined in <anExplo>. |
85 | //! The bisecting locus are computed on the side <aSide> |
86 | //! from the line <LineIndex> in <anExplo>. |
87 | Standard_EXPORT void Compute (BRepMAT2d_Explorer& anExplo, const Standard_Integer LineIndex = 1, const MAT_Side aSide = MAT_Left, const GeomAbs_JoinType aJoinType = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False); |
88 | |
89 | //! Returns True if Compute has succeeded. |
90 | Standard_EXPORT Standard_Boolean IsDone() const; |
91 | |
92 | //! Returns <theGraph> of <me>. |
93 | Standard_EXPORT Handle(MAT_Graph) Graph() const; |
94 | |
95 | //! Returns the number of contours. |
96 | Standard_EXPORT Standard_Integer NumberOfContours() const; |
97 | |
98 | //! Returns the number of BasicElts on the line |
99 | //! <IndLine>. |
100 | Standard_EXPORT Standard_Integer NumberOfElts (const Standard_Integer IndLine) const; |
101 | |
102 | //! Returns the number of sections of a curve. |
103 | //! this curve is the Indexth curve in the IndLineth contour |
104 | //! given by anExplo. |
105 | Standard_EXPORT Standard_Integer NumberOfSections (const Standard_Integer IndLine, const Standard_Integer Index) const; |
106 | |
107 | //! Returns the BasicElts located at the position |
108 | //! <Index> on the contour designed by <IndLine>. |
109 | //! Remark: the BasicElts on a contour are sorted. |
110 | Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer IndLine, const Standard_Integer Index) const; |
111 | |
112 | //! Returns the geometry linked to the <BasicElt>. |
113 | Standard_EXPORT Handle(Geom2d_Geometry) GeomElt (const Handle(MAT_BasicElt)& aBasicElt) const; |
114 | |
115 | //! Returns the geometry of type <gp> linked to |
116 | //! the <Node>. |
117 | Standard_EXPORT gp_Pnt2d GeomElt (const Handle(MAT_Node)& aNode) const; |
118 | |
119 | //! Returns the geometry of type <Bissec> |
120 | //! linked to the arc <ARC>. |
121 | //! <Reverse> is False when the FirstNode of <anArc> |
122 | //! correspond to the first point of geometry. |
123 | Standard_EXPORT Bisector_Bisec GeomBis (const Handle(MAT_Arc)& anArc, Standard_Boolean& Reverse) const; |
124 | |
125 | |
126 | |
127 | |
128 | protected: |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | private: |
135 | |
136 | |
137 | Standard_EXPORT void Fusion(); |
138 | |
139 | Standard_EXPORT void RenumerationAndFusion (const Standard_Integer IndexLine, const Standard_Integer LengthLine, Standard_Integer& IndexLast, MAT_DataMapOfIntegerBasicElt& NewMap); |
140 | |
141 | |
142 | Handle(MAT_Graph) theGraph; |
143 | MAT2d_Tool2d theTool; |
144 | Standard_Boolean isDone; |
145 | MAT2d_DataMapOfBiIntInteger nbSect; |
146 | Standard_Integer nbContours; |
147 | |
148 | |
149 | }; |
150 | |
151 | |
152 | |
153 | |
154 | |
155 | |
156 | |
157 | #endif // _BRepMAT2d_BisectingLocus_HeaderFile |