42cf5bc1 |
1 | // Created on: 1999-04-27 |
2 | // Created by: Andrey BETENEV |
3 | // Copyright (c) 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 _ShapeFix_WireSegment_HeaderFile |
18 | #define _ShapeFix_WireSegment_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopoDS_Vertex.hxx> |
25 | #include <TopAbs_Orientation.hxx> |
26 | #include <TColStd_HSequenceOfInteger.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | class ShapeExtend_WireData; |
30 | class TopoDS_Wire; |
31 | class TopoDS_Vertex; |
32 | class TopoDS_Edge; |
33 | |
34 | |
35 | //! This class is auxiliary class (data storage) used in ComposeShell. |
36 | //! It is intended for representing segment of the wire |
37 | //! (or whole wire). The segment itself is represented by |
38 | //! ShapeExtend_WireData. In addition, some associated data |
39 | //! necessary for computations are stored: |
40 | //! |
41 | //! * Orientation flag - determines current use of the segment |
42 | //! and used for parity checking: |
43 | //! |
44 | //! TopAbs_FORWARD and TopAbs_REVERSED - says that segment was |
45 | //! traversed once in the corresponding direction, and hence |
46 | //! it should be traversed once more in opposite direction; |
47 | //! |
48 | //! TopAbs_EXTERNAL - the segment was not yet traversed in any |
49 | //! direction (i.e. not yet used as boundary) |
50 | //! |
51 | //! TopAbs_INTERNAL - the segment was traversed in both |
52 | //! directions and hence is out of further work. |
53 | //! |
54 | //! Segments of initial bounding wires are created with |
55 | //! orientation REVERSED (for outer wire) or FORWARD (for inner |
56 | //! wires), and segments of splitting seams - with orientation |
57 | //! EXTERNAL. |
58 | class ShapeFix_WireSegment |
59 | { |
60 | public: |
61 | |
62 | DEFINE_STANDARD_ALLOC |
63 | |
64 | |
65 | //! Creates empty segment. |
66 | Standard_EXPORT ShapeFix_WireSegment(); |
67 | |
68 | //! Creates segment and initializes it with wire and orientation. |
69 | Standard_EXPORT ShapeFix_WireSegment(const Handle(ShapeExtend_WireData)& wire, const TopAbs_Orientation ori = TopAbs_EXTERNAL); |
70 | |
71 | //! Creates segment and initializes it with wire and orientation. |
72 | Standard_EXPORT ShapeFix_WireSegment(const TopoDS_Wire& wire, const TopAbs_Orientation ori = TopAbs_EXTERNAL); |
73 | |
74 | //! Clears all fields. |
75 | Standard_EXPORT void Clear(); |
76 | |
77 | //! Loads wire. |
78 | Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& wire); |
79 | |
80 | //! Returns wire. |
81 | Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const; |
82 | |
83 | //! Sets orientation flag. |
84 | Standard_EXPORT void Orientation (const TopAbs_Orientation ori); |
85 | |
86 | //! Returns orientation flag. |
87 | Standard_EXPORT TopAbs_Orientation Orientation() const; |
88 | |
89 | //! Returns first vertex of the first edge in the wire |
90 | //! (no dependance on Orientation()). |
91 | Standard_EXPORT TopoDS_Vertex FirstVertex() const; |
92 | |
93 | //! Returns last vertex of the last edge in the wire |
94 | //! (no dependance on Orientation()). |
95 | Standard_EXPORT TopoDS_Vertex LastVertex() const; |
96 | |
97 | //! Returns True if FirstVertex() == LastVertex() |
98 | Standard_EXPORT Standard_Boolean IsClosed() const; |
99 | |
100 | //! Returns Number of edges in the wire |
101 | Standard_EXPORT Standard_Integer NbEdges() const; |
102 | |
103 | //! Returns edge by given index in the wire |
104 | Standard_EXPORT TopoDS_Edge Edge (const Standard_Integer i) const; |
105 | |
106 | //! Replaces edge at index i by new one. |
107 | Standard_EXPORT void SetEdge (const Standard_Integer i, const TopoDS_Edge& edge); |
108 | |
109 | //! Insert a new edge with index i and implicitly defined |
110 | //! patch indices (indefinite patch). |
111 | //! If i==0, edge is inserted at end of wire. |
112 | Standard_EXPORT void AddEdge (const Standard_Integer i, const TopoDS_Edge& edge); |
113 | |
114 | //! Insert a new edge with index i and explicitly defined |
115 | //! patch indices. If i==0, edge is inserted at end of wire. |
116 | Standard_EXPORT void AddEdge (const Standard_Integer i, const TopoDS_Edge& edge, const Standard_Integer iumin, const Standard_Integer iumax, const Standard_Integer ivmin, const Standard_Integer ivmax); |
117 | |
118 | //! Set patch indices for edge i. |
119 | Standard_EXPORT void SetPatchIndex (const Standard_Integer i, const Standard_Integer iumin, const Standard_Integer iumax, const Standard_Integer ivmin, const Standard_Integer ivmax); |
120 | |
121 | Standard_EXPORT void DefineIUMin (const Standard_Integer i, const Standard_Integer iumin); |
122 | |
123 | Standard_EXPORT void DefineIUMax (const Standard_Integer i, const Standard_Integer iumax); |
124 | |
125 | Standard_EXPORT void DefineIVMin (const Standard_Integer i, const Standard_Integer ivmin); |
126 | |
127 | //! Modify minimal or maximal patch index for edge i. |
128 | //! The corresponding patch index for that edge is modified so |
129 | //! as to satisfy eq. iumin <= myIUMin(i) <= myIUMax(i) <= iumax |
130 | Standard_EXPORT void DefineIVMax (const Standard_Integer i, const Standard_Integer ivmax); |
131 | |
132 | //! Returns patch indices for edge i. |
133 | Standard_EXPORT void GetPatchIndex (const Standard_Integer i, Standard_Integer& iumin, Standard_Integer& iumax, Standard_Integer& ivmin, Standard_Integer& ivmax) const; |
134 | |
135 | //! Checks patch indices for edge i to satisfy equations |
136 | //! IUMin(i) <= IUMax(i) <= IUMin(i)+1 |
137 | Standard_EXPORT Standard_Boolean CheckPatchIndex (const Standard_Integer i) const; |
138 | |
139 | Standard_EXPORT void SetVertex (const TopoDS_Vertex& theVertex); |
140 | |
141 | Standard_EXPORT TopoDS_Vertex GetVertex() const; |
142 | |
143 | Standard_EXPORT Standard_Boolean IsVertex() const; |
144 | |
145 | |
146 | |
147 | |
148 | protected: |
149 | |
150 | |
151 | |
152 | |
153 | |
154 | private: |
155 | |
156 | |
157 | |
158 | Handle(ShapeExtend_WireData) myWire; |
159 | TopoDS_Vertex myVertex; |
160 | TopAbs_Orientation myOrient; |
161 | Handle(TColStd_HSequenceOfInteger) myIUMin; |
162 | Handle(TColStd_HSequenceOfInteger) myIUMax; |
163 | Handle(TColStd_HSequenceOfInteger) myIVMin; |
164 | Handle(TColStd_HSequenceOfInteger) myIVMax; |
165 | |
166 | |
167 | }; |
168 | |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | |
175 | #endif // _ShapeFix_WireSegment_HeaderFile |