0025993: References to enums are wrapped wrong in SWIG Java
[occt.git] / src / Graphic3d / Graphic3d_GraduatedTrihedron.hxx
CommitLineData
a79f67f8 1// Created on: 2011-03-06
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2014 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 _Graphic3d_GraduatedTrihedron_HeaderFile
17#define _Graphic3d_GraduatedTrihedron_HeaderFile
18
19#include <Font_FontAspect.hxx>
20#include <NCollection_Array1.hxx>
21#include <Quantity_Color.hxx>
22#include <Standard_Boolean.hxx>
23#include <Standard_Integer.hxx>
24#include <TCollection_AsciiString.hxx>
25#include <TCollection_ExtendedString.hxx>
26
27class Visual3d_View;
28
29//! Class that stores style for one graduated trihedron axis such as colors, lengths and customization flags.
30//! It is used in Graphic3d_GraduatedTrihedron.
31class Graphic3d_AxisAspect
32{
33 public:
34
35 Graphic3d_AxisAspect (const TCollection_ExtendedString theName = "", const Quantity_Color theNameColor = Quantity_NOC_BLACK,
36 const Quantity_Color theColor = Quantity_NOC_BLACK,
37 const Standard_Integer theValuesOffset = 10, const Standard_Integer theNameOffset = 30,
38 const Standard_Integer theTickmarkNumber = 5, const Standard_Integer theTickmarkLength = 10,
39 const Standard_Boolean theToDrawName = Standard_True,
40 const Standard_Boolean theToDrawValues = Standard_True,
41 const Standard_Boolean theToDrawTickmarks = Standard_True)
42 : myName (theName),
43 myToDrawName (theToDrawName),
44 myToDrawTickmarks (theToDrawTickmarks),
45 myToDrawValues (theToDrawValues),
46 myNameColor (theNameColor),
47 myTickmarkNumber (theTickmarkNumber),
48 myTickmarkLength (theTickmarkLength),
49 myColor (theColor),
50 myValuesOffset (theValuesOffset),
51 myNameOffset (theNameOffset)
52 { }
53
54public:
55
56 void SetName (const TCollection_ExtendedString& theName) { myName = theName; }
57 const TCollection_ExtendedString& Name() const { return myName; }
58
59 const Standard_Boolean ToDrawName() const { return myToDrawName; }
60 void SetToDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; }
61
62 const Standard_Boolean ToDrawTickmarks() const { return myToDrawTickmarks; }
63 void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; }
64
65 const Standard_Boolean ToDrawValues() const { return myToDrawValues; }
66 void SetToDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; }
67
68 const Quantity_Color& NameColor() const { return myNameColor; }
69 void SetNameColor (const Quantity_Color& theColor) { myNameColor = theColor; }
70
71 //! Color of axis and values
72 const Quantity_Color& Color() const { return myColor; }
73
74 //! Sets color of axis and values
75 void SetColor (const Quantity_Color& theColor) { myColor = theColor; }
76
77 const Standard_Integer TickmarkNumber() const { return myTickmarkNumber; }
78 void SetTickmarkNumber (const Standard_Integer theValue) { myTickmarkNumber = theValue; }
79
80 const Standard_Integer TickmarkLength() const { return myTickmarkLength; }
81 void SetTickmarkLength (const Standard_Integer theValue) { myTickmarkLength = theValue; }
82
83 const Standard_Integer ValuesOffset() const { return myValuesOffset; }
84 void SetValuesOffset (const Standard_Integer theValue) { myValuesOffset = theValue; }
85
86 const Standard_Integer NameOffset() const { return myNameOffset; }
87 void SetNameOffset (const Standard_Integer theValue) { myNameOffset = theValue; }
88
89protected:
90
91 TCollection_ExtendedString myName;
92
93 Standard_Boolean myToDrawName;
94 Standard_Boolean myToDrawTickmarks;
95 Standard_Boolean myToDrawValues;
96
97 Quantity_Color myNameColor;
98
99 Standard_Integer myTickmarkNumber; //!< Number of splits along axes
100 Standard_Integer myTickmarkLength; //!< Length of tickmarks
101 Quantity_Color myColor; //!< Color of axis and values
102
103 Standard_Integer myValuesOffset; //!< Offset for drawing values
104 Standard_Integer myNameOffset; //!< Offset for drawing name of axis
105};
106
107//! Defines the class of a graduated trihedron.
108//! It contains main style parameters for implementation of graduated trihedron
109//! @sa OpenGl_GraduatedTrihedron
110class Graphic3d_GraduatedTrihedron
111{
112public:
113
114 typedef void (*MinMaxValuesCallback) (Visual3d_View*);
115
116public:
117
118 //! Default constructor
119 //! Constructs the default graduated trihedron with grid, X, Y, Z axes, and tickmarks
120 Graphic3d_GraduatedTrihedron (const TCollection_AsciiString& theNamesFont = "Arial",
121 const Font_FontAspect& theNameStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12,
122 const TCollection_AsciiString& theValuesFont = "Arial",
123 const Font_FontAspect& theValuesStyle = Font_FA_Regular, const Standard_Integer theValuesSize = 12,
124 const Standard_ShortReal theArrowLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE,
125 const Standard_Boolean theToDrawGrid = Standard_True, const Standard_Boolean theToDrawAxes = Standard_True)
126 : myNamesFont (theNamesFont),
127 myNamesStyle (theNameStyle),
128 myNamesSize (theNamesSize),
129 myValuesFont (theValuesFont),
130 myValuesStyle (theValuesStyle),
131 myValuesSize (theValuesSize),
132 myArrowLength (theArrowLength),
133 myGridColor (theGridColor),
134 myToDrawGrid (theToDrawGrid),
135 myToDrawAxes (theToDrawAxes),
136 myAxes(0, 2)
137 {
138 myAxes (0) = Graphic3d_AxisAspect ("X", Quantity_NOC_RED, Quantity_NOC_RED);
139 myAxes (1) = Graphic3d_AxisAspect ("Y", Quantity_NOC_GREEN, Quantity_NOC_GREEN);
140 myAxes (2) = Graphic3d_AxisAspect ("Z", Quantity_NOC_BLUE1, Quantity_NOC_BLUE1);
141 PtrVisual3dView = NULL;
142 }
143
144public:
145
146 Graphic3d_AxisAspect& ChangeXAxisAspect() { return myAxes(0); }
147 Graphic3d_AxisAspect& ChangeYAxisAspect() { return myAxes(1); }
148 Graphic3d_AxisAspect& ChangeZAxisAspect() { return myAxes(2); }
149
150 const Graphic3d_AxisAspect& XAxisAspect() const { return myAxes(0); }
151 const Graphic3d_AxisAspect& YAxisAspect() const { return myAxes(1); }
152 const Graphic3d_AxisAspect& ZAxisAspect() const { return myAxes(2); }
153
154 const Graphic3d_AxisAspect& AxisAspect (const Standard_Integer theIndex) const
155 {
156 Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > 2, "Graphic3d_GraduatedTrihedron::AxisAspect: theIndex is out of bounds [0,2].");
157 return myAxes (theIndex);
158 }
159
160 const Standard_ShortReal ArrowLength() const { return myArrowLength; }
161 void SetArrowLength (const Standard_ShortReal theValue) { myArrowLength = theValue; }
162
163 const Quantity_Color& GridColor() const { return myGridColor; }
164 void SetGridColor (const Quantity_Color& theColor) {myGridColor = theColor; }
165
166 const Standard_Boolean ToDrawGrid() const { return myToDrawGrid; }
167 void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; }
168
169 const Standard_Boolean ToDrawAxes() const { return myToDrawAxes; }
170 void SetToDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; }
171
172 const TCollection_AsciiString& NamesFont() const { return myNamesFont; }
173 void SetNamesFont (const TCollection_AsciiString& theFont) { myNamesFont = theFont; }
174
a3ee6e9f 175 Font_FontAspect NamesFontAspect() const { return myNamesStyle; }
176 void SetNamesFontAspect (Font_FontAspect theAspect) { myNamesStyle = theAspect; }
a79f67f8 177
178 const Standard_Integer NamesSize() const { return myNamesSize; }
179 void SetNamesSize (const Standard_Integer theValue) { myNamesSize = theValue; }
180
181 const TCollection_AsciiString& ValuesFont () const { return myValuesFont; }
182 void SetValuesFont (const TCollection_AsciiString& theFont) { myValuesFont = theFont; }
183
a3ee6e9f 184 Font_FontAspect ValuesFontAspect() const { return myValuesStyle; }
185 void SetValuesFontAspect (Font_FontAspect theAspect) { myValuesStyle = theAspect; }
a79f67f8 186
187 const Standard_Integer ValuesSize() const { return myValuesSize; }
188 void SetValuesSize (const Standard_Integer theValue) { myValuesSize = theValue; }
189
190public:
191
192 MinMaxValuesCallback CubicAxesCallback; //!< Callback function to define boundary box of displayed objects
193 Visual3d_View* PtrVisual3dView;
194
195protected:
196
197 TCollection_AsciiString myNamesFont; //!< Font name of names of axes: Courier, Arial, ...
198 Font_FontAspect myNamesStyle; //!< Style of names of axes: OSD_FA_Regular, OSD_FA_Bold,..
199 Standard_Integer myNamesSize; //!< Size of names of axes: 8, 10,..
200
201protected:
202
203 TCollection_AsciiString myValuesFont; //!< Font name of values: Courier, Arial, ...
204 Font_FontAspect myValuesStyle; //!< Style of values: OSD_FA_Regular, OSD_FA_Bold, ...
205 Standard_Integer myValuesSize; //!< Size of values: 8, 10, 12, 14, ...
206
207protected:
208
209 Standard_ShortReal myArrowLength;
210 Quantity_Color myGridColor;
211
212 Standard_Boolean myToDrawGrid;
213 Standard_Boolean myToDrawAxes;
214
215 NCollection_Array1<Graphic3d_AxisAspect> myAxes; //!< X, Y and Z axes parameters
216
217};
218#endif // Graphic3d_GraduatedTrihedron_HeaderFile