0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / MAT2d / MAT2d_MiniPath.hxx
1 // Created on: 1993-10-07
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 _MAT2d_MiniPath_HeaderFile
18 #define _MAT2d_MiniPath_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <MAT2d_DataMapOfIntegerSequenceOfConnexion.hxx>
25 #include <MAT2d_DataMapOfIntegerConnexion.hxx>
26 #include <MAT2d_SequenceOfConnexion.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 #include <MAT2d_SequenceOfSequenceOfGeometry.hxx>
30 #include <Standard_Boolean.hxx>
31 class MAT2d_Connexion;
32
33
34 //! MiniPath computes a path to link all the  lines in
35 //! a set of lines. The path is described as a  set of
36 //! connexions.
37 //!
38 //! The set of connexions can be  seen as an arbitrary Tree.
39 //! The node of the  tree are the  lines.  The arcs of the
40 //! tree are the connexions.  The ancestror  of  a line is
41 //! the connexion which ends on it. The children of a line
42 //! are the connexions which start on it.
43 //!
44 //! The children of a line are ordered by the relation
45 //! <IsAfter> defined on the connexions.
46 //! (See MAT2s_Connexion.cdl).
47 class MAT2d_MiniPath 
48 {
49 public:
50
51   DEFINE_STANDARD_ALLOC
52
53   
54   Standard_EXPORT MAT2d_MiniPath();
55   
56   //! Computes the path  to link the  lines in <Figure>.
57   //! the path   starts on the  line  of index <IndStart>
58   //! <Sense>  = True    if  the Circuit turns in the
59   //! trigonometric  sense.
60   Standard_EXPORT void Perform (const MAT2d_SequenceOfSequenceOfGeometry& Figure, const Standard_Integer IndStart, const Standard_Boolean Sense);
61   
62   //! Run on the set of connexions to compute the path.
63   //! the path is an exploration of the tree which contains
64   //! the connexions and their reverses.
65   //! if the tree of connexions is
66   //! A
67   //! / |
68   //! B  E
69   //! / |  |
70   //! C  D  F
71   //!
72   //! the path is A->B, B->C, C->B, B->D, D->B, B->A, A->E,
73   //! E->F, F->E, E->A.
74   Standard_EXPORT void RunOnConnexions();
75   
76   //! Returns  the  sequence of  connexions corresponding to
77   //! the  path.
78   Standard_EXPORT const MAT2d_SequenceOfConnexion& Path() const;
79   
80   //! Returns <True> if there is one Connexion which starts
81   //! on line designed by <Index>.
82   Standard_EXPORT Standard_Boolean IsConnexionsFrom (const Standard_Integer Index) const;
83   
84   //! Returns    the  connexions  which   start  on line
85   //! designed  by <Index>.
86   Standard_EXPORT MAT2d_SequenceOfConnexion& ConnexionsFrom (const Standard_Integer Index);
87   
88   //! Returns <True> if the line designed by <Index> is
89   //! the root.
90   Standard_EXPORT Standard_Boolean IsRoot (const Standard_Integer Index) const;
91   
92   //! Returns    the  connexion  which ends  on line
93   //! designed  by <Index>.
94   Standard_EXPORT Handle(MAT2d_Connexion) Father (const Standard_Integer Index);
95
96
97
98
99 protected:
100
101
102
103
104
105 private:
106
107   
108   //! Add a connexion to the path.
109   Standard_EXPORT void Append (const Handle(MAT2d_Connexion)& Connexion);
110   
111   Standard_EXPORT void ExploSons (MAT2d_SequenceOfConnexion& aPath, const Handle(MAT2d_Connexion)& aConnexion);
112   
113   //! Returns the connexion which realises the minimum of
114   //! distance between the lines of index <L1> and <L2> in
115   //! <aFigure>. The connexion is oriented from <L1> to <L2>.
116   Standard_EXPORT Handle(MAT2d_Connexion) MinimumL1L2 (const MAT2d_SequenceOfSequenceOfGeometry& Figure, const Standard_Integer L1, const Standard_Integer L2) const;
117
118
119   MAT2d_DataMapOfIntegerSequenceOfConnexion theConnexions;
120   MAT2d_DataMapOfIntegerConnexion theFather;
121   MAT2d_SequenceOfConnexion thePath;
122   Standard_Real theDirection;
123   Standard_Integer indStart;
124
125
126 };
127
128
129
130
131
132
133
134 #endif // _MAT2d_MiniPath_HeaderFile