Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:15:55

0001 // Created on: 1993-07-06
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepMAT2d_BisectingLocus_HeaderFile
0018 #define _BRepMAT2d_BisectingLocus_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <MAT2d_Tool2d.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <MAT2d_BiInt.hxx>
0027 #include <NCollection_DataMap.hxx>
0028 #include <MAT_Side.hxx>
0029 #include <GeomAbs_JoinType.hxx>
0030 #include <MAT_BasicElt.hxx>
0031 class MAT_Graph;
0032 class BRepMAT2d_Explorer;
0033 class MAT_BasicElt;
0034 class Geom2d_Geometry;
0035 class gp_Pnt2d;
0036 class MAT_Node;
0037 class Bisector_Bisec;
0038 class MAT_Arc;
0039 
0040 //! BisectingLocus generates and contains the Bisecting_Locus
0041 //! of a set of lines from Geom2d, defined by <ExploSet>.
0042 //!
0043 //! If the set of lines contains closed lines:
0044 //! ------------------------------------------
0045 //! These lines cut the plane in areas.
0046 //! One map can be computed for each area.
0047 //!
0048 //! Bisecting locus computes a map in an area.
0049 //! The area is defined by a side (MAT_Left,MAT_Right)
0050 //! on one of the closed lines.
0051 //!
0052 //! If the set of lines contains only open lines:
0053 //! --------------------------------------------
0054 //! the map recovers all the plane.
0055 //!
0056 //! Warning: Assume the orientation of the closed lines are
0057 //! compatible.
0058 //!
0059 //! Assume the explo contains only lines located in the
0060 //! area where the bisecting locus will be computed.
0061 //!
0062 //! Assume a line don't cross itself or an other line.
0063 //!
0064 //! Remark:
0065 //! the curves coming from the explorer can be
0066 //! decomposed in different parts. It the case for the
0067 //! curves other than circles or lines.
0068 //!
0069 //! The map of bisecting locus is described by a graph.
0070 //! - The BasicsElements correspond to elements on
0071 //! the figure described by the Explorer from BRepMAT2d.
0072 //! - The Arcs correspond to the bisectors.
0073 //! - The Nodes are the extremities of the arcs.
0074 class BRepMAT2d_BisectingLocus
0075 {
0076 public:
0077   DEFINE_STANDARD_ALLOC
0078 
0079   Standard_EXPORT BRepMAT2d_BisectingLocus();
0080 
0081   //! Computation of the Bisector_Locus in a set of Lines
0082   //! defined in <anExplo>.
0083   //! The bisecting locus are computed on the side <aSide>
0084   //! from the line <LineIndex> in <anExplo>.
0085   Standard_EXPORT void Compute(BRepMAT2d_Explorer&    anExplo,
0086                                const int              LineIndex    = 1,
0087                                const MAT_Side         aSide        = MAT_Left,
0088                                const GeomAbs_JoinType aJoinType    = GeomAbs_Arc,
0089                                const bool             IsOpenResult = false);
0090 
0091   //! Returns True if Compute has succeeded.
0092   Standard_EXPORT bool IsDone() const;
0093 
0094   //! Returns <theGraph> of <me>.
0095   Standard_EXPORT occ::handle<MAT_Graph> Graph() const;
0096 
0097   //! Returns the number of contours.
0098   Standard_EXPORT int NumberOfContours() const;
0099 
0100   //! Returns the number of BasicElts on the line
0101   //! <IndLine>.
0102   Standard_EXPORT int NumberOfElts(const int IndLine) const;
0103 
0104   //! Returns the number of sections of a curve.
0105   //! this curve is the Indexth curve in the IndLineth contour
0106   //! given by anExplo.
0107   Standard_EXPORT int NumberOfSections(const int IndLine, const int Index) const;
0108 
0109   //! Returns the BasicElts located at the position
0110   //! <Index> on the contour designed by <IndLine>.
0111   //! Remark: the BasicElts on a contour are sorted.
0112   Standard_EXPORT occ::handle<MAT_BasicElt> BasicElt(const int IndLine, const int Index) const;
0113 
0114   //! Returns the geometry linked to the <BasicElt>.
0115   Standard_EXPORT occ::handle<Geom2d_Geometry> GeomElt(
0116     const occ::handle<MAT_BasicElt>& aBasicElt) const;
0117 
0118   //! Returns the geometry of type <gp> linked to
0119   //! the <Node>.
0120   Standard_EXPORT gp_Pnt2d GeomElt(const occ::handle<MAT_Node>& aNode) const;
0121 
0122   //! Returns the geometry of type <Bissec>
0123   //! linked to the arc <ARC>.
0124   //! <Reverse> is False when the FirstNode of <anArc>
0125   //! correspond to the first point of geometry.
0126   Standard_EXPORT Bisector_Bisec GeomBis(const occ::handle<MAT_Arc>& anArc, bool& Reverse) const;
0127 
0128 private:
0129   Standard_EXPORT void Fusion();
0130 
0131   Standard_EXPORT void RenumerationAndFusion(
0132     const int                                            IndexLine,
0133     const int                                            LengthLine,
0134     int&                                                 IndexLast,
0135     NCollection_DataMap<int, occ::handle<MAT_BasicElt>>& NewMap);
0136 
0137   occ::handle<MAT_Graph>                theGraph;
0138   MAT2d_Tool2d                          theTool;
0139   bool                                  isDone;
0140   NCollection_DataMap<MAT2d_BiInt, int> nbSect;
0141   int                                   nbContours;
0142 };
0143 
0144 #endif // _BRepMAT2d_BisectingLocus_HeaderFile