0031431: Visualization, PrsMgr_PresentableObject - simplify HLR computing interface
[occt.git] / src / Graphic3d / Graphic3d_AspectMarker3d.cxx
1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-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 #include <Graphic3d_AspectMarker3d.hxx>
17
18 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Graphic3d_Aspects)
19
20 // =======================================================================
21 // function : Graphic3d_AspectMarker3d
22 // purpose  :
23 // =======================================================================
24 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
25 {
26   myShadingModel = Graphic3d_TOSM_UNLIT;
27   myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
28   myMarkerType = Aspect_TOM_X;
29   myMarkerScale = 1.0f;
30 }
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)
39 {
40   myShadingModel = Graphic3d_TOSM_UNLIT;
41   myInteriorColor.SetRGB (theColor);
42   myMarkerType = theType;
43   SetMarkerScale ((float )theScale);
44 }
45
46 // =======================================================================
47 // function : Graphic3d_AspectMarker3d
48 // purpose  :
49 // =======================================================================
50 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color&  theColor,
51                                                     const Standard_Integer theWidth,
52                                                     const Standard_Integer theHeight,
53                                                     const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
54 {
55   myShadingModel = Graphic3d_TOSM_UNLIT;
56   myMarkerImage = new Graphic3d_MarkerImage(theTextureBitMap, theWidth, theHeight);
57   myInteriorColor.SetRGB (theColor),
58   myMarkerType = Aspect_TOM_USERDEFINED;
59   myMarkerScale = 1.0f;
60 }
61
62 // =======================================================================
63 // function : Graphic3d_AspectMarker3d
64 // purpose  :
65 // =======================================================================
66 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
67 {
68   myShadingModel = Graphic3d_TOSM_UNLIT;
69   myMarkerImage = new Graphic3d_MarkerImage (theTextureImage);
70   myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
71   myMarkerType = Aspect_TOM_USERDEFINED;
72   myMarkerScale = 1.0f;
73 }
74
75 // =======================================================================
76 // function : GetTextureSize
77 // purpose  :
78 // =======================================================================
79 void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
80                                                Standard_Integer& theHeight) const
81 {
82   if (!myMarkerImage.IsNull())
83   {
84     myMarkerImage->GetTextureSize (theWidth, theHeight);
85   }
86   else
87   {
88     theWidth  = 0;
89     theHeight = 0;
90   }
91 }
92
93 // =======================================================================
94 // function : SetBitMap
95 // purpose  :
96 // =======================================================================
97 void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
98                                           const Standard_Integer theHeight,
99                                           const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
100 {
101   myMarkerImage.Nullify();
102   myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
103 }