1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-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.
17 #include <Graphic3d_AspectMarker3d.hxx>
18 #include <Graphic3d_MarkerImage.hxx>
19 #include <Image_PixMap.hxx>
20 #include <Quantity_Color.hxx>
21 #include <Standard_Type.hxx>
22 #include <TColStd_Array1OfByte.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d,Aspect_AspectMarker)
26 // =======================================================================
27 // function : Graphic3d_AspectMarker3d
29 // =======================================================================
30 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
31 : Aspect_AspectMarker()
34 // =======================================================================
35 // function : Graphic3d_AspectMarker3d
37 // =======================================================================
38 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
39 const Quantity_Color& theColor,
40 const Standard_Real theScale)
41 : Aspect_AspectMarker (theColor, theType, theScale)
44 // =======================================================================
45 // function : Graphic3d_AspectMarker3d
47 // =======================================================================
48 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theColor,
49 const Standard_Integer theWidth,
50 const Standard_Integer theHeight,
51 const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
52 : Aspect_AspectMarker (theColor, Aspect_TOM_USERDEFINED, 1.0),
53 myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight))
56 // =======================================================================
57 // function : Graphic3d_AspectMarker3d
59 // =======================================================================
60 Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
61 : Aspect_AspectMarker (Quantity_NOC_YELLOW, Aspect_TOM_USERDEFINED, 1.0),
62 myMarkerImage (new Graphic3d_MarkerImage (theTextureImage))
65 // =======================================================================
66 // function : GetTextureSize
68 // =======================================================================
69 void Graphic3d_AspectMarker3d::GetTextureSize (Standard_Integer& theWidth,
70 Standard_Integer& theHeight) const
72 if (!myMarkerImage.IsNull())
74 myMarkerImage->GetTextureSize (theWidth, theHeight);
83 // =======================================================================
84 // function : GetMarkerImage
86 // =======================================================================
87 const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage() const
92 // =======================================================================
93 // function : SetMarkerImage
95 // =======================================================================
96 void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
98 myMarkerImage = theImage;
101 // =======================================================================
102 // function : SetBitMap
104 // =======================================================================
105 void Graphic3d_AspectMarker3d::SetBitMap (const Standard_Integer theWidth,
106 const Standard_Integer theHeight,
107 const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
109 myMarkerImage.Nullify();
110 myMarkerImage = new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight);
113 // =======================================================================
114 // function : SetShaderProgram
116 // =======================================================================
117 void Graphic3d_AspectMarker3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
119 MyShaderProgram = theProgram;
122 // =======================================================================
123 // function : ShaderProgram
125 // =======================================================================
126 const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectMarker3d::ShaderProgram() const
128 return MyShaderProgram;