0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / IGESAppli / IGESAppli_Flow.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 <IGESAppli_Flow.hxx>
20 #include <IGESData_IGESEntity.hxx>
21 #include <IGESDraw_ConnectPoint.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
28 IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_Flow,IGESData_IGESEntity)
29
30 IGESAppli_Flow::IGESAppli_Flow ()    {  }
31
32
33     void  IGESAppli_Flow::Init
34   (const Standard_Integer nbContextFlags,
35    const Standard_Integer aFlowType, const Standard_Integer aFuncFlag,
36    const Handle(IGESData_HArray1OfIGESEntity)&    allFlowAssocs,
37    const Handle(IGESDraw_HArray1OfConnectPoint)&  allConnectPoints,
38    const Handle(IGESData_HArray1OfIGESEntity)&    allJoins,
39    const Handle(Interface_HArray1OfHAsciiString)& allFlowNames,
40    const Handle(IGESGraph_HArray1OfTextDisplayTemplate)& allTextDisps,
41    const Handle(IGESData_HArray1OfIGESEntity)&    allContFlowAssocs)
42 {
43   theNbContextFlags          = nbContextFlags;
44   theTypeOfFlow              = aFlowType;
45   theFunctionFlag            = aFuncFlag;
46   theFlowAssociativities     = allFlowAssocs;
47   theConnectPoints           = allConnectPoints;
48   theJoins                   = allJoins;
49   theFlowNames               = allFlowNames;
50   theTextDisplayTemplates    = allTextDisps;
51   theContFlowAssociativities = allContFlowAssocs;
52   InitTypeAndForm(402,18);
53 }
54
55     Standard_Boolean  IGESAppli_Flow::OwnCorrect ()
56 {
57   if (theNbContextFlags == 2) return Standard_False;
58   theNbContextFlags = 2;
59   return Standard_True;
60 }
61
62
63     Standard_Integer  IGESAppli_Flow::NbContextFlags () const
64 {
65   return theNbContextFlags;
66 }
67
68     Standard_Integer  IGESAppli_Flow::NbFlowAssociativities () const
69 {
70   return (theFlowAssociativities.IsNull() ? 0 : theFlowAssociativities->Length());
71 }
72
73     Standard_Integer  IGESAppli_Flow::NbConnectPoints () const
74 {
75   return (theConnectPoints.IsNull() ? 0 : theConnectPoints->Length());
76 }
77
78     Standard_Integer  IGESAppli_Flow::NbJoins () const
79 {
80   return (theJoins.IsNull() ? 0 : theJoins->Length());
81 }
82
83     Standard_Integer  IGESAppli_Flow::NbFlowNames () const
84 {
85   return (theFlowNames.IsNull() ? 0 : theFlowNames->Length());
86 }
87
88     Standard_Integer  IGESAppli_Flow::NbTextDisplayTemplates () const
89 {
90   return (theTextDisplayTemplates.IsNull() ? 0 : theTextDisplayTemplates->Length());
91 }
92
93     Standard_Integer  IGESAppli_Flow::NbContFlowAssociativities () const
94 {
95   return (theContFlowAssociativities.IsNull() ? 0 : theContFlowAssociativities->Length());
96 }
97
98     Standard_Integer  IGESAppli_Flow::TypeOfFlow () const
99 {
100   return theTypeOfFlow;
101 }
102
103     Standard_Integer  IGESAppli_Flow::FunctionFlag () const
104 {
105   return theFunctionFlag;
106 }
107
108     Handle(IGESData_IGESEntity)  IGESAppli_Flow::FlowAssociativity
109   (const Standard_Integer Index) const
110 {
111   return theFlowAssociativities->Value(Index);
112 }
113
114     Handle(IGESDraw_ConnectPoint)  IGESAppli_Flow::ConnectPoint
115   (const Standard_Integer Index) const
116 {
117   return theConnectPoints->Value(Index);
118 }
119
120     Handle(IGESData_IGESEntity)  IGESAppli_Flow::Join
121   (const Standard_Integer Index) const
122 {
123   return theJoins->Value(Index);
124 }
125
126     Handle(TCollection_HAsciiString)  IGESAppli_Flow::FlowName
127   (const Standard_Integer Index) const
128 {
129   return theFlowNames->Value(Index);
130 }
131
132     Handle(IGESGraph_TextDisplayTemplate)  IGESAppli_Flow::TextDisplayTemplate
133   (const Standard_Integer Index) const
134 {
135   return theTextDisplayTemplates->Value(Index);
136 }
137
138     Handle(IGESData_IGESEntity)  IGESAppli_Flow::ContFlowAssociativity
139   (const Standard_Integer Index) const
140 {
141   return theContFlowAssociativities->Value(Index);
142 }