973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Standard_Type.hxx> |
16 | #include <Vrml_SFImage.hxx> |
7fd59977 |
17 | |
25e59720 |
18 | IMPLEMENT_STANDARD_RTTIEXT(Vrml_SFImage,Standard_Transient) |
92efcf78 |
19 | |
b311480e |
20 | Vrml_SFImage::Vrml_SFImage() |
7fd59977 |
21 | { |
22 | myArray = new TColStd_HArray1OfInteger(1,1); |
23 | myArrayFlag = Standard_False; |
24 | } |
25 | Vrml_SFImage::Vrml_SFImage(const Standard_Integer aWidth, |
26 | const Standard_Integer aHeight, |
27 | const Vrml_SFImageNumber aNumber, |
28 | const Handle(TColStd_HArray1OfInteger)& anArray) |
29 | { |
30 | Standard_Integer size = aWidth*aHeight; |
31 | if (anArray->Length() != size) |
32 | { |
9775fa61 |
33 | throw Standard_Failure("The size of Array is no equal (aWidth*aHeight)"); |
7fd59977 |
34 | } |
35 | myWidth = aWidth; |
36 | myHeight = aHeight; |
37 | myNumber = aNumber; |
38 | myArray = anArray; |
39 | myArrayFlag = Standard_True; |
40 | } |
41 | |
42 | void Vrml_SFImage::SetWidth(const Standard_Integer aWidth) |
43 | { |
44 | myWidth = aWidth; |
45 | } |
46 | |
47 | Standard_Integer Vrml_SFImage::Width() const |
48 | { |
49 | return myWidth; |
50 | } |
51 | |
52 | void Vrml_SFImage::SetHeight(const Standard_Integer aHeight) |
53 | { |
54 | myHeight = aHeight; |
55 | } |
56 | |
57 | Standard_Integer Vrml_SFImage::Height() const |
58 | { |
59 | return myHeight; |
60 | } |
61 | |
62 | void Vrml_SFImage::SetNumber(const Vrml_SFImageNumber aNumber) |
63 | { |
64 | myNumber = aNumber; |
65 | } |
66 | |
67 | Vrml_SFImageNumber Vrml_SFImage::Number() const |
68 | { |
69 | return myNumber; |
70 | } |
71 | |
72 | void Vrml_SFImage::SetArray(const Handle(TColStd_HArray1OfInteger)& anArray) |
73 | { |
74 | Standard_Integer size = myWidth*myHeight; |
75 | if (anArray->Length() != size) |
76 | { |
9775fa61 |
77 | throw Standard_Failure("The size of Array is no equal (aWidth*aHeight)"); |
7fd59977 |
78 | } |
79 | myArray = anArray; |
80 | myArrayFlag = Standard_True; |
81 | } |
82 | |
83 | Standard_Boolean Vrml_SFImage::ArrayFlag() const |
84 | { |
85 | return myArrayFlag; |
86 | } |
87 | Handle(TColStd_HArray1OfInteger) Vrml_SFImage::Array() const |
88 | { |
89 | return myArray; |
90 | } |