1 // Created on: 2011-09-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2013 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.
16 #ifndef _OpenGl_Trihedron_Header
17 #define _OpenGl_Trihedron_Header
19 #include <OpenGl_Element.hxx>
21 #include <Aspect_TypeOfTriedronPosition.hxx>
22 #include <OpenGl_AspectLine.hxx>
23 #include <OpenGl_AspectText.hxx>
24 #include <OpenGl_Cylinder.hxx>
25 #include <OpenGl_Disk.hxx>
26 #include <OpenGl_Sphere.hxx>
27 #include <OpenGl_Text.hxx>
28 #include <Quantity_NameOfColor.hxx>
30 //! Class render trihedron
31 class OpenGl_Trihedron : public OpenGl_Element
35 //! Default constructor.
39 virtual ~OpenGl_Trihedron();
41 //! Render the element.
42 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
44 //! Release OpenGL resources.
45 virtual void Release (OpenGl_Context* theCtx);
49 //! Switch wireframe / shaded trihedron.
50 void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; }
52 //! Setup the corner to draw the trihedron.
53 void SetPosition (const Aspect_TypeOfTriedronPosition thePosition) { myPos = thePosition; }
55 //! Setup the scale factor.
56 void SetScale (const Standard_Real theScale);
58 //! Setup the size ratio factor.
59 void SetSizeRatio (const Standard_Real theRatio);
61 //! Setup the arrow diameter.
62 void SetArrowDiameter (const Standard_Real theDiam);
64 //! Setup the number of facets for tessellation.
65 void SetNbFacets (const Standard_Integer theNbFacets);
67 //! Setup color of text labels.
68 void SetLabelsColor (const Quantity_Color& theColor);
70 //! Setup per-arrow color.
71 void SetArrowsColors (const Quantity_Color& theColorX,
72 const Quantity_Color& theColorY,
73 const Quantity_Color& theColorZ);
77 //! Invalidate Primitive Arrays.
80 void redraw(const Handle(OpenGl_Workspace)& theWorkspace) const;
81 void redrawZBuffer(const Handle(OpenGl_Workspace)& theWorkspace) const;
83 //! Resets current model-view and projection transformations and sets
84 //! translation for trihedron position
85 //! @sa Aspect_TypeOfTriedronPosition
86 void resetTransformations (const Handle(OpenGl_Workspace)& theWorkspace) const;
90 Aspect_TypeOfTriedronPosition myPos;
91 Standard_Real myScale;
92 Standard_Boolean myIsWireframe;
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;
114 DEFINE_STANDARD_ALLOC
118 #endif //_OpenGl_Trihedron_Header