File indexing completed on 2025-01-18 10:03:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _Graphic3d_GraduatedTrihedron_HeaderFile
0017 #define _Graphic3d_GraduatedTrihedron_HeaderFile
0018
0019 #include <Font_FontAspect.hxx>
0020 #include <NCollection_Array1.hxx>
0021 #include <Quantity_Color.hxx>
0022 #include <Standard_Integer.hxx>
0023 #include <TCollection_AsciiString.hxx>
0024 #include <TCollection_ExtendedString.hxx>
0025
0026 class Graphic3d_CView;
0027
0028
0029
0030
0031 class Graphic3d_GraduatedTrihedron
0032 {
0033
0034 public:
0035
0036
0037
0038 class AxisAspect
0039 {
0040 public:
0041
0042 AxisAspect (const TCollection_ExtendedString theName = "", const Quantity_Color theNameColor = Quantity_NOC_BLACK,
0043 const Quantity_Color theColor = Quantity_NOC_BLACK,
0044 const Standard_Integer theValuesOffset = 10, const Standard_Integer theNameOffset = 30,
0045 const Standard_Integer theTickmarksNumber = 5, const Standard_Integer theTickmarksLength = 10,
0046 const Standard_Boolean theToDrawName = Standard_True,
0047 const Standard_Boolean theToDrawValues = Standard_True,
0048 const Standard_Boolean theToDrawTickmarks = Standard_True)
0049 : myName (theName),
0050 myToDrawName (theToDrawName),
0051 myToDrawTickmarks (theToDrawTickmarks),
0052 myToDrawValues (theToDrawValues),
0053 myNameColor (theNameColor),
0054 myTickmarksNumber (theTickmarksNumber),
0055 myTickmarksLength (theTickmarksLength),
0056 myColor (theColor),
0057 myValuesOffset (theValuesOffset),
0058 myNameOffset (theNameOffset)
0059 { }
0060
0061 public:
0062
0063 void SetName (const TCollection_ExtendedString& theName) { myName = theName; }
0064 const TCollection_ExtendedString& Name() const { return myName; }
0065
0066 Standard_Boolean ToDrawName() const { return myToDrawName; }
0067 void SetDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; }
0068
0069 Standard_Boolean ToDrawTickmarks() const { return myToDrawTickmarks; }
0070 void SetDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; }
0071
0072 Standard_Boolean ToDrawValues() const { return myToDrawValues; }
0073 void SetDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; }
0074
0075 const Quantity_Color& NameColor() const { return myNameColor; }
0076 void SetNameColor (const Quantity_Color& theColor) { myNameColor = theColor; }
0077
0078
0079 const Quantity_Color& Color() const { return myColor; }
0080
0081
0082 void SetColor (const Quantity_Color& theColor) { myColor = theColor; }
0083
0084 Standard_Integer TickmarksNumber() const { return myTickmarksNumber; }
0085 void SetTickmarksNumber (const Standard_Integer theValue) { myTickmarksNumber = theValue; }
0086
0087 Standard_Integer TickmarksLength() const { return myTickmarksLength; }
0088 void SetTickmarksLength (const Standard_Integer theValue) { myTickmarksLength = theValue; }
0089
0090 Standard_Integer ValuesOffset() const { return myValuesOffset; }
0091 void SetValuesOffset (const Standard_Integer theValue) { myValuesOffset = theValue; }
0092
0093 Standard_Integer NameOffset() const { return myNameOffset; }
0094 void SetNameOffset (const Standard_Integer theValue) { myNameOffset = theValue; }
0095
0096 protected:
0097
0098 TCollection_ExtendedString myName;
0099
0100 Standard_Boolean myToDrawName;
0101 Standard_Boolean myToDrawTickmarks;
0102 Standard_Boolean myToDrawValues;
0103
0104 Quantity_Color myNameColor;
0105
0106 Standard_Integer myTickmarksNumber;
0107 Standard_Integer myTickmarksLength;
0108 Quantity_Color myColor;
0109
0110 Standard_Integer myValuesOffset;
0111 Standard_Integer myNameOffset;
0112 };
0113
0114 public:
0115
0116 typedef void (*MinMaxValuesCallback) (Graphic3d_CView*);
0117
0118 public:
0119
0120
0121
0122 Graphic3d_GraduatedTrihedron (const TCollection_AsciiString& theNamesFont = "Arial",
0123 const Font_FontAspect& theNamesStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12,
0124 const TCollection_AsciiString& theValuesFont = "Arial",
0125 const Font_FontAspect& theValuesStyle = Font_FA_Regular, const Standard_Integer theValuesSize = 12,
0126 const Standard_ShortReal theArrowsLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE,
0127 const Standard_Boolean theToDrawGrid = Standard_True, const Standard_Boolean theToDrawAxes = Standard_True)
0128 : myCubicAxesCallback (NULL),
0129 myNamesFont (theNamesFont),
0130 myNamesStyle (theNamesStyle),
0131 myNamesSize (theNamesSize),
0132 myValuesFont (theValuesFont),
0133 myValuesStyle (theValuesStyle),
0134 myValuesSize (theValuesSize),
0135 myArrowsLength (theArrowsLength),
0136 myGridColor (theGridColor),
0137 myToDrawGrid (theToDrawGrid),
0138 myToDrawAxes (theToDrawAxes),
0139 myAxes(0, 2)
0140 {
0141 myAxes (0) = AxisAspect ("X", Quantity_NOC_RED, Quantity_NOC_RED);
0142 myAxes (1) = AxisAspect ("Y", Quantity_NOC_GREEN, Quantity_NOC_GREEN);
0143 myAxes (2) = AxisAspect ("Z", Quantity_NOC_BLUE1, Quantity_NOC_BLUE1);
0144 }
0145
0146 public:
0147
0148 AxisAspect& ChangeXAxisAspect() { return myAxes(0); }
0149 AxisAspect& ChangeYAxisAspect() { return myAxes(1); }
0150 AxisAspect& ChangeZAxisAspect() { return myAxes(2); }
0151
0152 AxisAspect& ChangeAxisAspect (const Standard_Integer theIndex)
0153 {
0154 Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > 2, "Graphic3d_GraduatedTrihedron::ChangeAxisAspect: theIndex is out of bounds [0,2].");
0155 return myAxes (theIndex);
0156 }
0157
0158 const AxisAspect& XAxisAspect() const { return myAxes(0); }
0159 const AxisAspect& YAxisAspect() const { return myAxes(1); }
0160 const AxisAspect& ZAxisAspect() const { return myAxes(2); }
0161
0162 const AxisAspect& AxisAspectAt (const Standard_Integer theIndex) const
0163 {
0164 Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > 2, "Graphic3d_GraduatedTrihedron::AxisAspect: theIndex is out of bounds [0,2].");
0165 return myAxes (theIndex);
0166 }
0167
0168 Standard_ShortReal ArrowsLength() const { return myArrowsLength; }
0169 void SetArrowsLength (const Standard_ShortReal theValue) { myArrowsLength = theValue; }
0170
0171 const Quantity_Color& GridColor() const { return myGridColor; }
0172 void SetGridColor (const Quantity_Color& theColor) {myGridColor = theColor; }
0173
0174 Standard_Boolean ToDrawGrid() const { return myToDrawGrid; }
0175 void SetDrawGrid (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; }
0176
0177 Standard_Boolean ToDrawAxes() const { return myToDrawAxes; }
0178 void SetDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; }
0179
0180 const TCollection_AsciiString& NamesFont() const { return myNamesFont; }
0181 void SetNamesFont (const TCollection_AsciiString& theFont) { myNamesFont = theFont; }
0182
0183 Font_FontAspect NamesFontAspect() const { return myNamesStyle; }
0184 void SetNamesFontAspect (Font_FontAspect theAspect) { myNamesStyle = theAspect; }
0185
0186 Standard_Integer NamesSize() const { return myNamesSize; }
0187 void SetNamesSize (const Standard_Integer theValue) { myNamesSize = theValue; }
0188
0189 const TCollection_AsciiString& ValuesFont () const { return myValuesFont; }
0190 void SetValuesFont (const TCollection_AsciiString& theFont) { myValuesFont = theFont; }
0191
0192 Font_FontAspect ValuesFontAspect() const { return myValuesStyle; }
0193 void SetValuesFontAspect (Font_FontAspect theAspect) { myValuesStyle = theAspect; }
0194
0195 Standard_Integer ValuesSize() const { return myValuesSize; }
0196 void SetValuesSize (const Standard_Integer theValue) { myValuesSize = theValue; }
0197
0198 Standard_Boolean CubicAxesCallback(Graphic3d_CView* theView) const
0199 {
0200 if (myCubicAxesCallback != NULL)
0201 {
0202 myCubicAxesCallback (theView);
0203 return Standard_True;
0204 }
0205 return Standard_False;
0206 }
0207 void SetCubicAxesCallback (const MinMaxValuesCallback theCallback) { myCubicAxesCallback = theCallback; }
0208
0209 protected:
0210
0211 MinMaxValuesCallback myCubicAxesCallback;
0212
0213 TCollection_AsciiString myNamesFont;
0214 Font_FontAspect myNamesStyle;
0215 Standard_Integer myNamesSize;
0216
0217 protected:
0218
0219 TCollection_AsciiString myValuesFont;
0220 Font_FontAspect myValuesStyle;
0221 Standard_Integer myValuesSize;
0222
0223 protected:
0224
0225 Standard_ShortReal myArrowsLength;
0226 Quantity_Color myGridColor;
0227
0228 Standard_Boolean myToDrawGrid;
0229 Standard_Boolean myToDrawAxes;
0230
0231 NCollection_Array1<AxisAspect> myAxes;
0232
0233 };
0234 #endif