caf231b0 |
1 | // Created on: 2016-10-11 |
2 | // Created by: Ilya SEVRIKOV |
3 | // Copyright (c) 2016 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 | #ifndef _V3d_Trihedron_HeaderFile |
17 | #define _V3d_Trihedron_HeaderFile |
18 | |
19 | #include <Graphic3d_Group.hxx> |
20 | #include <Graphic3d_Structure.hxx> |
21 | #include <Graphic3d_StructureManager.hxx> |
22 | #include <Graphic3d_TransformPers.hxx> |
23 | #include <Prs3d_LineAspect.hxx> |
24 | #include <Prs3d_ShadingAspect.hxx> |
25 | #include <Prs3d_TextAspect.hxx> |
26 | |
27 | class V3d_View; |
28 | |
29 | //! Class for presentation of zbuffer trihedron object. |
30 | class V3d_Trihedron : public Standard_Transient |
31 | { |
32 | DEFINE_STANDARD_RTTIEXT(V3d_Trihedron, Standard_Transient) |
33 | public: |
34 | |
35 | //! Creates a default trihedron. |
36 | Standard_EXPORT V3d_Trihedron(); |
37 | |
475c2302 |
38 | //! Destructor. |
39 | Standard_EXPORT virtual ~V3d_Trihedron(); |
40 | |
caf231b0 |
41 | //! Switch wireframe / shaded trihedron. |
42 | void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; } |
43 | |
44 | //! Setup the corner to draw the trihedron. |
45 | Standard_EXPORT void SetPosition (const Aspect_TypeOfTriedronPosition thePosition); |
46 | |
47 | //! Setup the scale factor. |
48 | Standard_EXPORT void SetScale (const Standard_Real theScale); |
49 | |
50 | //! Setup the size ratio factor. |
51 | Standard_EXPORT void SetSizeRatio (const Standard_Real theRatio); |
52 | |
53 | //! Setup the arrow diameter. |
54 | Standard_EXPORT void SetArrowDiameter (const Standard_Real theDiam); |
55 | |
56 | //! Setup the number of facets for tessellation. |
57 | Standard_EXPORT void SetNbFacets (const Standard_Integer theNbFacets); |
58 | |
59 | //! Setup color of text labels. |
60 | Standard_EXPORT void SetLabelsColor (const Quantity_Color& theColor); |
61 | |
62 | //! Setup colors of arrows. |
63 | Standard_EXPORT void SetArrowsColor (const Quantity_Color& theXColor, |
64 | const Quantity_Color& theYColor, |
65 | const Quantity_Color& theZColor); |
66 | |
67 | //! Display trihedron. |
68 | Standard_EXPORT void Display (const V3d_View& theView); |
69 | |
70 | //! Erase trihedron. |
71 | Standard_EXPORT void Erase(); |
72 | |
73 | protected: |
74 | |
75 | //! Fills Graphic3d_Group. |
76 | Standard_EXPORT void compute(); |
77 | |
78 | //! Invalidates objects. It leads recompute. |
79 | void invalidate() |
80 | { |
81 | myToCompute = Standard_True; |
82 | } |
83 | |
84 | //! Sets offset 2d for transform persistence. |
85 | Standard_EXPORT void setOffset2d(); |
86 | |
87 | private: |
88 | |
89 | //! Custom Graphic3d_Structure implementation. |
90 | class TrihedronStructure; |
91 | |
92 | protected: |
93 | |
94 | Handle(Prs3d_ShadingAspect) mySphereShadingAspect; |
95 | Handle(Prs3d_LineAspect) mySphereLineAspect; |
96 | |
97 | Handle(Prs3d_TextAspect) myTextAspect; |
98 | |
99 | Handle(Prs3d_ShadingAspect) myArrowShadingAspects[3]; |
100 | Handle(Prs3d_LineAspect) myArrowLineAspects[3]; |
101 | |
102 | Handle(Graphic3d_Structure) myStructure; |
103 | Handle(Graphic3d_TransformPers) myTransformPers; |
104 | |
105 | Standard_Real myScale; |
106 | Standard_Real myRatio; |
107 | Standard_Real myDiameter; |
108 | Standard_Integer myNbFacettes; |
109 | Standard_Boolean myIsWireframe; |
110 | Standard_Boolean myToCompute; |
111 | |
112 | }; |
113 | |
114 | DEFINE_STANDARD_HANDLE (V3d_Trihedron, Standard_Transient) |
115 | |
116 | #endif |