diff --git a/src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx b/src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx index b6649deb2e..4e3bdf67a2 100644 --- a/src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx +++ b/src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx @@ -1,3 +1,7 @@ +// File: Graphic3d_CGraduatedTrihedron.cxx +// Created: 6 March 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE SA 2011 #include diff --git a/src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx b/src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx index 53321378b2..489feb2566 100644 --- a/src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx +++ b/src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx @@ -1,22 +1,70 @@ -/*============================================================================*/ -/*==== 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 -#include -typedef CALL_DEF_GRADUATEDTRIHEDRON Graphic3d_CGraduatedTrihedron; - -#if defined(__cplusplus) || defined(c_plusplus) -/*==== Definition de Type ====================================================*/ +#include +#include #include -const Handle(Standard_Type)& TYPE(Graphic3d_CGraduatedTrihedron); -/*============================================================================*/ +#include +#include +#include +#include + +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*/ diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cdl b/src/Graphic3d/Graphic3d_GraphicDriver.cdl index bacce22d4c..c548b89e84 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cdl +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cdl @@ -927,138 +927,9 @@ is ---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; diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx index 8c19d2bf6c..8d3ab63798 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx +++ b/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx @@ -107,136 +107,8 @@ void Graphic3d_GraphicDriver::SetBgGradientStyle( const Graphic3d_CView& /*ACVie { } -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&) { } diff --git a/src/Graphic3d/Graphic3d_Group_10.cxx b/src/Graphic3d/Graphic3d_Group_10.cxx index 3812c976ec..345b9dbe17 100755 --- a/src/Graphic3d/Graphic3d_Group_10.cxx +++ b/src/Graphic3d/Graphic3d_Group_10.cxx @@ -1,9 +1,7 @@ - -// 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 @@ -36,29 +34,27 @@ void Graphic3d_Group::Text ( const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax - ) { + ) +{ + if (IsDeleted ()) return; - if (IsDeleted ()) return; + MyIsEmpty = Standard_False; - 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); + } - // 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 (); + MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax); + Update (); } void Graphic3d_Group::Text ( @@ -66,28 +62,27 @@ void Graphic3d_Group::Text ( const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax - ) { + ) +{ + if (IsDeleted ()) return; - if (IsDeleted ()) return; + MyIsEmpty = Standard_False; - 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); + } - // 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 (); + MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax); + Update (); } void Graphic3d_Group::Text ( @@ -99,31 +94,27 @@ void Graphic3d_Group::Text ( const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax - ) { + ) +{ + if (IsDeleted ()) return; - if (IsDeleted ()) return; + MyIsEmpty = Standard_False; - if (! AText.IsAscii ()) return; + // 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); + } - 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 (); + MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax); + Update (); } void Graphic3d_Group::Text ( @@ -131,28 +122,25 @@ void Graphic3d_Group::Text ( const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax - ) { + ) +{ + if (IsDeleted ()) return; - if (IsDeleted ()) return; + MyIsEmpty = Standard_False; - if (! AText.IsAscii ()) return; + // 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); + } - 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 (); + MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax); + Update (); } diff --git a/src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx b/src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx index f4708d76b9..fe52fa4a9d 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx @@ -63,6 +63,7 @@ #include #include +#include #define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing from higher API */ @@ -1091,21 +1092,13 @@ int EXPORT call_togl_isgllight ( 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 ); diff --git a/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx b/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx index 8bf741664f..1fe3f754b8 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx @@ -246,7 +246,7 @@ typedef struct { typedef struct { - char *string; + unsigned short *string; CALL_DEF_POINT Position; @@ -260,7 +260,7 @@ typedef struct { int VAlign; - bool Zoomable; + bool Zoomable; } CALL_DEF_TEXT; diff --git a/src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx b/src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx index 1bca4ca2e5..bff76a3050 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx @@ -52,8 +52,6 @@ Facility : CAS-CADE V1 #include #endif -#include - typedef float CALL_DEF_MATRIX4X4[4][4]; /* SOMMET */ @@ -256,61 +254,4 @@ typedef struct { } 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 */ diff --git a/src/InterfaceGraphic/InterfaceGraphic_telem.hxx b/src/InterfaceGraphic/InterfaceGraphic_telem.hxx index c5d0292a75..b61c09f760 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_telem.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_telem.hxx @@ -112,15 +112,6 @@ struct TEL_MATRIX3_DATA }; 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; diff --git a/src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx b/src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx index aee37aad82..1f1aae7572 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx @@ -19,6 +19,8 @@ therefore it should be made signed explicitly, as on Linux 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 diff --git a/src/OpenGl/OpenGl_FontMgr.cxx b/src/OpenGl/OpenGl_FontMgr.cxx index 641f435c07..8b0abf9eb3 100755 --- a/src/OpenGl/OpenGl_FontMgr.cxx +++ b/src/OpenGl/OpenGl_FontMgr.cxx @@ -310,8 +310,8 @@ int OpenGl_FontMgr::request_font( const Handle(TCollection_HAsciiString)& fontNa 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" @@ -333,7 +333,7 @@ void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text, if ( !is2d ) { if ( !enableDepthTest ) glEnable(GL_DEPTH_TEST); - } + } else if ( enableDepthTest ) { glDisable(GL_DEPTH_TEST); } @@ -363,28 +363,30 @@ void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text, } -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; @@ -397,7 +399,8 @@ void OpenGl_FontMgr::setCurrentScale( const Standard_ShortReal xScale, #include #include -void dump_texture( int id) { +void dump_texture( int id) +{ Handle(AlienImage_BMPAlienData) image = new AlienImage_BMPAlienData(); if (!glIsTexture(id)) diff --git a/src/OpenGl/OpenGl_FontMgr.hxx b/src/OpenGl/OpenGl_FontMgr.hxx index 073a78b09e..96527a45ec 100755 --- a/src/OpenGl/OpenGl_FontMgr.hxx +++ b/src/OpenGl/OpenGl_FontMgr.hxx @@ -1,7 +1,6 @@ #ifndef OPENGL_FONT_MGR_H #define OPENGL_FONT_MGR_H - #ifdef WNT # include # include @@ -20,26 +19,27 @@ void dump_texture(); 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& ); diff --git a/src/OpenGl/OpenGl_GraphicDriver.cdl b/src/OpenGl/OpenGl_GraphicDriver.cdl index 4d76a7c956..bd35b40717 100755 --- a/src/OpenGl/OpenGl_GraphicDriver.cdl +++ b/src/OpenGl/OpenGl_GraphicDriver.cdl @@ -904,138 +904,9 @@ is ---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; diff --git a/src/OpenGl/OpenGl_GraphicDriver_710.cxx b/src/OpenGl/OpenGl_GraphicDriver_710.cxx index 6ca8647aaa..e7dcf0941d 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_710.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_710.cxx @@ -43,35 +43,11 @@ void OpenGl_GraphicDriver::Text 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 @@ -80,35 +56,11 @@ 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 @@ -124,14 +76,11 @@ 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); @@ -143,15 +92,13 @@ void OpenGl_GraphicDriver::Text 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 @@ -161,33 +108,29 @@ void OpenGl_GraphicDriver::Text const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean - ) { + ) +{ + Graphic3d_CGroup MyCGroup = ACGroup; + CALL_DEF_TEXT atext; - Graphic3d_CGroup MyCGroup = ACGroup; + 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 (); - 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 (); - - } + if (MyTraceLevel) { + PrintFunction ("call_togl_text"); + PrintCGroup (MyCGroup, 1); + } + call_togl_text (&MyCGroup, &atext); +} diff --git a/src/OpenGl/OpenGl_GraphicDriver_713.cxx b/src/OpenGl/OpenGl_GraphicDriver_713.cxx index f97e60a7bd..05ef87c5a1 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_713.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_713.cxx @@ -36,8 +36,7 @@ Standard_Boolean OpenGl_GraphicDriver { #ifdef BUC61044 Graphic3d_CView MyCView = view; - if ( call_togl_isdepthtest( &MyCView ) ) - return Standard_True; + return (call_togl_isdepthtest( &MyCView ) != 0); #endif } @@ -65,8 +64,7 @@ Standard_Boolean OpenGl_GraphicDriver { #ifdef BUC61045 Graphic3d_CView MyCView = view; - if ( call_togl_isgllight( &MyCView ) ) - return Standard_True; + return (call_togl_isgllight( &MyCView ) != 0); #endif } diff --git a/src/OpenGl/OpenGl_GraphicDriver_9.cxx b/src/OpenGl/OpenGl_GraphicDriver_9.cxx index 846ace29d7..30d29a0d24 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_9.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_9.cxx @@ -1,4 +1,3 @@ - // File OpenGl_GraphicDriver_9.cxx // Created 1/08/97 // Author PCT @@ -269,304 +268,10 @@ void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,cons 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) diff --git a/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx b/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx index 066fa5991d..b00046b77d 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx @@ -200,7 +200,8 @@ void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const 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); @@ -208,14 +209,15 @@ void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_Sh 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); diff --git a/src/OpenGl/OpenGl_GraphicDriver_print.cxx b/src/OpenGl/OpenGl_GraphicDriver_print.cxx index ed25d2b7cb..05d1cdab16 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_print.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_print.cxx @@ -11,7 +11,7 @@ #include #include -#include "OpenGl_tgl_funcs.hxx" +#include /************************************************************************/ diff --git a/src/OpenGl/OpenGl_TextRender.cxx b/src/OpenGl/OpenGl_TextRender.cxx index de03c9be86..e0d9a93372 100755 --- a/src/OpenGl/OpenGl_TextRender.cxx +++ b/src/OpenGl/OpenGl_TextRender.cxx @@ -23,7 +23,6 @@ #include #endif - /*-----------------------------------------------------------------------------*/ /* * Prototypes variables statiques @@ -237,7 +236,7 @@ Tint OpenGl_TextRender::FindFont ( Tchar* fontName, } /*-----------------------------------------------------------------------------*/ -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;*/ @@ -261,7 +260,7 @@ void OpenGl_TextRender::StringSize(char *str, GLint *Width, GLint *Ascent, GLint /*-----------------------------------------------------------------------------*/ -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]; @@ -351,7 +350,7 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x glTranslatef(x, y, 0.f); glRotatef( 180, 1, 0, 0 ); } - else { + else { GLdouble wx, wy, wz; GLdouble x1, y1, z1; GLdouble x2, y2, z2; @@ -415,7 +414,6 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x glPopMatrix(); } glPopAttrib(); - return; } @@ -465,7 +463,7 @@ int OpenGl_TextRender::alignmentforgl2ps(int vh, int vy) #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 @@ -479,11 +477,15 @@ void OpenGl_TextRender::ExportText( char* str, char* fontname, GLfloat height, G 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 - } diff --git a/src/OpenGl/OpenGl_TextRender.hxx b/src/OpenGl/OpenGl_TextRender.hxx index 8edfb6a842..9af9692ab2 100755 --- a/src/OpenGl/OpenGl_TextRender.hxx +++ b/src/OpenGl/OpenGl_TextRender.hxx @@ -11,22 +11,21 @@ #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 ; diff --git a/src/OpenGl/OpenGl_funcs.cxx b/src/OpenGl/OpenGl_funcs.cxx index b0280730fa..a49b937093 100755 --- a/src/OpenGl/OpenGl_funcs.cxx +++ b/src/OpenGl/OpenGl_funcs.cxx @@ -667,7 +667,7 @@ call_func_set_anno_align( Tint hor, Tint ver ) /*----------------------------------------------------------------------*/ 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]; diff --git a/src/OpenGl/OpenGl_graduatedtrihedron.cxx b/src/OpenGl/OpenGl_graduatedtrihedron.cxx index ebdfc59fcd..64f65337d9 100644 --- a/src/OpenGl/OpenGl_graduatedtrihedron.cxx +++ b/src/OpenGl/OpenGl_graduatedtrihedron.cxx @@ -1,3 +1,8 @@ +// File: OpenGl_graduatedtrihedron.cxx +// Created: 6 March 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE SA 2011 + #include #include @@ -24,262 +29,208 @@ #include #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) +static void copyData(const Graphic3d_CGraduatedTrihedron *fromData, TEL_GRADUATEDTRIHEDRON_DATA* toData) { - int len; + 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) -{ - /* 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); + /* 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) + if (nbWsIds) + { + int i = 0; + tel_graduatedtrihedron_data gtdata; + for (i = 0; i < nbWsIds; i++) { - free(WsIds); - for (i = 0; i < nbWsIds; i++) - { - freeGraduatedTrihedronData(graduatedTrihedronData[i]); - } - free(graduatedTrihedronData); + gtdata = graduatedTrihedronData[i]; - WsIds = 0; - graduatedTrihedronData = 0; + // 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; } + delete graduatedTrihedronData; + graduatedTrihedronData = 0; + nbWsIds = 0; + } } static int getGraduatedTrihedronDataIndex(int WsId) { - 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*)); - 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 */ - 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; -} - -/* Erases the trihedron from the view */ -static TStatus removeView(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!) */ @@ -363,12 +314,11 @@ static char getFarestCorner(float d000, float d100, float d010, float d001, 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; @@ -442,793 +392,744 @@ static void drawArrow(float x1, float y1, float z1, glEnd(); } -TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data) +TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data) { - int index; + /* 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]; - /* 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; -} + /* 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 */ + int index = getGraduatedTrihedronDataIndex(WsId); + if (index == -1) + return TFailure; - /* Get index of the trihedron data */ - index = getGraduatedTrihedronDataIndex(WsId); - if (index == -1) - return TFailure; - data = graduatedTrihedronData[index]; + tel_graduatedtrihedron_data data = graduatedTrihedronData[index]; - /* Update boundary box */ - if (data->cbCubicAxes) - data->cbCubicAxes(data->ptrVisual3dView); + /* Update boundary box */ + if (data->cbCubicAxes) + data->cbCubicAxes(data->ptrVisual3dView); - /* Disable lighting for lines */ - light = glIsEnabled(GL_LIGHTING); - if (light) - glDisable(GL_LIGHTING); + /* 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; + /* 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 */ - center[0] = 0.5f * (xmin + xmax); - center[1] = 0.5f * (ymin + ymax); - center[2] = 0.5f * (zmin + zmax); + /* 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*/ - 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); + /* 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. */ - /* The first axis will be used for drawing the text and the values. */ - switch (farestCorner) + /* 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 */ { - 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; + /* 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 - 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; + /* 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; - } + break; } - - /* Draw the graduated trihedron */ - - /* Grid */ - if (data->drawgrid) + case 2: /* d100 */ { - 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])); - } + /* 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++; + } + } + } - /* 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; - } - } + /* 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) + { + 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; + + /* 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]); } - /* Axes (arrows) */ - if (data->drawaxes) + /* X-values */ + if (data->xdrawvalues && data->nbx > 0) { - /* X-axis */ - glColor3fv(data->xcolor); - drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]); + 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); + 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; + + /* 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); + 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++; + } + } + + /* 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) + { + dy = (dy > 0.0f)? 1.0f : -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); + 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++; + } + } + + /* 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); - /* 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*/ - - 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) - { - 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; - } - } - } - - 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) - { - 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; - } - } - } - - 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) - { - 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; - } - } - } - - /* 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, @@ -1245,4 +1146,4 @@ TStatus call_graduatedtrihedron_minmaxvalues(const float xMin, ymax = yMax; zmax = zMax; return TSuccess; -} \ No newline at end of file +} diff --git a/src/OpenGl/OpenGl_graduatedtrihedron.hxx b/src/OpenGl/OpenGl_graduatedtrihedron.hxx index f8af880f6e..dda77d2f2a 100644 --- a/src/OpenGl/OpenGl_graduatedtrihedron.hxx +++ b/src/OpenGl/OpenGl_graduatedtrihedron.hxx @@ -1,3 +1,8 @@ +// File: OpenGl_graduatedtrihedron.hxx +// Created: 6 March 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE SA 2011 + #ifndef __OPENGL_GRADUATEDTRIHEDRON_H_ #define __OPENGL_GRADUATEDTRIHEDRON_H_ @@ -9,8 +14,9 @@ #include #include -extern TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data); -extern TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data); +#include + +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, diff --git a/src/OpenGl/OpenGl_subrs.cxx b/src/OpenGl/OpenGl_subrs.cxx index 28c947f204..ff724c8c1e 100755 --- a/src/OpenGl/OpenGl_subrs.cxx +++ b/src/OpenGl/OpenGl_subrs.cxx @@ -1631,7 +1631,7 @@ call_subr_structure_exploration( Tint Id, 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], diff --git a/src/OpenGl/OpenGl_telem_inquire.hxx b/src/OpenGl/OpenGl_telem_inquire.hxx index 523d15a38c..5f40c63626 100755 --- a/src/OpenGl/OpenGl_telem_inquire.hxx +++ b/src/OpenGl/OpenGl_telem_inquire.hxx @@ -22,7 +22,7 @@ typedef union { TEL_POINT ref_pt; /* reference text point */ TEL_POINT anno; /* annotation pt/offset */ - Tchar *string; /* text string */ + Techar *string; /* text string */ } atext3; Tint size; diff --git a/src/OpenGl/OpenGl_text.cxx b/src/OpenGl/OpenGl_text.cxx index 329215a777..2983524ba6 100755 --- a/src/OpenGl/OpenGl_text.cxx +++ b/src/OpenGl/OpenGl_text.cxx @@ -49,9 +49,17 @@ xx-xx-xx : xxx ; Creation. #include #include - #include +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 @@ -103,12 +111,6 @@ extern int g_nDegenerateModel; 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 @@ -127,7 +129,7 @@ TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) 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++ ) { @@ -137,23 +139,27 @@ TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) 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; @@ -225,6 +231,8 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) if (flag_zbuffer) glDisable(GL_DEPTH_TEST); } + OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); + /* display type of text */ if (display_type != ASPECT_TODT_NORMAL) { @@ -237,7 +245,6 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); switch (display_type) { case ASPECT_TODT_BLEND: @@ -272,7 +279,7 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) #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]; @@ -326,30 +333,30 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) &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) @@ -370,8 +377,12 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) 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; } @@ -385,7 +396,7 @@ TextPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) 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] ); @@ -406,7 +417,7 @@ TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) d = (tel_text_data)data.pdata; - size_reqd = d->length; + size_reqd = sizeof(Techar)*d->length; for( i = 0; i < n; i++ ) { @@ -429,12 +440,15 @@ TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) 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 diff --git a/src/OpenGl/OpenGl_tgl_funcs.hxx b/src/OpenGl/OpenGl_tgl_funcs.hxx index ae56562ee2..9e0e0d3408 100755 --- a/src/OpenGl/OpenGl_tgl_funcs.hxx +++ b/src/OpenGl/OpenGl_tgl_funcs.hxx @@ -58,6 +58,7 @@ from higher API */ #include #include +#include /*----------------------------------------------------------------------*/ /* @@ -152,7 +153,7 @@ extern void call_func_set_anno_char_ht(Tfloat); /* height */ 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 */ @@ -383,11 +384,8 @@ void EXPORT call_togl_triedron_echo ( /* 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); @@ -1288,7 +1286,7 @@ void EXPORT call_togl_set_text_scale_factors ( void EXPORT call_togl_text2d ( - char *s, + Techar *s, float x, float y, float height @@ -1297,7 +1295,7 @@ void EXPORT call_togl_text2d ( void EXPORT call_togl_textsize2d ( - char *s, + Techar *s, float height, float *width, float *ascent, diff --git a/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx b/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx index 438b2e9d89..7213a57d15 100755 --- a/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx +++ b/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx @@ -116,7 +116,6 @@ static float layerFontRed = -1.; static float layerFontGreen = -1.; static float layerFontBlue = -1.; - static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular; static Tint FTGLLayerFontHeight = 16; static Tint FTGLLayerFontAscent = 0; @@ -593,19 +592,18 @@ call_togl_rectangle2d /*----------------------------------------------------------------------*/ 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); @@ -624,6 +622,15 @@ call_togl_text2d ( char *s, 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 */ @@ -634,7 +641,7 @@ call_togl_text2d ( char *s, 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 */ @@ -721,8 +728,7 @@ call_togl_text2d ( char *s, 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 */ @@ -774,7 +780,7 @@ call_togl_text2d ( char *s, 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; @@ -787,7 +793,7 @@ call_togl_text2d ( char *s, 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; @@ -801,7 +807,7 @@ call_togl_text2d ( char *s, #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; @@ -813,12 +819,12 @@ call_togl_text2d ( char *s, 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"); @@ -853,7 +859,7 @@ call_togl_text2d ( char *s, #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 @@ -864,7 +870,7 @@ call_togl_text2d ( char *s, 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"); @@ -872,38 +878,50 @@ call_togl_text2d ( char *s, #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; @@ -1084,7 +1102,7 @@ void call_togl_set_text_attributes( Tchar* font, FTGLLayerFontXScale = FTGLLayerFontYScale = 1.f; OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight); - + layerFontRed = r; layerFontGreen = g; layerFontBlue = b; diff --git a/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx b/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx index 93e4238aa0..fc04543184 100644 --- a/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx +++ b/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx @@ -1,3 +1,8 @@ +// File: OpenGl_togl_graduatedtrihedron.cxx +// Created: 6 March 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE SA 2011 + #include #include @@ -7,14 +12,8 @@ #include #include -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); } diff --git a/src/OpenGl/OpenGl_togl_text.cxx b/src/OpenGl/OpenGl_togl_text.cxx index 352455b55e..9774902123 100755 --- a/src/OpenGl/OpenGl_togl_text.cxx +++ b/src/OpenGl/OpenGl_togl_text.cxx @@ -78,7 +78,6 @@ call_togl_text 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; } diff --git a/src/OpenGl/OpenGl_triedron.cxx b/src/OpenGl/OpenGl_triedron.cxx index 682470bd4f..23b05d836c 100755 --- a/src/OpenGl/OpenGl_triedron.cxx +++ b/src/OpenGl/OpenGl_triedron.cxx @@ -299,7 +299,6 @@ TStatus call_triedron_redraw ( 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 */ @@ -581,25 +580,22 @@ TStatus call_triedron_redraw ( 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 */ @@ -658,7 +654,6 @@ TStatus call_zbuffer_triedron_redraw ( GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 }; GLuint fontBase = 0; - char AxeName[]="X\0"; GLuint startList; GLUquadricObj* aQuadric; @@ -1092,27 +1087,22 @@ TStatus call_zbuffer_triedron_redraw ( 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 */ diff --git a/src/V3d/V3d_View.cdl b/src/V3d/V3d_View.cdl index 4514284417..d2c821913f 100755 --- a/src/V3d/V3d_View.cdl +++ b/src/V3d/V3d_View.cdl @@ -142,7 +142,9 @@ uses GraphicCallbackProc from Aspect, FillMethod from Aspect, GradientFillMethod from Aspect, - FontAspect from OSD + FontAspect from OSD, + AsciiString from TCollection, + ExtendedString from TCollection raises @@ -479,63 +481,39 @@ is 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 -- @@ -545,9 +523,9 @@ is 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; @@ -595,13 +573,13 @@ is -- 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 -- diff --git a/src/V3d/V3d_View_4.cxx b/src/V3d/V3d_View_4.cxx index ec4178f679..48d0108652 100755 --- a/src/V3d/V3d_View_4.cxx +++ b/src/V3d/V3d_View_4.cxx @@ -493,9 +493,9 @@ void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType ) { } 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, @@ -543,13 +543,13 @@ void V3d_View::GetGraduatedTrihedron(/* Names of axes */ /* 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 */ @@ -620,9 +620,9 @@ void V3d_View::GetGraduatedTrihedron(/* Names of axes */ } 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, @@ -670,13 +670,13 @@ void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */ /* 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 */ @@ -750,4 +750,3 @@ void V3d_View::GraduatedTrihedronErase() { MyView->GraduatedTrihedronErase(); } - diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 44ed93ee14..7c2dffa76f 100755 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -1,7 +1,7 @@ -// File: ViewerTest_ObjectsCommands.cxx -// Created: Thu Nov 12 15:50:42 1998 -// Author: Robert COUBLANC -// +// File: ViewerTest_ObjectsCommands.cxx +// Created: Thu Nov 12 15:50:42 1998 +// Author: Robert COUBLANC +// Copyright: OPEN CASCADE 1998 //=============================================== @@ -1937,8 +1937,8 @@ static int VCircleBuilder(Draw_Interpretor& di, Standard_Integer argc, const cha DEFINE_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject) -class MyTextClass:public AIS_InteractiveObject{ - +class MyTextClass:public AIS_InteractiveObject +{ public: // CASCADE RTTI DEFINE_STANDARD_RTTI(MyTextClass ); @@ -1989,7 +1989,6 @@ IMPLEMENT_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject) 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, @@ -2049,75 +2048,90 @@ void MyTextClass::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentat static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { - // Verification des arguments - if ( argc > 17 ) {di<Display(my,Standard_True); - - if(aContext.IsNull()) + if (name.Length()) { - di << "use 'vinit' command before " << argv[0] << "\n"; - return -1; + 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; } @@ -2723,7 +2737,7 @@ static int VClipPlane (Draw_Interpretor& di, Standard_Integer argc, const char** if (anActivePlanes < aView->View()->PlaneLimit()) { aView->SetPlaneOn (aPlaneV3d); // add to enabled planes list - aView->Update(); + aView->Update(); } else { @@ -2794,7 +2808,7 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) __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", @@ -2804,5 +2818,4 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) theCommands.Add("vclipplane", "vclipplane : vclipplane [x y z dx dy dz] [planeId {on/off/del/display/hide}]", __FILE__,VClipPlane,group); - } diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 18efd829a7..a5034d7ba9 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -1661,51 +1661,102 @@ static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char //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; - - if (argc < 2) + // Check arguments + if (argc != 2 && argc < 5) { - di << argv[0] << " Invalid number of arguments" << "\n"; - return 1; + di<<"Error: "< 2) + // Create 3D view if it doesn't exist + if ( aV3dView.IsNull() ) { - if (argc != 5) - { - di << argv[0] << " Define all X, Y and Z axes names, please" << "\n"; - return 1; - } - xname = argv[2]; - yname = argv[3]; - zname = argv[4]; + ViewerTest::ViewerInit(); + aV3dView = ViewerTest::CurrentView(); + if( aV3dView.IsNull() ) + { + di << "Error: Cannot create a 3D view\n"; + return 1; //TCL_ERROR + } } - int display = atoi(argv[1]); + // Erase (==0) or display (!=0) + const 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*/); + { + // 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) + { + AddMultibyteString(xname, argv[2]); + AddMultibyteString(yname, argv[3]); + AddMultibyteString(zname, argv[4]); + } + else + { + xname += argv[2]; + yname += argv[3]; + zname += argv[4]; + } + } + else + { + xname += "X (mm)"; + yname += "Y (mm)"; + zname += "Z (mm)"; + } + + 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; } @@ -1773,6 +1824,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "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); } diff --git a/src/Visual3d/Visual3d_View.cdl b/src/Visual3d/Visual3d_View.cdl index a829e2418d..b2341980f7 100755 --- a/src/Visual3d/Visual3d_View.cdl +++ b/src/Visual3d/Visual3d_View.cdl @@ -106,7 +106,10 @@ uses 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, @@ -591,129 +594,82 @@ is 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 -- @@ -1327,6 +1283,8 @@ fields -- Booleans MyCBitFields : CBitFields8 from Graphic3d; + MyGTrihedron : CGraduatedTrihedron from Graphic3d; + friends class ViewManager from Visual3d diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index ec6d48e733..51bb1a36a4 100755 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -3672,268 +3672,258 @@ void SetMinMaxValuesCallback(void* Visual3dView) } } -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); }