1 // Created on: 1993-04-29
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 _MAT_Graph_HeaderFile
18 #define _MAT_Graph_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <MAT_DataMapOfIntegerArc.hxx>
24 #include <MAT_DataMapOfIntegerBasicElt.hxx>
25 #include <MAT_DataMapOfIntegerNode.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Standard_Transient.hxx>
28 #include <Standard_Boolean.hxx>
29 class MAT_ListOfBisector;
36 DEFINE_STANDARD_HANDLE(MAT_Graph, Standard_Transient)
38 //! The Class Graph permits the exploration of the
40 class MAT_Graph : public Standard_Transient
46 //! Empty constructor.
47 Standard_EXPORT MAT_Graph();
49 //! Construct <me> from the result of the method
50 //! <CreateMat> of the class <MAT> from <MAT>.
52 //! <SemiInfinite> : if some bisector are infinites.
53 //! <TheRoots> : Set of the bisectors.
54 //! <NbBasicElts> : Number of Basic Elements.
55 //! <NbArcs> : Number of Arcs = Number of Bisectors.
56 Standard_EXPORT void Perform (const Standard_Boolean SemiInfinite, const Handle(MAT_ListOfBisector)& TheRoots, const Standard_Integer NbBasicElts, const Standard_Integer NbArcs);
58 //! Return the Arc of index <Index> in <theArcs>.
59 Standard_EXPORT Handle(MAT_Arc) Arc (const Standard_Integer Index) const;
61 //! Return the BasicElt of index <Index> in <theBasicElts>.
62 Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer Index) const;
64 //! Return the Node of index <Index> in <theNodes>.
65 Standard_EXPORT Handle(MAT_Node) Node (const Standard_Integer Index) const;
67 //! Return the number of arcs of <me>.
68 Standard_EXPORT Standard_Integer NumberOfArcs() const;
70 //! Return the number of nodes of <me>.
71 Standard_EXPORT Standard_Integer NumberOfNodes() const;
73 //! Return the number of basic elements of <me>.
74 Standard_EXPORT Standard_Integer NumberOfBasicElts() const;
76 //! Return the number of infinites nodes of <me>.
77 Standard_EXPORT Standard_Integer NumberOfInfiniteNodes() const;
79 //! Merge two BasicElts. The End of the BasicElt Elt1
80 //! of IndexElt1 becomes The End of the BasicElt Elt2
81 //! of IndexElt2. Elt2 is replaced in the arcs by
82 //! Elt1, Elt2 is eliminated.
84 //! <MergeArc1> is True if the fusion of the BasicElts =>
85 //! a fusion of two Arcs which separated the same elements.
86 //! In this case <GeomIndexArc1> and <GeomIndexArc2> are the
87 //! Geometric Index of this arcs.
89 //! If the BasicElt corresponds to a close line ,
90 //! the StartArc and the EndArc of Elt1 can separate the same
92 //! In this case there is a fusion of this arcs, <MergeArc2>
93 //! is true and <GeomIndexArc3> and <GeomIndexArc4> are the
94 //! Geometric Index of this arcs.
95 Standard_EXPORT void FusionOfBasicElts (const Standard_Integer IndexElt1, const Standard_Integer IndexElt2, Standard_Boolean& MergeArc1, Standard_Integer& GeomIndexArc1, Standard_Integer& GeomIndexArc2, Standard_Boolean& MergeArc2, Standard_Integer& GeomIndexArc3, Standard_Integer& GeomIndexArc4);
97 Standard_EXPORT void CompactArcs();
99 Standard_EXPORT void CompactNodes();
101 Standard_EXPORT void ChangeBasicElts (const MAT_DataMapOfIntegerBasicElt& NewMap);
103 Standard_EXPORT Handle(MAT_BasicElt) ChangeBasicElt (const Standard_Integer Index);
108 DEFINE_STANDARD_RTTIEXT(MAT_Graph,Standard_Transient)
118 //! Merge two Arcs. the second node of <Arc2> becomes
119 //! the first node of <Arc1>. Update of the first
120 //! node and the neighbours of <Arc1>.
121 //! <Arc2> is eliminated.
122 Standard_EXPORT void FusionOfArcs (const Handle(MAT_Arc)& Arc1, const Handle(MAT_Arc)& Arc2);
124 Standard_EXPORT void UpDateNodes (Standard_Integer& Index);
126 MAT_DataMapOfIntegerArc theArcs;
127 MAT_DataMapOfIntegerBasicElt theBasicElts;
128 MAT_DataMapOfIntegerNode theNodes;
129 Standard_Integer numberOfArcs;
130 Standard_Integer numberOfNodes;
131 Standard_Integer numberOfBasicElts;
132 Standard_Integer numberOfInfiniteNodes;
143 #endif // _MAT_Graph_HeaderFile