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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _ShapeFix_WireSegment_HeaderFile
18 #define _ShapeFix_WireSegment_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
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:
41 //! * Orientation flag - determines current use of the segment
42 //! and used for parity checking:
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;
48 //! TopAbs_EXTERNAL - the segment was not yet traversed in any
49 //! direction (i.e. not yet used as boundary)
51 //! TopAbs_INTERNAL - the segment was traversed in both
52 //! directions and hence is out of further work.
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
58 class ShapeFix_WireSegment
65 //! Creates empty segment.
66 Standard_EXPORT ShapeFix_WireSegment();
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);
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);
74 //! Clears all fields.
75 Standard_EXPORT void Clear();
78 Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& wire);
81 Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
83 //! Sets orientation flag.
84 Standard_EXPORT void Orientation (const TopAbs_Orientation ori);
86 //! Returns orientation flag.
87 Standard_EXPORT TopAbs_Orientation Orientation() const;
89 //! Returns first vertex of the first edge in the wire
90 //! (no dependance on Orientation()).
91 Standard_EXPORT TopoDS_Vertex FirstVertex() const;
93 //! Returns last vertex of the last edge in the wire
94 //! (no dependance on Orientation()).
95 Standard_EXPORT TopoDS_Vertex LastVertex() const;
97 //! Returns True if FirstVertex() == LastVertex()
98 Standard_EXPORT Standard_Boolean IsClosed() const;
100 //! Returns Number of edges in the wire
101 Standard_EXPORT Standard_Integer NbEdges() const;
103 //! Returns edge by given index in the wire
104 Standard_EXPORT TopoDS_Edge Edge (const Standard_Integer i) const;
106 //! Replaces edge at index i by new one.
107 Standard_EXPORT void SetEdge (const Standard_Integer i, const TopoDS_Edge& edge);
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);
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);
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);
121 Standard_EXPORT void DefineIUMin (const Standard_Integer i, const Standard_Integer iumin);
123 Standard_EXPORT void DefineIUMax (const Standard_Integer i, const Standard_Integer iumax);
125 Standard_EXPORT void DefineIVMin (const Standard_Integer i, const Standard_Integer ivmin);
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);
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;
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;
139 Standard_EXPORT void SetVertex (const TopoDS_Vertex& theVertex);
141 Standard_EXPORT TopoDS_Vertex GetVertex() const;
143 Standard_EXPORT Standard_Boolean IsVertex() const;
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;
175 #endif // _ShapeFix_WireSegment_HeaderFile