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