943fb97c55f2f2cec03e9f052e7f58bedc614935
[occt.git] / src / IGESDimen / IGESDimen_GeneralSymbol.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
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 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESData_IGESEntity.hxx>
20 #include <IGESDimen_GeneralNote.hxx>
21 #include <IGESDimen_GeneralSymbol.hxx>
22 #include <IGESDimen_LeaderArrow.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_OutOfRange.hxx>
25 #include <Standard_Type.hxx>
26
27 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_GeneralSymbol,IGESData_IGESEntity)
28
29 IGESDimen_GeneralSymbol::IGESDimen_GeneralSymbol ()    {  }
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)
37     Standard_DimensionMismatch::Raise("IGESDimen_GeneralSymbol : Init");
38   if (!allLeaders.IsNull())
39     if (allLeaders->Lower() != 1) Standard_DimensionMismatch::Raise("$");
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 {
49   if ((form < 0 || form > 3) && form < 5000) Standard_OutOfRange::Raise
50     ("IGESDimen_GeneralSymbol : SetFormNumber");
51   InitTypeAndForm(228,form);
52 }
53
54
55     Standard_Boolean  IGESDimen_GeneralSymbol::HasNote () const
56 {
57   return (!theNote.IsNull());
58 }
59
60     Handle(IGESDimen_GeneralNote)  IGESDimen_GeneralSymbol::Note () const
61 {
62   return theNote;
63 }
64
65     Standard_Integer  IGESDimen_GeneralSymbol::NbGeomEntities () const
66 {
67   return theGeoms->Length();
68 }
69
70     Handle(IGESData_IGESEntity)  IGESDimen_GeneralSymbol::GeomEntity
71   (const Standard_Integer Index) const
72 {
73   return theGeoms->Value(Index);
74 }
75
76     Standard_Integer  IGESDimen_GeneralSymbol::NbLeaders () const
77 {
78   return (theLeaders.IsNull() ? 0 : theLeaders->Length());
79 }
80
81     Handle(IGESDimen_LeaderArrow)  IGESDimen_GeneralSymbol::LeaderArrow
82   (const Standard_Integer Index) const
83 {
84   return theLeaders->Value(Index);
85 }