0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IGESDimen / IGESDimen_GeneralSymbol.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 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
973c2be1 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.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESData_IGESEntity.hxx>
20#include <IGESDimen_GeneralNote.hxx>
21#include <IGESDimen_GeneralSymbol.hxx>
22#include <IGESDimen_LeaderArrow.hxx>
7fd59977 23#include <Standard_DimensionMismatch.hxx>
24#include <Standard_OutOfRange.hxx>
42cf5bc1 25#include <Standard_Type.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_GeneralSymbol,IGESData_IGESEntity)
28
b311480e 29IGESDimen_GeneralSymbol::IGESDimen_GeneralSymbol () { }
7fd59977 30
31 void IGESDimen_GeneralSymbol::Init
32 (const Handle(IGESDimen_GeneralNote)& aNote,
33 const Handle(IGESData_HArray1OfIGESEntity)& allGeoms,
34 const Handle(IGESDimen_HArray1OfLeaderArrow)& allLeaders)
35{
36 if (!allGeoms.IsNull() && allGeoms->Lower() != 1)
9775fa61 37 throw Standard_DimensionMismatch("IGESDimen_GeneralSymbol : Init");
7fd59977 38 if (!allLeaders.IsNull())
9775fa61 39 if (allLeaders->Lower() != 1) throw Standard_DimensionMismatch("$");
7fd59977 40 theNote = aNote;
41 theGeoms = allGeoms;
42 theLeaders = allLeaders;
43 InitTypeAndForm(228,FormNumber());
44// FormNumber precises the Nature of the Symbol, cf G.14 (0-3 or > 5000)
45}
46
47 void IGESDimen_GeneralSymbol::SetFormNumber (const Standard_Integer form)
48{
9775fa61 49 if ((form < 0 || form > 3) && form < 5000) throw Standard_OutOfRange("IGESDimen_GeneralSymbol : SetFormNumber");
7fd59977 50 InitTypeAndForm(228,form);
51}
52
53
54 Standard_Boolean IGESDimen_GeneralSymbol::HasNote () const
55{
56 return (!theNote.IsNull());
57}
58
59 Handle(IGESDimen_GeneralNote) IGESDimen_GeneralSymbol::Note () const
60{
61 return theNote;
62}
63
64 Standard_Integer IGESDimen_GeneralSymbol::NbGeomEntities () const
65{
66 return theGeoms->Length();
67}
68
69 Handle(IGESData_IGESEntity) IGESDimen_GeneralSymbol::GeomEntity
70 (const Standard_Integer Index) const
71{
72 return theGeoms->Value(Index);
73}
74
75 Standard_Integer IGESDimen_GeneralSymbol::NbLeaders () const
76{
77 return (theLeaders.IsNull() ? 0 : theLeaders->Length());
78}
79
80 Handle(IGESDimen_LeaderArrow) IGESDimen_GeneralSymbol::LeaderArrow
81 (const Standard_Integer Index) const
82{
83 return theLeaders->Value(Index);
84}