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 <IGESDraw_ConnectPoint.hxx>
21 #include <IGESDraw_NetworkSubfigureDef.hxx>
22 #include <IGESGraph_TextDisplayTemplate.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_OutOfRange.hxx>
25 #include <Standard_Type.hxx>
26 #include <TCollection_HAsciiString.hxx>
27
IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_NetworkSubfigureDef,IGESData_IGESEntity)28 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_NetworkSubfigureDef,IGESData_IGESEntity)
29
30 IGESDraw_NetworkSubfigureDef::IGESDraw_NetworkSubfigureDef () { }
31
32
Init(const Standard_Integer aDepth,const Handle (TCollection_HAsciiString)& aName,const Handle (IGESData_HArray1OfIGESEntity)& allEntities,const Standard_Integer aTypeFlag,const Handle (TCollection_HAsciiString)& aDesignator,const Handle (IGESGraph_TextDisplayTemplate)& aTemplate,const Handle (IGESDraw_HArray1OfConnectPoint)& allPointEntities)33 void IGESDraw_NetworkSubfigureDef::Init
34 (const Standard_Integer aDepth,
35 const Handle(TCollection_HAsciiString)& aName,
36 const Handle(IGESData_HArray1OfIGESEntity)& allEntities,
37 const Standard_Integer aTypeFlag,
38 const Handle(TCollection_HAsciiString)& aDesignator,
39 const Handle(IGESGraph_TextDisplayTemplate)& aTemplate,
40 const Handle(IGESDraw_HArray1OfConnectPoint)& allPointEntities)
41 {
42 if (!allPointEntities.IsNull())
43 if (allPointEntities->Lower() != 1 || allEntities->Lower() != 1)
44 throw Standard_DimensionMismatch("IGESDraw_NetworkSubfigureDef : Init");
45 theDepth = aDepth;
46 theName = aName;
47 theEntities = allEntities;
48 theTypeFlag = aTypeFlag;
49 theDesignator = aDesignator;
50 theDesignatorTemplate = aTemplate;
51 thePointEntities = allPointEntities;
52 InitTypeAndForm(320,0);
53 }
54
Depth() const55 Standard_Integer IGESDraw_NetworkSubfigureDef::Depth () const
56 {
57 return theDepth;
58 }
59
Handle(TCollection_HAsciiString)60 Handle(TCollection_HAsciiString) IGESDraw_NetworkSubfigureDef::Name () const
61 {
62 return theName;
63 }
64
NbEntities() const65 Standard_Integer IGESDraw_NetworkSubfigureDef::NbEntities () const
66 {
67 return theEntities->Length();
68 }
69
Handle(IGESData_IGESEntity)70 Handle(IGESData_IGESEntity) IGESDraw_NetworkSubfigureDef::Entity
71 (const Standard_Integer Index) const
72 {
73 return theEntities->Value(Index);
74 // if Index is out of bound HArray1 will raise OutOfRange exception
75 }
76
TypeFlag() const77 Standard_Integer IGESDraw_NetworkSubfigureDef::TypeFlag () const
78 {
79 return theTypeFlag;
80 }
81
Handle(TCollection_HAsciiString)82 Handle(TCollection_HAsciiString) IGESDraw_NetworkSubfigureDef::Designator
83 () const
84 {
85 return theDesignator;
86 }
87
HasDesignatorTemplate() const88 Standard_Boolean IGESDraw_NetworkSubfigureDef::HasDesignatorTemplate () const
89 {
90 return (! theDesignatorTemplate.IsNull());
91 }
92
Handle(IGESGraph_TextDisplayTemplate)93 Handle(IGESGraph_TextDisplayTemplate)
94 IGESDraw_NetworkSubfigureDef::DesignatorTemplate () const
95 {
96 return theDesignatorTemplate;
97 }
98
NbPointEntities() const99 Standard_Integer IGESDraw_NetworkSubfigureDef::NbPointEntities () const
100 {
101 return (thePointEntities.IsNull() ? 0 : thePointEntities->Length());
102 }
103
HasPointEntity(const Standard_Integer Index) const104 Standard_Boolean IGESDraw_NetworkSubfigureDef::HasPointEntity
105 (const Standard_Integer Index) const
106 {
107 if (thePointEntities.IsNull()) return Standard_False;
108 return (! thePointEntities->Value(Index).IsNull());
109 // if Index is out of bound HArray1 will raise OutOfRange exception
110 }
111
Handle(IGESDraw_ConnectPoint)112 Handle(IGESDraw_ConnectPoint) IGESDraw_NetworkSubfigureDef::PointEntity
113 (const Standard_Integer Index) const
114 {
115 return thePointEntities->Value(Index);
116 // if Index is out of bound HArray1 will raise OutOfRange exception
117 }
118