Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/RWMesh_VertexIterator.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (c) 2025 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _RWMesh_VertexIterator_HeaderFile
0015 #define _RWMesh_VertexIterator_HeaderFile
0016 
0017 #include <NCollection_DataMap.hxx>
0018 #include <Poly_Polygon3D.hxx>
0019 #include <RWMesh_ShapeIterator.hxx>
0020 #include <TopExp_Explorer.hxx>
0021 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0022 #include <TopoDS_Vertex.hxx>
0023 #include <XCAFPrs_Style.hxx>
0024 #include <gp_Trsf.hxx>
0025 
0026 #include <algorithm>
0027 
0028 class TDF_Label;
0029 
0030 //! Auxiliary class to iterate through vertices.
0031 //! Provides functionality to iterate through the vertices of a shape.
0032 //! It inherits from `RWMesh_ShapeIterator` and implements
0033 //! methods to access and manipulate vertex data.
0034 class RWMesh_VertexIterator : public RWMesh_ShapeIterator
0035 {
0036 public:
0037   //! Main constructor.
0038   //! @param[in] theLabel The label of the shape.
0039   //! @param[in] theLocation The location of the shape.
0040   //! @param[in] theToMapColors Flag to indicate if colors should be mapped.
0041   //! @param[in] theStyle The style of the shape.
0042   Standard_EXPORT RWMesh_VertexIterator(const TDF_Label&       theLabel,
0043                                         const TopLoc_Location& theLocation,
0044                                         const Standard_Boolean theToMapColors = false,
0045                                         const XCAFPrs_Style&   theStyle       = XCAFPrs_Style());
0046 
0047   //! Auxiliary constructor.
0048   //! @param[in] theShape The shape to iterate.
0049   //! @param[in] theStyle The style of the shape.
0050   Standard_EXPORT RWMesh_VertexIterator(const TopoDS_Shape&  theShape,
0051                                         const XCAFPrs_Style& theStyle = XCAFPrs_Style());
0052 
0053   //! Return true if iterator points to the valid triangulation.
0054   bool More() const Standard_OVERRIDE { return !myVertex.IsNull(); }
0055 
0056   //! Find next value.
0057   Standard_EXPORT void Next() Standard_OVERRIDE;
0058 
0059   //! Return current edge.
0060   const TopoDS_Vertex& Vertex() const { return myVertex; }
0061 
0062   //! Return current vertex.
0063   const TopoDS_Shape& Shape() const Standard_OVERRIDE { return myVertex; }
0064 
0065   //! Return current vertex data.
0066   const gp_Pnt& Point() const { return myPoint; }
0067 
0068   //! Return true if geometry data is defined.
0069   bool IsEmpty() const Standard_OVERRIDE { return myVertex.IsNull(); }
0070 
0071 public:
0072   //! Lower element index in current triangulation.
0073   Standard_Integer ElemLower() const Standard_OVERRIDE { return 1; }
0074 
0075   //! Upper element index in current triangulation.
0076   Standard_Integer ElemUpper() const Standard_OVERRIDE { return 1; }
0077 
0078 public:
0079   //! Return number of nodes for the current edge.
0080   Standard_Integer NbNodes() const Standard_OVERRIDE { return 1; }
0081 
0082   //! Lower node index in current triangulation.
0083   Standard_Integer NodeLower() const Standard_OVERRIDE { return 1; }
0084 
0085   //! Upper node index in current triangulation.
0086   Standard_Integer NodeUpper() const Standard_OVERRIDE { return 1; }
0087 
0088 public:
0089   //! Return the node with specified index with applied transformation.
0090   gp_Pnt node(const Standard_Integer /*theNode*/) const Standard_OVERRIDE { return myPoint; }
0091 
0092 private:
0093   //! Reset information for current vertex.
0094   void resetVertex()
0095   {
0096     myVertex.Nullify();
0097     resetShape();
0098   }
0099 
0100   //! Initialize vertex properties.
0101   void initVertex();
0102 
0103 private:
0104   TopoDS_Vertex myVertex; //!< current vertex
0105   gp_Pnt        myPoint;  //!< geometry of current vertex
0106 };
0107 
0108 #endif // _RWMesh_VertexIterator_HeaderFile