+// File: Graphic3d_CGraduatedTrihedron.cxx
+// Created: 6 March 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE SA 2011
#include <Graphic3d_CGraduatedTrihedron.hxx>
-/*============================================================================*/
-/*==== Titre: Graphic3d_CGraduatedTrihedron.hxx */
-/*==== Role : The header file of primitive type "CGraduatedTrihedron" from Graphic3d */
-/*==== */
-/*==== Implementation: This is a primitive type implemented with typedef */
-/*============================================================================*/
+// File: Graphic3d_CGraduatedTrihedron.hxx
+// Created: 6 March 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE SA 2011
#ifndef _Graphic3d_CGraduatedTrihedron_HeaderFile
#define _Graphic3d_CGraduatedTrihedron_HeaderFile
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-typedef CALL_DEF_GRADUATEDTRIHEDRON Graphic3d_CGraduatedTrihedron;
-
-#if defined(__cplusplus) || defined(c_plusplus)
-/*==== Definition de Type ====================================================*/
+#include <Standard_Boolean.hxx>
+#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
+#include <Quantity_Color.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <OSD_FontAspect.hxx>
+
+typedef void (*minMaxValuesCallback)(void*);
+class Graphic3d_CGraduatedTrihedron
+{
+ public:
+ /* Default constructor. Nullifies the view pointer */
+ Graphic3d_CGraduatedTrihedron () : ptrVisual3dView(NULL) {}
+
+ /* Names of axes */
+ TCollection_ExtendedString xname, yname, zname;
+ /* Draw names */
+ Standard_Boolean xdrawname, ydrawname, zdrawname;
+ /* Draw values */
+ Standard_Boolean xdrawvalues, ydrawvalues, zdrawvalues;
+ /* Draw grid */
+ Standard_Boolean drawgrid;
+ /* Draw axes */
+ Standard_Boolean drawaxes;
+ /* Number of splits along axes */
+ Standard_Integer nbx, nby, nbz;
+ /* Offset for drawing values */
+ Standard_Integer xoffset, yoffset, zoffset;
+ /* Offset for drawing names of axes */
+ Standard_Integer xaxisoffset, yaxisoffset, zaxisoffset;
+ /* Draw tickmarks */
+ Standard_Boolean xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
+ /* Length of tickmarks */
+ Standard_Integer xtickmarklength, ytickmarklength, ztickmarklength;
+ /* Grid color */
+ Quantity_Color gridcolor;
+ /* Colors of axis names */
+ Quantity_Color xnamecolor, ynamecolor, znamecolor;
+ /* Colors of axis and values */
+ Quantity_Color xcolor, ycolor, zcolor;
+ /* Font name of names of axes: Courier, Arial, ... */
+ TCollection_AsciiString fontOfNames;
+ /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
+ OSD_FontAspect styleOfNames;
+ /* Size of names of axes: 8, 10, 12, 14, ... */
+ Standard_Integer sizeOfNames;
+ /* Font name of values: Courier, Arial, ... */
+ TCollection_AsciiString fontOfValues;
+ /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
+ OSD_FontAspect styleOfValues;
+ /* Size of values: 8, 10, 12, 14, ... */
+ Standard_Integer sizeOfValues;
+
+ /* Callback function to define boundary box of displayed objects */
+ minMaxValuesCallback cbCubicAxes;
+ void* ptrVisual3dView;
+};
+
const Handle(Standard_Type)& TYPE(Graphic3d_CGraduatedTrihedron);
-/*============================================================================*/
-#endif
#endif /*Graphic3d_CGraduatedTrihedron_HeaderFile*/
---Category: Graduated trihedron
---------------------------------
- GetGraduatedTrihedron(me;
- view : CView from Graphic3d;
- -- Names of axes --
- xname : out CString from Standard;
- yname : out CString from Standard;
- zname : out CString from Standard;
- -- Draw names --
- xdrawname : out Boolean from Standard;
- ydrawname : out Boolean from Standard;
- zdrawname : out Boolean from Standard;
- -- Draw values --
- xdrawvalues : out Boolean from Standard;
- ydrawvalues : out Boolean from Standard;
- zdrawvalues : out Boolean from Standard;
- -- Draw grid --
- drawgrid : out Boolean from Standard;
- -- Draw axes --
- drawaxes : out Boolean from Standard;
- -- Number of splits along axes --
- nbx : out Integer from Standard;
- nby : out Integer from Standard;
- nbz : out Integer from Standard;
- -- Offset for drawing values --
- xoffset : out Integer from Standard;
- yoffset : out Integer from Standard;
- zoffset : out Integer from Standard;
- -- Offset for drawing names of axes --
- xaxisoffset : out Integer from Standard;
- yaxisoffset : out Integer from Standard;
- zaxisoffset : out Integer from Standard;
- -- Draw tickmarks --
- xdrawtickmarks : out Boolean from Standard;
- ydrawtickmarks : out Boolean from Standard;
- zdrawtickmarks : out Boolean from Standard;
- -- Length of tickmarks --
- xtickmarklength : out Integer from Standard;
- ytickmarklength : out Integer from Standard;
- ztickmarklength : out Integer from Standard;
- -- Grid color --
- gridcolor : out Color from Quantity;
- -- X name color --
- xnamecolor : out Color from Quantity;
- -- Y name color --
- ynamecolor : out Color from Quantity;
- -- Z name color --
- znamecolor : out Color from Quantity;
- -- X color of axis and values --
- xcolor : out Color from Quantity;
- -- Y color of axis and values --
- ycolor : out Color from Quantity;
- -- Z color of axis and values --
- zcolor : out Color from Quantity;
- -- Name of font for names of axes --
- fontOfNames : out CString from Standard;
- -- Style of names of axes --
- styleOfNames : out FontAspect from OSD;
- -- Size of names of axes --
- sizeOfNames : out Integer from Standard;
- -- Name of font for values --
- fontOfValues : out CString from Standard;
- -- Style of values --
- styleOfValues : out FontAspect from OSD;
- -- Size of values --
- sizeOfValues : out Integer from Standard)
- ---Purpose: call_togl_graduatedtrihedron_get
- is virtual;
-
GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d;
- cubic : in out CGraduatedTrihedron from Graphic3d;
- -- Names of axes --
- xname : CString from Standard;
- yname : CString from Standard;
- zname : CString from Standard;
- -- Draw names --
- xdrawname : Boolean from Standard;
- ydrawname : Boolean from Standard;
- zdrawname : Boolean from Standard;
- -- Draw values --
- xdrawvalues : Boolean from Standard;
- ydrawvalues : Boolean from Standard;
- zdrawvalues : Boolean from Standard;
- -- Draw grid --
- drawgrid : Boolean from Standard;
- -- Draw axes --
- drawaxes : Boolean from Standard;
- -- Number of splits along axes --
- nbx : Integer from Standard;
- nby : Integer from Standard;
- nbz : Integer from Standard;
- -- Offset for drawing values --
- xoffset : Integer from Standard;
- yoffset : Integer from Standard;
- zoffset : Integer from Standard;
- -- Offset for drawing names of axes --
- xaxisoffset : Integer from Standard;
- yaxisoffset : Integer from Standard;
- zaxisoffset : Integer from Standard;
- -- Draw tickmarks --
- xdrawtickmarks : Boolean from Standard;
- ydrawtickmarks : Boolean from Standard;
- zdrawtickmarks : Boolean from Standard;
- -- Length of tickmarks --
- xtickmarklength : Integer from Standard;
- ytickmarklength : Integer from Standard;
- ztickmarklength : Integer from Standard;
- -- Grid color --
- gridcolor : Color from Quantity;
- -- X name color --
- xnamecolor : Color from Quantity;
- -- Y name color --
- ynamecolor : Color from Quantity;
- -- Z name color --
- znamecolor : Color from Quantity;
- -- X color of axis and values --
- xcolor : Color from Quantity;
- -- Y color of axis and values --
- ycolor : Color from Quantity;
- -- Z color of axis and values --
- zcolor : Color from Quantity;
- -- Name of font for names of axes --
- fontOfNames : CString from Standard;
- -- Style of names of axes --
- styleOfNames : FontAspect from OSD;
- -- Size of names of axes --
- sizeOfNames : Integer from Standard;
- -- Name of font for values --
- fontOfValues : CString from Standard;
- -- Style of values --
- styleOfValues : FontAspect from OSD;
- -- Size of values --
- sizeOfValues : Integer from Standard)
+ cubic : CGraduatedTrihedron from Graphic3d)
---Purpose: call_togl_graduatedtrihedron_display
is deferred;
{
}
-void Graphic3d_GraphicDriver::GetGraduatedTrihedron(const Graphic3d_CView&,
- /* Names of axes */
- Standard_CString&,
- Standard_CString&,
- Standard_CString&,
- /* Draw names */
- Standard_Boolean&,
- Standard_Boolean&,
- Standard_Boolean&,
- /* Draw values */
- Standard_Boolean&,
- Standard_Boolean&,
- Standard_Boolean&,
- /* Draw grid */
- Standard_Boolean&,
- /* Draw axes */
- Standard_Boolean&,
- /* Number of splits along axes */
- Standard_Integer&,
- Standard_Integer&,
- Standard_Integer&,
- /* Offset for drawing values */
- Standard_Integer&,
- Standard_Integer&,
- Standard_Integer&,
- /* Offset for drawing names of axes */
- Standard_Integer&,
- Standard_Integer&,
- Standard_Integer&,
- /* Draw tickmarks */
- Standard_Boolean&,
- Standard_Boolean&,
- Standard_Boolean&,
- /* Length of tickmarks */
- Standard_Integer&,
- Standard_Integer&,
- Standard_Integer&,
- /* Grid color */
- Quantity_Color&,
- /* X name color */
- Quantity_Color&,
- /* Y name color */
- Quantity_Color&,
- /* Z name color */
- Quantity_Color&,
- /* X color of axis and values */
- Quantity_Color&,
- /* Y color of axis and values */
- Quantity_Color&,
- /* Z color of axis and values */
- Quantity_Color&,
- /* Name of font for names of axes */
- Standard_CString&,
- /* Style of names of axes */
- OSD_FontAspect&,
- /* Size of names of axes */
- Standard_Integer&,
- /* Name of font for values */
- Standard_CString&,
- /* Style of values */
- OSD_FontAspect&,
- /* Size of values */
- Standard_Integer&) const
-{
-}
-
void Graphic3d_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView&,
- Graphic3d_CGraduatedTrihedron&,
- /* Names of axes */
- const Standard_CString,
- const Standard_CString,
- const Standard_CString,
- /* Draw names */
- const Standard_Boolean,
- const Standard_Boolean,
- const Standard_Boolean,
- /* Draw values */
- const Standard_Boolean,
- const Standard_Boolean,
- const Standard_Boolean,
- /* Draw grid */
- const Standard_Boolean,
- /* Draw axes */
- const Standard_Boolean,
- /* Number of splits along axes */
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- /* Offset for drawing values */
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- /* Offset for drawing names of axes */
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- /* Draw tickmarks */
- const Standard_Boolean,
- const Standard_Boolean,
- const Standard_Boolean,
- /* Length of tickmarks */
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- /* Grid color */
- const Quantity_Color&,
- /* X name color */
- const Quantity_Color&,
- /* Y name color */
- const Quantity_Color&,
- /* Z name color */
- const Quantity_Color&,
- /* X color of axis and values */
- const Quantity_Color&,
- /* Y color of axis and values */
- const Quantity_Color&,
- /* Z color of axis and values */
- const Quantity_Color&,
- /* Name of font for names of axes */
- const Standard_CString,
- /* Style of names of axes */
- const OSD_FontAspect,
- /* Size of names of axes */
- const Standard_Integer,
- /* Name of font for values */
- const Standard_CString,
- /* Style of values */
- const OSD_FontAspect,
- /* Size of values */
- const Standard_Integer)
+ const Graphic3d_CGraduatedTrihedron&)
{
}
-
-// File Graphic3d_Group_10.cxx (Text)
-// Created Fevrier 1992
-// Author NW,JPB,CAL
-
-//-Copyright MatraDatavision 1991,1992
+// File: Graphic3d_Group_10.cxx (Text)
+// Created: Fevrier 1992
+// Author: NW,JPB,CAL
+// Copyright: OPEN CASCADE 1992
//-Version
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax
- ) {
-
- if (IsDeleted ()) return;
-
- MyIsEmpty = Standard_False;
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
-
- MyGraphicDriver->Text
-(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
-
- Update ();
-
+ )
+{
+ if (IsDeleted ()) return;
+
+ MyIsEmpty = Standard_False;
+
+ // Min-Max Update
+ if (EvalMinMax) {
+ Standard_Real X, Y, Z;
+ APoint.Coord (X, Y, Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
+ if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
+ if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
+ if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ }
+
+ MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
+
+ Update ();
}
void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax
- ) {
-
- if (IsDeleted ()) return;
-
- MyIsEmpty = Standard_False;
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
-
- MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
-
- Update ();
-
+ )
+{
+ if (IsDeleted ()) return;
+
+ MyIsEmpty = Standard_False;
+
+ // Min-Max Update
+ if (EvalMinMax) {
+ Standard_Real X, Y, Z;
+ APoint.Coord (X, Y, Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
+ if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
+ if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
+ if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ }
+
+ MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
+
+ Update ();
}
void Graphic3d_Group::Text (
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax
- ) {
-
- if (IsDeleted ()) return;
-
- if (! AText.IsAscii ()) return;
-
- MyIsEmpty = Standard_False;
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
-
- MyGraphicDriver->Text
-(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
-
- Update ();
-
+ )
+{
+ if (IsDeleted ()) return;
+
+ MyIsEmpty = Standard_False;
+
+ // Min-Max Update
+ if (EvalMinMax) {
+ Standard_Real X, Y, Z;
+ APoint.Coord (X, Y, Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
+ if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
+ if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
+ if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ }
+
+ MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
+
+ Update ();
}
void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax
- ) {
-
- if (IsDeleted ()) return;
-
- if (! AText.IsAscii ()) return;
-
- MyIsEmpty = Standard_False;
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
-
- MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
-
- Update ();
-
+ )
+{
+ if (IsDeleted ()) return;
+
+ MyIsEmpty = Standard_False;
+
+ // Min-Max Update
+ if (EvalMinMax) {
+ Standard_Real X, Y, Z;
+ APoint.Coord (X, Y, Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
+ if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
+ if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
+ if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ }
+
+ MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
+
+ Update ();
}
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
+#include <Graphic3d_CGraduatedTrihedron.hxx>
#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
from higher API */
CALL_DEF_VIEW *aview
#endif
);
-void EXPORT call_togl_graduatedtrihedron_get (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- /* View id */
- CALL_DEF_VIEW* aview,
- /* Graduated trihedron data */
- CALL_DEF_GRADUATEDTRIHEDRON* cubic
-#endif
-);
void EXPORT call_togl_graduatedtrihedron_display (
#ifdef INTERFACEGRAPHIC_PROTOTYPE
/* View id */
CALL_DEF_VIEW* aview,
/* Graduated trihedron data */
- CALL_DEF_GRADUATEDTRIHEDRON* cubic
+ const Graphic3d_CGraduatedTrihedron &cubic
#endif
);
typedef struct {
- char *string;
+ unsigned short *string;
CALL_DEF_POINT Position;
int VAlign;
- bool Zoomable;
+ bool Zoomable;
} CALL_DEF_TEXT;
#include <Aspect_GraphicCallbackProc.hxx>
#endif
-#include <OSD_FontAspect.hxx>
-
typedef float CALL_DEF_MATRIX4X4[4][4];
/* SOMMET */
} CALL_DEF_PICK;
-/* Graduated trihedron */
-typedef void (*minMaxValuesCallback)(void*);
-typedef struct
-{
- /* Names of axes */
- char *xname, *yname, *zname;
- /* Draw names */
- unsigned char xdrawname, ydrawname, zdrawname;
- /* Draw values */
- unsigned char xdrawvalues, ydrawvalues, zdrawvalues;
- /* Draw grid */
- unsigned char drawgrid;
- /* Draw axes */
- unsigned char drawaxes;
- /* Number of splits along axes */
- unsigned int nbx, nby, nbz;
- /* Offset for drawing values */
- int xoffset, yoffset, zoffset;
- /* Offset for drawing names of axes */
- int xaxisoffset, yaxisoffset, zaxisoffset;
- /* Draw tickmarks */
- unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
- /* Length of tickmarks */
- unsigned int xtickmarklength, ytickmarklength, ztickmarklength;
- /* Grid color */
- float gridcolor[3];
- /* X name color */
- float xnamecolor[3];
- /* Y name color */
- float ynamecolor[3];
- /* Z name color */
- float znamecolor[3];
- /* X color of axis and values */
- float xcolor[3];
- /* Y color of axis and values */
- float ycolor[3];
- /* Z color of axis and values */
- float zcolor[3];
- /* Font name of names of axes: Courier, Arial, ... */
- char* fontOfNames;
- /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
- OSD_FontAspect styleOfNames;
- /* Size of names of axes: 8, 10, 12, 14, ... */
- int sizeOfNames;
- /* Font name of values: Courier, Arial, ... */
- char* fontOfValues;
- /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
- OSD_FontAspect styleOfValues;
- /* Size of values: 8, 10, 12, 14, ... */
- int sizeOfValues;
-
- /* Callback function to define boundary box of displayed objects */
- minMaxValuesCallback cbCubicAxes;
- void* ptrVisual3dView;
-
-} CALL_DEF_GRADUATEDTRIHEDRON;
-
#endif /* InterfaceGraphic_Visual3dHeader */
};
typedef TEL_MATRIX3_DATA* tel_matrix3_data;
-struct TEL_TEXT_DATA
-{
- TEL_POINT attach_pt;
- Tint length;
- Tchar* data;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_TEXT_DATA* tel_text_data;
-
struct TEL_ALIGN_DATA
{
Tint Hmode;
typedef signed char Tchar;
typedef char Tbool;
typedef unsigned int Tuint;
+/* szv: Techar is an Extended character */
+typedef unsigned short Techar;
#define TGL_SP 1
#define TGL_DP 0
return -1;
}
-void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text,
- const Standard_Boolean is2d )
+void OpenGl_FontMgr::render_text( const Standard_Integer id, const wchar_t* text,
+ const Standard_Boolean is2d )
{
#ifdef TRACE
cout << "TKOpenGl::render_text\n"
if ( !is2d ) {
if ( !enableDepthTest )
glEnable(GL_DEPTH_TEST);
- }
+ }
else if ( enableDepthTest ) {
glDisable(GL_DEPTH_TEST);
}
}
-void OpenGl_FontMgr::render_text( const char* text, const Standard_Boolean is2d ){
+void OpenGl_FontMgr::render_text ( const wchar_t* text, const Standard_Boolean is2d )
+{
render_text( _CurrentFontId, text, is2d );
}
-
-const FTFont* OpenGl_FontMgr::fontById( const Standard_Integer id ){
+const FTFont* OpenGl_FontMgr::fontById (const Standard_Integer id)
+{
return _FontCache.IsBound( id ) ? _FontCache.Find( id ).Font: NULL;
}
-Standard_ShortReal OpenGl_FontMgr::computeWidth( const Standard_Integer id, const char* str ){
+Standard_ShortReal OpenGl_FontMgr::computeWidth( const Standard_Integer id, const wchar_t* text )
+{
if( !_FontCache.IsBound( id ) )
return 0.f;
OGLFont_Cache cache = _FontCache.Find( id );
- Standard_ShortReal w = cache.Font->Advance( str );
+ Standard_ShortReal w = cache.Font->Advance( text );
return w;
}
-void OpenGl_FontMgr::setCurrentScale( const Standard_ShortReal xScale,
- const Standard_ShortReal yScale)
+void OpenGl_FontMgr::setCurrentScale (const Standard_ShortReal xScale,
+ const Standard_ShortReal yScale)
{
_XCurrentScale = xScale;
_YCurrentScale = yScale;
#include <Image_ColorImage.hxx>
#include <Quantity_Color.hxx>
-void dump_texture( int id) {
+void dump_texture( int id)
+{
Handle(AlienImage_BMPAlienData) image = new AlienImage_BMPAlienData();
if (!glIsTexture(id))
#ifndef OPENGL_FONT_MGR_H
#define OPENGL_FONT_MGR_H
-
#ifdef WNT
# include <windows.h>
# include <stdlib.h>
class OpenGl_FontMgr
{
-public:
+ public:
static OpenGl_FontMgr* instance();
int request_font( const Handle(TCollection_HAsciiString)& fontName,
- const OSD_FontAspect fontAspect,
- const Standard_Integer fontHeight );
+ const OSD_FontAspect fontAspect,
+ const Standard_Integer fontHeight );
void render_text( const Standard_Integer id,
- const char* text,
- const Standard_Boolean is2d = 0 );
+ const wchar_t* text,
+ const Standard_Boolean is2d = Standard_False );
//render text by last requested font
- void render_text( const char* text, const Standard_Boolean is2d = 0 );
+ void render_text( const wchar_t* text,
+ const Standard_Boolean is2d = Standard_False );
//returns direct access to FTGL font
//Warning: don't change font pointer.
const FTFont* fontById( const Standard_Integer id );
//returns width of string
- Standard_ShortReal computeWidth( const Standard_Integer id, const char* str );
+ Standard_ShortReal computeWidth( const Standard_Integer id, const wchar_t *str );
bool requestFontList( Graphic3d_NListOfHAsciiString& );
---Category: Graduated trihedron
--------------------------------
- GetGraduatedTrihedron(me;
- view : CView from Graphic3d;
- -- Names of axes --
- xname : out CString from Standard;
- yname : out CString from Standard;
- zname : out CString from Standard;
- -- Draw names --
- xdrawname : out Boolean from Standard;
- ydrawname : out Boolean from Standard;
- zdrawname : out Boolean from Standard;
- -- Draw values --
- xdrawvalues : out Boolean from Standard;
- ydrawvalues : out Boolean from Standard;
- zdrawvalues : out Boolean from Standard;
- -- Draw grid --
- drawgrid : out Boolean from Standard;
- -- Draw axes --
- drawaxes : out Boolean from Standard;
- -- Number of splits along axes --
- nbx : out Integer from Standard;
- nby : out Integer from Standard;
- nbz : out Integer from Standard;
- -- Offset for drawing values --
- xoffset : out Integer from Standard;
- yoffset : out Integer from Standard;
- zoffset : out Integer from Standard;
- -- Offset for drawing names of axes --
- xaxisoffset : out Integer from Standard;
- yaxisoffset : out Integer from Standard;
- zaxisoffset : out Integer from Standard;
- -- Draw tickmarks --
- xdrawtickmarks : out Boolean from Standard;
- ydrawtickmarks : out Boolean from Standard;
- zdrawtickmarks : out Boolean from Standard;
- -- Length of tickmarks --
- xtickmarklength : out Integer from Standard;
- ytickmarklength : out Integer from Standard;
- ztickmarklength : out Integer from Standard;
- -- Grid color --
- gridcolor : out Color from Quantity;
- -- X name color --
- xnamecolor : out Color from Quantity;
- -- Y name color --
- ynamecolor : out Color from Quantity;
- -- Z name color --
- znamecolor : out Color from Quantity;
- -- X color of axis and values --
- xcolor : out Color from Quantity;
- -- Y color of axis and values --
- ycolor : out Color from Quantity;
- -- Z color of axis and values --
- zcolor : out Color from Quantity;
- -- Name of font for names of axes --
- fontOfNames : out CString from Standard;
- -- Style of names of axes --
- styleOfNames : out FontAspect from OSD;
- -- Size of names of axes --
- sizeOfNames : out Integer from Standard;
- -- Name of font for values --
- fontOfValues : out CString from Standard;
- -- Style of values --
- styleOfValues : out FontAspect from OSD;
- -- Size of values --
- sizeOfValues : out Integer from Standard)
- ---Purpose: call_togl_graduatedtrihedron_get
- is redefined static;
-
GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d;
- cubic : in out CGraduatedTrihedron from Graphic3d;
- -- Names of axes --
- xname : CString from Standard;
- yname : CString from Standard;
- zname : CString from Standard;
- -- Draw names --
- xdrawname : Boolean from Standard;
- ydrawname : Boolean from Standard;
- zdrawname : Boolean from Standard;
- -- Draw values --
- xdrawvalues : Boolean from Standard;
- ydrawvalues : Boolean from Standard;
- zdrawvalues : Boolean from Standard;
- -- Draw grid --
- drawgrid : Boolean from Standard;
- -- Draw axes --
- drawaxes : Boolean from Standard;
- -- Number of splits along axes --
- nbx : Integer from Standard;
- nby : Integer from Standard;
- nbz : Integer from Standard;
- -- Offset for drawing values --
- xoffset : Integer from Standard;
- yoffset : Integer from Standard;
- zoffset : Integer from Standard;
- -- Offset for drawing names of axes --
- xaxisoffset : Integer from Standard;
- yaxisoffset : Integer from Standard;
- zaxisoffset : Integer from Standard;
- -- Draw tickmarks --
- xdrawtickmarks : Boolean from Standard;
- ydrawtickmarks : Boolean from Standard;
- zdrawtickmarks : Boolean from Standard;
- -- Length of tickmarks --
- xtickmarklength : Integer from Standard;
- ytickmarklength : Integer from Standard;
- ztickmarklength : Integer from Standard;
- -- Grid color --
- gridcolor : Color from Quantity;
- -- X name color --
- xnamecolor : Color from Quantity;
- -- Y name color --
- ynamecolor : Color from Quantity;
- -- Z name color --
- znamecolor : Color from Quantity;
- -- X color of axis and values --
- xcolor : Color from Quantity;
- -- Y color of axis and values --
- ycolor : Color from Quantity;
- -- Z color of axis and values --
- zcolor : Color from Quantity;
- -- Name of font for names of axes --
- fontOfNames : CString from Standard;
- -- Style of names of axes --
- styleOfNames : FontAspect from OSD;
- -- Size of names of axes --
- sizeOfNames : Integer from Standard;
- -- Name of font for values --
- fontOfValues : CString from Standard;
- -- Style of values --
- styleOfValues : FontAspect from OSD;
- -- Size of values --
- sizeOfValues : Integer from Standard)
+ cubic : CGraduatedTrihedron from Graphic3d)
---Purpose: call_togl_graduatedtrihedron_display
is redefined static;
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
- const Standard_Boolean
+ const Standard_Boolean EvalMinMax
)
{
-
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
-
- CALL_DEF_TEXT atext;
- APoint.Coord (X, Y, Z);
- atext.Position.x = float (X);
- atext.Position.y = float (Y);
- atext.Position.z = float (Z);
- atext.Height = float (AHeight);
- if (atext.Height < 0)
- atext.Height = DefaultTextHeight();
- atext.Angle = float (AAngle);
- atext.Path = int (ATp);
- atext.HAlign = int (AHta);
- atext.VAlign = int (AVta);
- atext.string = (char *) AText;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_text (&MyCGroup, &atext);
-
+ TCollection_ExtendedString TheText(AText);
+ OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,AAngle,ATp,AHta,AVta,EvalMinMax);
}
void OpenGl_GraphicDriver::Text
const Standard_CString AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
- const Standard_Boolean
+ const Standard_Boolean EvalMinMax
)
{
-
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
-
- CALL_DEF_TEXT atext;
- APoint.Coord (X, Y, Z);
- atext.Position.x = float (X);
- atext.Position.y = float (Y);
- atext.Position.z = float (Z);
- atext.Height = float (AHeight);
- if (atext.Height < 0)
- atext.Height = DefaultTextHeight();
- atext.Angle = float (Standard_PI / 2.);
- atext.Path = int (Graphic3d_TP_RIGHT);
- atext.HAlign = int (Graphic3d_HTA_LEFT);
- atext.VAlign = int (Graphic3d_VTA_BOTTOM);
- atext.string = (char *) AText;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_text (&MyCGroup, &atext);
-
+ TCollection_ExtendedString TheText(AText);
+ OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,EvalMinMax);
}
void OpenGl_GraphicDriver::Text
const Standard_Boolean
)
{
-
-
Graphic3d_CGroup MyCGroup = ACGroup;
- Standard_Real X, Y, Z;
CALL_DEF_TEXT atext;
- TCollection_AsciiString ascii (AText,'?');
+ Standard_Real X, Y, Z;
APoint.Coord (X, Y, Z);
atext.Position.x = float (X);
atext.Position.y = float (Y);
atext.Path = int (ATp);
atext.HAlign = int (AHta);
atext.VAlign = int (AVta);
- atext.string = (Standard_PCharacter)ascii.ToCString ();
+ atext.string = (unsigned short *)AText.ToExtString ();
if (MyTraceLevel) {
PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1);
}
call_togl_text (&MyCGroup, &atext);
- ascii.Clear ();
-
}
void OpenGl_GraphicDriver::Text
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean
- ) {
-
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- CALL_DEF_TEXT atext;
- TCollection_AsciiString ascii (AText, '?');
-
- APoint.Coord (X, Y, Z);
- atext.Position.x = float (X);
- atext.Position.y = float (Y);
- atext.Position.z = float (Z);
- atext.Height = float (AHeight);
- if (atext.Height < 0)
- atext.Height = DefaultTextHeight();
- atext.Angle = float (Standard_PI / 2.);
- atext.Path = int (Graphic3d_TP_RIGHT);
- atext.HAlign = int (Graphic3d_HTA_LEFT);
- atext.VAlign = int (Graphic3d_VTA_BOTTOM);
- atext.string = (Standard_PCharacter)ascii.ToCString ();
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_text (&MyCGroup, &atext);
- ascii.Clear ();
-
- }
+ )
+{
+ Graphic3d_CGroup MyCGroup = ACGroup;
+
+ CALL_DEF_TEXT atext;
+
+ Standard_Real X, Y, Z;
+ APoint.Coord (X, Y, Z);
+ atext.Position.x = float (X);
+ atext.Position.y = float (Y);
+ atext.Position.z = float (Z);
+ atext.Height = float (AHeight);
+ if (atext.Height < 0)
+ atext.Height = DefaultTextHeight();
+ atext.Angle = float (Standard_PI / 2.);
+ atext.Path = int (Graphic3d_TP_RIGHT);
+ atext.HAlign = int (Graphic3d_HTA_LEFT);
+ atext.VAlign = int (Graphic3d_VTA_BOTTOM);
+ atext.string = (unsigned short *)AText.ToExtString ();
+
+ if (MyTraceLevel) {
+ PrintFunction ("call_togl_text");
+ PrintCGroup (MyCGroup, 1);
+ }
+ call_togl_text (&MyCGroup, &atext);
+}
{
#ifdef BUC61044
Graphic3d_CView MyCView = view;
- if ( call_togl_isdepthtest( &MyCView ) )
- return Standard_True;
+ return (call_togl_isdepthtest( &MyCView ) != 0);
#endif
}
{
#ifdef BUC61045
Graphic3d_CView MyCView = view;
- if ( call_togl_isgllight( &MyCView ) )
- return Standard_True;
+ return (call_togl_isgllight( &MyCView ) != 0);
#endif
}
-
// File OpenGl_GraphicDriver_9.cxx
// Created 1/08/97
// Author PCT
call_togl_set_gradient_type( ACView.WsId, FillType);
}
-void OpenGl_GraphicDriver::GetGraduatedTrihedron(const Graphic3d_CView& view,
- /* Names of axes */
- Standard_CString& xname,
- Standard_CString& yname,
- Standard_CString& zname,
- /* Draw names */
- Standard_Boolean& xdrawname,
- Standard_Boolean& ydrawname,
- Standard_Boolean& zdrawname,
- /* Draw values */
- Standard_Boolean& xdrawvalues,
- Standard_Boolean& ydrawvalues,
- Standard_Boolean& zdrawvalues,
- /* Draw grid */
- Standard_Boolean& drawgrid,
- /* Draw axes */
- Standard_Boolean& drawaxes,
- /* Number of splits along axes */
- Standard_Integer& nbx,
- Standard_Integer& nby,
- Standard_Integer& nbz,
- /* Offset for drawing values */
- Standard_Integer& xoffset,
- Standard_Integer& yoffset,
- Standard_Integer& zoffset,
- /* Offset for drawing names of axes */
- Standard_Integer& xaxisoffset,
- Standard_Integer& yaxisoffset,
- Standard_Integer& zaxisoffset,
- /* Draw tickmarks */
- Standard_Boolean& xdrawtickmarks,
- Standard_Boolean& ydrawtickmarks,
- Standard_Boolean& zdrawtickmarks,
- /* Length of tickmarks */
- Standard_Integer& xtickmarklength,
- Standard_Integer& ytickmarklength,
- Standard_Integer& ztickmarklength,
- /* Grid color */
- Quantity_Color& gridcolor,
- /* X name color */
- Quantity_Color& xnamecolor,
- /* Y name color */
- Quantity_Color& ynamecolor,
- /* Z name color */
- Quantity_Color& znamecolor,
- /* X color of axis and values */
- Quantity_Color& xcolor,
- /* Y color of axis and values */
- Quantity_Color& ycolor,
- /* Z color of axis and values */
- Quantity_Color& zcolor,
- /* Name of font for names of axes */
- Standard_CString& fontOfNames,
- /* Style of names of axes */
- OSD_FontAspect& styleOfNames,
- /* Size of names of axes */
- Standard_Integer& sizeOfNames,
- /* Name of font for values */
- Standard_CString& fontOfValues,
- /* Style of values */
- OSD_FontAspect& styleOfValues,
- /* Size of values */
- Standard_Integer& sizeOfValues) const
-{
- Graphic3d_CGraduatedTrihedron cubic;
- call_togl_graduatedtrihedron_get((CALL_DEF_VIEW*)&view, &cubic);
-
- /* Names of axes */
- xname = cubic.xname;
- yname = cubic.yname;
- zname = cubic.zname;
- /* Draw names */
- xdrawname = cubic.xdrawname;
- ydrawname = cubic.ydrawname;
- zdrawname = cubic.zdrawname;
- /* Draw values */
- xdrawvalues = cubic.xdrawvalues;
- ydrawvalues = cubic.ydrawvalues;
- zdrawvalues = cubic.zdrawvalues;
- /* Draw grid */
- drawgrid = cubic.drawgrid;
- /* Draw axes */
- drawaxes = cubic.drawaxes;
- /* Number of splits along axes */
- nbx = cubic.nbx;
- nby = cubic.nby;
- nbz = cubic.nbz;
- /* Offset for drawing values */
- xoffset = cubic.xoffset;
- yoffset = cubic.yoffset;
- zoffset = cubic.zoffset;
- /* Offset for drawing names of axes */
- xaxisoffset = cubic.xaxisoffset;
- yaxisoffset = cubic.yaxisoffset;
- zaxisoffset = cubic.zaxisoffset;
- /* Draw tickmarks */
- xdrawtickmarks = cubic.xdrawtickmarks;
- ydrawtickmarks = cubic.ydrawtickmarks;
- zdrawtickmarks = cubic.zdrawtickmarks;
- /* Length of tickmarks */
- xtickmarklength = cubic.xtickmarklength;
- ytickmarklength = cubic.ytickmarklength;
- ztickmarklength = cubic.ztickmarklength;
- /* Grid color */
- gridcolor.SetValues(cubic.gridcolor[0], cubic.gridcolor[1], cubic.gridcolor[2], Quantity_TOC_RGB);
- /* X name color */
- xnamecolor.SetValues(cubic.xnamecolor[0], cubic.xnamecolor[1], cubic.xnamecolor[2], Quantity_TOC_RGB);
- /* Y name color */
- ynamecolor.SetValues(cubic.ynamecolor[0], cubic.ynamecolor[1], cubic.ynamecolor[2], Quantity_TOC_RGB);
- /* Z name color */
- znamecolor.SetValues(cubic.znamecolor[0], cubic.znamecolor[1], cubic.znamecolor[2], Quantity_TOC_RGB);
- /* X color of axis and values */
- xcolor.SetValues(cubic.xcolor[0], cubic.xcolor[1], cubic.xcolor[2], Quantity_TOC_RGB);
- /* Y color of axis and values */
- ycolor.SetValues(cubic.ycolor[0], cubic.ycolor[1], cubic.ycolor[2], Quantity_TOC_RGB);
- /* Z color of axis and values */
- zcolor.SetValues(cubic.zcolor[0], cubic.zcolor[1], cubic.zcolor[2], Quantity_TOC_RGB);
- /* Name of font for names of axes */
- fontOfNames = cubic.fontOfNames;
- /* Style of names of axes */
- styleOfNames = cubic.styleOfNames;
- /* Size of names of axes */
- sizeOfNames = cubic.sizeOfNames;
- /* Name of font for values */
- fontOfValues = cubic.fontOfValues;
- /* Style of values */
- styleOfValues = cubic.styleOfValues;
- /* Size of values */
- sizeOfValues = cubic.sizeOfValues;
- /* Name of font for names of axes */
- fontOfNames = cubic.fontOfNames;
- /* Style of names of axes */
- styleOfNames = cubic.styleOfNames;
- /* Size of names of axes */
- sizeOfNames = cubic.sizeOfNames;
- /* Name of font for values */
- fontOfValues = cubic.fontOfValues;
- /* Style of values */
- styleOfValues = cubic.styleOfValues;
- /* Size of values */
- sizeOfValues = cubic.sizeOfValues;
-}
-
void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& view,
- Graphic3d_CGraduatedTrihedron& cubic,
- /* Names of axes */
- const Standard_CString xname,
- const Standard_CString yname,
- const Standard_CString zname,
- /* Draw names */
- const Standard_Boolean xdrawname,
- const Standard_Boolean ydrawname,
- const Standard_Boolean zdrawname,
- /* Draw values */
- const Standard_Boolean xdrawvalues,
- const Standard_Boolean ydrawvalues,
- const Standard_Boolean zdrawvalues,
- /* Draw grid */
- const Standard_Boolean drawgrid,
- /* Draw axes */
- const Standard_Boolean drawaxes,
- /* Number of splits along axes */
- const Standard_Integer nbx,
- const Standard_Integer nby,
- const Standard_Integer nbz,
- /* Offset for drawing values */
- const Standard_Integer xoffset,
- const Standard_Integer yoffset,
- const Standard_Integer zoffset,
- /* Offset for drawing names of axes */
- const Standard_Integer xaxisoffset,
- const Standard_Integer yaxisoffset,
- const Standard_Integer zaxisoffset,
- /* Draw tickmarks */
- const Standard_Boolean xdrawtickmarks,
- const Standard_Boolean ydrawtickmarks,
- const Standard_Boolean zdrawtickmarks,
- /* Length of tickmarks */
- const Standard_Integer xtickmarklength,
- const Standard_Integer ytickmarklength,
- const Standard_Integer ztickmarklength,
- /* Grid color */
- const Quantity_Color& gridcolor,
- /* X name color */
- const Quantity_Color& xnamecolor,
- /* Y name color */
- const Quantity_Color& ynamecolor,
- /* Z name color */
- const Quantity_Color& znamecolor,
- /* X color of axis and values */
- const Quantity_Color& xcolor,
- /* Y color of axis and values */
- const Quantity_Color& ycolor,
- /* Z color of axis and values */
- const Quantity_Color& zcolor,
- /* Name of font for names of axes */
- const Standard_CString fontOfNames,
- /* Style of names of axes */
- const OSD_FontAspect styleOfNames,
- /* Size of names of axes */
- const Standard_Integer sizeOfNames,
- /* Name of font for values */
- const Standard_CString fontOfValues,
- /* Style of values */
- const OSD_FontAspect styleOfValues,
- /* Size of values */
- const Standard_Integer sizeOfValues)
+ const Graphic3d_CGraduatedTrihedron& cubic)
{
- /* Names of axes */
- cubic.xname = (char*) xname;
- cubic.yname = (char*) yname;
- cubic.zname = (char*) zname;
- /* Draw names */
- cubic.xdrawname = xdrawname;
- cubic.ydrawname = ydrawname;
- cubic.zdrawname = zdrawname;
- /* Draw values */
- cubic.xdrawvalues = xdrawvalues;
- cubic.ydrawvalues = ydrawvalues;
- cubic.zdrawvalues = zdrawvalues;
- /* Draw grid */
- cubic.drawgrid = drawgrid;
- /* Draw axes */
- cubic.drawaxes = drawaxes;
- /* Number of splits along axes */
- cubic.nbx = nbx;
- cubic.nby = nby;
- cubic.nbz = nbz;
- /* Offset for drawing values */
- cubic.xoffset = xoffset;
- cubic.yoffset = yoffset;
- cubic.zoffset = zoffset;
- /* Offset for drawing names of axes */
- cubic.xaxisoffset = xaxisoffset;
- cubic.yaxisoffset = yaxisoffset;
- cubic.zaxisoffset = zaxisoffset;
- /* Draw tickmarks */
- cubic.xdrawtickmarks = xdrawtickmarks;
- cubic.ydrawtickmarks = ydrawtickmarks;
- cubic.zdrawtickmarks = zdrawtickmarks;
- /* Length of tickmarks */
- cubic.xtickmarklength = xtickmarklength;
- cubic.ytickmarklength = ytickmarklength;
- cubic.ztickmarklength = ztickmarklength;
- /* Grid color */
- cubic.gridcolor[0] = (Standard_ShortReal) gridcolor.Red();
- cubic.gridcolor[1] = (Standard_ShortReal) gridcolor.Green();
- cubic.gridcolor[2] = (Standard_ShortReal) gridcolor.Blue();
- /* X name color */
- cubic.xnamecolor[0] = (Standard_ShortReal) xnamecolor.Red();
- cubic.xnamecolor[1] = (Standard_ShortReal) xnamecolor.Green();
- cubic.xnamecolor[2] = (Standard_ShortReal) xnamecolor.Blue();
- /* Y name color */
- cubic.ynamecolor[0] = (Standard_ShortReal) ynamecolor.Red();
- cubic.ynamecolor[1] = (Standard_ShortReal) ynamecolor.Green();
- cubic.ynamecolor[2] = (Standard_ShortReal) ynamecolor.Blue();
- /* Z name color */
- cubic.znamecolor[0] = (Standard_ShortReal) znamecolor.Red();
- cubic.znamecolor[1] = (Standard_ShortReal) znamecolor.Green();
- cubic.znamecolor[2] = (Standard_ShortReal) znamecolor.Blue();
- /* X color of axis and values */
- cubic.xcolor[0] = (Standard_ShortReal) xcolor.Red();
- cubic.xcolor[1] = (Standard_ShortReal) xcolor.Green();
- cubic.xcolor[2] = (Standard_ShortReal) xcolor.Blue();
- /* Y color of axis and values */
- cubic.ycolor[0] = (Standard_ShortReal) ycolor.Red();
- cubic.ycolor[1] = (Standard_ShortReal) ycolor.Green();
- cubic.ycolor[2] = (Standard_ShortReal) ycolor.Blue();
- /* Z color of axis and values */
- cubic.zcolor[0] = (Standard_ShortReal) zcolor.Red();
- cubic.zcolor[1] = (Standard_ShortReal) zcolor.Green();
- cubic.zcolor[2] = (Standard_ShortReal) zcolor.Blue();
- /* Name of font for names of axes */
- cubic.fontOfNames = (char*) fontOfNames;
- /* Style of names of axes */
- cubic.styleOfNames = styleOfNames;
- /* Size of names of axes */
- cubic.sizeOfNames = sizeOfNames;
- /* Name of font for values */
- cubic.fontOfValues = (char*) fontOfValues;
- /* Style of values */
- cubic.styleOfValues = styleOfValues;
- /* Size of values */
- cubic.sizeOfValues = sizeOfValues;
- /* Name of font for names of axes */
- cubic.fontOfNames = (char*) fontOfNames;
- /* Style of names of axes */
- cubic.styleOfNames = styleOfNames;
- /* Size of names of axes */
- cubic.sizeOfNames = sizeOfNames;
- /* Name of font for values */
- cubic.fontOfValues = (char*) fontOfValues;
- /* Style of values */
- cubic.styleOfValues = styleOfValues;
- /* Size of values */
- cubic.sizeOfValues = sizeOfValues;
-
- call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, &cubic);
+ call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, cubic);
}
void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view)
call_togl_set_text_attributes ((Tchar*)Font, AType, R, G, B);
}
-void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Height) {
+void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Height)
+{
if (MyTraceLevel) {
PrintFunction ("call_togl_text2d");
PrintString ("Text", AText);
PrintShortReal ("Y", Y);
PrintShortReal ("Height", Height);
}
- Standard_ShortReal h = Height;
- if ( h < 0 )
- h = DefaultTextHeight();
- call_togl_text2d ((char *)AText, X, Y, h);
+ const Standard_ShortReal h = (Height < 0)? DefaultTextHeight() : Height;
+ TCollection_ExtendedString estr(AText);
+ call_togl_text2d ((Techar *)estr.ToExtString(), X, Y, h);
}
-void OpenGl_GraphicDriver::TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const {
- call_togl_textsize2d ((char *) AText, AHeight, &AWidth, &AnAscent, &ADescent);
+void OpenGl_GraphicDriver::TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const
+{
+ TCollection_ExtendedString estr(AText);
+ call_togl_textsize2d ((Techar *)estr.ToExtString(), AHeight, &AWidth, &AnAscent, &ADescent);
if (MyTraceLevel) {
PrintFunction ("call_togl_textsize2d");
PrintString ("Text", AText);
#include <Aspect_DriverDefinitionError.hxx>
#include <Standard_NotImplemented.hxx>
-#include "OpenGl_tgl_funcs.hxx"
+#include <OpenGl_tgl_funcs.hxx>
/************************************************************************/
#include <gl2ps.h>
#endif
-
/*-----------------------------------------------------------------------------*/
/*
* Prototypes variables statiques
}
/*-----------------------------------------------------------------------------*/
-void OpenGl_TextRender::StringSize(char *str, GLint *Width, GLint *Ascent, GLint *Descent)
+void OpenGl_TextRender::StringSize(const wchar_t *str, GLint *Width, GLint *Ascent, GLint *Descent)
{
/* int dir, asc, des;*/
/*-----------------------------------------------------------------------------*/
-void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z )
+void OpenGl_TextRender::RenderText ( const wchar_t* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z )
{
GLdouble projMatrix[4][4], modelMatrix[4][4];
GLint viewport[4];
glTranslatef(x, y, 0.f);
glRotatef( 180, 1, 0, 0 );
}
- else {
+ else {
GLdouble wx, wy, wz;
GLdouble x1, y1, z1;
GLdouble x2, y2, z2;
glPopMatrix();
}
glPopAttrib();
- return;
}
#endif
/*-----------------------------------------------------------------------------*/
-void OpenGl_TextRender::ExportText( char* str, char* fontname, GLfloat height, GLfloat angle, GLint alignment,
+void OpenGl_TextRender::ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alignment,
GLfloat x, GLfloat y, GLfloat z, GLboolean is2d )
{
#ifdef HAVE_GL2PS
glRasterPos2f( x, y );
else
glRasterPos3f( x, y, z );
-
+
glBitmap( 1, 1, 0, 0, 0, 0, &zero );
- gl2psTextOpt( str, ps_font, height, alignment, angle);
+ //szv: workaround for gl2ps!
+ const int len = 4 * (wcslen(text) + 1); //szv: should be more than enough
+ char *astr = new char[len];
+ wcstombs(astr,text,len);
+ gl2psTextOpt(astr, ps_font, height, alignment, angle);
+ delete[] astr;
#endif
-
}
#define NUM_CHAR_FONT 1024
#define CACHE_SIZE 30
-class OpenGl_TextRender{
-
-public:
+class OpenGl_TextRender
+{
+ public:
static OpenGl_TextRender* instance();
Tint FindFont ( Tchar*, OSD_FontAspect, Tfloat, Tfloat = 1. , Tfloat = 1.);
- void StringSize( char *text, GLint *width, GLint *ascent, GLint *descent);
- void RenderText( const Standard_Integer id, const char* text);
- void RenderText( char*, GLuint, int, GLfloat, GLfloat, GLfloat );
- void ExportText( char* str, char* fontname, GLfloat height, GLfloat angle, GLint alingment, GLfloat x, GLfloat y, GLfloat z, GLboolean is2d );
+ void StringSize( const wchar_t *text, GLint *width, GLint *ascent, GLint *descent);
+ void RenderText( const wchar_t*, GLuint, int, GLfloat, GLfloat, GLfloat );
+ void ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alingment, GLfloat x, GLfloat y, GLfloat z, GLboolean is2d );
#ifdef HAVE_GL2PS
static void getGL2PSFontName(char *src_font, char *ps_font);
#endif
-
-private:
+
+ private:
static int curFont ;
static int curSize ;
/*----------------------------------------------------------------------*/
void
-call_func_anno_text_rel3( tel_point pt, Tchar *str )
+call_func_anno_text_rel3( tel_point pt, Techar *str )
{
CMN_KEY k[2];
+// File: OpenGl_graduatedtrihedron.cxx
+// Created: 6 March 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE SA 2011
+
#include <OpenGl_tgl_all.hxx>
#include <OpenGl_graduatedtrihedron.hxx>
#include <string.h>
#endif
+struct TEL_GRADUATEDTRIHEDRON_DATA
+{
+ int WsId;
+ wchar_t *xname, *yname, *zname;
+ unsigned char xdrawname, ydrawname, zdrawname;
+ unsigned char xdrawvalues, ydrawvalues, zdrawvalues;
+ unsigned char drawgrid;
+ unsigned char drawaxes;
+ unsigned int nbx, nby, nbz;
+ int xoffset, yoffset, zoffset;
+ int xaxisoffset, yaxisoffset, zaxisoffset;
+ unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
+ unsigned int xtickmarklength, ytickmarklength, ztickmarklength;
+ float gridcolor[3];
+ float xnamecolor[3];
+ float ynamecolor[3];
+ float znamecolor[3];
+ float xcolor[3];
+ float ycolor[3];
+ float zcolor[3];
+ char* fontOfNames;
+ OSD_FontAspect styleOfNames;
+ int sizeOfNames;
+ char* fontOfValues;
+ OSD_FontAspect styleOfValues;
+ int sizeOfValues;
+ minMaxValuesCallback cbCubicAxes;
+ void* ptrVisual3dView;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+typedef TEL_GRADUATEDTRIHEDRON_DATA* tel_graduatedtrihedron_data;
+
/* Graduated trihedron data */
-static int nbWsIds = 0; /* Number of the views (size of the arrays below */
-static int* WsIds = 0; /* The array contans indices of graduated trihedron data corresponding to the view ID */
-static CALL_DEF_GRADUATEDTRIHEDRON** graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */
+static int nbWsIds = 0; /* Number of the views (size of the arrays below */
+static tel_graduatedtrihedron_data* graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */
/* Bounding box */
float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f;
-static void copyData(CALL_DEF_GRADUATEDTRIHEDRON* fromData, CALL_DEF_GRADUATEDTRIHEDRON* toData)
-{
- int len;
-
- /* Names of axes */
- /* X-name */
- if (fromData->xname)
- len = strlen(fromData->xname) + 1;
- else
- len = 1;
- toData->xname = (char*) malloc(len * sizeof(char));
- if (fromData->xname)
- strcpy(toData->xname, fromData->xname);
- else
- toData->xname[0] = '\0';
- /* Y-name */
- if (fromData->yname)
- len = strlen(fromData->yname) + 1;
- else
- len = 1;
- toData->yname = (char*) malloc(len * sizeof(char));
- if (fromData->yname)
- strcpy(toData->yname, fromData->yname);
- else
- toData->yname[0] = '\0';
- /* Z-name */
- if (fromData->zname)
- len = strlen(fromData->zname) + 1;
- else
- len = 1;
- toData->zname = (char*) malloc(len * sizeof(char));
- if (fromData->zname)
- strcpy(toData->zname, fromData->zname);
- else
- toData->zname[0] = '\0';
- /* Draw names */
- toData->xdrawname = fromData->xdrawname;
- toData->ydrawname = fromData->ydrawname;
- toData->zdrawname = fromData->zdrawname;
- /* Draw values */
- toData->xdrawvalues = fromData->xdrawvalues;
- toData->ydrawvalues = fromData->ydrawvalues;
- toData->zdrawvalues = fromData->zdrawvalues;
- /* Draw grid */
- toData->drawgrid = fromData->drawgrid;
- /* Draw axes */
- toData->drawaxes = fromData->drawaxes;
- /* Number of splits along axes */
- toData->nbx = fromData->nbx;
- toData->nby = fromData->nby;
- toData->nbz = fromData->nbz;
- /* Offset for drawing values */
- toData->xoffset = fromData->xoffset;
- toData->yoffset = fromData->yoffset;
- toData->zoffset = fromData->zoffset;
- /* Offset for drawing names of axes */
- toData->xaxisoffset = fromData->xaxisoffset;
- toData->yaxisoffset = fromData->yaxisoffset;
- toData->zaxisoffset = fromData->zaxisoffset;
- /* Draw tickmarks */
- toData->xdrawtickmarks = fromData->xdrawtickmarks;
- toData->ydrawtickmarks = fromData->ydrawtickmarks;
- toData->zdrawtickmarks = fromData->zdrawtickmarks;
- /* Length of tickmarks */
- toData->xtickmarklength = fromData->xtickmarklength;
- toData->ytickmarklength = fromData->ytickmarklength;
- toData->ztickmarklength = fromData->ztickmarklength;
- /* Grid color */
- memcpy(toData->gridcolor, fromData->gridcolor, 3 * sizeof(float));
- /* X name color */
- memcpy(toData->xnamecolor, fromData->xnamecolor, 3 * sizeof(float));
- /* Y name color */
- memcpy(toData->ynamecolor, fromData->ynamecolor, 3 * sizeof(float));
- /* Z name color */
- memcpy(toData->znamecolor, fromData->znamecolor, 3 * sizeof(float));
- /* X color of axis and values */
- memcpy(toData->xcolor, fromData->xcolor, 3 * sizeof(float));
- /* Y color of axis and values */
- memcpy(toData->ycolor, fromData->ycolor, 3 * sizeof(float));
- /* Z color of axis and values */
- memcpy(toData->zcolor, fromData->zcolor, 3 * sizeof(float));
- /* Font name of names of axes: Courier, Arial, ... */
- if (fromData->fontOfNames)
- len = strlen(fromData->fontOfNames) + 1;
- else
- len = 1;
- toData->fontOfNames = (char*) malloc(len * sizeof(char));
- if (fromData->fontOfNames)
- strcpy(toData->fontOfNames, fromData->fontOfNames);
- else
- toData->fontOfNames[0] = '\0';
- /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
- toData->styleOfNames = fromData->styleOfNames;
- /* Size of names of axes: 8, 10, 12, 14, ... */
- toData->sizeOfNames = fromData->sizeOfNames;
- /* Font name of values: Courier, Arial, ... */
- if (fromData->fontOfValues)
- len = strlen(fromData->fontOfValues) + 1;
- else
- len = 1;
- toData->fontOfValues = (char*) malloc(len * sizeof(char));
- if (fromData->fontOfValues)
- strcpy(toData->fontOfValues, fromData->fontOfValues);
- else
- toData->fontOfValues[0] = '\0';
- /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
- toData->styleOfValues = fromData->styleOfValues;
- /* Size of values: 8, 10, 12, 14, ... */
- toData->sizeOfValues = fromData->sizeOfValues;
- /* Callback - updater of boundary box */
- toData->cbCubicAxes = fromData->cbCubicAxes;
- toData->ptrVisual3dView = fromData->ptrVisual3dView;
-}
-
-static void freeGraduatedTrihedronData(CALL_DEF_GRADUATEDTRIHEDRON* data)
+static void copyData(const Graphic3d_CGraduatedTrihedron *fromData, TEL_GRADUATEDTRIHEDRON_DATA* toData)
{
- /* Names of axes */
- if (data->xname)
- free(data->xname);
- if (data->yname)
- free(data->yname);
- if (data->zname)
- free(data->zname);
-
- /* Fonts */
- if (data->fontOfNames)
- free(data->fontOfNames);
- if (data->fontOfValues)
- free(data->fontOfValues);
-
- free(data);
+ int len;
+
+ /* Names of axes */
+ /* X-name */
+ len = fromData->xname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = fromData->xname.ToExtString();
+ toData->xname = new wchar_t[len+1];
+ len = 0; while (toData->xname[len] = (wchar_t)(iname[len])) len++;
+ }
+ else
+ toData->xname = NULL;
+ /* Y-name */
+ len = fromData->yname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = fromData->yname.ToExtString();
+ toData->yname = new wchar_t[len+1];
+ len = 0; while (toData->yname[len] = (wchar_t)(iname[len])) len++;
+ }
+ else
+ toData->yname = NULL;
+ /* Z-name */
+ len = fromData->zname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = fromData->zname.ToExtString();
+ toData->zname = new wchar_t[len+1];
+ len = 0; while (toData->zname[len] = (wchar_t)(iname[len])) len++;
+ }
+ else
+ toData->zname = NULL;
+ /* Draw names */
+ toData->xdrawname = fromData->xdrawname;
+ toData->ydrawname = fromData->ydrawname;
+ toData->zdrawname = fromData->zdrawname;
+ /* Draw values */
+ toData->xdrawvalues = fromData->xdrawvalues;
+ toData->ydrawvalues = fromData->ydrawvalues;
+ toData->zdrawvalues = fromData->zdrawvalues;
+ /* Draw grid */
+ toData->drawgrid = fromData->drawgrid;
+ /* Draw axes */
+ toData->drawaxes = fromData->drawaxes;
+ /* Number of splits along axes */
+ toData->nbx = fromData->nbx;
+ toData->nby = fromData->nby;
+ toData->nbz = fromData->nbz;
+ /* Offset for drawing values */
+ toData->xoffset = fromData->xoffset;
+ toData->yoffset = fromData->yoffset;
+ toData->zoffset = fromData->zoffset;
+ /* Offset for drawing names of axes */
+ toData->xaxisoffset = fromData->xaxisoffset;
+ toData->yaxisoffset = fromData->yaxisoffset;
+ toData->zaxisoffset = fromData->zaxisoffset;
+ /* Draw tickmarks */
+ toData->xdrawtickmarks = fromData->xdrawtickmarks;
+ toData->ydrawtickmarks = fromData->ydrawtickmarks;
+ toData->zdrawtickmarks = fromData->zdrawtickmarks;
+ /* Length of tickmarks */
+ toData->xtickmarklength = fromData->xtickmarklength;
+ toData->ytickmarklength = fromData->ytickmarklength;
+ toData->ztickmarklength = fromData->ztickmarklength;
+ /* Grid color */
+ toData->gridcolor[0] = (float) fromData->gridcolor.Red();
+ toData->gridcolor[1] = (float) fromData->gridcolor.Green();
+ toData->gridcolor[2] = (float) fromData->gridcolor.Blue();
+ /* X name color */
+ toData->xnamecolor[0] = (float) fromData->xnamecolor.Red();
+ toData->xnamecolor[1] = (float) fromData->xnamecolor.Green();
+ toData->xnamecolor[2] = (float) fromData->xnamecolor.Blue();
+ /* Y name color */
+ toData->ynamecolor[0] = (float) fromData->ynamecolor.Red();
+ toData->ynamecolor[1] = (float) fromData->ynamecolor.Green();
+ toData->ynamecolor[2] = (float) fromData->ynamecolor.Blue();
+ /* Z name color */
+ toData->znamecolor[0] = (float) fromData->znamecolor.Red();
+ toData->znamecolor[1] = (float) fromData->znamecolor.Green();
+ toData->znamecolor[2] = (float) fromData->znamecolor.Blue();
+ /* X color of axis and values */
+ toData->xcolor[0] = (float) fromData->xcolor.Red();
+ toData->xcolor[1] = (float) fromData->xcolor.Green();
+ toData->xcolor[2] = (float) fromData->xcolor.Blue();
+ /* Y color of axis and values */
+ toData->ycolor[0] = (float) fromData->ycolor.Red();
+ toData->ycolor[1] = (float) fromData->ycolor.Green();
+ toData->ycolor[2] = (float) fromData->ycolor.Blue();
+ /* Z color of axis and values */
+ toData->zcolor[0] = (float) fromData->zcolor.Red();
+ toData->zcolor[1] = (float) fromData->zcolor.Green();
+ toData->zcolor[2] = (float) fromData->zcolor.Blue();
+ /* Font name of names of axes: Courier, Arial, ... */
+ len = fromData->fontOfNames.Length();
+ toData->fontOfNames = new char[len+1];
+ if (len)
+ strcpy(toData->fontOfNames, fromData->fontOfNames.ToCString());
+ else
+ toData->fontOfNames[0] = L'\0';
+ /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
+ toData->styleOfNames = fromData->styleOfNames;
+ /* Size of names of axes: 8, 10, 12, 14, ... */
+ toData->sizeOfNames = fromData->sizeOfNames;
+ /* Font name of values: Courier, Arial, ... */
+ len = fromData->fontOfValues.Length();
+ toData->fontOfValues = new char[len+1];
+ if (len)
+ strcpy(toData->fontOfValues, fromData->fontOfValues.ToCString());
+ else
+ toData->fontOfValues[0] = L'\0';
+ /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
+ toData->styleOfValues = fromData->styleOfValues;
+ /* Size of values: 8, 10, 12, 14, ... */
+ toData->sizeOfValues = fromData->sizeOfValues;
+ /* Callback - updater of boundary box */
+ toData->cbCubicAxes = fromData->cbCubicAxes;
+ toData->ptrVisual3dView = fromData->ptrVisual3dView;
}
static void freeData()
{
- int i;
-
- if (WsIds)
- {
- free(WsIds);
- for (i = 0; i < nbWsIds; i++)
- {
- freeGraduatedTrihedronData(graduatedTrihedronData[i]);
- }
- free(graduatedTrihedronData);
-
- WsIds = 0;
- graduatedTrihedronData = 0;
- }
-}
-
-static int getGraduatedTrihedronDataIndex(int WsId)
-{
+ if (nbWsIds)
+ {
int i = 0;
-
- if (!nbWsIds)
- return -1;
-
- for (; i < nbWsIds; i++)
- {
- if (WsIds[i] == WsId)
- return i;
- }
-
- return -1;
-}
-
-static unsigned char initView(int WsId)
-{
- int i;
- int* newWsIds;
- CALL_DEF_GRADUATEDTRIHEDRON** newGraduatedTrihedronData;
-
- /* Extend arrays for +1 */
- nbWsIds++;
- newWsIds = (int*) calloc(nbWsIds, sizeof(int));
- newGraduatedTrihedronData = (CALL_DEF_GRADUATEDTRIHEDRON**) calloc(nbWsIds, sizeof(CALL_DEF_GRADUATEDTRIHEDRON*));
+ tel_graduatedtrihedron_data gtdata;
for (i = 0; i < nbWsIds; i++)
{
- newGraduatedTrihedronData[i] = (CALL_DEF_GRADUATEDTRIHEDRON*) calloc(1, sizeof(CALL_DEF_GRADUATEDTRIHEDRON));
+ gtdata = graduatedTrihedronData[i];
+
+ // Names of axes
+ if (gtdata->xname)
+ delete[] gtdata->xname;
+ if (gtdata->yname)
+ delete[] gtdata->yname;
+ if (gtdata->zname)
+ delete[] gtdata->zname;
+
+ // Fonts
+ if (gtdata->fontOfNames)
+ delete[] gtdata->fontOfNames;
+ if (gtdata->fontOfValues)
+ delete[] gtdata->fontOfValues;
+
+ delete gtdata;
}
-
- /* Copy data from current arrays to the newly created */
- if (nbWsIds > 1)
- {
- for (i = 0; i < nbWsIds - 1; i++)
- {
- newWsIds[i] = WsIds[i];
- copyData(graduatedTrihedronData[i], newGraduatedTrihedronData[i]);
- }
- }
-
- /* Delete the previous used arrays */
- nbWsIds--; /* Don't delete just created graduated trihedron data */
- freeData();
- nbWsIds++; /* Return the counter back */
-
- /* Switch to new arrays */
- WsIds = newWsIds;
- graduatedTrihedronData = newGraduatedTrihedronData;
-
- /* Set view ID */
- WsIds[nbWsIds - 1] = WsId;
-
- return TSuccess;
+ delete graduatedTrihedronData;
+ graduatedTrihedronData = 0;
+ nbWsIds = 0;
+ }
}
-/* Erases the trihedron from the view */
-static TStatus removeView(int WsId)
+static int getGraduatedTrihedronDataIndex(int WsId)
{
- int index, i, j;
- int* newWsIds;
- CALL_DEF_GRADUATEDTRIHEDRON** newGraduatedTrihedronData;
-
- index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- return TSuccess; /* Nothing to remove */
-
- /* If trihedron is displayed only in one view,
- just free the arrays and set nbWsIds equal to 0. */
- if (nbWsIds == 1)
- {
- freeData();
- nbWsIds = 0;
- return TSuccess;
- }
-
- /* create new arrays with nbWsIds - 1 length. */
- nbWsIds--;
- newWsIds = (int*) calloc(nbWsIds, sizeof(int));
- newGraduatedTrihedronData = (CALL_DEF_GRADUATEDTRIHEDRON**) calloc(nbWsIds, sizeof(CALL_DEF_GRADUATEDTRIHEDRON*));
- for (i = 0; i < nbWsIds; i++)
- {
- newGraduatedTrihedronData[i] = (CALL_DEF_GRADUATEDTRIHEDRON*) calloc(1, sizeof(CALL_DEF_GRADUATEDTRIHEDRON));
- }
-
- /* Copy data from current arrays to the newly created */
- for (i = 0, j = 0; j <= nbWsIds; j++)
- {
- if (j != index)
- {
- newWsIds[i] = WsIds[j];
- copyData(graduatedTrihedronData[j], newGraduatedTrihedronData[i]);
- i++;
- }
- }
-
- return TSuccess;
+ int i = 0;
+ for (; i < nbWsIds; i++)
+ {
+ if (graduatedTrihedronData[i]->WsId == WsId)
+ return i;
+ }
+ return -1;
}
/* Normal of the view (not normalized!) */
return 8; /* d111 */
}
-static void drawText(char* text, char* font, OSD_FontAspect style, int size, float x, float y, float z)
+static void drawText(const wchar_t* text, char* font, OSD_FontAspect style, int size, float x, float y, float z)
{
- GLuint fontBase = 0;
- OpenGl_TextRender* textRenderer = OpenGl_TextRender::instance();
- fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size);
- textRenderer->RenderText(text, fontBase, 0, x, y, z);
+ OpenGl_TextRender* textRenderer = OpenGl_TextRender::instance();
+ const GLuint fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size);
+ textRenderer->RenderText(text, fontBase, 0, x, y, z);
/* 4 OCC 6.3.1 and older:
GLuint fontBase;
glEnd();
}
-TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data)
+TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data)
{
- int index;
-
- /* Get index of the view */
- index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- {
- /* Default values */
- data->xname = "X\0";
- data->yname = "Y\0";
- data->zname = "Z\0";
- data->xdrawname = 1;
- data->ydrawname = 1;
- data->zdrawname = 1;
- data->xdrawvalues = 1;
- data->ydrawvalues = 1;
- data->zdrawvalues = 1;
- data->drawgrid = 1;
- data->drawaxes = 1;
- data->nbx = 3;
- data->nby = 3;
- data->nbz = 3;
- data->xoffset = 10;
- data->yoffset = 10;
- data->zoffset = 10;
- data->xaxisoffset = 30;
- data->yaxisoffset = 30;
- data->zaxisoffset = 30;
- data->xdrawtickmarks = 1;
- data->ydrawtickmarks = 1;
- data->zdrawtickmarks = 1;
- data->xtickmarklength = 10;
- data->ytickmarklength = 10;
- data->ztickmarklength = 10;
- /*Quantity_NOC_WHITE*/;
- data->gridcolor[0] = 1.0f;
- data->gridcolor[1] = 1.0f;
- data->gridcolor[2] = 1.0f;
- /* Quantity_NOC_RED */
- data->xnamecolor[0] = 1.0f;
- data->xnamecolor[1] = 0.0f;
- data->xnamecolor[2] = 0.0f;
- /* Quantity_NOC_GREEN */
- data->ynamecolor[0] = 0.0f;
- data->ynamecolor[1] = 1.0f;
- data->ynamecolor[2] = 0.0f;
- /* Quantity_NOC_BLUE1 */
- data->znamecolor[0] = 0.0f;
- data->znamecolor[1] = 0.0f;
- data->znamecolor[2] = 1.0f;
- /* Quantity_NOC_RED */
- data->xcolor[0] = 1.0f;
- data->xcolor[1] = 0.0f;
- data->xcolor[2] = 0.0f;
- /* Quantity_NOC_GREEN */
- data->ycolor[0] = 0.0f;
- data->ycolor[1] = 1.0f;
- data->ycolor[2] = 0.0f;
- /* Quantity_NOC_BLUE1 */
- data->zcolor[0] = 0.0f;
- data->zcolor[1] = 0.0f;
- data->zcolor[2] = 1.0f;
- }
- else
- {
- copyData(graduatedTrihedronData[index], data);
- }
- return TSuccess;
-}
+ /* Initialize data for a new view */
+ int index = getGraduatedTrihedronDataIndex(WsId);
+ if (index == -1)
+ {
+ /* Extend array for +1 */
+ tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds+1];
+
+ /* Copy existing contents */
+ int i;
+ for (i = 0; i < nbWsIds; i++)
+ newGraduatedTrihedronData[i] = graduatedTrihedronData[i];
-TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data)
-{
- int index;
+ /* Add new item */
+ index = nbWsIds++;
+ newGraduatedTrihedronData[index] = new TEL_GRADUATEDTRIHEDRON_DATA;
+ newGraduatedTrihedronData[index]->WsId = WsId;
- /* Initialize data for a new view */
- index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- {
- initView(WsId);
- index = getGraduatedTrihedronDataIndex(WsId);
- }
- copyData(data, graduatedTrihedronData[index]);
- return call_graduatedtrihedron_redraw(WsId);
+ /* Switch to new array */
+ delete graduatedTrihedronData;
+ graduatedTrihedronData = newGraduatedTrihedronData;
+ }
+ copyData(&data, graduatedTrihedronData[index]);
+ return call_graduatedtrihedron_redraw(WsId);
}
TStatus call_graduatedtrihedron_erase(int WsId)
{
- return removeView(WsId);
+ int index = getGraduatedTrihedronDataIndex(WsId);
+ if (index == -1)
+ return TSuccess; /* Nothing to remove */
+
+ /* If trihedron is displayed only in one view, just free the array and set nbWsIds equal to 0. */
+ if (nbWsIds == 1)
+ {
+ freeData();
+ return TSuccess;
+ }
+
+ /* Reduce array for -1 */
+ tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds-1];
+
+ /* Copy existing contents */
+ int i, j;
+ for (i = 0, j = 0; i < nbWsIds; i++)
+ {
+ if (graduatedTrihedronData[i]->WsId != WsId)
+ newGraduatedTrihedronData[j++] = graduatedTrihedronData[i];
+ }
+ nbWsIds--;
+
+ /* Switch to new array */
+ delete graduatedTrihedronData;
+ graduatedTrihedronData = newGraduatedTrihedronData;
+
+ return TSuccess;
}
TStatus call_graduatedtrihedron_redraw(int WsId)
{
- GLboolean light;
- unsigned int i, offset;
- unsigned char farestCorner;
- float normal[3], center[3];
- CALL_DEF_GRADUATEDTRIHEDRON* data;
- float d000, d100, d010, d001, d110, d101, d011, d111; /* 0 - min, 1 - max */
- float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
- float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
- float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
- unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
- unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
- unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
- float m1[3], m2[3];
- float step, d, dpix, dx, dy, dz;
- char textValue[128];
- int index;
-
- /* Get index of the trihedron data */
- index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- return TFailure;
- data = graduatedTrihedronData[index];
-
- /* Update boundary box */
- if (data->cbCubicAxes)
- data->cbCubicAxes(data->ptrVisual3dView);
-
- /* Disable lighting for lines */
- light = glIsEnabled(GL_LIGHTING);
- if (light)
- glDisable(GL_LIGHTING);
+ /* Get index of the trihedron data */
+ int index = getGraduatedTrihedronDataIndex(WsId);
+ if (index == -1)
+ return TFailure;
+
+ tel_graduatedtrihedron_data data = graduatedTrihedronData[index];
+
+ /* Update boundary box */
+ if (data->cbCubicAxes)
+ data->cbCubicAxes(data->ptrVisual3dView);
+
+ /* Disable lighting for lines */
+ GLboolean light = glIsEnabled(GL_LIGHTING);
+ if (light)
+ glDisable(GL_LIGHTING);
- /* Find the farest point of bounding box */
+ /* Find the farest point of bounding box */
- /* Get normal of the view out of user. */
- /* Also, the method return distance corresponding to 1 pixel */
- dpix = getNormal(normal);
+ /* Get normal of the view out of user. */
+ /* Also, the method return distance corresponding to 1 pixel */
+ float normal[3];
+ float dpix = getNormal(normal);
- /* Normalize normal */
- d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
- normal[0] = normal[0] / d;
- normal[1] = normal[1] / d;
- normal[2] = normal[2] / d;
-
- /* Get central point of bounding box */
- center[0] = 0.5f * (xmin + xmax);
- center[1] = 0.5f * (ymin + ymax);
- center[2] = 0.5f * (zmin + zmax);
-
- /* Check distance to corners of bounding box along the normal*/
- d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
- d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
- d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
- d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
- d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
- d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
- d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
- d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
- farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
-
- /* Choose axes for the grid. */
- /* The first axis will be used for drawing the text and the values. */
- switch (farestCorner)
+ /* Normalize normal */
+ float d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
+ normal[0] /= d;
+ normal[1] /= d;
+ normal[2] /= d;
+
+ /* Get central point of bounding box */
+ float center[3];
+ center[0] = 0.5f * (xmin + xmax);
+ center[1] = 0.5f * (ymin + ymax);
+ center[2] = 0.5f * (zmin + zmax);
+
+ /* Check distance to corners of bounding box along the normal */
+ float d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
+ float d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
+ float d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
+ float d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
+ float d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
+ float d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
+ float d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
+ float d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
+ unsigned char farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
+
+ /* Choose axes for the grid. */
+ float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
+ float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
+ float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
+ unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
+ unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
+ unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
+
+ /* The first axis will be used for drawing the text and the values. */
+ switch (farestCorner)
+ {
+ case 1: /* d000 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 000 - 100 */
+ LX2draw = 0; /* forbidden! */
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 000 - 010 */
+ LY2draw = 0; /* forbidden! */
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 000 - 001 */
+ LZ2draw = 0; /* forbidden! */
+ LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 2: /* d100 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 000 - 100 */
+ LX2draw = 0; /* forbidden! */
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden! */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 100 - 110 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden! */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 100 - 101 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 3: /* d010 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 010 - 110 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 000 - 010 */
+ LY2draw = 0; /* forbidden */
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 110 - 111 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymax; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymax; LZ1[5] = zmax;
+ /* 010 - 011 */
+ LZ2draw = 1;
+ LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 000 - 001 */
+ LZ3draw = 0; /* forbidden */
+ LZ3[0] = xmin; LZ3[1] = ymin; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymin; LZ3[5] = zmax;
+
+ break;
+ }
+ case 4: /* d001 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 001 - 101 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 001 - 011 */
+ LY2draw = 1;
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 000 - 001 */
+ LZ2draw = 0; /* forbidden */
+ LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 5: /* d110 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 010 - 110 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 100 - 110 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 110 - 111 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 6: /* d101 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 001 - 101 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 101 - 111 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 100 - 101 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 7: /* d011 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 011 - 111 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 001 - 011 */
+ LY2draw = 1;
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 010 - 011 */
+ LZ2draw = 1;
+ LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 8: /* d111 */
+ {
+ /* 010 - 110 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymax; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymax; LX1[5] = zmin;
+ /* 011 - 111 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
+ /* 001 - 101 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymin; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymin; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 101 - 111 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 110 - 111 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ }
+
+ /* Draw the graduated trihedron */
+ unsigned int i, j, offset;
+ float m1[3], m2[3];
+ float step, dx, dy, dz;
+
+ /* Grid */
+ if (data->drawgrid)
+ {
+ glColor3fv(data->gridcolor);
+ glBegin(GL_LINES);
+ /* Boundary grid-lines */
+ if (LX1draw == 1)
+ {
+ glVertex3fv(&(LX1[0]));
+ glVertex3fv(&(LX1[3]));
+ }
+ if (LX2draw == 1)
+ {
+ glVertex3fv(&(LX2[0]));
+ glVertex3fv(&(LX2[3]));
+ }
+ if (LX3draw == 1)
+ {
+ glVertex3fv(&(LX3[0]));
+ glVertex3fv(&(LX3[3]));
+ }
+ if (LY1draw == 1)
+ {
+ glVertex3fv(&(LY1[0]));
+ glVertex3fv(&(LY1[3]));
+ }
+ if (LY2draw == 1)
+ {
+ glVertex3fv(&(LY2[0]));
+ glVertex3fv(&(LY2[3]));
+ }
+ if (LY3draw == 1)
+ {
+ glVertex3fv(&(LY3[0]));
+ glVertex3fv(&(LY3[3]));
+ }
+ if (LZ1draw == 1)
+ {
+ glVertex3fv(&(LZ1[0]));
+ glVertex3fv(&(LZ1[3]));
+ }
+ if (LZ2draw == 1)
+ {
+ glVertex3fv(&(LZ2[0]));
+ glVertex3fv(&(LZ2[3]));
+ }
+ if (LZ3draw == 1)
+ {
+ glVertex3fv(&(LZ3[0]));
+ glVertex3fv(&(LZ3[3]));
+ }
+ glEnd();
+
+ /* Intermediate grid-lines */
+ /* X-Grid lines */
+ if (data->nbx > 0)
+ {
+ i = data->drawaxes ? 1 : 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
+ while (i < data->nbx)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LX1[0] + i * step, LX1[1], LX1[2]);
+ glVertex3f(LX2[0] + i * step, LX2[1], LX2[2]);
+ glVertex3f(LX3[0] + i * step, LX3[1], LX3[2]);
+ glEnd();
+ i++;
+ }
+ }
+ /* Y-Grid lines */
+ if (data->nby > 0)
+ {
+ i = data->drawaxes ? 1 : 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
+ while (i < data->nby)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LY1[0], LY1[1] + i * step, LY1[2]);
+ glVertex3f(LY2[0], LY2[1] + i * step, LY2[2]);
+ glVertex3f(LY3[0], LY3[1] + i * step, LY3[2]);
+ glEnd();
+ i++;
+ }
+ }
+ /* Z-Grid lines */
+ if (data->nbz > 0)
+ {
+ i = data->drawaxes ? 1 : 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
+ while (i < data->nbz)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LZ1[0], LZ1[1], LZ1[2] + i * step);
+ glVertex3f(LZ2[0], LZ2[1], LZ2[2] + i * step);
+ glVertex3f(LZ3[0], LZ3[1], LZ3[2] + i * step);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ /* Axes (arrows) */
+ if (data->drawaxes)
+ {
+ /* X-axis */
+ glColor3fv(data->xcolor);
+ drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]);
+
+ /* Y-axis */
+ glColor3fv(data->ycolor);
+ drawArrow(xmin, ymin, zmin, xmin, ymax, zmin, normal[0], normal[1], normal[2]);
+
+ /* Z-axis */
+ glColor3fv(data->zcolor);
+ drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]);
+ }
+
+ /* Names of axes & values */
+ char textValue[128];
+ wchar_t wtextValue[128];
+
+ if (data->xdrawname || data->xdrawvalues)
+ {
+ /* Middle point of the first X-axis */
+ m1[0] = 0.5f * (LX1[0] + LX1[3]);
+ m1[1] = 0.5f * (LX1[1] + LX1[4]);
+ m1[2] = 0.5f * (LX1[2] + LX1[5]);
+
+ /* Middle point of the second X-axis */
+ m2[0] = 0.5f * (LX2[0] + LX2[3]);
+ m2[1] = 0.5f * (LX2[1] + LX2[4]);
+ m2[2] = 0.5f * (LX2[2] + LX2[5]);
+
+ /* Apply offset to m1 */
+ dy = m1[1] - m2[1];
+ if (fabsf(dy) > 1.e-7f)
{
- case 1: /* d000 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 000 - 100 */
- LX2draw = 0; /* forbidden! */
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 000 - 010 */
- LY2draw = 0; /* forbidden! */
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 000 - 001 */
- LZ2draw = 0; /* forbidden! */
- LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 2: /* d100 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 000 - 100 */
- LX2draw = 0; /* forbidden! */
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden! */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 100 - 110 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden! */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 100 - 101 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 3: /* d010 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 010 - 110 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 000 - 010 */
- LY2draw = 0; /* forbidden */
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 110 - 111 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymax; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymax; LZ1[5] = zmax;
- /* 010 - 011 */
- LZ2draw = 1;
- LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 000 - 001 */
- LZ3draw = 0; /* forbidden */
- LZ3[0] = xmin; LZ3[1] = ymin; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymin; LZ3[5] = zmax;
-
- break;
- }
- case 4: /* d001 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 001 - 101 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 001 - 011 */
- LY2draw = 1;
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 000 - 001 */
- LZ2draw = 0; /* forbidden */
- LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 5: /* d110 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 010 - 110 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 100 - 110 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 110 - 111 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 6: /* d101 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 001 - 101 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 101 - 111 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 100 - 101 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 7: /* d011 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 011 - 111 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 001 - 011 */
- LY2draw = 1;
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 010 - 011 */
- LZ2draw = 1;
- LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 8: /* d111 */
- {
- /* 010 - 110 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymax; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymax; LX1[5] = zmin;
- /* 011 - 111 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
- /* 001 - 101 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymin; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymin; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 101 - 111 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 110 - 111 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
+ dy = (dy > 0.0f)? 1.0f : -1.0f;
}
+ dz = m1[2] - m2[2];
+ if (fabsf(dz) > 1.e-7f)
+ {
+ dz = (dz > 0.0f)? 1.0f : -1.0f;
+ }
+ m2[1] = dpix * dy;
+ m2[2] = dpix * dz;
- /* Draw the graduated trihedron */
+ /* Name of X-axis */
+ if (data->xdrawname)
+ {
+ glColor3fv(data->xnamecolor);
+ offset = data->xaxisoffset + data->xtickmarklength;
+ drawText(data->xname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
+ m1[0], m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
+ }
- /* Grid */
- if (data->drawgrid)
+ /* X-values */
+ if (data->xdrawvalues && data->nbx > 0)
{
- glColor3fv(data->gridcolor);
+ glColor3fv(data->xcolor);
+
+ i = 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
+ offset = data->xoffset + data->xtickmarklength;
+ while (i <= data->nbx)
+ {
+ sprintf(textValue, "%g", LX1[0] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
+ LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
+ i++;
+ }
+ }
+
+ /* X-tickmark */
+ if (data->xdrawtickmarks && data->nbx > 0)
+ {
+ glColor3fv(data->gridcolor);
+
+ i = 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
+ while (i <= data->nbx)
+ {
glBegin(GL_LINES);
- /* Boundary grid-lines */
- if (LX1draw == 1)
- {
- glVertex3fv(&(LX1[0]));
- glVertex3fv(&(LX1[3]));
- }
- if (LX2draw == 1)
- {
- glVertex3fv(&(LX2[0]));
- glVertex3fv(&(LX2[3]));
- }
- if (LX3draw == 1)
- {
- glVertex3fv(&(LX3[0]));
- glVertex3fv(&(LX3[3]));
- }
- if (LY1draw == 1)
- {
- glVertex3fv(&(LY1[0]));
- glVertex3fv(&(LY1[3]));
- }
- if (LY2draw == 1)
- {
- glVertex3fv(&(LY2[0]));
- glVertex3fv(&(LY2[3]));
- }
- if (LY3draw == 1)
- {
- glVertex3fv(&(LY3[0]));
- glVertex3fv(&(LY3[3]));
- }
- if (LZ1draw == 1)
- {
- glVertex3fv(&(LZ1[0]));
- glVertex3fv(&(LZ1[3]));
- }
- if (LZ2draw == 1)
- {
- glVertex3fv(&(LZ2[0]));
- glVertex3fv(&(LZ2[3]));
- }
- if (LZ3draw == 1)
- {
- glVertex3fv(&(LZ3[0]));
- glVertex3fv(&(LZ3[3]));
- }
+ glVertex3f(LX1[0] + i * step, m1[1], m1[2]);
+ glVertex3f(LX1[0] + i * step, m1[1] + data->xtickmarklength * m2[1], m1[2] + data->xtickmarklength * m2[2]);
glEnd();
+ i++;
+ }
+ }
+ }
+
+ if (data->ydrawname || data->ydrawvalues)
+ {
+ /* Middle point of the first Y-axis */
+ m1[0] = 0.5f * (LY1[0] + LY1[3]);
+ m1[1] = 0.5f * (LY1[1] + LY1[4]);
+ m1[2] = 0.5f * (LY1[2] + LY1[5]);
+
+ /* Middle point of the second Y-axis */
+ m2[0] = 0.5f * (LY2[0] + LY2[3]);
+ m2[1] = 0.5f * (LY2[1] + LY2[4]);
+ m2[2] = 0.5f * (LY2[2] + LY2[5]);
+
+ /* Apply offset to m1 */
+ dx = m1[0] - m2[0];
+ if (fabsf(dx) > 1.e-7f)
+ {
+ dx = (dx > 0.0f)? 1.0f : -1.0f;
+ }
+ dz = m1[2] - m2[2];
+ if (fabsf(dz) > 1.e-7f)
+ {
+ dz = (dz > 0.0f)? 1.0f : -1.0f;
+ }
+
+ m2[0] = dpix * dx;
+ m2[2] = dpix * dz;
- /* Intermediate grid-lines */
- /* X-Grid lines */
- if (data->nbx > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- while (i < data->nbx)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LX1[0] + i * step, LX1[1], LX1[2]);
- glVertex3f(LX2[0] + i * step, LX2[1], LX2[2]);
- glVertex3f(LX3[0] + i * step, LX3[1], LX3[2]);
- glEnd();
- i = i + 1;
- }
- }
- /* Y-Grid lines */
- if (data->nby > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- while (i < data->nby)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LY1[0], LY1[1] + i * step, LY1[2]);
- glVertex3f(LY2[0], LY2[1] + i * step, LY2[2]);
- glVertex3f(LY3[0], LY3[1] + i * step, LY3[2]);
- glEnd();
- i = i + 1;
- }
- }
- /* Z-Grid lines */
- if (data->nbz > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- while (i < data->nbz)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LZ1[0], LZ1[1], LZ1[2] + i * step);
- glVertex3f(LZ2[0], LZ2[1], LZ2[2] + i * step);
- glVertex3f(LZ3[0], LZ3[1], LZ3[2] + i * step);
- glEnd();
- i = i + 1;
- }
- }
+ /* Name of Y-axis */
+ if (data->ydrawname)
+ {
+ glColor3fv(data->ynamecolor);
+ offset = data->yaxisoffset + data->ytickmarklength;
+ drawText(data->yname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
+ m1[0] + offset * m2[0], m1[1], m1[2] + offset * m2[2]);
}
- /* Axes (arrows) */
- if (data->drawaxes)
+ /* Y-values */
+ if (data->ydrawvalues && data->nby > 0)
{
- /* X-axis */
- glColor3fv(data->xcolor);
- drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]);
-
- /* Y-axis */
- glColor3fv(data->ycolor);
- drawArrow(xmin, ymin, zmin, xmin, ymax, zmin, normal[0], normal[1], normal[2]);
-
- /* Z-axis */
- glColor3fv(data->zcolor);
- drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]);
+ glColor3fv(data->ycolor);
+
+ i = 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
+ offset = data->yoffset + data->ytickmarklength;
+ while (i <= data->nby)
+ {
+ sprintf(textValue, "%g", LY1[1] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
+ m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]);
+ i++;
+ }
}
- /* Names of axes & values*/
- if (data->xdrawname || data->xdrawvalues)
+ /* Y-tickmark */
+ if (data->ydrawtickmarks && data->nby > 0)
+ {
+ glColor3fv(data->gridcolor);
+
+ i = 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
+ while (i <= data->nby)
+ {
+ glBegin(GL_LINES);
+ glVertex3f(m1[0], LY1[1] + i * step, m1[2]);
+ glVertex3f(m1[0] + data->ytickmarklength * m2[0], LY1[1] + i * step, m1[2] + data->ytickmarklength * m2[2]);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ if (data->zdrawname || data->zdrawvalues)
+ {
+ /* Middle point of the first Z-axis */
+ m1[0] = 0.5f * (LZ1[0] + LZ1[3]);
+ m1[1] = 0.5f * (LZ1[1] + LZ1[4]);
+ m1[2] = 0.5f * (LZ1[2] + LZ1[5]);
+
+ /* Middle point of the second Z-axis */
+ m2[0] = 0.5f * (LZ2[0] + LZ2[3]);
+ m2[1] = 0.5f * (LZ2[1] + LZ2[4]);
+ m2[2] = 0.5f * (LZ2[2] + LZ2[5]);
+
+ /* Apply offset to m1 */
+ dx = m1[0] - m2[0];
+ if (fabsf(dx) > 1.e-7f)
+ {
+ dx = (dx > 0.0f)? 1.0f : -1.0f;
+ }
+ dy = m1[1] - m2[1];
+ if (fabsf(dy) > 1.e-7f)
{
- /* Middle point of the first X-axis */
- m1[0] = 0.5f * (LX1[0] + LX1[3]);
- m1[1] = 0.5f * (LX1[1] + LX1[4]);
- m1[2] = 0.5f * (LX1[2] + LX1[5]);
-
- /* Middle point of the second X-axis */
- m2[0] = 0.5f * (LX2[0] + LX2[3]);
- m2[1] = 0.5f * (LX2[1] + LX2[4]);
- m2[2] = 0.5f * (LX2[2] + LX2[5]);
-
- /* Apply offset to m1 */
- dy = m1[1] - m2[1];
- if (fabsf(dy) > 1.e-7f)
- {
- if (dy > 0.0f)
- dy = 1.0f;
- else
- dy = -1.0f;
- }
- dz = m1[2] - m2[2];
- if (fabsf(dz) > 1.e-7f)
- {
- if (dz > 0.0f)
- dz = 1.0f;
- else
- dz = -1.0f;
- }
-
- m2[1] = dpix * dy;
- m2[2] = dpix * dz;
-
- /* Name of X-axis */
- if (data->xdrawname)
- {
- glColor3fv(data->xnamecolor);
- offset = data->xaxisoffset + data->xtickmarklength;
- drawText(data->xname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0], m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
- }
-
- /* X-values */
- if (data->xdrawvalues && data->nbx > 0)
- {
- glColor3fv(data->xcolor);
-
- i = 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- offset = data->xoffset + data->xtickmarklength;
- while (i <= data->nbx)
- {
- sprintf(textValue, "%g", LX1[0] + i * step);
- drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
- i = i + 1;
- }
- }
-
- /* X-tickmark */
- if (data->xdrawtickmarks && data->nbx > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- while (i <= data->nbx)
- {
- glBegin(GL_LINES);
- glVertex3f(LX1[0] + i * step, m1[1], m1[2]);
- glVertex3f(LX1[0] + i * step, m1[1] + data->xtickmarklength * m2[1], m1[2] + data->xtickmarklength * m2[2]);
- glEnd();
- i = i + 1;
- }
- }
+ dy = (dy > 0.0f)? 1.0f : -1.0f;
}
- if (data->ydrawname || data->ydrawvalues)
+ m2[0] = dpix * dx;
+ m2[1] = dpix * dy;
+
+ /* Name of Z-axis */
+ if (data->zdrawname)
{
- /* Middle point of the first Y-axis */
- m1[0] = 0.5f * (LY1[0] + LY1[3]);
- m1[1] = 0.5f * (LY1[1] + LY1[4]);
- m1[2] = 0.5f * (LY1[2] + LY1[5]);
-
- /* Middle point of the second Y-axis */
- m2[0] = 0.5f * (LY2[0] + LY2[3]);
- m2[1] = 0.5f * (LY2[1] + LY2[4]);
- m2[2] = 0.5f * (LY2[2] + LY2[5]);
-
- /* Apply offset to m1 */
- dx = m1[0] - m2[0];
- if (fabsf(dx) > 1.e-7f)
- {
- if (dx > 0.0f)
- dx = 1.0f;
- else
- dx = -1.0f;
- }
- dz = m1[2] - m2[2];
- if (fabsf(dz) > 1.e-7f)
- {
- if (dz > 0.0f)
- dz = 1.0f;
- else
- dz = -1.0f;
- }
-
- m2[0] = dpix * dx;
- m2[2] = dpix * dz;
-
- /* Name of Y-axis */
- if (data->ydrawname)
- {
- glColor3fv(data->ynamecolor);
- offset = data->yaxisoffset + data->ytickmarklength;
- drawText(data->yname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0] + offset * m2[0], m1[1], m1[2] + offset * m2[2]);
- }
-
- /* Y-values */
- if (data->ydrawvalues && data->nby > 0)
- {
- glColor3fv(data->ycolor);
-
- i = 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- offset = data->yoffset + data->ytickmarklength;
- while (i <= data->nby)
- {
- sprintf(textValue, "%g", LY1[1] + i * step);
- drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]);
- i = i + 1;
- }
- }
-
- /* Y-tickmark */
- if (data->ydrawtickmarks && data->nby > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- while (i <= data->nby)
- {
- glBegin(GL_LINES);
- glVertex3f(m1[0], LY1[1] + i * step, m1[2]);
- glVertex3f(m1[0] + data->ytickmarklength * m2[0], LY1[1] + i * step, m1[2] + data->ytickmarklength * m2[2]);
- glEnd();
- i = i + 1;
- }
- }
+ glColor3fv(data->znamecolor);
+ offset = data->zaxisoffset + data->ztickmarklength;
+ drawText(data->zname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
+ m1[0] + offset * m2[0], m1[1] + offset * m2[1], m1[2]);
}
- if (data->zdrawname || data->zdrawvalues)
+ /* Z-values */
+ if (data->zdrawvalues && data->nbz > 0)
{
- /* Middle point of the first Z-axis */
- m1[0] = 0.5f * (LZ1[0] + LZ1[3]);
- m1[1] = 0.5f * (LZ1[1] + LZ1[4]);
- m1[2] = 0.5f * (LZ1[2] + LZ1[5]);
-
- /* Middle point of the second Z-axis */
- m2[0] = 0.5f * (LZ2[0] + LZ2[3]);
- m2[1] = 0.5f * (LZ2[1] + LZ2[4]);
- m2[2] = 0.5f * (LZ2[2] + LZ2[5]);
-
- /* Apply offset to m1 */
- dx = m1[0] - m2[0];
- if (fabsf(dx) > 1.e-7f)
- {
- if (dx > 0.0f)
- dx = 1.0f;
- else
- dx = -1.0f;
- }
- dy = m1[1] - m2[1];
- if (fabsf(dy) > 1.e-7f)
- {
- if (dy > 0.0f)
- dy = 1.0f;
- else
- dy = -1.0f;
- }
-
- m2[0] = dpix * dx;
- m2[1] = dpix * dy;
-
- /* Name of Z-axis */
- if (data->zdrawname)
- {
- glColor3fv(data->znamecolor);
- offset = data->zaxisoffset + data->ztickmarklength;
- drawText(data->zname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0] + offset * m2[0], m1[1] + offset * m2[1], m1[2]);
- }
-
- /* Z-values */
- if (data->zdrawvalues && data->nbz > 0)
- {
- glColor3fv(data->zcolor);
-
- i = 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- offset = data->zoffset + data->ztickmarklength;
- while (i <= data->nbz)
- {
- sprintf(textValue, "%g", LZ1[2] + i * step);
- drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step);
- i = i + 1;
- }
- }
-
- /* Z-tickmark */
- if (data->zdrawtickmarks && data->nbz > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- while (i <= data->nbz)
- {
- glBegin(GL_LINES);
- glVertex3f(m1[0], m1[1], LZ1[2] + i * step);
- glVertex3f(m1[0] + data->ztickmarklength * m2[0], m1[1] + data->ztickmarklength * m2[1], LZ1[2] + i * step);
- glEnd();
- i = i + 1;
- }
- }
+ glColor3fv(data->zcolor);
+
+ i = 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
+ offset = data->zoffset + data->ztickmarklength;
+ while (i <= data->nbz)
+ {
+ sprintf(textValue, "%g", LZ1[2] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
+ m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step);
+ i++;
+ }
}
- /* Activate the lighting if it was turned off by this method call */
- if (light)
- glEnable(GL_LIGHTING);
+ /* Z-tickmark */
+ if (data->zdrawtickmarks && data->nbz > 0)
+ {
+ glColor3fv(data->gridcolor);
+
+ i = 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
+ while (i <= data->nbz)
+ {
+ glBegin(GL_LINES);
+ glVertex3f(m1[0], m1[1], LZ1[2] + i * step);
+ glVertex3f(m1[0] + data->ztickmarklength * m2[0], m1[1] + data->ztickmarklength * m2[1], LZ1[2] + i * step);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ /* Activate the lighting if it was turned off by this method call */
+ if (light)
+ glEnable(GL_LIGHTING);
- return TSuccess;
+ return TSuccess;
}
TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,
ymax = yMax;
zmax = zMax;
return TSuccess;
-}
\ No newline at end of file
+}
+// File: OpenGl_graduatedtrihedron.hxx
+// Created: 6 March 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE SA 2011
+
#ifndef __OPENGL_GRADUATEDTRIHEDRON_H_
#define __OPENGL_GRADUATEDTRIHEDRON_H_
#include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
-extern TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data);
-extern TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data);
+#include <Graphic3d_CGraduatedTrihedron.hxx>
+
+extern TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data);
extern TStatus call_graduatedtrihedron_redraw(int WsId);
extern TStatus call_graduatedtrihedron_erase(int WsId);
extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,
else
{
printf( "\tELEM_ANNO_TEXT_REL3\n" );
- printf( "\t\tANNOTATION TEXT RELATIVE 3 %s\n",
+ printf( "\t\tANNOTATION TEXT RELATIVE 3 %S\n",
data.atext3.string );
printf( "\t\treference point %f %f %f\n",
data.atext3.ref_pt.xyz[0],
{
TEL_POINT ref_pt; /* reference text point */
TEL_POINT anno; /* annotation pt/offset */
- Tchar *string; /* text string */
+ Techar *string; /* text string */
} atext3;
Tint size;
#include <OpenGl_Extension.hxx>
#include <OpenGl_Memory.hxx>
-
#include <OpenGl_TextRender.hxx>
+struct TEL_TEXT_DATA
+{
+ TEL_POINT attach_pt;
+ Tint length;
+ const wchar_t *sdata;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+typedef TEL_TEXT_DATA* tel_text_data;
+
/*----------------------------------------------------------------------*/
/*
* Fonctions statiques
extern float g_fSkipRatio;
#endif
-void putText( Tchar* data, Tfloat x, Tfloat y, Tfloat z )
-{
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
- textRender->RenderText ( (char*)data, fontBase, 0, x, y, z );
-}
-
/*----------------------------------------------------------------------*/
MtblPtr
TEL_POINT def_pt = {{ ( float )0.0, ( float )0.0, ( float )0.0 }};
tel_point pt = &def_pt;
tel_text_data data;
- Tchar *str= 0;
+ Techar *str= 0;
for( i = 0; i < n; i++ )
{
pt = (tel_point)k[i]->data.pdata;
break;
case TEXT_STRING_ID:
- str = (Tchar*)k[i]->data.pdata;
+ str = (Techar*)k[i]->data.pdata;
break;
}
}
- i = strlen((char*)str) + 1;
-
data = new TEL_TEXT_DATA();
if( !data )
return TFailure;
- data->data = new Tchar[i];
- if( !data->data )
+
+ //szv: instead of strlen + 1
+ i = 0; while (str[i++]);
+
+ wchar_t *wstr = new wchar_t[i];
+ if( !wstr )
return TFailure;
data->attach_pt = *pt;
data->length = i;
- memcpy( data->data, str, i );
+ //szv: instead of memcpy
+ i = 0; while (wstr[i++] = (wchar_t)(*str++));
+ data->sdata = wstr;
((tsm_elem_data)(d.pdata))->pdata = data;
if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
}
+ OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
+
/* display type of text */
if (display_type != ASPECT_TODT_NORMAL)
{
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
switch (display_type)
{
case ASPECT_TODT_BLEND:
#endif
break;
case ASPECT_TODT_SUBTITLE:
- textRender->StringSize((char *)d->data, &sWidth, &sAscent, &sDescent);
+ textRender->StringSize(d->sdata, &sWidth, &sAscent, &sDescent);
objrefX = (float)d->attach_pt.xyz[0];
objrefY = (float)d->attach_pt.xyz[1];
objrefZ = (float)d->attach_pt.xyz[2];
&objX, &objY, &objZ);
glColor3fv( colours.rgb );
- putText( d->data, (float)objX, (float)objY,(float)objZ );
+ textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1-1;
winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
- putText( d->data, (float)objX, (float)objY,(float)objZ );
+ textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1-1;
winy = winy1+1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
- putText( d->data, (float)objX, (float)objY,(float)objZ );
+ textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1+1;
winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
- putText( d->data, (float)objX, (float)objY,(float)objZ );
+ textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
break;
}
}
glColor3fv( colour.rgb );
- putText( d->data, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] );
+ textRender->RenderText( d->sdata, fontBase, 0, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] );
/* maj attributs */
if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
if (display_type == ASPECT_TODT_BLEND)
static TStatus
TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
{
- if (data.pdata)
- delete data.pdata;
+ tel_text_data d = (tel_text_data)data.pdata;
+ if (d)
+ {
+ delete[] d->sdata;
+ delete d;
+ }
return TSuccess;
}
p = (tel_text_data)data.pdata;
fprintf( stdout, "TelText.\n" );
- fprintf( stdout, "\t\tString : %s\n", p->data );
+ fprintf( stdout, "\t\tString : %S\n", p->sdata );
fprintf( stdout, "\t\tAttach Point : %f %f %f\n", p->attach_pt.xyz[0],
p->attach_pt.xyz[1],
p->attach_pt.xyz[2] );
d = (tel_text_data)data.pdata;
- size_reqd = d->length;
+ size_reqd = sizeof(Techar)*d->length;
for( i = 0; i < n; i++ )
{
if( c->size >= size_reqd )
{
- w->atext3.string = c->buf;
+ w->atext3.string = (Techar*)c->buf;
w->atext3.ref_pt = d->attach_pt;
w->atext3.anno.xyz[0] = ( float )0.0;
w->atext3.anno.xyz[1] = ( float )0.0;
w->atext3.anno.xyz[2] = ( float )0.0;
- strcpy( (char*)w->atext3.string, (char*)d->data );
+ //szv: instead of strcpy
+ Techar *ptr1 = w->atext3.string;
+ const wchar_t *ptr2 = d->sdata;
+ while (*ptr1++ = (Techar)(*ptr2++));
status = TSuccess;
}
else
#include <InterfaceGraphic_Visual3d.hxx>
#include <OSD_FontAspect.hxx>
+#include <Graphic3d_CGraduatedTrihedron.hxx>
/*----------------------------------------------------------------------*/
/*
extern void call_func_set_anno_char_up_vec(Tfloat[2]); /* up_vector */
extern void call_func_set_anno_path(Tint); /* path */
extern void call_func_set_anno_align(Tint, Tint); /* hor, ver */
-extern void call_func_anno_text_rel3( tel_point, Tchar* );
+extern void call_func_anno_text_rel3( tel_point, Techar* );
extern void call_func_dcue_ind(Tint); /* dcid */
extern void call_func_set_do_texturemap(Tint); /* bool */
extern void call_func_set_texture_id(Tint); /* TextureID */
/* Graduated trihedron */
-void EXPORT call_togl_graduatedtrihedron_get(CALL_DEF_VIEW* view,
- CALL_DEF_GRADUATEDTRIHEDRON* cubic);
-
-void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
- CALL_DEF_GRADUATEDTRIHEDRON* cubic);
+void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
+ const Graphic3d_CGraduatedTrihedron &cubic);
void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view);
void EXPORT call_togl_text2d (
- char *s,
+ Techar *s,
float x,
float y,
float height
void EXPORT call_togl_textsize2d (
- char *s,
+ Techar *s,
float height,
float *width,
float *ascent,
static float layerFontGreen = -1.;
static float layerFontBlue = -1.;
-
static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular;
static Tint FTGLLayerFontHeight = 16;
static Tint FTGLLayerFontAscent = 0;
/*----------------------------------------------------------------------*/
void EXPORT
-call_togl_text2d ( char *s,
+call_togl_text2d ( Techar *s,
float x,
float y,
float height )
{
- call_def_ptrLayer ptrLayer;
#ifndef WNT
Tint dispWidth, dispHeight;
#endif
GLdouble objx1, objy1, objz1;
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
+ call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
+ if (!ptrLayer) return;
if (ptrLayer->listIndex == 0) return;
#ifdef TRACE_TEXT
printf ("call_togl_text2d %d\n", ptrLayer->listIndex);
objy1 = y,
objz1 = 0.0;
+ //szv: conversion of Techar to wchar_t
+ wchar_t *s1 = (wchar_t*)s;
+ if (sizeof(Techar) != sizeof(wchar_t))
+ {
+ Tint i = 0; while (s[i++]);
+ s1 = new wchar_t[i];
+ i = 0; while (s1[i++] = (wchar_t)(*s++));
+ }
+
/*
* On traite les differents types d'affichage de texte
*/
printf ("texte normal %f %f\n", objx1, objy1);
#endif
- textRender->RenderText(s , fontBase, 1, (float )objx1, (float )objy1, 0.f );
+ textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f );
break;
case 1 : /* Aspect_TODT_SubTitle */
glColor3f (layerRed, layerGreen, layerBlue);
#endif /* OK */
-
- textRender->RenderText(s, fontBase, 1, (float )objx1, (float )objy1, 0.f);
+ textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
break;
case 2 : /* Aspect_TODT_Dekale */
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
- textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f);
+ textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
winx2 = winx1-1;
printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
#endif
- textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f);
+ textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
winx2 = winx1-1;
#endif
- textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f);
+ textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
winx2 = winx1+1;
winy2 = winy1-1;
printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
#endif
- textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f);
+ textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
glColor3f (layerRed, layerGreen, layerBlue);
#endif /* OK */
- textRender->RenderText(s, fontBase, 1, (float )objx1, (float )objy1, 0.f);
+ textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
#ifdef DEBUG
printf ("---------------------\n");
#else
glColor3f (layerRed, layerGreen, layerBlue);
- textRender->RenderText(s, fontBase, 1, (float )objx1, (float )objy1, 0.f);
+ textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
#endif //WNT
printf ("texte blend %f %f\n", objx1, objy1);
#endif
- textRender->RenderText(s, fontBase, 1, (float )objx1, (float )objy1, 0.f);
+ textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
#ifdef DEBUG
printf ("---------------------\n");
#endif /* OK */
break;
}
+ //szv: delete temporary wide string
+ if (sizeof(Techar) != sizeof(wchar_t))
+ delete[] s1;
}
void EXPORT
call_togl_textsize2d
(
- char *s,
+ Techar *s,
float height,
float *width,
float *ascent,
float *descent
)
{
- call_def_ptrLayer ptrLayer;
#ifndef WNT
Tint dispWidth, dispHeight;
#endif
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
+ call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
+ if (!ptrLayer) return;
if (ptrLayer->listIndex == 0) return;
+ OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- if ( FTGLLayerFontHeight != height || layerFontFlag == IsModified || FTGLLayerFontCurrent == 0 ) {
+ if ( FTGLLayerFontHeight != height || layerFontFlag == IsModified || FTGLLayerFontCurrent == 0 )
+ {
layerFontFlag = IsNotModified;
FTGLLayerFontHeight = height;
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight);
- textRender -> StringSize(s, &FTGLLayerFontWidth, &FTGLLayerFontAscent, &FTGLLayerFontDescent);
}
-
+ //szv: conversion of Techar to wchar_t
+ wchar_t *s1 = (wchar_t*)s, *s2 = 0;
+ if (sizeof(Techar) != sizeof(wchar_t))
+ {
+ Tint i = 0; while (s[i++]);
+ s1 = s2 = new wchar_t[i];
+ i = 0; while (s1[i++] = (wchar_t)(*s++));
+ }
+ textRender->StringSize(s1, &FTGLLayerFontWidth, &FTGLLayerFontAscent, &FTGLLayerFontDescent);
+ //szv: delete temporary wide string
+ if (s2) delete[] s2;
+
*width = (float) FTGLLayerFontWidth;
*ascent = (float) FTGLLayerFontAscent;
*descent = (float) FTGLLayerFontDescent;
FTGLLayerFontXScale = FTGLLayerFontYScale = 1.f;
OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight);
-
+
layerFontRed = r;
layerFontGreen = g;
layerFontBlue = b;
+// File: OpenGl_togl_graduatedtrihedron.cxx
+// Created: 6 March 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE SA 2011
+
#include <OpenGl_graduatedtrihedron.hxx>
#include <OpenGl_tsm_ws.hxx>
#include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
-void EXPORT call_togl_graduatedtrihedron_get(CALL_DEF_VIEW* view,
- CALL_DEF_GRADUATEDTRIHEDRON* cubic)
-{
- call_graduatedtrihedron_get(view->WsId, cubic);
-}
-
void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
- CALL_DEF_GRADUATEDTRIHEDRON* cubic)
+ const Graphic3d_CGraduatedTrihedron &cubic)
{
call_graduatedtrihedron_display(view->WsId, cubic);
}
call_func_set_anno_char_up_vec (up_vect);
call_func_set_anno_path (path);
call_func_set_anno_align (hor_align, ver_align);
- call_func_anno_text_rel3 (&text_pt, (Tchar*)atext->string);
+ call_func_anno_text_rel3 (&text_pt, (Techar*)atext->string);
if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
}
GLuint fontBase = 0;
GLint mode;
- char AxeName[]="X\0";
#ifdef QTOCC_PATCH /* PCD 10/02/08 */
/* Fix to problem with clipping planes chopping off pieces of the triedron */
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* Axe X */
- strcpy ( AxeName, "X\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + 0.0;
TriedronCoord[2] = TriedronOrigin[2] - rayon ;
+ textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2] );
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2] );
/* Axe Y */
- strcpy ( AxeName, "Y\0" );
TriedronCoord[0] = TriedronOrigin[0] + rayon ;
TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon );
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+ textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+
/* Axe Z */
- strcpy ( AxeName, "Z\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ;
-
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+ textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
#ifdef QTOCC_PATCH /* PCD 10/02/08 */
/* Recover the clip planes */
GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 };
GLuint fontBase = 0;
- char AxeName[]="X\0";
GLuint startList;
GLUquadricObj* aQuadric;
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* Axe X */
- strcpy ( AxeName, "X\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + 0.0;
TriedronCoord[2] = TriedronOrigin[2] - rayon ;
-
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+ textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
/* Axe Y */
- strcpy ( AxeName, "Y\0" );
TriedronCoord[0] = TriedronOrigin[0] + rayon ;
TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon );
-
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+ textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
/* Axe Z */
- strcpy ( AxeName, "Z\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ;
- textRender->RenderText(AxeName, fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
+ textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
#ifdef QTOCC_PATCH
/*PCD 17/06/07 */
GraphicCallbackProc from Aspect,
FillMethod from Aspect,
GradientFillMethod from Aspect,
- FontAspect from OSD
+ FontAspect from OSD,
+ AsciiString from TCollection,
+ ExtendedString from TCollection
raises
GetGraduatedTrihedron(me;
-- Names of axes --
- xname : out CString from Standard;
- yname : out CString from Standard;
- zname : out CString from Standard;
+ xname, yname, zname : out ExtendedString from TCollection;
-- Draw names --
- xdrawname : out Boolean from Standard;
- ydrawname : out Boolean from Standard;
- zdrawname : out Boolean from Standard;
+ xdrawname, ydrawname, zdrawname : out Boolean from Standard;
-- Draw values --
- xdrawvalues : out Boolean from Standard;
- ydrawvalues : out Boolean from Standard;
- zdrawvalues : out Boolean from Standard;
+ xdrawvalues, ydrawvalues, zdrawvalues : out Boolean from Standard;
-- Draw grid --
drawgrid : out Boolean from Standard;
-- Draw axes --
drawaxes : out Boolean from Standard;
-- Number of splits along axes --
- nbx : out Integer from Standard;
- nby : out Integer from Standard;
- nbz : out Integer from Standard;
+ nbx, nby, nbz : out Integer from Standard;
-- Offset for drawing values --
- xoffset : out Integer from Standard;
- yoffset : out Integer from Standard;
- zoffset : out Integer from Standard;
+ xoffset, yoffset, zoffset : out Integer from Standard;
-- Offset for drawing names of axes --
- xaxisoffset : out Integer from Standard;
- yaxisoffset : out Integer from Standard;
- zaxisoffset : out Integer from Standard;
+ xaxisoffset, yaxisoffset, zaxisoffset : out Integer from Standard;
-- Draw tickmarks --
- xdrawtickmarks : out Boolean from Standard;
- ydrawtickmarks : out Boolean from Standard;
- zdrawtickmarks : out Boolean from Standard;
+ xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks --
- xtickmarklength : out Integer from Standard;
- ytickmarklength : out Integer from Standard;
- ztickmarklength : out Integer from Standard;
+ xtickmarklength, ytickmarklength, ztickmarklength : out Integer from Standard;
-- Grid color --
gridcolor : out Color from Quantity;
- -- X name color --
- xnamecolor : out Color from Quantity;
- -- Y name color --
- ynamecolor : out Color from Quantity;
- -- Z name color --
- znamecolor : out Color from Quantity;
- -- X color of axis and values --
- xcolor : out Color from Quantity;
- -- Y color of axis and values --
- ycolor : out Color from Quantity;
- -- Z color of axis and values --
- zcolor : out Color from Quantity;
+ -- Colors of axis names --
+ xnamecolor, ynamecolor, znamecolor : out Color from Quantity;
+ -- Colors of axis and values --
+ xcolor, ycolor, zcolor : out Color from Quantity;
-- Name of font for names of axes --
- fontOfNames : out CString from Standard;
+ fontOfNames : out AsciiString from TCollection;
-- Style of names of axes --
styleOfNames : out FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : out Integer from Standard;
-- Name of font for values --
- fontOfValues : out CString from Standard;
+ fontOfValues : out AsciiString from TCollection;
-- Style of values --
styleOfValues : out FontAspect from OSD;
-- Size of values --
GraduatedTrihedronDisplay(me : mutable;
-- Names of axes --
- xname : CString from Standard = "X\0";
- yname : CString from Standard = "Y\0";
- zname : CString from Standard = "Z\0";
+ xname : ExtendedString from TCollection = "X";
+ yname : ExtendedString from TCollection = "Y";
+ zname : ExtendedString from TCollection = "Z";
-- Draw names --
xdrawname : Boolean from Standard = Standard_True;
ydrawname : Boolean from Standard = Standard_True;
-- Z color of axis and values --
zcolor : Color from Quantity = Quantity_NOC_BLUE1;
-- Name of font for names of axes --
- fontOfNames : CString from Standard = "Arial";
+ fontOfNames : AsciiString from TCollection = "Arial";
-- Style of names of axes --
styleOfNames : FontAspect from OSD = OSD_FA_Bold;
-- Size of names of axes --
sizeOfNames : Integer from Standard = 12;
-- Name of font for values --
- fontOfValues : CString from Standard = "Arial";
+ fontOfValues : AsciiString from TCollection = "Arial";
-- Style of values --
styleOfValues : FontAspect from OSD = OSD_FA_Regular;
-- Size of values --
}
void V3d_View::GetGraduatedTrihedron(/* Names of axes */
- Standard_CString& xname,
- Standard_CString& yname,
- Standard_CString& zname,
+ TCollection_ExtendedString &xname,
+ TCollection_ExtendedString &yname,
+ TCollection_ExtendedString &zname,
/* Draw names */
Standard_Boolean& xdrawname,
Standard_Boolean& ydrawname,
/* Z color of axis and values */
Quantity_Color& zcolor,
/* Name of font for names of axes */
- Standard_CString& fontOfNames,
+ TCollection_AsciiString &fontOfNames,
/* Style of names of axes */
OSD_FontAspect& styleOfNames,
/* Size of names of axes */
Standard_Integer& sizeOfNames,
/* Name of font for values */
- Standard_CString& fontOfValues,
+ TCollection_AsciiString &fontOfValues,
/* Style of values */
OSD_FontAspect& styleOfValues,
/* Size of values */
}
void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */
- const Standard_CString xname,
- const Standard_CString yname,
- const Standard_CString zname,
+ const TCollection_ExtendedString &xname,
+ const TCollection_ExtendedString &yname,
+ const TCollection_ExtendedString &zname,
/* Draw names */
const Standard_Boolean xdrawname,
const Standard_Boolean ydrawname,
/* Z color of axis and values */
const Quantity_Color& zcolor,
/* Name of font for names of axes */
- const Standard_CString fontOfNames,
+ const TCollection_AsciiString &fontOfNames,
/* Style of names of axes */
const OSD_FontAspect styleOfNames,
/* Size of names of axes */
const Standard_Integer sizeOfNames,
/* Name of font for values */
- const Standard_CString fontOfValues,
+ const TCollection_AsciiString &fontOfValues,
/* Style of values */
const OSD_FontAspect styleOfValues,
/* Size of values */
{
MyView->GraduatedTrihedronErase();
}
-
-// File: ViewerTest_ObjectsCommands.cxx
-// Created: Thu Nov 12 15:50:42 1998
-// Author: Robert COUBLANC
-// <rob@robox.paris1.matra-dtv.fr>
+// File: ViewerTest_ObjectsCommands.cxx
+// Created: Thu Nov 12 15:50:42 1998
+// Author: Robert COUBLANC
+// Copyright: OPEN CASCADE 1998
//===============================================
DEFINE_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject)
-class MyTextClass:public AIS_InteractiveObject{
-
+class MyTextClass:public AIS_InteractiveObject
+{
public:
// CASCADE RTTI
DEFINE_STANDARD_RTTI(MyTextClass );
IMPLEMENT_STANDARD_RTTIEXT(MyTextClass, AIS_InteractiveObject)
-
MyTextClass::MyTextClass( const TCollection_ExtendedString& text, const gp_Pnt& position,
Quantity_Color color = Quantity_NOC_YELLOW,
Standard_Integer aHJust = Graphic3d_HTA_LEFT,
static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- // Verification des arguments
- if ( argc > 17 ) {di<<argv[0]<<" Syntaxe error"<<"\n"; return 1;}
- Quantity_Parameter R, G, B;
- Quantity_Color aColor;
- Standard_Real angle;
- Standard_Real height;
- Standard_Boolean zoom;
- OSD_FontAspect aspect;
- TCollection_AsciiString font;
- gp_Pnt pnt;
- int hor_align;
- int ver_align;
- TCollection_AsciiString aFont;
- TCollection_AsciiString name = argv[1];
-
- //Declarations et creation des objets par default
- Standard_Real X,Y,Z;
- X = atof(argv[2]);
- Y = atof(argv[3]);
- Z = atof(argv[4]);
- pnt.SetCoord(X,Y,Z);
-
- R = atof(argv[5])/255.;
- G = atof(argv[6])/255.;
- B = atof(argv[7])/255.;
-
- hor_align = atoi(argv[8]);
- ver_align = atoi(argv[9]);
-
- angle = atof(argv[10]);
-
- zoom = atoi(argv[11]);
-
- height = atof(argv[12]);
-
- aspect = OSD_FontAspect(atoi(argv[13]));
-
- if(argc == 14)
- font.AssignCat("Courier");
- if(argc == 15)
- font.AssignCat(argv[14]);
- if(argc == 16)
+ // Check arguments
+ if (argc < 14)
{
- font.AssignCat(argv[14]);
- font.AssignCat(" ");
- font.AssignCat(argv[15]);
+ di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
+ di<<"Usage: type help "<<argv[0]<<"\n";
+ return 1; //TCL_ERROR
}
- if(argc == 17)
+
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+ // Create 3D view if it doesn't exist
+ if ( aContext.IsNull() )
{
- font.AssignCat(argv[14]);
- font.AssignCat(" ");
- font.AssignCat(argv[15]);
- font.AssignCat(" ");
- font.AssignCat(argv[16]);
+ ViewerTest::ViewerInit();
+ aContext = ViewerTest::GetAISContext();
+ if( aContext.IsNull() )
+ {
+ di << "Error: Cannot create a 3D view\n";
+ return 1; //TCL_ERROR
+ }
}
- aColor.SetValues( R, G, B, Quantity_TOC_RGB );
+ // Text position
+ const Standard_Real X = atof(argv[2]);
+ const Standard_Real Y = atof(argv[3]);
+ const Standard_Real Z = atof(argv[4]);
+ const gp_Pnt pnt(X,Y,Z);
- Handle(AIS_InteractiveContext) aContext= ViewerTest::GetAISContext();
+ // Text color
+ const Quantity_Parameter R = atof(argv[5])/255.;
+ const Quantity_Parameter G = atof(argv[6])/255.;
+ const Quantity_Parameter B = atof(argv[7])/255.;
+ const Quantity_Color aColor( R, G, B, Quantity_TOC_RGB );
- Handle(MyTextClass) my=new MyTextClass(argv[1],pnt,aColor,hor_align,ver_align,angle,zoom,height,aspect,font.ToCString());
+ // Text alignment
+ const int hor_align = atoi(argv[8]);
+ const int ver_align = atoi(argv[9]);
- aContext->Display(my,Standard_True);
+ // Text angle
+ const Standard_Real angle = atof(argv[10]);
- if(aContext.IsNull())
+ // Text zooming
+ const Standard_Boolean zoom = atoi(argv[11]);
+
+ // Text height
+ const Standard_Real height = atof(argv[12]);
+
+ // Text aspect
+ const OSD_FontAspect aspect = OSD_FontAspect(atoi(argv[13]));
+
+ // Text font
+ TCollection_AsciiString font;
+ if(argc < 15)
+ font.AssignCat("Courier");
+ else
+ font.AssignCat(argv[14]);
+
+ // Text is multibyte
+ const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (atoi(argv[15]) != 0);
+
+ // Read text string
+ TCollection_ExtendedString name;
+ if (isMultibyte)
{
- di << "use 'vinit' command before " << argv[0] << "\n";
- return -1;
+ const char *str = argv[1];
+ while (*str)
+ {
+ unsigned short c1 = *str++;
+ unsigned short c2 = *str++;
+ if (!c1 || !c2) break;
+ name += (Standard_ExtCharacter)((c1 << 8) | c2);
+ }
}
+ else
+ {
+ name += argv[1];
+ }
+
+ if (name.Length())
+ {
+ Handle(MyTextClass) myT = new MyTextClass(name,pnt,aColor,hor_align,ver_align,angle,zoom,height,aspect,font.ToCString());
+ aContext->Display(myT,Standard_True);
+ }
+
return 0;
}
if (anActivePlanes < aView->View()->PlaneLimit())
{
aView->SetPlaneOn (aPlaneV3d); // add to enabled planes list
- aView->Update();
+ aView->Update();
}
else
{
__FILE__,VCircleBuilder,group);
theCommands.Add("vdrawtext",
- "vdrawtext : vdrawtext name X Y Z R G B hor_align ver_align angle zoomable height Aspect FONT ",
+ "vdrawtext : vdrawtext name X Y Z R G B hor_align ver_align angle zoomable height Aspect [Font [isMultiByte]]",
__FILE__,VDrawText,group);
theCommands.Add("vdrawsphere",
theCommands.Add("vclipplane",
"vclipplane : vclipplane [x y z dx dy dz] [planeId {on/off/del/display/hide}]",
__FILE__,VClipPlane,group);
-
}
//function : VGraduatedTrihedron
//purpose : Displays a graduated trihedron
//==============================================================================
+
+static void AddMultibyteString (TCollection_ExtendedString &name, const char *arg)
+{
+ const char *str = arg;
+ while (*str)
+ {
+ unsigned short c1 = *str++;
+ unsigned short c2 = *str++;
+ if (!c1 || !c2) break;
+ name += (Standard_ExtCharacter)((c1 << 8) | c2);
+ }
+}
+
static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- Handle(V3d_View) V3dView = ViewerTest::CurrentView();
- if (V3dView.IsNull())
- return 1;
+ // Check arguments
+ if (argc != 2 && argc < 5)
+ {
+ di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
+ di<<"Usage: type help "<<argv[0]<<"\n";
+ return 1; //TCL_ERROR
+ }
- if (argc < 2)
+ Handle(V3d_View) aV3dView = ViewerTest::CurrentView();
+
+ // Create 3D view if it doesn't exist
+ if ( aV3dView.IsNull() )
{
- di << argv[0] << " Invalid number of arguments" << "\n";
- return 1;
+ ViewerTest::ViewerInit();
+ aV3dView = ViewerTest::CurrentView();
+ if( aV3dView.IsNull() )
+ {
+ di << "Error: Cannot create a 3D view\n";
+ return 1; //TCL_ERROR
+ }
}
- Standard_CString xname = "X (mm)";
- Standard_CString yname = "Y (mm)";
- Standard_CString zname = "Z (mm)";
+ // Erase (==0) or display (!=0)
+ const int display = atoi(argv[1]);
- if (argc > 2)
+ if (display)
{
- if (argc != 5)
+ // Text font
+ TCollection_AsciiString font;
+ if (argc < 6)
+ font.AssignCat("Courier");
+ else
+ font.AssignCat(argv[5]);
+
+ // Text is multibyte
+ const Standard_Boolean isMultibyte = (argc < 7)? Standard_False : (atoi(argv[6]) != 0);
+
+ // Set axis names
+ TCollection_ExtendedString xname, yname, zname;
+ if (argc >= 5)
+ {
+ if (isMultibyte)
{
- di << argv[0] << " Define all X, Y and Z axes names, please" << "\n";
- return 1;
+ AddMultibyteString(xname, argv[2]);
+ AddMultibyteString(yname, argv[3]);
+ AddMultibyteString(zname, argv[4]);
}
- xname = argv[2];
- yname = argv[3];
- zname = argv[4];
- }
+ else
+ {
+ xname += argv[2];
+ yname += argv[3];
+ zname += argv[4];
+ }
+ }
+ else
+ {
+ xname += "X (mm)";
+ yname += "Y (mm)";
+ zname += "Z (mm)";
+ }
- int display = atoi(argv[1]);
- if (display)
- V3dView->GraduatedTrihedronDisplay(xname, yname, zname,
- Standard_True/*xdrawname*/, Standard_True/*ydrawname*/, Standard_True/*zdrawname*/,
- Standard_True/*xdrawvalues*/, Standard_True/*ydrawvalues*/, Standard_True/*zdrawvalues*/,
- Standard_True/*drawgrid*/,
- Standard_True/*drawaxes*/,
- 5/*nbx*/, 5/*nby*/, 5/*nbz*/,
- 10/*xoffset*/, 10/*yoffset*/, 10/*zoffset*/,
- 30/*xaxisoffset*/, 30/*yaxisoffset*/, 30/*zaxisoffset*/,
- Standard_True/*xdrawtickmarks*/, Standard_True/*ydrawtickmarks*/, Standard_True/*zdrawtickmarks*/,
- 10/*xtickmarklength*/, 10/*ytickmarklength*/, 10/*ztickmarklength*/);
+ aV3dView->GraduatedTrihedronDisplay(xname, yname, zname,
+ Standard_True/*xdrawname*/, Standard_True/*ydrawname*/, Standard_True/*zdrawname*/,
+ Standard_True/*xdrawvalues*/, Standard_True/*ydrawvalues*/, Standard_True/*zdrawvalues*/,
+ Standard_True/*drawgrid*/,
+ Standard_True/*drawaxes*/,
+ 5/*nbx*/, 5/*nby*/, 5/*nbz*/,
+ 10/*xoffset*/, 10/*yoffset*/, 10/*zoffset*/,
+ 30/*xaxisoffset*/, 30/*yaxisoffset*/, 30/*zaxisoffset*/,
+ Standard_True/*xdrawtickmarks*/, Standard_True/*ydrawtickmarks*/, Standard_True/*zdrawtickmarks*/,
+ 10/*xtickmarklength*/, 10/*ytickmarklength*/, 10/*ztickmarklength*/,
+ Quantity_NOC_WHITE/*gridcolor*/,
+ Quantity_NOC_RED/*xnamecolor*/,Quantity_NOC_GREEN/*ynamecolor*/,Quantity_NOC_BLUE1/*znamecolor*/,
+ Quantity_NOC_RED/*xcolor*/,Quantity_NOC_GREEN/*ycolor*/,Quantity_NOC_BLUE1/*zcolor*/,font);
+ }
else
- V3dView->GraduatedTrihedronErase();
+ aV3dView->GraduatedTrihedronErase();
ViewerTest::GetAISContext()->UpdateCurrentViewer();
- V3dView->Redraw();
+ aV3dView->Redraw();
+
return 0;
}
"vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
__FILE__,VColorScale,group);
theCommands.Add("vgraduatedtrihedron",
- "vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname]",
+ "vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname [Font [isMultibyte]]]",
__FILE__,VGraduatedTrihedron,group);
}
ExportFormat from Graphic3d,
SortType from Graphic3d,
Color from Quantity,
- FontAspect from OSD
+ FontAspect from OSD,
+ AsciiString from TCollection,
+ ExtendedString from TCollection,
+ CGraduatedTrihedron from Graphic3d
raises
TransformError from Visual3d,
GetGraduatedTrihedron(me;
-- Names of axes --
- xname : out CString from Standard;
- yname : out CString from Standard;
- zname : out CString from Standard;
+ xname, yname, zname : out ExtendedString from TCollection;
-- Draw names --
- xdrawname : out Boolean from Standard;
- ydrawname : out Boolean from Standard;
- zdrawname : out Boolean from Standard;
+ xdrawname, ydrawname, zdrawname : out Boolean from Standard;
-- Draw values --
- xdrawvalues : out Boolean from Standard;
- ydrawvalues : out Boolean from Standard;
- zdrawvalues : out Boolean from Standard;
+ xdrawvalues, ydrawvalues, zdrawvalues : out Boolean from Standard;
-- Draw grid --
drawgrid : out Boolean from Standard;
-- Draw axes --
drawaxes : out Boolean from Standard;
-- Number of splits along axes --
- nbx : out Integer from Standard;
- nby : out Integer from Standard;
- nbz : out Integer from Standard;
+ nbx, nby, nbz : out Integer from Standard;
-- Offset for drawing values --
- xoffset : out Integer from Standard;
- yoffset : out Integer from Standard;
- zoffset : out Integer from Standard;
+ xoffset, yoffset, zoffset : out Integer from Standard;
-- Offset for drawing names of axes --
- xaxisoffset : out Integer from Standard;
- yaxisoffset : out Integer from Standard;
- zaxisoffset : out Integer from Standard;
+ xaxisoffset, yaxisoffset, zaxisoffset : out Integer from Standard;
-- Draw tickmarks --
- xdrawtickmarks : out Boolean from Standard;
- ydrawtickmarks : out Boolean from Standard;
- zdrawtickmarks : out Boolean from Standard;
+ xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks --
- xtickmarklength : out Integer from Standard;
- ytickmarklength : out Integer from Standard;
- ztickmarklength : out Integer from Standard;
+ xtickmarklength, ytickmarklength, ztickmarklength : out Integer from Standard;
-- Grid color --
gridcolor : out Color from Quantity;
- -- X name color --
- xnamecolor : out Color from Quantity;
- -- Y name color --
- ynamecolor : out Color from Quantity;
- -- Z name color --
- znamecolor : out Color from Quantity;
- -- X color of axis and values --
- xcolor : out Color from Quantity;
- -- Y color of axis and values --
- ycolor : out Color from Quantity;
- -- Z color of axis and values --
- zcolor : out Color from Quantity;
+ -- Colors of axis names --
+ xnamecolor, ynamecolor, znamecolor : out Color from Quantity;
+ -- Colors of axis and values --
+ xcolor, ycolor, zcolor : out Color from Quantity;
-- Name of font for names of axes --
- fontOfNames : out CString from Standard;
+ fontOfNames : out AsciiString from TCollection;
-- Style of names of axes --
styleOfNames : out FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : out Integer from Standard;
-- Name of font for values --
- fontOfValues : out CString from Standard;
+ fontOfValues : out AsciiString from TCollection;
-- Style of values --
styleOfValues : out FontAspect from OSD;
-- Size of values --
sizeOfValues : out Integer from Standard)
- ---Purpose: Returns data of a graduated trihedron.
+ returns Boolean from Standard
is static;
+ ---Purpose: Returns data of a graduated trihedron if displayed (return value is True)
GraduatedTrihedronDisplay(me : mutable;
-- Names of axes --
- xname : CString from Standard;
- yname : CString from Standard;
- zname : CString from Standard;
+ xname, yname, zname : ExtendedString from TCollection;
-- Draw names --
- xdrawname : Boolean from Standard;
- ydrawname : Boolean from Standard;
- zdrawname : Boolean from Standard;
+ xdrawname, ydrawname, zdrawname : Boolean from Standard;
-- Draw values --
- xdrawvalues : Boolean from Standard;
- ydrawvalues : Boolean from Standard;
- zdrawvalues : Boolean from Standard;
+ xdrawvalues, ydrawvalues, zdrawvalues : Boolean from Standard;
-- Draw grid --
drawgrid : Boolean from Standard;
-- Draw axes --
drawaxes : Boolean from Standard;
-- Number of splits along axes --
- nbx : Integer from Standard;
- nby : Integer from Standard;
- nbz : Integer from Standard;
+ nbx, nby, nbz : Integer from Standard;
-- Offset for drawing values --
- xoffset : Integer from Standard;
- yoffset : Integer from Standard;
- zoffset : Integer from Standard;
+ xoffset, yoffset, zoffset : Integer from Standard;
-- Offset for drawing names of axes --
- xaxisoffset : Integer from Standard;
- yaxisoffset : Integer from Standard;
- zaxisoffset : Integer from Standard;
+ xaxisoffset, yaxisoffset, zaxisoffset : Integer from Standard;
-- Draw tickmarks --
- xdrawtickmarks : Boolean from Standard;
- ydrawtickmarks : Boolean from Standard;
- zdrawtickmarks : Boolean from Standard;
+ xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : Boolean from Standard;
-- Length of tickmarks --
- xtickmarklength : Integer from Standard;
- ytickmarklength : Integer from Standard;
- ztickmarklength : Integer from Standard;
+ xtickmarklength, ytickmarklength, ztickmarklength : Integer from Standard;
-- Grid color --
gridcolor : Color from Quantity;
- -- X name color --
- xnamecolor : Color from Quantity;
- -- Y name color --
- ynamecolor : Color from Quantity;
- -- Z name color --
- znamecolor : Color from Quantity;
- -- X color of axis and values --
- xcolor : Color from Quantity;
- -- Y color of axis and values --
- ycolor : Color from Quantity;
- -- Z color of axis and values --
- zcolor : Color from Quantity;
+ -- Colors of axis names --
+ xnamecolor, ynamecolor, znamecolor : Color from Quantity;
+ -- Colors of axis and values --
+ xcolor, ycolor, zcolor : Color from Quantity;
-- Name of font for names of axes --
- fontOfNames : CString from Standard;
+ fontOfNames : AsciiString from TCollection;
-- Style of names of axes --
styleOfNames : FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : Integer from Standard;
-- Name of font for values --
- fontOfValues : CString from Standard;
+ fontOfValues : AsciiString from TCollection;
-- Style of values --
styleOfValues : FontAspect from OSD;
-- Size of values --
-- Booleans
MyCBitFields : CBitFields8 from Graphic3d;
+ MyGTrihedron : CGraduatedTrihedron from Graphic3d;
+
friends
class ViewManager from Visual3d
}
}
-void Visual3d_View::GetGraduatedTrihedron(/* Names of axes */
- Standard_CString& xname,
- Standard_CString& yname,
- Standard_CString& zname,
- /* Draw names */
- Standard_Boolean& xdrawname,
- Standard_Boolean& ydrawname,
- Standard_Boolean& zdrawname,
- /* Draw values */
- Standard_Boolean& xdrawvalues,
- Standard_Boolean& ydrawvalues,
- Standard_Boolean& zdrawvalues,
- /* Draw grid */
- Standard_Boolean& drawgrid,
- /* Draw axes */
- Standard_Boolean& drawaxes,
- /* Number of splits along axes */
- Standard_Integer& nbx,
- Standard_Integer& nby,
- Standard_Integer& nbz,
- /* Offset for drawing values */
- Standard_Integer& xoffset,
- Standard_Integer& yoffset,
- Standard_Integer& zoffset,
- /* Offset for drawing names of axes */
- Standard_Integer& xaxisoffset,
- Standard_Integer& yaxisoffset,
- Standard_Integer& zaxisoffset,
- /* Draw tickmarks */
- Standard_Boolean& xdrawtickmarks,
- Standard_Boolean& ydrawtickmarks,
- Standard_Boolean& zdrawtickmarks,
- /* Length of tickmarks */
- Standard_Integer& xtickmarklength,
- Standard_Integer& ytickmarklength,
- Standard_Integer& ztickmarklength,
- /* Grid color */
- Quantity_Color& gridcolor,
- /* X name color */
- Quantity_Color& xnamecolor,
- /* Y name color */
- Quantity_Color& ynamecolor,
- /* Z name color */
- Quantity_Color& znamecolor,
- /* X color of axis and values */
- Quantity_Color& xcolor,
- /* Y color of axis and values */
- Quantity_Color& ycolor,
- /* Z color of axis and values */
- Quantity_Color& zcolor,
- /* Name of font for names of axes */
- Standard_CString& fontOfNames,
- /* Style of names of axes */
- OSD_FontAspect& styleOfNames,
- /* Size of names of axes */
- Standard_Integer& sizeOfNames,
- /* Name of font for values */
- Standard_CString& fontOfValues,
- /* Style of values */
- OSD_FontAspect& styleOfValues,
- /* Size of values */
- Standard_Integer& sizeOfValues) const
+Standard_Boolean Visual3d_View::GetGraduatedTrihedron
+ (/* Names of axes */
+ TCollection_ExtendedString& xname,
+ TCollection_ExtendedString& yname,
+ TCollection_ExtendedString& zname,
+ /* Draw names */
+ Standard_Boolean& xdrawname,
+ Standard_Boolean& ydrawname,
+ Standard_Boolean& zdrawname,
+ /* Draw values */
+ Standard_Boolean& xdrawvalues,
+ Standard_Boolean& ydrawvalues,
+ Standard_Boolean& zdrawvalues,
+ /* Draw grid */
+ Standard_Boolean& drawgrid,
+ /* Draw axes */
+ Standard_Boolean& drawaxes,
+ /* Number of splits along axes */
+ Standard_Integer& nbx,
+ Standard_Integer& nby,
+ Standard_Integer& nbz,
+ /* Offset for drawing values */
+ Standard_Integer& xoffset,
+ Standard_Integer& yoffset,
+ Standard_Integer& zoffset,
+ /* Offset for drawing names of axes */
+ Standard_Integer& xaxisoffset,
+ Standard_Integer& yaxisoffset,
+ Standard_Integer& zaxisoffset,
+ /* Draw tickmarks */
+ Standard_Boolean& xdrawtickmarks,
+ Standard_Boolean& ydrawtickmarks,
+ Standard_Boolean& zdrawtickmarks,
+ /* Length of tickmarks */
+ Standard_Integer& xtickmarklength,
+ Standard_Integer& ytickmarklength,
+ Standard_Integer& ztickmarklength,
+ /* Grid color */
+ Quantity_Color& gridcolor,
+ /* Colors of axis names */
+ Quantity_Color& xnamecolor,
+ Quantity_Color& ynamecolor,
+ Quantity_Color& znamecolor,
+ /* Colors of axis and values */
+ Quantity_Color& xcolor,
+ Quantity_Color& ycolor,
+ Quantity_Color& zcolor,
+ /* Name of font for names of axes */
+ TCollection_AsciiString& fontOfNames,
+ /* Style of names of axes */
+ OSD_FontAspect& styleOfNames,
+ /* Size of names of axes */
+ Standard_Integer& sizeOfNames,
+ /* Name of font for values */
+ TCollection_AsciiString& fontOfValues,
+ /* Style of values */
+ OSD_FontAspect& styleOfValues,
+ /* Size of values */
+ Standard_Integer& sizeOfValues) const
{
- MyGraphicDriver->GetGraduatedTrihedron(MyCView,
- /* Names of axes */
- xname,
- yname,
- zname,
- /* Draw names */
- xdrawname,
- ydrawname,
- zdrawname,
- /* Draw values */
- xdrawvalues,
- ydrawvalues,
- zdrawvalues,
- /* Draw grid */
- drawgrid,
- /* Draw axes */
- drawaxes,
- /* Number of splits along axes */
- nbx,
- nby,
- nbz,
- /* Offset for drawing values */
- xoffset,
- yoffset,
- zoffset,
- /* Offset for drawing names of axes */
- xaxisoffset,
- yaxisoffset,
- zaxisoffset,
- /* Draw tickmarks */
- xdrawtickmarks,
- ydrawtickmarks,
- zdrawtickmarks,
- /* Length of tickmarks */
- xtickmarklength,
- ytickmarklength,
- ztickmarklength,
- /* Grid color */
- gridcolor,
- /* X name color */
- xnamecolor,
- /* Y name color */
- ynamecolor,
- /* Z name color */
- znamecolor,
- /* X color of axis and values */
- xcolor,
- /* Y color of axis and values */
- ycolor,
- /* Z color of axis and values */
- zcolor,
- /* Name of font for names of axes */
- fontOfNames,
- /* Style of names of axes */
- styleOfNames,
- /* Size of names of axes */
- sizeOfNames,
- /* Name of font for values */
- fontOfValues,
- /* Style of values */
- styleOfValues,
- /* Size of values */
- sizeOfValues);
+ if (!MyGTrihedron.ptrVisual3dView)
+ return Standard_False;
+
+ /* Names of axes */
+ xname = MyGTrihedron.xname;
+ yname = MyGTrihedron.yname;
+ zname = MyGTrihedron.zname;
+ /* Draw names */
+ xdrawname = MyGTrihedron.xdrawname;
+ ydrawname = MyGTrihedron.ydrawname;
+ zdrawname = MyGTrihedron.zdrawname;
+ /* Draw values */
+ xdrawvalues = MyGTrihedron.xdrawvalues;
+ ydrawvalues = MyGTrihedron.ydrawvalues;
+ zdrawvalues = MyGTrihedron.zdrawvalues;
+ /* Draw grid */
+ drawgrid = MyGTrihedron.drawgrid;
+ /* Draw axes */
+ drawaxes = MyGTrihedron.drawaxes;
+ /* Number of splits along axes */
+ nbx = MyGTrihedron.nbx;
+ nby = MyGTrihedron.nby;
+ nbz = MyGTrihedron.nbz;
+ /* Offset for drawing values */
+ xoffset = MyGTrihedron.xoffset;
+ yoffset = MyGTrihedron.yoffset;
+ zoffset = MyGTrihedron.zoffset;
+ /* Offset for drawing names of axes */
+ xaxisoffset = MyGTrihedron.xaxisoffset;
+ yaxisoffset = MyGTrihedron.yaxisoffset;
+ zaxisoffset = MyGTrihedron.zaxisoffset;
+ /* Draw tickmarks */
+ xdrawtickmarks = MyGTrihedron.xdrawtickmarks;
+ ydrawtickmarks = MyGTrihedron.ydrawtickmarks;
+ zdrawtickmarks = MyGTrihedron.zdrawtickmarks;
+ /* Length of tickmarks */
+ xtickmarklength = MyGTrihedron.xtickmarklength;
+ ytickmarklength = MyGTrihedron.ytickmarklength;
+ ztickmarklength = MyGTrihedron.ztickmarklength;
+ /* Grid color */
+ gridcolor = MyGTrihedron.gridcolor;
+ /* Colors of axis names */
+ xnamecolor = MyGTrihedron.xnamecolor;
+ ynamecolor = MyGTrihedron.ynamecolor;
+ znamecolor = MyGTrihedron.znamecolor;
+ /* Colors of axis and values */
+ xcolor = MyGTrihedron.xcolor;
+ ycolor = MyGTrihedron.ycolor;
+ zcolor = MyGTrihedron.zcolor;
+ /* Name of font for names of axes */
+ fontOfNames = MyGTrihedron.fontOfNames;
+ /* Style of names of axes */
+ styleOfNames = MyGTrihedron.styleOfNames;
+ /* Size of names of axes */
+ sizeOfNames = MyGTrihedron.sizeOfNames;
+ /* Name of font for values */
+ fontOfValues = MyGTrihedron.fontOfValues;
+ /* Style of values */
+ styleOfValues = MyGTrihedron.styleOfValues;
+ /* Size of values */
+ sizeOfValues = MyGTrihedron.sizeOfValues;
+
+ return Standard_True;
}
-void Visual3d_View::GraduatedTrihedronDisplay(/* Names of axes */
- const Standard_CString xname,
- const Standard_CString yname,
- const Standard_CString zname,
- /* Draw names */
- const Standard_Boolean xdrawname,
- const Standard_Boolean ydrawname,
- const Standard_Boolean zdrawname,
- /* Draw values */
- const Standard_Boolean xdrawvalues,
- const Standard_Boolean ydrawvalues,
- const Standard_Boolean zdrawvalues,
- /* Draw grid */
- const Standard_Boolean drawgrid,
- /* Draw axes */
- const Standard_Boolean drawaxes,
- /* Number of splits along axes */
- const Standard_Integer nbx,
- const Standard_Integer nby,
- const Standard_Integer nbz,
- /* Offset for drawing values */
- const Standard_Integer xoffset,
- const Standard_Integer yoffset,
- const Standard_Integer zoffset,
- /* Offset for drawing names of axes */
- const Standard_Integer xaxisoffset,
- const Standard_Integer yaxisoffset,
- const Standard_Integer zaxisoffset,
- /* Draw tickmarks */
- const Standard_Boolean xdrawtickmarks,
- const Standard_Boolean ydrawtickmarks,
- const Standard_Boolean zdrawtickmarks,
- /* Length of tickmarks */
- const Standard_Integer xtickmarklength,
- const Standard_Integer ytickmarklength,
- const Standard_Integer ztickmarklength,
- /* Grid color */
- const Quantity_Color& gridcolor,
- /* X name color */
- const Quantity_Color& xnamecolor,
- /* Y name color */
- const Quantity_Color& ynamecolor,
- /* Z name color */
- const Quantity_Color& znamecolor,
- /* X color of axis and values */
- const Quantity_Color& xcolor,
- /* Y color of axis and values */
- const Quantity_Color& ycolor,
- /* Z color of axis and values */
- const Quantity_Color& zcolor,
- /* Name of font for names of axes */
- const Standard_CString fontOfNames,
- /* Style of names of axes */
- const OSD_FontAspect styleOfNames,
- /* Size of names of axes */
- const Standard_Integer sizeOfNames,
- /* Name of font for values */
- const Standard_CString fontOfValues,
- /* Style of values */
- const OSD_FontAspect styleOfValues,
- /* Size of values */
- const Standard_Integer sizeOfValues)
+void Visual3d_View::GraduatedTrihedronDisplay
+ (/* Names of axes */
+ const TCollection_ExtendedString &xname,
+ const TCollection_ExtendedString &yname,
+ const TCollection_ExtendedString &zname,
+ /* Draw names */
+ const Standard_Boolean xdrawname,
+ const Standard_Boolean ydrawname,
+ const Standard_Boolean zdrawname,
+ /* Draw values */
+ const Standard_Boolean xdrawvalues,
+ const Standard_Boolean ydrawvalues,
+ const Standard_Boolean zdrawvalues,
+ /* Draw grid */
+ const Standard_Boolean drawgrid,
+ /* Draw axes */
+ const Standard_Boolean drawaxes,
+ /* Number of splits along axes */
+ const Standard_Integer nbx,
+ const Standard_Integer nby,
+ const Standard_Integer nbz,
+ /* Offset for drawing values */
+ const Standard_Integer xoffset,
+ const Standard_Integer yoffset,
+ const Standard_Integer zoffset,
+ /* Offset for drawing names of axes */
+ const Standard_Integer xaxisoffset,
+ const Standard_Integer yaxisoffset,
+ const Standard_Integer zaxisoffset,
+ /* Draw tickmarks */
+ const Standard_Boolean xdrawtickmarks,
+ const Standard_Boolean ydrawtickmarks,
+ const Standard_Boolean zdrawtickmarks,
+ /* Length of tickmarks */
+ const Standard_Integer xtickmarklength,
+ const Standard_Integer ytickmarklength,
+ const Standard_Integer ztickmarklength,
+ /* Grid color */
+ const Quantity_Color& gridcolor,
+ /* Colors of axis names */
+ const Quantity_Color& xnamecolor,
+ const Quantity_Color& ynamecolor,
+ const Quantity_Color& znamecolor,
+ /* Colors of axis and values */
+ const Quantity_Color& xcolor,
+ const Quantity_Color& ycolor,
+ const Quantity_Color& zcolor,
+ /* Name of font for names of axes */
+ const TCollection_AsciiString &fontOfNames,
+ /* Style of names of axes */
+ const OSD_FontAspect styleOfNames,
+ /* Size of names of axes */
+ const Standard_Integer sizeOfNames,
+ /* Name of font for values */
+ const TCollection_AsciiString &fontOfValues,
+ /* Style of values */
+ const OSD_FontAspect styleOfValues,
+ /* Size of values */
+ const Standard_Integer sizeOfValues)
{
- CALL_DEF_GRADUATEDTRIHEDRON cubic;
- cubic.ptrVisual3dView = this;
- cubic.cbCubicAxes = SetMinMaxValuesCallback;
- MyGraphicDriver->GraduatedTrihedronDisplay(MyCView,
- cubic,
- /* Names of axes */
- xname,
- yname,
- zname,
- /* Draw names */
- xdrawname,
- ydrawname,
- zdrawname,
- /* Draw values */
- xdrawvalues,
- ydrawvalues,
- zdrawvalues,
- /* Draw grid */
- drawgrid,
- /* Draw axes */
- drawaxes,
- /* Number of splits along axes */
- nbx,
- nby,
- nbz,
- /* Offset for drawing values */
- xoffset,
- yoffset,
- zoffset,
- /* Offset for drawing names of axes */
- xaxisoffset,
- yaxisoffset,
- zaxisoffset,
- /* Draw tickmarks */
- xdrawtickmarks,
- ydrawtickmarks,
- zdrawtickmarks,
- /* Length of tickmarks */
- xtickmarklength,
- ytickmarklength,
- ztickmarklength,
- /* Grid color */
- gridcolor,
- /* X name color */
- xnamecolor,
- /* Y name color */
- ynamecolor,
- /* Z name color */
- znamecolor,
- /* X color of axis and values */
- xcolor,
- /* Y color of axis and values */
- ycolor,
- /* Z color of axis and values */
- zcolor,
- /* Name of font for names of axes */
- fontOfNames,
- /* Style of names of axes */
- styleOfNames,
- /* Size of names of axes */
- sizeOfNames,
- /* Name of font for values */
- fontOfValues,
- /* Style of values */
- styleOfValues,
- /* Size of values */
- sizeOfValues);
+ /* Names of axes */
+ MyGTrihedron.xname = xname;
+ MyGTrihedron.yname = yname;
+ MyGTrihedron.zname = zname;
+ /* Draw names */
+ MyGTrihedron.xdrawname = xdrawname;
+ MyGTrihedron.ydrawname = ydrawname;
+ MyGTrihedron.zdrawname = zdrawname;
+ /* Draw values */
+ MyGTrihedron.xdrawvalues = xdrawvalues;
+ MyGTrihedron.ydrawvalues = ydrawvalues;
+ MyGTrihedron.zdrawvalues = zdrawvalues;
+ /* Draw grid */
+ MyGTrihedron.drawgrid = drawgrid;
+ /* Draw axes */
+ MyGTrihedron.drawaxes = drawaxes;
+ /* Number of splits along axes */
+ MyGTrihedron.nbx = nbx;
+ MyGTrihedron.nby = nby;
+ MyGTrihedron.nbz = nbz;
+ /* Offset for drawing values */
+ MyGTrihedron.xoffset = xoffset;
+ MyGTrihedron.yoffset = yoffset;
+ MyGTrihedron.zoffset = zoffset;
+ /* Offset for drawing names of axes */
+ MyGTrihedron.xaxisoffset = xaxisoffset;
+ MyGTrihedron.yaxisoffset = yaxisoffset;
+ MyGTrihedron.zaxisoffset = zaxisoffset;
+ /* Draw tickmarks */
+ MyGTrihedron.xdrawtickmarks = xdrawtickmarks;
+ MyGTrihedron.ydrawtickmarks = ydrawtickmarks;
+ MyGTrihedron.zdrawtickmarks = zdrawtickmarks;
+ /* Length of tickmarks */
+ MyGTrihedron.xtickmarklength = xtickmarklength;
+ MyGTrihedron.ytickmarklength = ytickmarklength;
+ MyGTrihedron.ztickmarklength = ztickmarklength;
+ /* Grid color */
+ MyGTrihedron.gridcolor = gridcolor;
+ /* Colors of axis names */
+ MyGTrihedron.xnamecolor = xnamecolor;
+ MyGTrihedron.ynamecolor = ynamecolor;
+ MyGTrihedron.znamecolor = znamecolor;
+ /* Colors of axis and values */
+ MyGTrihedron.xcolor = xcolor;
+ MyGTrihedron.ycolor = ycolor;
+ MyGTrihedron.zcolor = zcolor;
+ /* Name of font for names of axes */
+ MyGTrihedron.fontOfNames = fontOfNames;
+ /* Style of names of axes */
+ MyGTrihedron.styleOfNames = styleOfNames;
+ /* Size of names of axes */
+ MyGTrihedron.sizeOfNames = sizeOfNames;
+ /* Name of font for values */
+ MyGTrihedron.fontOfValues = fontOfValues;
+ /* Style of values */
+ MyGTrihedron.styleOfValues = styleOfValues;
+ /* Size of values */
+ MyGTrihedron.sizeOfValues = sizeOfValues;
+
+ MyGTrihedron.ptrVisual3dView = this;
+ MyGTrihedron.cbCubicAxes = SetMinMaxValuesCallback;
+ MyGraphicDriver->GraduatedTrihedronDisplay(MyCView,MyGTrihedron);
}
void Visual3d_View::GraduatedTrihedronErase()
{
+ MyGTrihedron.ptrVisual3dView = NULL;
MyGraphicDriver->GraduatedTrihedronErase(MyCView);
}