Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:13

0001 // Created on: 1993-10-07
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 _MAT2d_MiniPath_HeaderFile
0018 #define _MAT2d_MiniPath_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <MAT2d_DataMapOfIntegerSequenceOfConnexion.hxx>
0025 #include <MAT2d_DataMapOfIntegerConnexion.hxx>
0026 #include <MAT2d_SequenceOfConnexion.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <MAT2d_SequenceOfSequenceOfGeometry.hxx>
0029 class MAT2d_Connexion;
0030 
0031 
0032 //! MiniPath computes a path to link all the  lines in
0033 //! a set of lines. The path is described as a  set of
0034 //! connexions.
0035 //!
0036 //! The set of connexions can be  seen as an arbitrary Tree.
0037 //! The node of the  tree are the  lines.  The arcs of the
0038 //! tree are the connexions.  The ancestror  of  a line is
0039 //! the connexion which ends on it. The children of a line
0040 //! are the connexions which start on it.
0041 //!
0042 //! The children of a line are ordered by the relation
0043 //! <IsAfter> defined on the connexions.
0044 //! (See MAT2s_Connexion.cdl).
0045 class MAT2d_MiniPath 
0046 {
0047 public:
0048 
0049   DEFINE_STANDARD_ALLOC
0050 
0051   
0052   Standard_EXPORT MAT2d_MiniPath();
0053   
0054   //! Computes the path  to link the  lines in <Figure>.
0055   //! the path   starts on the  line  of index <IndStart>
0056   //! <Sense>  = True    if  the Circuit turns in the
0057   //! trigonometric  sense.
0058   Standard_EXPORT void Perform (const MAT2d_SequenceOfSequenceOfGeometry& Figure, const Standard_Integer IndStart, const Standard_Boolean Sense);
0059   
0060   //! Run on the set of connexions to compute the path.
0061   //! the path is an exploration of the tree which contains
0062   //! the connexions and their reverses.
0063   //! if the tree of connexions is
0064   //! A
0065   //! / |
0066   //! B  E
0067   //! / |  |
0068   //! C  D  F
0069   //!
0070   //! the path is A->B, B->C, C->B, B->D, D->B, B->A, A->E,
0071   //! E->F, F->E, E->A.
0072   Standard_EXPORT void RunOnConnexions();
0073   
0074   //! Returns  the  sequence of  connexions corresponding to
0075   //! the  path.
0076   Standard_EXPORT const MAT2d_SequenceOfConnexion& Path() const;
0077   
0078   //! Returns <True> if there is one Connexion which starts
0079   //! on line designed by <Index>.
0080   Standard_EXPORT Standard_Boolean IsConnexionsFrom (const Standard_Integer Index) const;
0081   
0082   //! Returns    the  connexions  which   start  on line
0083   //! designed  by <Index>.
0084   Standard_EXPORT MAT2d_SequenceOfConnexion& ConnexionsFrom (const Standard_Integer Index);
0085   
0086   //! Returns <True> if the line designed by <Index> is
0087   //! the root.
0088   Standard_EXPORT Standard_Boolean IsRoot (const Standard_Integer Index) const;
0089   
0090   //! Returns    the  connexion  which ends  on line
0091   //! designed  by <Index>.
0092   Standard_EXPORT Handle(MAT2d_Connexion) Father (const Standard_Integer Index);
0093 
0094 
0095 
0096 
0097 protected:
0098 
0099 
0100 
0101 
0102 
0103 private:
0104 
0105   
0106   //! Add a connexion to the path.
0107   Standard_EXPORT void Append (const Handle(MAT2d_Connexion)& Connexion);
0108   
0109   Standard_EXPORT void ExploSons (MAT2d_SequenceOfConnexion& aPath, const Handle(MAT2d_Connexion)& aConnexion);
0110   
0111   //! Returns the connexion which realises the minimum of
0112   //! distance between the lines of index <L1> and <L2> in
0113   //! <aFigure>. The connexion is oriented from <L1> to <L2>.
0114   Standard_EXPORT Handle(MAT2d_Connexion) MinimumL1L2 (const MAT2d_SequenceOfSequenceOfGeometry& Figure, const Standard_Integer L1, const Standard_Integer L2) const;
0115 
0116 
0117   MAT2d_DataMapOfIntegerSequenceOfConnexion theConnexions;
0118   MAT2d_DataMapOfIntegerConnexion theFather;
0119   MAT2d_SequenceOfConnexion thePath;
0120   Standard_Real theDirection;
0121   Standard_Integer indStart;
0122 
0123 
0124 };
0125 
0126 
0127 
0128 
0129 
0130 
0131 
0132 #endif // _MAT2d_MiniPath_HeaderFile