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
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 _BRepMAT2d_BisectingLocus_HeaderFile
18 #define _BRepMAT2d_BisectingLocus_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <MAT2d_Tool2d.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <MAT2d_DataMapOfBiIntInteger.hxx>
27 #include <Standard_Integer.hxx>
28 #include <MAT_Side.hxx>
29 #include <GeomAbs_JoinType.hxx>
30 #include <MAT_DataMapOfIntegerBasicElt.hxx>
32 class BRepMAT2d_Explorer;
34 class Geom2d_Geometry;
41 //! BisectingLocus generates and contains the Bisecting_Locus
42 //! of a set of lines from Geom2d, defined by <ExploSet>.
44 //! If the set of lines contains closed lines:
45 //! ------------------------------------------
46 //! These lines cut the plane in areas.
47 //! One map can be computed for each area.
49 //! Bisecting locus computes a map in an area.
50 //! The area is defined by a side (MAT_Left,MAT_Right)
51 //! on one of the closed lines.
53 //! If the set of lines contains only open lines:
54 //! --------------------------------------------
55 //! the map recovers all the plane.
57 //! Warning: Assume the orientation of the closed lines are
60 //! Assume the explo contains only lines located in the
61 //! area where the bisecting locus will be computed.
63 //! Assume a line don't cross itself or an other line.
66 //! the curves coming from the explorer can be
67 //! decomposed in different parts. It the case for the
68 //! curves other than circles or lines.
70 //! The map of bisecting locus is described by a graph.
71 //! - The BasicsElements correspond to elements on
72 //! the figure described by the Explorer from BRepMAT2d.
73 //! - The Arcs correspond to the bisectors.
74 //! - The Nodes are the extremities of the arcs.
75 class BRepMAT2d_BisectingLocus
82 Standard_EXPORT BRepMAT2d_BisectingLocus();
84 //! Computation of the Bisector_Locus in a set of Lines
85 //! defined in <anExplo>.
86 //! The bisecting locus are computed on the side <aSide>
87 //! from the line <LineIndex> in <anExplo>.
88 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);
90 //! Returns True if Compute has succeeded.
91 Standard_EXPORT Standard_Boolean IsDone() const;
93 //! Returns <theGraph> of <me>.
94 Standard_EXPORT Handle(MAT_Graph) Graph() const;
96 //! Returns the number of contours.
97 Standard_EXPORT Standard_Integer NumberOfContours() const;
99 //! Returns the number of BasicElts on the line
101 Standard_EXPORT Standard_Integer NumberOfElts (const Standard_Integer IndLine) const;
103 //! Returns the number of sections of a curve.
104 //! this curve is the Indexth curve in the IndLineth contour
105 //! given by anExplo.
106 Standard_EXPORT Standard_Integer NumberOfSections (const Standard_Integer IndLine, const Standard_Integer Index) const;
108 //! Returns the BasicElts located at the position
109 //! <Index> on the contour designed by <IndLine>.
110 //! Remark: the BasicElts on a contour are sorted.
111 Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer IndLine, const Standard_Integer Index) const;
113 //! Returns the geometry linked to the <BasicElt>.
114 Standard_EXPORT Handle(Geom2d_Geometry) GeomElt (const Handle(MAT_BasicElt)& aBasicElt) const;
116 //! Returns the geometry of type <gp> linked to
118 Standard_EXPORT gp_Pnt2d GeomElt (const Handle(MAT_Node)& aNode) const;
120 //! Returns the geometry of type <Bissec>
121 //! linked to the arc <ARC>.
122 //! <Reverse> is False when the FirstNode of <anArc>
123 //! correspond to the first point of geometry.
124 Standard_EXPORT Bisector_Bisec GeomBis (const Handle(MAT_Arc)& anArc, Standard_Boolean& Reverse) const;
138 Standard_EXPORT void Fusion();
140 Standard_EXPORT void RenumerationAndFusion (const Standard_Integer IndexLine, const Standard_Integer LengthLine, Standard_Integer& IndexLast, MAT_DataMapOfIntegerBasicElt& NewMap);
143 Handle(MAT_Graph) theGraph;
144 MAT2d_Tool2d theTool;
145 Standard_Boolean isDone;
146 MAT2d_DataMapOfBiIntInteger nbSect;
147 Standard_Integer nbContours;
158 #endif // _BRepMAT2d_BisectingLocus_HeaderFile