0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / IGESDraw / IGESDraw_ViewsVisibleWithAttr.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 <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>
7fd59977 27
92efcf78 28IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_ViewsVisibleWithAttr,IGESData_ViewKindEntity)
29
b311480e 30IGESDraw_ViewsVisibleWithAttr::IGESDraw_ViewsVisibleWithAttr () { }
7fd59977 31
32
33// This class inherits from IGESData_ViewKindEntity
34
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)
43{
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))
9775fa61 52 throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : Init");
7fd59977 53 }
54 if (!allDisplayEntities.IsNull())
9775fa61 55 if (allDisplayEntities->Lower() != 1) throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : Init");
7fd59977 56
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);
65}
66
67 void IGESDraw_ViewsVisibleWithAttr::InitImplied
68 (const Handle(IGESData_HArray1OfIGESEntity)& allDisplayEntity)
69{
70 if (!allDisplayEntity.IsNull())
71 if (allDisplayEntity->Lower() != 1)
9775fa61 72 throw Standard_DimensionMismatch("IGESDraw_ViewsVisibleWithAttr : InitImplied");
7fd59977 73 theDisplayEntities = allDisplayEntity;
74}
75
76 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsSingle () const
77{
78 return Standard_False;
79 // Is redefined to return Standard_Flase, since <me> contains list of Views
80}
81
82 Standard_Integer IGESDraw_ViewsVisibleWithAttr::NbViews () const
83{
84 return (theViewEntities.IsNull() ? 0 : theViewEntities->Length());
85}
86
87 Standard_Integer IGESDraw_ViewsVisibleWithAttr::NbDisplayedEntities () const
88{
89 return (theDisplayEntities.IsNull() ? 0 : theDisplayEntities->Length());
90 // Return 0 if HArray1 theDisplyEntities id NULL Handle
91}
92
93 Handle(IGESData_ViewKindEntity) IGESDraw_ViewsVisibleWithAttr::ViewItem
94 (const Standard_Integer Index) const
95{
96 return theViewEntities->Value(Index);
97 // if Index is out of bound HArray1 will raise OutOfRange exception
98}
99
100 Standard_Integer IGESDraw_ViewsVisibleWithAttr::LineFontValue
101 (const Standard_Integer Index) const
102{
103 return theLineFonts->Value(Index);
104 // if Index is out of bound HArray1 will raise OutOfRange exception
105}
106
107 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsFontDefinition
108 (const Standard_Integer Index) const
109{
110 return (! (theLineDefinitions->Value(Index)).IsNull());
111 // if Index is out of bound HArray1 will raise OutOfRange exception
112}
113
114 Handle(IGESData_LineFontEntity) IGESDraw_ViewsVisibleWithAttr::FontDefinition
115 (const Standard_Integer Index) const
116{
117 return theLineDefinitions->Value(Index);
118 // if Index is out of bound HArray1 will raise OutOfRange exception
119}
120
121 Standard_Integer IGESDraw_ViewsVisibleWithAttr::ColorValue
122 (const Standard_Integer Index) const
123{
124 return theColorValues->Value(Index);
125 // if Index is out of bound HArray1 will raise OutOfRange exception
126}
127
128 Standard_Boolean IGESDraw_ViewsVisibleWithAttr::IsColorDefinition
129 (const Standard_Integer Index) const
130{
131 return (! (theColorDefinitions->Value(Index)).IsNull());
132 // if Index is out of bound HArray1 will raise OutOfRange exception
133}
134
135 Handle(IGESGraph_Color) IGESDraw_ViewsVisibleWithAttr::ColorDefinition
136 (const Standard_Integer Index) const
137{
138 return theColorDefinitions->Value(Index);
139 // if Index is out of bound HArray1 will raise OutOfRange exception
140}
141
142 Standard_Integer IGESDraw_ViewsVisibleWithAttr::LineWeightItem
143 (const Standard_Integer Index) const
144{
145 return theLineWeights->Value(Index);
146 // if Index is out of bound HArray1 will raise OutOfRange exception
147}
148
149 Handle(IGESData_IGESEntity) IGESDraw_ViewsVisibleWithAttr::DisplayedEntity
150 (const Standard_Integer Index) const
151{
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
155}