b311480e |
1 | // Created by: NW,JPB,CAL |
2 | // Copyright (c) 1991-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. |
b311480e |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
42cf5bc1 |
16 | #include <Graphic3d_AspectMarker3d.hxx> |
a577aaab |
17 | |
b6472664 |
18 | IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Standard_Transient) |
92efcf78 |
19 | |
a577aaab |
20 | // ======================================================================= |
21 | // function : Graphic3d_AspectMarker3d |
22 | // purpose : |
23 | // ======================================================================= |
24 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d() |
b6472664 |
25 | : myColor (Quantity_NOC_YELLOW), |
26 | myType (Aspect_TOM_X), |
27 | myScale (1.0f) |
28 | { |
29 | // |
30 | } |
a577aaab |
31 | |
32 | // ======================================================================= |
33 | // function : Graphic3d_AspectMarker3d |
34 | // purpose : |
35 | // ======================================================================= |
36 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType, |
37 | const Quantity_Color& theColor, |
38 | const Standard_Real theScale) |
b6472664 |
39 | : myColor (theColor), |
40 | myType (theType), |
41 | myScale ((float )theScale) |
42 | { |
43 | if (theScale <= 0.0) |
44 | { |
45 | Aspect_AspectMarkerDefinitionError::Raise ("Bad value for MarkerScale"); |
46 | } |
47 | } |
a577aaab |
48 | |
49 | // ======================================================================= |
50 | // function : Graphic3d_AspectMarker3d |
51 | // purpose : |
52 | // ======================================================================= |
53 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor, |
54 | const Standard_Integer theWidth, |
55 | const Standard_Integer theHeight, |
56 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
b6472664 |
57 | : myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)), |
58 | myColor (theColor), |
59 | myType (Aspect_TOM_USERDEFINED), |
60 | myScale (1.0f) |
61 | { |
62 | // |
63 | } |
a577aaab |
64 | |
65 | // ======================================================================= |
66 | // function : Graphic3d_AspectMarker3d |
67 | // purpose : |
68 | // ======================================================================= |
69 | Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage) |
b6472664 |
70 | : myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)), |
71 | myColor (Quantity_NOC_YELLOW), |
72 | myType (Aspect_TOM_USERDEFINED), |
73 | myScale (1.0f) |
74 | { |
75 | // |
76 | } |
a577aaab |
77 | |
78 | // ======================================================================= |
79 | // function : GetTextureSize |
80 | // purpose : |
81 | // ======================================================================= |
82 | void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth, |
83 | Standard_Integer& theHeight) const |
7fd59977 |
84 | { |
a577aaab |
85 | if (!myMarkerImage.IsNull()) |
86 | { |
87 | myMarkerImage->GetTextureSize (theWidth, theHeight); |
88 | } |
89 | else |
90 | { |
91 | theWidth = 0; |
92 | theHeight = 0; |
93 | } |
7fd59977 |
94 | } |
95 | |
a577aaab |
96 | // ======================================================================= |
97 | // function : SetBitMap |
98 | // purpose : |
99 | // ======================================================================= |
100 | void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth, |
101 | const Standard_Integer theHeight, |
102 | const Handle(TColStd_HArray1OfByte)& theTextureBitMap) |
7fd59977 |
103 | { |
a577aaab |
104 | myMarkerImage.Nullify(); |
105 | myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight); |
7fd59977 |
106 | } |