|
||||
File indexing completed on 2025-01-18 10:04:56
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 _ShapeExtend_WireData_HeaderFile 0018 #define _ShapeExtend_WireData_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <TopTools_HSequenceOfShape.hxx> 0024 #include <TColStd_HSequenceOfInteger.hxx> 0025 #include <Standard_Integer.hxx> 0026 #include <Standard_Transient.hxx> 0027 class TopoDS_Wire; 0028 class TopoDS_Edge; 0029 class TopoDS_Shape; 0030 class TopoDS_Face; 0031 0032 0033 class ShapeExtend_WireData; 0034 DEFINE_STANDARD_HANDLE(ShapeExtend_WireData, Standard_Transient) 0035 0036 //! This class provides a data structure necessary for work with the wire as with 0037 //! ordered list of edges, what is required for many algorithms. The advantage of 0038 //! this class is that it allows to work with wires which are not correct. 0039 //! The object of the class ShapeExtend_WireData can be initialized by 0040 //! TopoDS_Wire, and converted back to TopoDS_Wire. 0041 //! An edge in the wire is defined by its rank number. Operations of accessing, 0042 //! adding and removing edge at the given rank number are provided. On the whole 0043 //! wire, operations of circular permutation and reversing (both orientations of 0044 //! all edges and order of edges) are provided as well. 0045 //! This class also provides a method to check if the edge in the wire is a seam 0046 //! (if the wire lies on a face). 0047 //! This class is handled by reference. Such an approach gives the following advantages: 0048 //! 1. Sharing the object of this class strongly optimizes the processes of 0049 //! analysis and fixing performed in parallel on the wire stored in the form 0050 //! of this class. Fixing tool (e.g. ShapeFix_Wire) fixes problems one by 0051 //! one using analyzing tool (e.g. ShapeAnalysis_Wire). Sharing allows not 0052 //! to reinitialize each time the analyzing tool with modified 0053 //! ShapeExtend_WireData what consumes certain time. 0054 //! 2. No copying of contents. The object of ShapeExtend_WireData class has 0055 //! quite big size, returning it as a result of the function would cause 0056 //! additional copying of contents if this class were one handled by value. 0057 //! Moreover, this class is stored as a field in other classes which are 0058 //! they returned as results of functions, storing only a handle to 0059 //! ShapeExtend_WireData saves time and memory. 0060 class ShapeExtend_WireData : public Standard_Transient 0061 { 0062 0063 public: 0064 0065 0066 //! Empty constructor, creates empty wire with no edges 0067 Standard_EXPORT ShapeExtend_WireData(); 0068 0069 //! Constructor initializing the data from TopoDS_Wire. Calls Init(wire,chained). 0070 Standard_EXPORT ShapeExtend_WireData(const TopoDS_Wire& wire, const Standard_Boolean chained = Standard_True, const Standard_Boolean theManifoldMode = Standard_True); 0071 0072 //! Copies data from another WireData 0073 Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& other); 0074 0075 //! Loads an already existing wire 0076 //! If <chained> is True (default), edges are added in the 0077 //! sequence as they are explored by TopoDS_Iterator 0078 //! Else, if <chained> is False, wire is explored by 0079 //! BRepTools_WireExplorer and it is guaranteed that edges will 0080 //! be sequentially connected. 0081 //! Remark : In the latter case it can happen that not all edges 0082 //! will be found (because of limitations of 0083 //! BRepTools_WireExplorer for disconnected wires and wires 0084 //! with seam edges). 0085 Standard_EXPORT Standard_Boolean Init (const TopoDS_Wire& wire, const Standard_Boolean chained = Standard_True, const Standard_Boolean theManifoldMode = Standard_True); 0086 0087 //! Clears data about Wire. 0088 Standard_EXPORT void Clear(); 0089 0090 //! Computes the list of seam edges 0091 //! By default (direct call), computing is enforced 0092 //! For indirect call (from IsSeam) it is redone only if not yet 0093 //! already done or if the list of edges has changed 0094 //! Remark : A Seam Edge is an Edge present twice in the list, once as 0095 //! FORWARD and once as REVERSED 0096 //! Each sense has its own PCurve, the one for FORWARD 0097 //! must be set in first 0098 Standard_EXPORT void ComputeSeams (const Standard_Boolean enforce = Standard_True); 0099 0100 //! Does a circular permutation in order to set <num>th edge last 0101 Standard_EXPORT void SetLast (const Standard_Integer num); 0102 0103 //! When the wire contains at least one degenerated edge, sets it 0104 //! as last one 0105 //! Note : It is useful to process pcurves, for instance, while the pcurve 0106 //! of a DGNR may not be computed from its 3D part (there is none) 0107 //! it is computed after the other edges have been computed and 0108 //! chained. 0109 Standard_EXPORT void SetDegeneratedLast(); 0110 0111 //! Adds an edge to a wire, being defined (not yet ended) 0112 //! This is the plain, basic, function to add an edge 0113 //! <num> = 0 (D): Appends at end 0114 //! <num> = 1: Preprends at start 0115 //! else, Insert before <num> 0116 //! Remark : Null Edge is simply ignored 0117 Standard_EXPORT void Add (const TopoDS_Edge& edge, const Standard_Integer atnum = 0); 0118 0119 //! Adds an entire wire, considered as a list of edges 0120 //! Remark : The wire is assumed to be ordered (TopoDS_Iterator 0121 //! is used) 0122 Standard_EXPORT void Add (const TopoDS_Wire& wire, const Standard_Integer atnum = 0); 0123 0124 //! Adds a wire in the form of WireData 0125 Standard_EXPORT void Add (const Handle(ShapeExtend_WireData)& wire, const Standard_Integer atnum = 0); 0126 0127 //! Adds an edge or a wire invoking corresponding method Add 0128 Standard_EXPORT void Add (const TopoDS_Shape& shape, const Standard_Integer atnum = 0); 0129 0130 //! Adds an edge to start or end of <me>, according to <mode> 0131 //! 0: at end, as direct 0132 //! 1: at end, as reversed 0133 //! 2: at start, as direct 0134 //! 3: at start, as reversed 0135 //! < 0: no adding 0136 Standard_EXPORT void AddOriented (const TopoDS_Edge& edge, const Standard_Integer mode); 0137 0138 //! Adds a wire to start or end of <me>, according to <mode> 0139 //! 0: at end, as direct 0140 //! 1: at end, as reversed 0141 //! 2: at start, as direct 0142 //! 3: at start, as reversed 0143 //! < 0: no adding 0144 Standard_EXPORT void AddOriented (const TopoDS_Wire& wire, const Standard_Integer mode); 0145 0146 //! Adds an edge or a wire invoking corresponding method 0147 //! AddOriented 0148 Standard_EXPORT void AddOriented (const TopoDS_Shape& shape, const Standard_Integer mode); 0149 0150 //! Removes an Edge, given its rank. By default removes the last edge. 0151 Standard_EXPORT void Remove (const Standard_Integer num = 0); 0152 0153 //! Replaces an edge at the given 0154 //! rank number <num> with new one. Default is last edge (<num> = 0). 0155 Standard_EXPORT void Set (const TopoDS_Edge& edge, const Standard_Integer num = 0); 0156 0157 //! Reverses the sense of the list and the orientation of each Edge 0158 //! This method should be called when either wire has no seam edges 0159 //! or face is not available 0160 Standard_EXPORT void Reverse(); 0161 0162 //! Reverses the sense of the list and the orientation of each Edge 0163 //! The face is necessary for swapping pcurves for seam edges 0164 //! (first pcurve corresponds to orientation FORWARD, and second to 0165 //! REVERSED; when edge is reversed, pcurves must be swapped) 0166 //! If face is NULL, no swapping is performed 0167 Standard_EXPORT void Reverse (const TopoDS_Face& face); 0168 0169 //! Returns the count of currently recorded edges 0170 Standard_EXPORT Standard_Integer NbEdges() const; 0171 0172 //! Returns the count of currently recorded non-manifold edges 0173 Standard_EXPORT Standard_Integer NbNonManifoldEdges() const; 0174 0175 //! Returns <num>th nonmanifold Edge 0176 Standard_EXPORT TopoDS_Edge NonmanifoldEdge (const Standard_Integer num) const; 0177 0178 //! Returns sequence of non-manifold edges 0179 //! This sequence can be not empty if wire data set in manifold mode but 0180 //! initial wire has INTERNAL orientation or contains INTERNAL edges 0181 Standard_EXPORT Handle(TopTools_HSequenceOfShape) NonmanifoldEdges() const; 0182 0183 //! Returns mode defining manifold wire data or not. 0184 //! If manifold that nonmanifold edges will not be not 0185 //! consider during operations(previous behaviour) 0186 //! and they will be added only in result wire 0187 //! else non-manifold edges will consider during operations 0188 Standard_EXPORT Standard_Boolean& ManifoldMode(); 0189 0190 //! Returns <num>th Edge 0191 Standard_EXPORT TopoDS_Edge Edge (const Standard_Integer num) const; 0192 0193 //! Returns the index of the edge 0194 //! If the edge is a seam the orientation is also checked 0195 //! Returns 0 if the edge is not found in the list 0196 Standard_EXPORT Standard_Integer Index (const TopoDS_Edge& edge); 0197 0198 //! Tells if an Edge is seam (see ComputeSeams) 0199 //! An edge is considered as seam if it presents twice in 0200 //! the edge list, once as FORWARD and once as REVERSED. 0201 Standard_EXPORT Standard_Boolean IsSeam (const Standard_Integer num); 0202 0203 //! Makes TopoDS_Wire using 0204 //! BRep_Builder (just creates the TopoDS_Wire object and adds 0205 //! all edges into it). This method should be called when 0206 //! the wire is correct (for example, after successful 0207 //! fixes by ShapeFix_Wire) and adjacent edges share common 0208 //! vertices. In case if adjacent edges do not share the same 0209 //! vertices the resulting TopoDS_Wire will be invalid. 0210 Standard_EXPORT TopoDS_Wire Wire() const; 0211 0212 //! Makes TopoDS_Wire using 0213 //! BRepAPI_MakeWire. Class BRepAPI_MakeWire merges 0214 //! geometrically coincided vertices and can disturb 0215 //! correct order of edges in the wire. If this class fails, 0216 //! null shape is returned. 0217 Standard_EXPORT TopoDS_Wire WireAPIMake() const; 0218 0219 0220 0221 0222 DEFINE_STANDARD_RTTIEXT(ShapeExtend_WireData,Standard_Transient) 0223 0224 protected: 0225 0226 0227 0228 0229 private: 0230 0231 0232 Handle(TopTools_HSequenceOfShape) myEdges; 0233 Handle(TopTools_HSequenceOfShape) myNonmanifoldEdges; 0234 Handle(TColStd_HSequenceOfInteger) mySeams; 0235 Standard_Integer mySeamF; 0236 Standard_Integer mySeamR; 0237 Standard_Boolean myManifoldMode; 0238 0239 0240 }; 0241 0242 0243 0244 0245 0246 0247 0248 #endif // _ShapeExtend_WireData_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |