1 // Created on: 1994-10-04
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-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_Explorer_HeaderFile
18 #define _BRepMAT2d_Explorer_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <MAT2d_SequenceOfSequenceOfCurve.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TopoDS_Shape.hxx>
27 #include <TColStd_SequenceOfBoolean.hxx>
28 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <TColGeom2d_SequenceOfCurve.hxx>
31 class TopoDS_Face;
32 class TopoDS_Wire;
33 class Geom2d_Curve;
34 
35 
36 //! Construct an explorer from wires, face, set of curves
37 //! from Geom2d to compute the bisecting Locus.
38 class BRepMAT2d_Explorer
39 {
40 public:
41 
42   DEFINE_STANDARD_ALLOC
43 
44 
45   Standard_EXPORT BRepMAT2d_Explorer();
46 
47   Standard_EXPORT BRepMAT2d_Explorer(const TopoDS_Face& aFace);
48 
49   //! Clear the contents of <me>.
50   Standard_EXPORT void Clear();
51 
52   Standard_EXPORT void Perform (const TopoDS_Face& aFace);
53 
54   //! Returns the Number of contours.
55   Standard_EXPORT Standard_Integer NumberOfContours() const;
56 
57   //! Returns the Number of Curves in the Contour  number
58   //! <IndexContour>.
59   Standard_EXPORT Standard_Integer NumberOfCurves (const Standard_Integer IndexContour) const;
60 
61   //! Initialisation of  an Iterator on  the curves of
62   //! the Contour number <IndexContour>.
63   Standard_EXPORT void Init (const Standard_Integer IndexContour);
64 
65   //! Return False if there is no more curves on the Contour
66   //! initialised by the method Init.
67   Standard_EXPORT Standard_Boolean More() const;
68 
69   //! Move to the next curve of the current Contour.
70   Standard_EXPORT void Next();
71 
72   //! Returns the current curve on the current Contour.
73   Standard_EXPORT Handle(Geom2d_Curve) Value() const;
74 
75   Standard_EXPORT TopoDS_Shape Shape() const;
76 
77   Standard_EXPORT const TColGeom2d_SequenceOfCurve& Contour (const Standard_Integer IndexContour) const;
78 
79   Standard_EXPORT Standard_Boolean IsModified (const TopoDS_Shape& aShape) const;
80 
81   //! If the shape is not modified, returns the shape itself.
82   Standard_EXPORT TopoDS_Shape ModifiedShape (const TopoDS_Shape& aShape) const;
83 
84   Standard_EXPORT const TColStd_SequenceOfBoolean& GetIsClosed() const;
85 
86 
87 
88 
89 protected:
90 
91 
92 
93 
94 
95 private:
96 
97 
98   //! Construction from a set of curves from Geom2d.
99   //! Assume  the   orientation  of  the  closed   lines are
100   //! compatible. (ie if A is in B, the orientation of A and B
101   //! has to be different.
102   //!
103   //! Assume the explo contains only lines located in the
104   //! area where the bisecting locus will be computed.
105   //!
106   //! Assume a line don't cross itself or an other line.
107   //!
108   //! A contour has to be construct in adding each curve in
109   //! respect to the sense of the contour.
110   //!
111   //! afirst point of a curve in a contour is equal to the last
112   //! point of the precedent curve.
113   //!
114   //! No  control of this  rules is done in the construction
115   //! of the explorer
116   Standard_EXPORT void Add (const TopoDS_Wire& Spine, const TopoDS_Face& aFace, TopoDS_Face& aNewFace);
117 
118   Standard_EXPORT void NewContour();
119 
120   //! Add the curve <aCurve> at me.
121   Standard_EXPORT void Add (const Handle(Geom2d_Curve)& aCurve);
122 
123 
124   MAT2d_SequenceOfSequenceOfCurve theCurves;
125   Standard_Integer current;
126   Standard_Integer currentContour;
127   TopoDS_Shape myShape;
128   TColStd_SequenceOfBoolean myIsClosed;
129   TopTools_IndexedDataMapOfShapeShape myModifShapes;
130 
131 
132 };
133 
134 
135 
136 
137 
138 
139 
140 #endif // _BRepMAT2d_Explorer_HeaderFile
141