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
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 _MAT2d_MiniPath_HeaderFile
18 #define _MAT2d_MiniPath_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
34 //! MiniPath computes a path to link all the lines in
35 //! a set of lines. The path is described as a set of
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.
44 //! The children of a line are ordered by the relation
45 //! <IsAfter> defined on the connexions.
46 //! (See MAT2s_Connexion.cdl).
54 Standard_EXPORT MAT2d_MiniPath();
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);
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
72 //! the path is A->B, B->C, C->B, B->D, D->B, B->A, A->E,
74 Standard_EXPORT void RunOnConnexions();
76 //! Returns the sequence of connexions corresponding to
78 Standard_EXPORT const MAT2d_SequenceOfConnexion& Path() const;
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;
84 //! Returns the connexions which start on line
85 //! designed by <Index>.
86 Standard_EXPORT MAT2d_SequenceOfConnexion& ConnexionsFrom (const Standard_Integer Index);
88 //! Returns <True> if the line designed by <Index> is
90 Standard_EXPORT Standard_Boolean IsRoot (const Standard_Integer Index) const;
92 //! Returns the connexion which ends on line
93 //! designed by <Index>.
94 Standard_EXPORT Handle(MAT2d_Connexion) Father (const Standard_Integer Index);
108 //! Add a connexion to the path.
109 Standard_EXPORT void Append (const Handle(MAT2d_Connexion)& Connexion);
111 Standard_EXPORT void ExploSons (MAT2d_SequenceOfConnexion& aPath, const Handle(MAT2d_Connexion)& aConnexion);
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;
119 MAT2d_DataMapOfIntegerSequenceOfConnexion theConnexions;
120 MAT2d_DataMapOfIntegerConnexion theFather;
121 MAT2d_SequenceOfConnexion thePath;
122 Standard_Real theDirection;
123 Standard_Integer indStart;
134 #endif // _MAT2d_MiniPath_HeaderFile