0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BRepMeshData / BRepMeshData_Wire.cxx
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#include <BRepMeshData_Wire.hxx>
17#include <IMeshData_Edge.hxx>
18#include <BRepMesh_OrientedEdge.hxx>
19#include <BRepMesh_Vertex.hxx>
20
21//=======================================================================
22// Function: Constructor
23// Purpose :
24//=======================================================================
25BRepMeshData_Wire::BRepMeshData_Wire (
26 const TopoDS_Wire& theWire,
27 const Standard_Integer theEdgeNb,
28 const Handle (NCollection_IncAllocator)& theAllocator)
29 : IMeshData_Wire (theWire),
30 myDEdges (theEdgeNb > 0 ? theEdgeNb : 256, theAllocator),
31 myDEdgesOri (theEdgeNb > 0 ? theEdgeNb : 256, theAllocator)
32{
33}
34
35//=======================================================================
36// Function: Destructor
37// Purpose :
38//=======================================================================
39BRepMeshData_Wire::~BRepMeshData_Wire ()
40{
41}
42
43//=======================================================================
44// Function: EdgesNb
45// Purpose :
46//=======================================================================
47Standard_Integer BRepMeshData_Wire::EdgesNb () const
48{
49 return myDEdges.Size ();
50}
51
52//=======================================================================
53// Function: Destructor
54// Purpose :
55//=======================================================================
56Standard_Integer BRepMeshData_Wire::AddEdge (
57 const IMeshData::IEdgePtr& theDEdge,
58 const TopAbs_Orientation theOrientation)
59{
60 const Standard_Integer aIndex = EdgesNb ();
61
62 myDEdges .Append (theDEdge);
63 myDEdgesOri.Append (theOrientation);
64
65 return aIndex;
66}
67
68//=======================================================================
69// Function: GetEdge
70// Purpose :
71//=======================================================================
72const IMeshData::IEdgePtr& BRepMeshData_Wire::GetEdge (
73 const Standard_Integer theIndex) const
74{
75 return myDEdges (theIndex);
76}
77
78//=======================================================================
79// Function: GetEdgeOrientation
80// Purpose :
81//=======================================================================
82TopAbs_Orientation BRepMeshData_Wire::GetEdgeOrientation (
83 const Standard_Integer theIndex) const
84{
85 return myDEdgesOri (theIndex);
86}