7fd59977 |
1 | // File: NIS_SurfaceDrawer.h |
2 | // Created: 20.03.08 09:05 |
3 | // Author: Alexander GRIGORIEV |
4 | // Copyright: Open Cascade S.A. 2008 |
5 | |
6 | #ifndef NIS_SurfaceDrawer_HeaderFile |
7 | #define NIS_SurfaceDrawer_HeaderFile |
8 | |
9 | #include <NIS_Drawer.hxx> |
10 | #include <gp_Trsf.hxx> |
11 | #include <Quantity_Color.hxx> |
12 | |
13 | class NIS_Surface; |
14 | |
15 | /** |
16 | * Drawer for interactive object type NIS_Surface. |
17 | */ |
18 | |
19 | class NIS_SurfaceDrawer : public NIS_Drawer |
20 | { |
21 | public: |
22 | // ---------- PUBLIC METHODS ---------- |
23 | |
24 | /** |
25 | * Constructor. |
26 | */ |
27 | Standard_EXPORT NIS_SurfaceDrawer(const Quantity_Color &theNormal, |
28 | const Quantity_Color &theHilight |
ffe2bea7 |
29 | = Quantity_NOC_GRAY65, |
7fd59977 |
30 | const Quantity_Color &theDynHilight |
31 | = Quantity_NOC_CYAN1); |
32 | |
33 | /** |
ffe2bea7 |
34 | * Sets the color of the drawer. |
7fd59977 |
35 | */ |
ffe2bea7 |
36 | Standard_EXPORT void SetColor (const Quantity_Color &theColor); |
7fd59977 |
37 | |
38 | /** |
39 | * Define the color used for the back side of rendered triangles. |
40 | * By default this color is the same as the 'Normal' color. |
41 | */ |
42 | inline void SetBackColor (const Quantity_Color& theColor) |
43 | { |
44 | myBackColor = theColor; |
45 | } |
46 | |
47 | /** |
48 | * Sets the transformation to the drawer. |
49 | */ |
50 | inline void SetTransformation (const gp_Trsf &theTrsf) |
51 | { |
52 | myTrsf = theTrsf; |
53 | } |
54 | |
55 | /** |
56 | * Returns the transformation to the drawer. |
57 | */ |
58 | inline const gp_Trsf& GetTransformation () const |
59 | { |
60 | return myTrsf; |
61 | } |
62 | |
63 | /** |
64 | * Sets the surface offset |
65 | */ |
66 | inline void SetPolygonOffset (const Standard_Real theOffset) |
67 | { |
ffe2bea7 |
68 | myPolygonOffset = static_cast<Standard_ShortReal>(theOffset); |
7fd59977 |
69 | } |
70 | |
71 | /** |
72 | * Get the surface offset. |
73 | */ |
74 | inline Standard_Real GetPolygonOffset () const |
75 | { |
ffe2bea7 |
76 | return static_cast<Standard_Real>(myPolygonOffset); |
7fd59977 |
77 | } |
78 | |
7fd59977 |
79 | /** |
80 | * Copy the relevant information from another instance of Drawer. |
81 | * raises exception if theOther has incompatible type (test IsKind). |
82 | */ |
83 | Standard_EXPORT virtual void Assign (const Handle_NIS_Drawer& theOther); |
84 | |
85 | /** |
86 | * Called before execution of Draw(), once per group of interactive objects. |
87 | */ |
88 | Standard_EXPORT virtual void BeforeDraw(const DrawType theType, |
89 | const NIS_DrawList& theDrawList); |
90 | |
91 | /** |
92 | * Called after execution of Draw(), once per group of interactive objects. |
93 | */ |
94 | Standard_EXPORT virtual void AfterDraw(const DrawType theType, |
95 | const NIS_DrawList& theDrawList); |
96 | |
97 | /** |
98 | * Main function: display the given interactive object in the given view. |
99 | */ |
100 | Standard_EXPORT virtual void Draw (const Handle_NIS_InteractiveObject&, |
101 | const DrawType theType, |
102 | const NIS_DrawList& theDrawList); |
103 | |
104 | /** |
105 | * Matching two instances, for Map interface. |
106 | */ |
107 | Standard_EXPORT virtual Standard_Boolean |
108 | IsEqual (const Handle_NIS_Drawer& theOth)const; |
109 | |
110 | protected: |
111 | Standard_EXPORT virtual void redraw (const DrawType theType, |
112 | const Handle_NIS_View& theView); |
113 | |
114 | |
115 | private: |
ffe2bea7 |
116 | Quantity_Color myColor[5]; |
7fd59977 |
117 | Quantity_Color myBackColor; |
118 | gp_Trsf myTrsf; |
7fd59977 |
119 | Standard_ShortReal myPolygonOffset; |
ffe2bea7 |
120 | Standard_Boolean myIsWireframe; |
7fd59977 |
121 | |
122 | friend class NIS_Surface; |
123 | |
124 | public: |
125 | // Declaration of CASCADE RTTI |
126 | DEFINE_STANDARD_RTTI (NIS_SurfaceDrawer) |
127 | }; |
128 | |
129 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
130 | DEFINE_STANDARD_HANDLE (NIS_SurfaceDrawer, NIS_Drawer) |
131 | |
132 | #endif |