0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepMeshData / BRepMeshData_Model.cxx
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 #include <BRepMeshData_Model.hxx>
17
18 #include <BRepMeshData_Face.hxx>
19 #include <BRepMeshData_Edge.hxx>
20 #include <BRepMesh_OrientedEdge.hxx>
21 #include <BRepMesh_Vertex.hxx>
22 #include <NCollection_IncAllocator.hxx>
23
24 IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
25
26 //=======================================================================
27 // Function: Constructor
28 // Purpose : 
29 //=======================================================================
30 BRepMeshData_Model::BRepMeshData_Model (const TopoDS_Shape& theShape)
31   : IMeshData_Model (theShape),
32     myMaxSize (0.),
33     myAllocator (new NCollection_IncAllocator (IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
34     myDFaces (256, myAllocator),
35     myDEdges (256, myAllocator)
36 {
37   myAllocator->SetThreadSafe();
38 }
39
40 //=======================================================================
41 // Function: Destructor
42 // Purpose : 
43 //=======================================================================
44 BRepMeshData_Model::~BRepMeshData_Model ()
45 {
46 }
47
48 //=======================================================================
49 // Function: FacesNb
50 // Purpose : 
51 //=======================================================================
52 Standard_Integer BRepMeshData_Model::FacesNb () const
53 {
54   return myDFaces.Size ();
55 }
56
57 //=======================================================================
58 // Function: AddFace
59 // Purpose : 
60 //=======================================================================
61 const IMeshData::IFaceHandle& BRepMeshData_Model::AddFace (const TopoDS_Face& theFace)
62 {
63   IMeshData::IFaceHandle aFace (new (myAllocator) BRepMeshData_Face (theFace, myAllocator));
64   myDFaces.Append (aFace);
65   return myDFaces (FacesNb () - 1);
66 }
67
68 //=======================================================================
69 // Function: GetFace
70 // Purpose : 
71 //=======================================================================
72 const IMeshData::IFaceHandle& BRepMeshData_Model::GetFace (const Standard_Integer theIndex) const
73 {
74   return myDFaces (theIndex);
75 }
76
77 //=======================================================================
78 // Function: EdgesNb
79 // Purpose : 
80 //=======================================================================
81 Standard_Integer BRepMeshData_Model::EdgesNb () const
82 {
83   return myDEdges.Size ();
84 }
85
86 //=======================================================================
87 // Function: AddEdge
88 // Purpose : 
89 //=======================================================================
90 const IMeshData::IEdgeHandle& BRepMeshData_Model::AddEdge (const TopoDS_Edge& theEdge)
91 {
92   IMeshData::IEdgeHandle aEdge (new (myAllocator) BRepMeshData_Edge (theEdge, myAllocator));
93   myDEdges.Append (aEdge);
94   return myDEdges (EdgesNb () - 1);
95 }
96
97 //=======================================================================
98 // Function: GetEdge
99 // Purpose : 
100 //=======================================================================
101 const IMeshData::IEdgeHandle& BRepMeshData_Model::GetEdge (const Standard_Integer theIndex) const
102 {
103   return myDEdges (theIndex);
104 }