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