Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2011-09-20 |
2 | // Created by: Sergey ZERCHANINOV | |
a174a3c5 | 3 | // Copyright (c) 2011-2013 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 | |
2166f0fa SK |
16 | #ifndef _OpenGl_Trihedron_Header |
17 | #define _OpenGl_Trihedron_Header | |
18 | ||
a174a3c5 | 19 | #include <OpenGl_Element.hxx> |
2166f0fa | 20 | |
2166f0fa | 21 | #include <Aspect_TypeOfTriedronPosition.hxx> |
2166f0fa SK |
22 | #include <OpenGl_AspectLine.hxx> |
23 | #include <OpenGl_AspectText.hxx> | |
c827ea3a | 24 | #include <OpenGl_Cylinder.hxx> |
25 | #include <OpenGl_Disk.hxx> | |
26 | #include <OpenGl_Sphere.hxx> | |
a174a3c5 | 27 | #include <OpenGl_Text.hxx> |
28 | #include <Quantity_NameOfColor.hxx> | |
2166f0fa | 29 | |
c827ea3a | 30 | //! Class render trihedron |
a174a3c5 | 31 | class OpenGl_Trihedron : public OpenGl_Element |
2166f0fa | 32 | { |
a174a3c5 | 33 | public: |
34 | ||
536d98e2 | 35 | //! Default constructor. |
36 | OpenGl_Trihedron(); | |
37 | ||
38 | //! Destructor. | |
39 | virtual ~OpenGl_Trihedron(); | |
40 | ||
41 | //! Render the element. | |
42 | virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; | |
43 | ||
44 | //! Release OpenGL resources. | |
45 | virtual void Release (OpenGl_Context* theCtx); | |
2166f0fa | 46 | |
a174a3c5 | 47 | public: |
2166f0fa | 48 | |
536d98e2 | 49 | //! Switch wireframe / shaded trihedron. |
50 | void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; } | |
51 | ||
52 | //! Setup the corner to draw the trihedron. | |
53 | void SetPosition (const Aspect_TypeOfTriedronPosition thePosition) { myPos = thePosition; } | |
54 | ||
55 | //! Setup the scale factor. | |
56 | void SetScale (const Standard_Real theScale); | |
2166f0fa | 57 | |
536d98e2 | 58 | //! Setup the size ratio factor. |
59 | void SetSizeRatio (const Standard_Real theRatio); | |
60 | ||
61 | //! Setup the arrow diameter. | |
62 | void SetArrowDiameter (const Standard_Real theDiam); | |
63 | ||
64 | //! Setup the number of facets for tessellation. | |
65 | void SetNbFacets (const Standard_Integer theNbFacets); | |
66 | ||
67 | //! Setup color of text labels. | |
68 | void SetLabelsColor (const Quantity_Color& theColor); | |
69 | ||
70 | //! Setup per-arrow color. | |
71 | void SetArrowsColors (const Quantity_Color& theColorX, | |
72 | const Quantity_Color& theColorY, | |
73 | const Quantity_Color& theColorZ); | |
2166f0fa | 74 | |
a174a3c5 | 75 | protected: |
2166f0fa | 76 | |
c357e426 | 77 | //! Invalidate Primitive Arrays. |
536d98e2 | 78 | void invalidate(); |
a174a3c5 | 79 | |
e1c659da | 80 | void redraw(const Handle(OpenGl_Workspace)& theWorkspace) const; |
81 | void redrawZBuffer(const Handle(OpenGl_Workspace)& theWorkspace) const; | |
82 | ||
536d98e2 | 83 | //! Resets current model-view and projection transformations and sets |
e1c659da | 84 | //! translation for trihedron position |
85 | //! @sa Aspect_TypeOfTriedronPosition | |
86 | void resetTransformations (const Handle(OpenGl_Workspace)& theWorkspace) const; | |
a174a3c5 | 87 | |
88 | protected: | |
2166f0fa SK |
89 | |
90 | Aspect_TypeOfTriedronPosition myPos; | |
91 | Standard_Real myScale; | |
92 | Standard_Boolean myIsWireframe; | |
536d98e2 | 93 | OpenGl_Vec4 myXColor; |
94 | OpenGl_Vec4 myYColor; | |
95 | OpenGl_Vec4 myZColor; | |
2166f0fa SK |
96 | float myRatio; |
97 | float myDiameter; | |
98 | int myNbFacettes; | |
99 | ||
e1c659da | 100 | OpenGl_AspectLine myAspectLine; |
101 | OpenGl_AspectText myAspectText; | |
102 | mutable OpenGl_Text myLabelX; | |
103 | mutable OpenGl_Text myLabelY; | |
104 | mutable OpenGl_Text myLabelZ; | |
105 | mutable OpenGl_Cylinder myCylinder; | |
106 | mutable OpenGl_Sphere mySphere; | |
107 | mutable OpenGl_Cylinder myCone; | |
108 | mutable OpenGl_Disk myDisk; | |
109 | mutable OpenGl_PrimitiveArray myLine; | |
110 | mutable OpenGl_PrimitiveArray myCircle; | |
a174a3c5 | 111 | |
112 | public: | |
2166f0fa | 113 | |
1c35b92f | 114 | DEFINE_STANDARD_ALLOC |
a174a3c5 | 115 | |
2166f0fa SK |
116 | }; |
117 | ||
118 | #endif //_OpenGl_Trihedron_Header |