0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / MAT / MAT_Graph.hxx
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
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 _MAT_Graph_HeaderFile
18 #define _MAT_Graph_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
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;
30 class MAT_Arc;
31 class MAT_BasicElt;
32 class MAT_Node;
33
34
35 class MAT_Graph;
36 DEFINE_STANDARD_HANDLE(MAT_Graph, Standard_Transient)
37
38 //! The Class Graph permits the exploration of the
39 //! Bisector Locus.
40 class MAT_Graph : public Standard_Transient
41 {
42
43 public:
44
45   
46   //! Empty constructor.
47   Standard_EXPORT MAT_Graph();
48   
49   //! Construct <me> from the result of the method
50   //! <CreateMat> of the class <MAT> from <MAT>.
51   //!
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);
57   
58   //! Return the Arc of index <Index> in <theArcs>.
59   Standard_EXPORT Handle(MAT_Arc) Arc (const Standard_Integer Index) const;
60   
61   //! Return the BasicElt of index <Index> in <theBasicElts>.
62   Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer Index) const;
63   
64   //! Return the Node of index <Index> in <theNodes>.
65   Standard_EXPORT Handle(MAT_Node) Node (const Standard_Integer Index) const;
66   
67   //! Return the number of arcs of <me>.
68   Standard_EXPORT Standard_Integer NumberOfArcs() const;
69   
70   //! Return the number of nodes of <me>.
71   Standard_EXPORT Standard_Integer NumberOfNodes() const;
72   
73   //! Return the number of basic elements of <me>.
74   Standard_EXPORT Standard_Integer NumberOfBasicElts() const;
75   
76   //! Return the number of infinites nodes of <me>.
77   Standard_EXPORT Standard_Integer NumberOfInfiniteNodes() const;
78   
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.
83   //!
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.
88   //!
89   //! If the  BasicElt corresponds to a close line ,
90   //! the StartArc and the EndArc of Elt1 can separate the same
91   //! elements .
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);
96   
97   Standard_EXPORT void CompactArcs();
98   
99   Standard_EXPORT void CompactNodes();
100   
101   Standard_EXPORT void ChangeBasicElts (const MAT_DataMapOfIntegerBasicElt& NewMap);
102   
103   Standard_EXPORT Handle(MAT_BasicElt) ChangeBasicElt (const Standard_Integer Index);
104
105
106
107
108   DEFINE_STANDARD_RTTIEXT(MAT_Graph,Standard_Transient)
109
110 protected:
111
112
113
114
115 private:
116
117   
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);
123   
124   Standard_EXPORT void UpDateNodes (Standard_Integer& Index);
125
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;
133
134
135 };
136
137
138
139
140
141
142
143 #endif // _MAT_Graph_HeaderFile