|
||||
File indexing completed on 2025-01-18 10:04:55
0001 // Created on: 1998-06-03 0002 // Created by: data exchange team 0003 // Copyright (c) 1998-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 _ShapeAnalysis_WireOrder_HeaderFile 0018 #define _ShapeAnalysis_WireOrder_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <TColStd_HArray1OfInteger.hxx> 0025 #include <TColgp_HSequenceOfXY.hxx> 0026 #include <TColgp_HSequenceOfXYZ.hxx> 0027 #include <Standard_Integer.hxx> 0028 class gp_XYZ; 0029 class gp_XY; 0030 0031 // resolve name collisions with X11 headers 0032 #ifdef Status 0033 #undef Status 0034 #endif 0035 0036 //! This class is intended to control and, if possible, redefine 0037 //! the order of a list of edges which define a wire 0038 //! Edges are not given directly, but as their bounds (start,end) 0039 //! 0040 //! This allows to use this tool, either on existing wire, or on 0041 //! data just taken from a file (coordinates are easy to get) 0042 //! 0043 //! It can work, either in 2D, or in 3D, or miscible mode 0044 //! The tolerance for each mode is fixed 0045 //! 0046 //! Two phases : firstly add the couples (start, end) 0047 //! secondly perform then get the result 0048 class ShapeAnalysis_WireOrder 0049 { 0050 public: 0051 0052 DEFINE_STANDARD_ALLOC 0053 0054 //! Empty constructor 0055 Standard_EXPORT ShapeAnalysis_WireOrder(); 0056 0057 //! Creates a WireOrder. 0058 //! Flag <theMode3D> defines 3D or 2d mode. 0059 //! Flag <theModeBoth> defines miscible mode and the flag <theMode3D> is ignored. 0060 //! Warning: Parameter <theTolerance> is not used in algorithm. 0061 Standard_EXPORT ShapeAnalysis_WireOrder (const Standard_Boolean theMode3D, 0062 const Standard_Real theTolerance, 0063 const Standard_Boolean theModeBoth = Standard_False); 0064 0065 //! Sets new values. 0066 //! Clears the edge list if the mode (<theMode3D> or <theModeBoth> ) changes. 0067 //! Clears the connexion list. 0068 //! Warning: Parameter <theTolerance> is not used in algorithm. 0069 Standard_EXPORT void SetMode (const Standard_Boolean theMode3D, 0070 const Standard_Real theTolerance, 0071 const Standard_Boolean theModeBoth = Standard_False); 0072 0073 //! Returns the working tolerance 0074 Standard_EXPORT Standard_Real Tolerance() const; 0075 0076 //! Clears the list of edges, but not mode and tol 0077 Standard_EXPORT void Clear(); 0078 0079 //! Adds a couple of points 3D (start, end) 0080 Standard_EXPORT void Add (const gp_XYZ& theStart3d, const gp_XYZ& theEnd3d); 0081 0082 //! Adds a couple of points 2D (start, end) 0083 Standard_EXPORT void Add (const gp_XY& theStart2d, const gp_XY& theEnd2d); 0084 0085 //! Adds a couple of points 3D and 2D (start, end) 0086 Standard_EXPORT void Add (const gp_XYZ& theStart3d, 0087 const gp_XYZ& theEnd3d, 0088 const gp_XY& theStart2d, 0089 const gp_XY& theEnd2d); 0090 0091 //! Returns the count of added couples of points (one per edges) 0092 Standard_EXPORT Standard_Integer NbEdges() const; 0093 0094 //! If this mode is True method perform does not sort edges of 0095 //! different loops. The resulting order is first loop, second 0096 //! one etc... 0097 Standard_EXPORT Standard_Boolean& KeepLoopsMode(); 0098 0099 //! Computes the better order 0100 //! Optimised if the couples were already in order 0101 //! The criterium is : two couples in order if distance between 0102 //! end-prec and start-cur is less then starting tolerance <tol> 0103 //! Else, the smallest distance is reached 0104 //! Warning: Parameter <closed> not used 0105 Standard_EXPORT void Perform (const Standard_Boolean closed = Standard_True); 0106 0107 //! Tells if Perform has been done 0108 //! Else, the following methods returns original values 0109 Standard_EXPORT Standard_Boolean IsDone() const; 0110 0111 //! Returns the status of the order (0 if not done) : 0112 //! 0 : all edges are direct and in sequence 0113 //! 1 : all edges are direct but some are not in sequence 0114 //! -1 : some edges are reversed, but no gap remain 0115 //! 3 : edges in sequence are just shifted in forward or reverse manner 0116 Standard_EXPORT Standard_Integer Status() const; 0117 0118 //! Returns the number of original edge which correspond to the 0119 //! newly ordered number <n> 0120 //! Warning : the returned value is NEGATIVE if edge should be reversed 0121 Standard_EXPORT Standard_Integer Ordered (const Standard_Integer theIdx) const; 0122 0123 //! Returns the values of the couple <num>, as 3D values 0124 Standard_EXPORT void XYZ (const Standard_Integer theIdx, gp_XYZ& theStart3D, gp_XYZ& theEnd3D) const; 0125 0126 //! Returns the values of the couple <num>, as 2D values 0127 Standard_EXPORT void XY (const Standard_Integer theIdx, gp_XY& theStart2D, gp_XY& theEnd2D) const; 0128 0129 //! Returns the gap between a couple and its preceding 0130 //! <num> is considered ordered 0131 //! If <num> = 0 (D), returns the greatest gap found 0132 Standard_EXPORT Standard_Real Gap (const Standard_Integer num = 0) const; 0133 0134 //! Determines the chains inside which successive edges have a gap 0135 //! less than a given value. Queried by NbChains and Chain 0136 Standard_EXPORT void SetChains (const Standard_Real gap); 0137 0138 //! Returns the count of computed chains 0139 Standard_EXPORT Standard_Integer NbChains() const; 0140 0141 //! Returns, for the chain n0 num, starting and ending numbers of 0142 //! edges. In the list of ordered edges (see Ordered for originals) 0143 Standard_EXPORT void Chain (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const; 0144 0145 //! Determines the couples of edges for which end and start fit 0146 //! inside a given gap. Queried by NbCouples and Couple 0147 //! Warning: function isn't implemented 0148 Standard_EXPORT void SetCouples (const Standard_Real gap); 0149 0150 //! Returns the count of computed couples 0151 Standard_EXPORT Standard_Integer NbCouples() const; 0152 0153 //! Returns, for the couple n0 num, the two implied edges 0154 //! In the list of ordered edges 0155 Standard_EXPORT void Couple (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const; 0156 0157 protected: 0158 0159 private: 0160 // the mode in which the algorithm works 0161 enum ModeType 0162 { 0163 Mode2D, 0164 Mode3D, 0165 ModeBoth 0166 }; 0167 0168 Handle(TColStd_HArray1OfInteger) myOrd; 0169 Handle(TColStd_HArray1OfInteger) myChains; 0170 Handle(TColStd_HArray1OfInteger) myCouples; 0171 Handle(TColgp_HSequenceOfXYZ) myXYZ; 0172 Handle(TColgp_HSequenceOfXY) myXY; 0173 Standard_Real myTol; 0174 Standard_Real myGap; 0175 Standard_Integer myStat; 0176 Standard_Boolean myKeepLoops; 0177 ModeType myMode; 0178 }; 0179 0180 #endif // _ShapeAnalysis_WireOrder_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |