0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BRepMeshData / BRepMeshData_Model.hxx
CommitLineData
7bd071ed 1// Created on: 2016-04-07
2// Copyright (c) 2016 OPEN CASCADE SAS
3// Created by: Oleg AGASHIN
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BRepMeshData_Model_HeaderFile
17#define _BRepMeshData_Model_HeaderFile
18
19#include <IMeshData_Model.hxx>
20#include <IMeshData_Types.hxx>
21#include <NCollection_IncAllocator.hxx>
22#include <IMeshData_Face.hxx>
23#include <IMeshData_Edge.hxx>
24
25//! Default implementation of model entity.
26class BRepMeshData_Model : public IMeshData_Model
27{
28public:
29
30 //! Constructor.
31 //! Initializes empty model.
32 Standard_EXPORT BRepMeshData_Model (const TopoDS_Shape& theShape);
33
34 //! Destructor.
35 Standard_EXPORT virtual ~BRepMeshData_Model ();
36
37 //! Returns maximum size of shape's bounding box.
38 Standard_EXPORT virtual Standard_Real GetMaxSize () const Standard_OVERRIDE
39 {
40 return myMaxSize;
41 }
42
43 //! Sets maximum size of shape's bounding box.
44 inline void SetMaxSize (const Standard_Real theValue)
45 {
46 myMaxSize = theValue;
47 }
48
49 DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Model, IMeshData_Model)
50
51public: //! @name discrete faces
52
53 //! Returns number of faces in discrete model.
54 Standard_EXPORT virtual Standard_Integer FacesNb () const Standard_OVERRIDE;
55
56 //! Adds new face to shape model.
57 Standard_EXPORT virtual const IMeshData::IFaceHandle& AddFace (const TopoDS_Face& theFace) Standard_OVERRIDE;
58
59 //! Gets model's face with the given index.
60 Standard_EXPORT virtual const IMeshData::IFaceHandle& GetFace (const Standard_Integer theIndex) const Standard_OVERRIDE;
61
62public: //! @name discrete edges
63
64 //! Returns number of edges in discrete model.
65 Standard_EXPORT virtual Standard_Integer EdgesNb () const Standard_OVERRIDE;
66
67 //! Adds new edge to shape model.
68 Standard_EXPORT virtual const IMeshData::IEdgeHandle& AddEdge (const TopoDS_Edge& theEdge) Standard_OVERRIDE;
69
70 //! Gets model's edge with the given index.
71 Standard_EXPORT virtual const IMeshData::IEdgeHandle& GetEdge (const Standard_Integer theIndex) const Standard_OVERRIDE;
72
73private:
74
75 Standard_Real myMaxSize;
76 Handle (NCollection_IncAllocator) myAllocator;
77 IMeshData::VectorOfIFaceHandles myDFaces;
78 IMeshData::VectorOfIEdgeHandles myDEdges;
79};
80
81#endif