1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <IGESData_IGESEntity.hxx>
20 #include <IGESData_LineFontEntity.hxx>
21 #include <IGESData_ViewKindEntity.hxx>
22 #include <IGESDraw_ViewsVisibleWithAttr.hxx>
23 #include <IGESGraph_Color.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_ViewsVisibleWithAttr,IGESData_ViewKindEntity)
30 IGESDraw_ViewsVisibleWithAttr::IGESDraw_ViewsVisibleWithAttr () { }
33 // This class inherits from IGESData_ViewKindEntity
35 void IGESDraw_ViewsVisibleWithAttr::Init
36 (const Handle(IGESDraw_HArray1OfViewKindEntity)& allViewEntities,
37 const Handle(TColStd_HArray1OfInteger)& allLineFonts,
38 const Handle(IGESBasic_HArray1OfLineFontEntity)& allLineDefinitions,
39 const Handle(TColStd_HArray1OfInteger)& allColorValues,
40 const Handle(IGESGraph_HArray1OfColor)& allColorDefinitions,
41 const Handle(TColStd_HArray1OfInteger)& allLineWeights,
42 const Handle(IGESData_HArray1OfIGESEntity)& allDisplayEntities)
44 if (!allViewEntities.IsNull()) {
45 Standard_Integer Exp = allViewEntities->Length();
46 if ( allViewEntities->Lower() != 1 ||
47 (allLineFonts->Lower() != 1 || allLineFonts->Length() != Exp) ||
48 (allColorValues->Lower() != 1 || allColorValues->Length() != Exp) ||
49 (allLineWeights->Lower() != 1 || allLineWeights->Length() != Exp) ||
50 (allLineDefinitions->Lower() != 1 || allLineDefinitions->Length() != Exp) ||
51 (allColorDefinitions->Lower() != 1 || allColorDefinitions->Length() != Exp))
52 throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : Init");
54 if (!allDisplayEntities.IsNull())
55 if (allDisplayEntities->Lower() != 1) throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : Init");
57 theViewEntities = allViewEntities;
58 theLineFonts = allLineFonts;
59 theLineDefinitions = allLineDefinitions;
60 theColorValues = allColorValues;
61 theColorDefinitions = allColorDefinitions;
62 theLineWeights = allLineWeights;
63 theDisplayEntities = allDisplayEntities;
64 InitTypeAndForm(402,4);
67 void IGESDraw_ViewsVisibleWithAttr::InitImplied
68 (const Handle(IGESData_HArray1OfIGESEntity)& allDisplayEntity)
70 if (!allDisplayEntity.IsNull())
71 if (allDisplayEntity->Lower() != 1)
72 throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : InitImplied");
73 theDisplayEntities = allDisplayEntity;
76 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsSingle () const
78 return Standard_False;
79 // Is redefined to return Standard_Flase, since <me> contains list of Views
82 Standard_Integer IGESDraw_ViewsVisibleWithAttr::NbViews () const
84 return (theViewEntities.IsNull() ? 0 : theViewEntities->Length());
87 Standard_Integer IGESDraw_ViewsVisibleWithAttr::NbDisplayedEntities () const
89 return (theDisplayEntities.IsNull() ? 0 : theDisplayEntities->Length());
90 // Return 0 if HArray1 theDisplyEntities id NULL Handle
93 Handle(IGESData_ViewKindEntity) IGESDraw_ViewsVisibleWithAttr::ViewItem
94 (const Standard_Integer Index) const
96 return theViewEntities->Value(Index);
97 // if Index is out of bound HArray1 will raise OutOfRange exception
100 Standard_Integer IGESDraw_ViewsVisibleWithAttr::LineFontValue
101 (const Standard_Integer Index) const
103 return theLineFonts->Value(Index);
104 // if Index is out of bound HArray1 will raise OutOfRange exception
107 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsFontDefinition
108 (const Standard_Integer Index) const
110 return (! (theLineDefinitions->Value(Index)).IsNull());
111 // if Index is out of bound HArray1 will raise OutOfRange exception
114 Handle(IGESData_LineFontEntity) IGESDraw_ViewsVisibleWithAttr::FontDefinition
115 (const Standard_Integer Index) const
117 return theLineDefinitions->Value(Index);
118 // if Index is out of bound HArray1 will raise OutOfRange exception
121 Standard_Integer IGESDraw_ViewsVisibleWithAttr::ColorValue
122 (const Standard_Integer Index) const
124 return theColorValues->Value(Index);
125 // if Index is out of bound HArray1 will raise OutOfRange exception
128 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsColorDefinition
129 (const Standard_Integer Index) const
131 return (! (theColorDefinitions->Value(Index)).IsNull());
132 // if Index is out of bound HArray1 will raise OutOfRange exception
135 Handle(IGESGraph_Color) IGESDraw_ViewsVisibleWithAttr::ColorDefinition
136 (const Standard_Integer Index) const
138 return theColorDefinitions->Value(Index);
139 // if Index is out of bound HArray1 will raise OutOfRange exception
142 Standard_Integer IGESDraw_ViewsVisibleWithAttr::LineWeightItem
143 (const Standard_Integer Index) const
145 return theLineWeights->Value(Index);
146 // if Index is out of bound HArray1 will raise OutOfRange exception
149 Handle(IGESData_IGESEntity) IGESDraw_ViewsVisibleWithAttr::DisplayedEntity
150 (const Standard_Integer Index) const
152 return theDisplayEntities->Value(Index);
153 // if Index is out of bound HArray1 will raise OutOfRange exception
154 // if (theDisplayEntity.IsNull()) then NoSuchObject Exception is raised