Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:18:26

0001 // Created on: 1999-04-27
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 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 _ShapeFix_WireSegment_HeaderFile
0018 #define _ShapeFix_WireSegment_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Vertex.hxx>
0025 #include <TopAbs_Orientation.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <NCollection_HSequence.hxx>
0029 class ShapeExtend_WireData;
0030 class TopoDS_Wire;
0031 class TopoDS_Edge;
0032 
0033 //! This class is auxiliary class (data storage) used in ComposeShell.
0034 //! It is intended for representing segment of the wire
0035 //! (or whole wire). The segment itself is represented by
0036 //! ShapeExtend_WireData. In addition, some associated data
0037 //! necessary for computations are stored:
0038 //!
0039 //! * Orientation flag - determines current use of the segment
0040 //! and used for parity checking:
0041 //!
0042 //! TopAbs_FORWARD and TopAbs_REVERSED - says that segment was
0043 //! traversed once in the corresponding direction, and hence
0044 //! it should be traversed once more in opposite direction;
0045 //!
0046 //! TopAbs_EXTERNAL - the segment was not yet traversed in any
0047 //! direction (i.e. not yet used as boundary)
0048 //!
0049 //! TopAbs_INTERNAL - the segment was traversed in both
0050 //! directions and hence is out of further work.
0051 //!
0052 //! Segments of initial bounding wires are created with
0053 //! orientation REVERSED (for outer wire) or FORWARD (for inner
0054 //! wires), and segments of splitting seams - with orientation
0055 //! EXTERNAL.
0056 class ShapeFix_WireSegment
0057 {
0058 public:
0059   DEFINE_STANDARD_ALLOC
0060 
0061   //! Creates empty segment.
0062   Standard_EXPORT ShapeFix_WireSegment();
0063 
0064   //! Creates segment and initializes it with wire and orientation.
0065   Standard_EXPORT ShapeFix_WireSegment(const occ::handle<ShapeExtend_WireData>& wire,
0066                                        const TopAbs_Orientation ori = TopAbs_EXTERNAL);
0067 
0068   //! Creates segment and initializes it with wire and orientation.
0069   Standard_EXPORT ShapeFix_WireSegment(const TopoDS_Wire&       wire,
0070                                        const TopAbs_Orientation ori = TopAbs_EXTERNAL);
0071 
0072   //! Clears all fields.
0073   Standard_EXPORT void Clear();
0074 
0075   //! Loads wire.
0076   Standard_EXPORT void Load(const occ::handle<ShapeExtend_WireData>& wire);
0077 
0078   //! Returns wire.
0079   Standard_EXPORT const occ::handle<ShapeExtend_WireData>& WireData() const;
0080 
0081   //! Sets orientation flag.
0082   Standard_EXPORT void Orientation(const TopAbs_Orientation ori);
0083 
0084   //! Returns orientation flag.
0085   Standard_EXPORT TopAbs_Orientation Orientation() const;
0086 
0087   //! Returns first vertex of the first edge in the wire
0088   //! (no dependence on Orientation()).
0089   Standard_EXPORT TopoDS_Vertex FirstVertex() const;
0090 
0091   //! Returns last vertex of the last edge in the wire
0092   //! (no dependence on Orientation()).
0093   Standard_EXPORT TopoDS_Vertex LastVertex() const;
0094 
0095   //! Returns True if FirstVertex() == LastVertex()
0096   Standard_EXPORT bool IsClosed() const;
0097 
0098   //! Returns Number of edges in the wire
0099   Standard_EXPORT int NbEdges() const;
0100 
0101   //! Returns edge by given index in the wire
0102   Standard_EXPORT TopoDS_Edge Edge(const int i) const;
0103 
0104   //! Replaces edge at index i by new one.
0105   Standard_EXPORT void SetEdge(const int i, const TopoDS_Edge& edge);
0106 
0107   //! Insert a new edge with index i and implicitly defined
0108   //! patch indices (indefinite patch).
0109   //! If i==0, edge is inserted at end of wire.
0110   Standard_EXPORT void AddEdge(const int i, const TopoDS_Edge& edge);
0111 
0112   //! Insert a new edge with index i and explicitly defined
0113   //! patch indices. If i==0, edge is inserted at end of wire.
0114   Standard_EXPORT void AddEdge(const int          i,
0115                                const TopoDS_Edge& edge,
0116                                const int          iumin,
0117                                const int          iumax,
0118                                const int          ivmin,
0119                                const int          ivmax);
0120 
0121   //! Set patch indices for edge i.
0122   Standard_EXPORT void SetPatchIndex(const int i,
0123                                      const int iumin,
0124                                      const int iumax,
0125                                      const int ivmin,
0126                                      const int ivmax);
0127 
0128   Standard_EXPORT void DefineIUMin(const int i, const int iumin);
0129 
0130   Standard_EXPORT void DefineIUMax(const int i, const int iumax);
0131 
0132   Standard_EXPORT void DefineIVMin(const int i, const int ivmin);
0133 
0134   //! Modify minimal or maximal patch index for edge i.
0135   //! The corresponding patch index for that edge is modified so
0136   //! as to satisfy eq. iumin <= myIUMin(i) <= myIUMax(i) <= iumax
0137   Standard_EXPORT void DefineIVMax(const int i, const int ivmax);
0138 
0139   //! Returns patch indices for edge i.
0140   Standard_EXPORT void GetPatchIndex(const int i,
0141                                      int&      iumin,
0142                                      int&      iumax,
0143                                      int&      ivmin,
0144                                      int&      ivmax) const;
0145 
0146   //! Checks patch indices for edge i to satisfy equations
0147   //! IUMin(i) <= IUMax(i) <= IUMin(i)+1
0148   Standard_EXPORT bool CheckPatchIndex(const int i) const;
0149 
0150   Standard_EXPORT void SetVertex(const TopoDS_Vertex& theVertex);
0151 
0152   Standard_EXPORT TopoDS_Vertex GetVertex() const;
0153 
0154   Standard_EXPORT bool IsVertex() const;
0155 
0156 private:
0157   occ::handle<ShapeExtend_WireData>       myWire;
0158   TopoDS_Vertex                           myVertex;
0159   TopAbs_Orientation                      myOrient;
0160   occ::handle<NCollection_HSequence<int>> myIUMin;
0161   occ::handle<NCollection_HSequence<int>> myIUMax;
0162   occ::handle<NCollection_HSequence<int>> myIVMin;
0163   occ::handle<NCollection_HSequence<int>> myIVMax;
0164 };
0165 
0166 #endif // _ShapeFix_WireSegment_HeaderFile