1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0022149: Strings with Japanese characters can not be displayed in 3D viewer

This commit is contained in:
SZV 2011-08-30 08:42:34 +00:00 committed by bugmaster
parent 093fdf5ffc
commit 13a224570c
37 changed files with 1719 additions and 2572 deletions

View File

@ -1,3 +1,7 @@
// File: Graphic3d_CGraduatedTrihedron.cxx
// Created: 6 March 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE SA 2011
#include <Graphic3d_CGraduatedTrihedron.hxx> #include <Graphic3d_CGraduatedTrihedron.hxx>

View File

@ -1,22 +1,70 @@
/*============================================================================*/ // File: Graphic3d_CGraduatedTrihedron.hxx
/*==== Titre: Graphic3d_CGraduatedTrihedron.hxx */ // Created: 6 March 2011
/*==== Role : The header file of primitive type "CGraduatedTrihedron" from Graphic3d */ // Author: Sergey ZERCHANINOV
/*==== */ // Copyright: OPEN CASCADE SA 2011
/*==== Implementation: This is a primitive type implemented with typedef */
/*============================================================================*/
#ifndef _Graphic3d_CGraduatedTrihedron_HeaderFile #ifndef _Graphic3d_CGraduatedTrihedron_HeaderFile
#define _Graphic3d_CGraduatedTrihedron_HeaderFile #define _Graphic3d_CGraduatedTrihedron_HeaderFile
#include <InterfaceGraphic_Graphic3d.hxx> #include <Standard_Boolean.hxx>
#include <InterfaceGraphic_Visual3d.hxx> #include <Standard_Integer.hxx>
typedef CALL_DEF_GRADUATEDTRIHEDRON Graphic3d_CGraduatedTrihedron;
#if defined(__cplusplus) || defined(c_plusplus)
/*==== Definition de Type ====================================================*/
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
const Handle(Standard_Type)& TYPE(Graphic3d_CGraduatedTrihedron); #include <Quantity_Color.hxx>
/*============================================================================*/ #include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <OSD_FontAspect.hxx>
typedef void (*minMaxValuesCallback)(void*);
class Graphic3d_CGraduatedTrihedron
{
public:
/* Default constructor. Nullifies the view pointer */
Graphic3d_CGraduatedTrihedron () : ptrVisual3dView(NULL) {}
/* Names of axes */
TCollection_ExtendedString xname, yname, zname;
/* Draw names */
Standard_Boolean xdrawname, ydrawname, zdrawname;
/* Draw values */
Standard_Boolean xdrawvalues, ydrawvalues, zdrawvalues;
/* Draw grid */
Standard_Boolean drawgrid;
/* Draw axes */
Standard_Boolean drawaxes;
/* Number of splits along axes */
Standard_Integer nbx, nby, nbz;
/* Offset for drawing values */
Standard_Integer xoffset, yoffset, zoffset;
/* Offset for drawing names of axes */
Standard_Integer xaxisoffset, yaxisoffset, zaxisoffset;
/* Draw tickmarks */
Standard_Boolean xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
/* Length of tickmarks */
Standard_Integer xtickmarklength, ytickmarklength, ztickmarklength;
/* Grid color */
Quantity_Color gridcolor;
/* Colors of axis names */
Quantity_Color xnamecolor, ynamecolor, znamecolor;
/* Colors of axis and values */
Quantity_Color xcolor, ycolor, zcolor;
/* Font name of names of axes: Courier, Arial, ... */
TCollection_AsciiString fontOfNames;
/* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
OSD_FontAspect styleOfNames;
/* Size of names of axes: 8, 10, 12, 14, ... */
Standard_Integer sizeOfNames;
/* Font name of values: Courier, Arial, ... */
TCollection_AsciiString fontOfValues;
/* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
OSD_FontAspect styleOfValues;
/* Size of values: 8, 10, 12, 14, ... */
Standard_Integer sizeOfValues;
/* Callback function to define boundary box of displayed objects */
minMaxValuesCallback cbCubicAxes;
void* ptrVisual3dView;
};
const Handle(Standard_Type)& TYPE(Graphic3d_CGraduatedTrihedron);
#endif
#endif /*Graphic3d_CGraduatedTrihedron_HeaderFile*/ #endif /*Graphic3d_CGraduatedTrihedron_HeaderFile*/

View File

@ -927,138 +927,9 @@ is
---Category: Graduated trihedron ---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; GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d; view : CView from Graphic3d;
cubic : in out CGraduatedTrihedron from Graphic3d; cubic : 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)
---Purpose: call_togl_graduatedtrihedron_display ---Purpose: call_togl_graduatedtrihedron_display
is deferred; is deferred;

View File

@ -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&, void Graphic3d_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView&,
Graphic3d_CGraduatedTrihedron&, const 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)
{ {
} }

View File

@ -1,9 +1,7 @@
// File: Graphic3d_Group_10.cxx (Text)
// File Graphic3d_Group_10.cxx (Text) // Created: Fevrier 1992
// Created Fevrier 1992 // Author: NW,JPB,CAL
// Author NW,JPB,CAL // Copyright: OPEN CASCADE 1992
//-Copyright MatraDatavision 1991,1992
//-Version //-Version
@ -36,29 +34,27 @@ void Graphic3d_Group::Text (
const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta, const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax 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 MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
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 ();
Update ();
} }
void Graphic3d_Group::Text ( void Graphic3d_Group::Text (
@ -66,28 +62,27 @@ void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint, const Graphic3d_Vertex& APoint,
const Standard_Real AHeight, const Standard_Real AHeight,
const Standard_Boolean EvalMinMax 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 MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
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 ();
Update ();
} }
void Graphic3d_Group::Text ( void Graphic3d_Group::Text (
@ -99,31 +94,27 @@ void Graphic3d_Group::Text (
const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta, const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax 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; MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
// 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 ();
Update ();
} }
void Graphic3d_Group::Text ( void Graphic3d_Group::Text (
@ -131,28 +122,25 @@ void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint, const Graphic3d_Vertex& APoint,
const Standard_Real AHeight, const Standard_Real AHeight,
const Standard_Boolean EvalMinMax 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; MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
// 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 ();
Update ();
} }

View File

@ -63,6 +63,7 @@
#include <InterfaceGraphic_Graphic3d.hxx> #include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx> #include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_CGraduatedTrihedron.hxx>
#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing #define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
from higher API */ from higher API */
@ -1091,21 +1092,13 @@ int EXPORT call_togl_isgllight (
CALL_DEF_VIEW *aview CALL_DEF_VIEW *aview
#endif #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 ( void EXPORT call_togl_graduatedtrihedron_display (
#ifdef INTERFACEGRAPHIC_PROTOTYPE #ifdef INTERFACEGRAPHIC_PROTOTYPE
/* View id */ /* View id */
CALL_DEF_VIEW* aview, CALL_DEF_VIEW* aview,
/* Graduated trihedron data */ /* Graduated trihedron data */
CALL_DEF_GRADUATEDTRIHEDRON* cubic const Graphic3d_CGraduatedTrihedron &cubic
#endif #endif
); );

View File

@ -246,7 +246,7 @@ typedef struct {
typedef struct { typedef struct {
char *string; unsigned short *string;
CALL_DEF_POINT Position; CALL_DEF_POINT Position;
@ -260,7 +260,7 @@ typedef struct {
int VAlign; int VAlign;
bool Zoomable; bool Zoomable;
} CALL_DEF_TEXT; } CALL_DEF_TEXT;

View File

@ -52,8 +52,6 @@ Facility : CAS-CADE V1
#include <Aspect_GraphicCallbackProc.hxx> #include <Aspect_GraphicCallbackProc.hxx>
#endif #endif
#include <OSD_FontAspect.hxx>
typedef float CALL_DEF_MATRIX4X4[4][4]; typedef float CALL_DEF_MATRIX4X4[4][4];
/* SOMMET */ /* SOMMET */
@ -256,61 +254,4 @@ typedef struct {
} CALL_DEF_PICK; } 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 */ #endif /* InterfaceGraphic_Visual3dHeader */

View File

@ -112,15 +112,6 @@ struct TEL_MATRIX3_DATA
}; };
typedef TEL_MATRIX3_DATA* 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 struct TEL_ALIGN_DATA
{ {
Tint Hmode; Tint Hmode;

View File

@ -19,6 +19,8 @@ therefore it should be made signed explicitly, as on Linux
typedef signed char Tchar; typedef signed char Tchar;
typedef char Tbool; typedef char Tbool;
typedef unsigned int Tuint; typedef unsigned int Tuint;
/* szv: Techar is an Extended character */
typedef unsigned short Techar;
#define TGL_SP 1 #define TGL_SP 1
#define TGL_DP 0 #define TGL_DP 0

View File

@ -310,8 +310,8 @@ int OpenGl_FontMgr::request_font( const Handle(TCollection_HAsciiString)& fontNa
return -1; return -1;
} }
void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text, void OpenGl_FontMgr::render_text( const Standard_Integer id, const wchar_t* text,
const Standard_Boolean is2d ) const Standard_Boolean is2d )
{ {
#ifdef TRACE #ifdef TRACE
cout << "TKOpenGl::render_text\n" cout << "TKOpenGl::render_text\n"
@ -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 ); 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; 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 ) ) if( !_FontCache.IsBound( id ) )
return 0.f; return 0.f;
OGLFont_Cache cache = _FontCache.Find( id ); OGLFont_Cache cache = _FontCache.Find( id );
Standard_ShortReal w = cache.Font->Advance( str ); Standard_ShortReal w = cache.Font->Advance( text );
return w; return w;
} }
void OpenGl_FontMgr::setCurrentScale( const Standard_ShortReal xScale, void OpenGl_FontMgr::setCurrentScale (const Standard_ShortReal xScale,
const Standard_ShortReal yScale) const Standard_ShortReal yScale)
{ {
_XCurrentScale = xScale; _XCurrentScale = xScale;
_YCurrentScale = yScale; _YCurrentScale = yScale;
@ -397,7 +399,8 @@ void OpenGl_FontMgr::setCurrentScale( const Standard_ShortReal xScale,
#include <Image_ColorImage.hxx> #include <Image_ColorImage.hxx>
#include <Quantity_Color.hxx> #include <Quantity_Color.hxx>
void dump_texture( int id) { void dump_texture( int id)
{
Handle(AlienImage_BMPAlienData) image = new AlienImage_BMPAlienData(); Handle(AlienImage_BMPAlienData) image = new AlienImage_BMPAlienData();
if (!glIsTexture(id)) if (!glIsTexture(id))

View File

@ -1,7 +1,6 @@
#ifndef OPENGL_FONT_MGR_H #ifndef OPENGL_FONT_MGR_H
#define OPENGL_FONT_MGR_H #define OPENGL_FONT_MGR_H
#ifdef WNT #ifdef WNT
# include <windows.h> # include <windows.h>
# include <stdlib.h> # include <stdlib.h>
@ -20,26 +19,27 @@ void dump_texture();
class OpenGl_FontMgr class OpenGl_FontMgr
{ {
public: public:
static OpenGl_FontMgr* instance(); static OpenGl_FontMgr* instance();
int request_font( const Handle(TCollection_HAsciiString)& fontName, int request_font( const Handle(TCollection_HAsciiString)& fontName,
const OSD_FontAspect fontAspect, const OSD_FontAspect fontAspect,
const Standard_Integer fontHeight ); const Standard_Integer fontHeight );
void render_text( const Standard_Integer id, void render_text( const Standard_Integer id,
const char* text, const wchar_t* text,
const Standard_Boolean is2d = 0 ); const Standard_Boolean is2d = Standard_False );
//render text by last requested font //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 //returns direct access to FTGL font
//Warning: don't change font pointer. //Warning: don't change font pointer.
const FTFont* fontById( const Standard_Integer id ); const FTFont* fontById( const Standard_Integer id );
//returns width of string //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& ); bool requestFontList( Graphic3d_NListOfHAsciiString& );

View File

@ -904,138 +904,9 @@ is
---Category: Graduated trihedron ---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; GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d; view : CView from Graphic3d;
cubic : in out CGraduatedTrihedron from Graphic3d; cubic : 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)
---Purpose: call_togl_graduatedtrihedron_display ---Purpose: call_togl_graduatedtrihedron_display
is redefined static; is redefined static;

View File

@ -43,35 +43,11 @@ void OpenGl_GraphicDriver::Text
const Graphic3d_TextPath ATp, const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta, const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean const Standard_Boolean EvalMinMax
) )
{ {
TCollection_ExtendedString TheText(AText);
OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,AAngle,ATp,AHta,AVta,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);
} }
void OpenGl_GraphicDriver::Text void OpenGl_GraphicDriver::Text
@ -80,35 +56,11 @@ void OpenGl_GraphicDriver::Text
const Standard_CString AText, const Standard_CString AText,
const Graphic3d_Vertex& APoint, const Graphic3d_Vertex& APoint,
const Standard_Real AHeight, const Standard_Real AHeight,
const Standard_Boolean const Standard_Boolean EvalMinMax
) )
{ {
TCollection_ExtendedString TheText(AText);
OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,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);
} }
void OpenGl_GraphicDriver::Text void OpenGl_GraphicDriver::Text
@ -124,14 +76,11 @@ void OpenGl_GraphicDriver::Text
const Standard_Boolean const Standard_Boolean
) )
{ {
Graphic3d_CGroup MyCGroup = ACGroup; Graphic3d_CGroup MyCGroup = ACGroup;
Standard_Real X, Y, Z;
CALL_DEF_TEXT atext; CALL_DEF_TEXT atext;
TCollection_AsciiString ascii (AText,'?');
Standard_Real X, Y, Z;
APoint.Coord (X, Y, Z); APoint.Coord (X, Y, Z);
atext.Position.x = float (X); atext.Position.x = float (X);
atext.Position.y = float (Y); atext.Position.y = float (Y);
@ -143,15 +92,13 @@ void OpenGl_GraphicDriver::Text
atext.Path = int (ATp); atext.Path = int (ATp);
atext.HAlign = int (AHta); atext.HAlign = int (AHta);
atext.VAlign = int (AVta); atext.VAlign = int (AVta);
atext.string = (Standard_PCharacter)ascii.ToCString (); atext.string = (unsigned short *)AText.ToExtString ();
if (MyTraceLevel) { if (MyTraceLevel) {
PrintFunction ("call_togl_text"); PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1); PrintCGroup (MyCGroup, 1);
} }
call_togl_text (&MyCGroup, &atext); call_togl_text (&MyCGroup, &atext);
ascii.Clear ();
} }
void OpenGl_GraphicDriver::Text void OpenGl_GraphicDriver::Text
@ -161,33 +108,29 @@ void OpenGl_GraphicDriver::Text
const Graphic3d_Vertex& APoint, const Graphic3d_Vertex& APoint,
const Standard_Real AHeight, const Standard_Real AHeight,
const Standard_Boolean 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; if (MyTraceLevel) {
CALL_DEF_TEXT atext; PrintFunction ("call_togl_text");
TCollection_AsciiString ascii (AText, '?'); PrintCGroup (MyCGroup, 1);
}
APoint.Coord (X, Y, Z); call_togl_text (&MyCGroup, &atext);
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 ();
}

View File

@ -36,8 +36,7 @@ Standard_Boolean OpenGl_GraphicDriver
{ {
#ifdef BUC61044 #ifdef BUC61044
Graphic3d_CView MyCView = view; Graphic3d_CView MyCView = view;
if ( call_togl_isdepthtest( &MyCView ) ) return (call_togl_isdepthtest( &MyCView ) != 0);
return Standard_True;
#endif #endif
} }
@ -65,8 +64,7 @@ Standard_Boolean OpenGl_GraphicDriver
{ {
#ifdef BUC61045 #ifdef BUC61045
Graphic3d_CView MyCView = view; Graphic3d_CView MyCView = view;
if ( call_togl_isgllight( &MyCView ) ) return (call_togl_isgllight( &MyCView ) != 0);
return Standard_True;
#endif #endif
} }

View File

@ -1,4 +1,3 @@
// File OpenGl_GraphicDriver_9.cxx // File OpenGl_GraphicDriver_9.cxx
// Created 1/08/97 // Created 1/08/97
// Author PCT // Author PCT
@ -269,304 +268,10 @@ void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,cons
call_togl_set_gradient_type( ACView.WsId, FillType); 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, void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& view,
Graphic3d_CGraduatedTrihedron& cubic, const 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)
{ {
/* Names of axes */ call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, cubic);
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);
} }
void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view) void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view)

View File

@ -200,7 +200,8 @@ void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const
call_togl_set_text_attributes ((Tchar*)Font, AType, R, G, B); 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) { if (MyTraceLevel) {
PrintFunction ("call_togl_text2d"); PrintFunction ("call_togl_text2d");
PrintString ("Text", AText); PrintString ("Text", AText);
@ -208,14 +209,15 @@ void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_Sh
PrintShortReal ("Y", Y); PrintShortReal ("Y", Y);
PrintShortReal ("Height", Height); PrintShortReal ("Height", Height);
} }
Standard_ShortReal h = Height; const Standard_ShortReal h = (Height < 0)? DefaultTextHeight() : Height;
if ( h < 0 ) TCollection_ExtendedString estr(AText);
h = DefaultTextHeight(); call_togl_text2d ((Techar *)estr.ToExtString(), X, Y, h);
call_togl_text2d ((char *)AText, 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 { 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); {
TCollection_ExtendedString estr(AText);
call_togl_textsize2d ((Techar *)estr.ToExtString(), AHeight, &AWidth, &AnAscent, &ADescent);
if (MyTraceLevel) { if (MyTraceLevel) {
PrintFunction ("call_togl_textsize2d"); PrintFunction ("call_togl_textsize2d");
PrintString ("Text", AText); PrintString ("Text", AText);

View File

@ -11,7 +11,7 @@
#include <Aspect_DriverDefinitionError.hxx> #include <Aspect_DriverDefinitionError.hxx>
#include <Standard_NotImplemented.hxx> #include <Standard_NotImplemented.hxx>
#include "OpenGl_tgl_funcs.hxx" #include <OpenGl_tgl_funcs.hxx>
/************************************************************************/ /************************************************************************/

View File

@ -23,7 +23,6 @@
#include <gl2ps.h> #include <gl2ps.h>
#endif #endif
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* /*
* Prototypes variables statiques * 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;*/ /* 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]; GLdouble projMatrix[4][4], modelMatrix[4][4];
GLint viewport[4]; GLint viewport[4];
@ -415,7 +414,6 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x
glPopMatrix(); glPopMatrix();
} }
glPopAttrib(); glPopAttrib();
return;
} }
@ -465,7 +463,7 @@ int OpenGl_TextRender::alignmentforgl2ps(int vh, int vy)
#endif #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 ) GLfloat x, GLfloat y, GLfloat z, GLboolean is2d )
{ {
#ifdef HAVE_GL2PS #ifdef HAVE_GL2PS
@ -482,8 +480,12 @@ void OpenGl_TextRender::ExportText( char* str, char* fontname, GLfloat height, G
glBitmap( 1, 1, 0, 0, 0, 0, &zero ); 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 #endif
} }

View File

@ -11,22 +11,21 @@
#define NUM_CHAR_FONT 1024 #define NUM_CHAR_FONT 1024
#define CACHE_SIZE 30 #define CACHE_SIZE 30
class OpenGl_TextRender{ class OpenGl_TextRender
{
public: public:
static OpenGl_TextRender* instance(); static OpenGl_TextRender* instance();
Tint FindFont ( Tchar*, OSD_FontAspect, Tfloat, Tfloat = 1. , Tfloat = 1.); Tint FindFont ( Tchar*, OSD_FontAspect, Tfloat, Tfloat = 1. , Tfloat = 1.);
void StringSize( char *text, GLint *width, GLint *ascent, GLint *descent); void StringSize( const wchar_t *text, GLint *width, GLint *ascent, GLint *descent);
void RenderText( const Standard_Integer id, const char* text); void RenderText( const wchar_t*, GLuint, int, GLfloat, GLfloat, GLfloat );
void RenderText( char*, 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 );
void ExportText( char* str, char* fontname, GLfloat height, GLfloat angle, GLint alingment, GLfloat x, GLfloat y, GLfloat z, GLboolean is2d );
#ifdef HAVE_GL2PS #ifdef HAVE_GL2PS
static void getGL2PSFontName(char *src_font, char *ps_font); static void getGL2PSFontName(char *src_font, char *ps_font);
#endif #endif
private: private:
static int curFont ; static int curFont ;
static int curSize ; static int curSize ;

View File

@ -667,7 +667,7 @@ call_func_set_anno_align( Tint hor, Tint ver )
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void 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]; CMN_KEY k[2];

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,8 @@
// File: OpenGl_graduatedtrihedron.hxx
// Created: 6 March 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE SA 2011
#ifndef __OPENGL_GRADUATEDTRIHEDRON_H_ #ifndef __OPENGL_GRADUATEDTRIHEDRON_H_
#define __OPENGL_GRADUATEDTRIHEDRON_H_ #define __OPENGL_GRADUATEDTRIHEDRON_H_
@ -9,8 +14,9 @@
#include <InterfaceGraphic_Aspect.hxx> #include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx> #include <InterfaceGraphic_Visual3d.hxx>
extern TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data); #include <Graphic3d_CGraduatedTrihedron.hxx>
extern TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data);
extern TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data);
extern TStatus call_graduatedtrihedron_redraw(int WsId); extern TStatus call_graduatedtrihedron_redraw(int WsId);
extern TStatus call_graduatedtrihedron_erase(int WsId); extern TStatus call_graduatedtrihedron_erase(int WsId);
extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin, extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,

View File

@ -1631,7 +1631,7 @@ call_subr_structure_exploration( Tint Id,
else else
{ {
printf( "\tELEM_ANNO_TEXT_REL3\n" ); 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 ); data.atext3.string );
printf( "\t\treference point %f %f %f\n", printf( "\t\treference point %f %f %f\n",
data.atext3.ref_pt.xyz[0], data.atext3.ref_pt.xyz[0],

View File

@ -22,7 +22,7 @@ typedef union
{ {
TEL_POINT ref_pt; /* reference text point */ TEL_POINT ref_pt; /* reference text point */
TEL_POINT anno; /* annotation pt/offset */ TEL_POINT anno; /* annotation pt/offset */
Tchar *string; /* text string */ Techar *string; /* text string */
} atext3; } atext3;
Tint size; Tint size;

View File

@ -49,9 +49,17 @@ xx-xx-xx : xxx ; Creation.
#include <OpenGl_Extension.hxx> #include <OpenGl_Extension.hxx>
#include <OpenGl_Memory.hxx> #include <OpenGl_Memory.hxx>
#include <OpenGl_TextRender.hxx> #include <OpenGl_TextRender.hxx>
struct TEL_TEXT_DATA
{
TEL_POINT attach_pt;
Tint length;
const wchar_t *sdata;
IMPLEMENT_MEMORY_OPERATORS
};
typedef TEL_TEXT_DATA* tel_text_data;
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/* /*
* Fonctions statiques * Fonctions statiques
@ -103,12 +111,6 @@ extern int g_nDegenerateModel;
extern float g_fSkipRatio; extern float g_fSkipRatio;
#endif #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 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 def_pt = {{ ( float )0.0, ( float )0.0, ( float )0.0 }};
tel_point pt = &def_pt; tel_point pt = &def_pt;
tel_text_data data; tel_text_data data;
Tchar *str= 0; Techar *str= 0;
for( i = 0; i < n; i++ ) 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; pt = (tel_point)k[i]->data.pdata;
break; break;
case TEXT_STRING_ID: case TEXT_STRING_ID:
str = (Tchar*)k[i]->data.pdata; str = (Techar*)k[i]->data.pdata;
break; break;
} }
} }
i = strlen((char*)str) + 1;
data = new TEL_TEXT_DATA(); data = new TEL_TEXT_DATA();
if( !data ) if( !data )
return TFailure; 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; return TFailure;
data->attach_pt = *pt; data->attach_pt = *pt;
data->length = i; 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; ((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); if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
} }
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* display type of text */ /* display type of text */
if (display_type != ASPECT_TODT_NORMAL) 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_MODELVIEW_MATRIX, modelMatrix);
glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
switch (display_type) switch (display_type)
{ {
case ASPECT_TODT_BLEND: case ASPECT_TODT_BLEND:
@ -272,7 +279,7 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
#endif #endif
break; break;
case ASPECT_TODT_SUBTITLE: 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]; objrefX = (float)d->attach_pt.xyz[0];
objrefY = (float)d->attach_pt.xyz[1]; objrefY = (float)d->attach_pt.xyz[1];
objrefZ = (float)d->attach_pt.xyz[2]; objrefZ = (float)d->attach_pt.xyz[2];
@ -326,30 +333,30 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
&objX, &objY, &objZ); &objX, &objY, &objZ);
glColor3fv( colours.rgb ); 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; winx = winx1-1;
winy = winy1-1; winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ); &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; winx = winx1-1;
winy = winy1+1; winy = winy1+1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ); &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; winx = winx1+1;
winy = winy1-1; winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ); &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; break;
} }
} }
glColor3fv( colour.rgb ); 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 */ /* maj attributs */
if (flag_zbuffer) glEnable(GL_DEPTH_TEST); if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
if (display_type == ASPECT_TODT_BLEND) if (display_type == ASPECT_TODT_BLEND)
@ -370,8 +377,12 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
static TStatus static TStatus
TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
{ {
if (data.pdata) tel_text_data d = (tel_text_data)data.pdata;
delete data.pdata; if (d)
{
delete[] d->sdata;
delete d;
}
return TSuccess; return TSuccess;
} }
@ -385,7 +396,7 @@ TextPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
p = (tel_text_data)data.pdata; p = (tel_text_data)data.pdata;
fprintf( stdout, "TelText.\n" ); 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], fprintf( stdout, "\t\tAttach Point : %f %f %f\n", p->attach_pt.xyz[0],
p->attach_pt.xyz[1], p->attach_pt.xyz[1],
p->attach_pt.xyz[2] ); 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; d = (tel_text_data)data.pdata;
size_reqd = d->length; size_reqd = sizeof(Techar)*d->length;
for( i = 0; i < n; i++ ) 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 ) 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.ref_pt = d->attach_pt;
w->atext3.anno.xyz[0] = ( float )0.0; w->atext3.anno.xyz[0] = ( float )0.0;
w->atext3.anno.xyz[1] = ( float )0.0; w->atext3.anno.xyz[1] = ( float )0.0;
w->atext3.anno.xyz[2] = ( 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; status = TSuccess;
} }
else else

View File

@ -58,6 +58,7 @@ from higher API */
#include <InterfaceGraphic_Visual3d.hxx> #include <InterfaceGraphic_Visual3d.hxx>
#include <OSD_FontAspect.hxx> #include <OSD_FontAspect.hxx>
#include <Graphic3d_CGraduatedTrihedron.hxx>
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/* /*
@ -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_char_up_vec(Tfloat[2]); /* up_vector */
extern void call_func_set_anno_path(Tint); /* path */ extern void call_func_set_anno_path(Tint); /* path */
extern void call_func_set_anno_align(Tint, Tint); /* hor, ver */ 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_dcue_ind(Tint); /* dcid */
extern void call_func_set_do_texturemap(Tint); /* bool */ extern void call_func_set_do_texturemap(Tint); /* bool */
extern void call_func_set_texture_id(Tint); /* TextureID */ extern void call_func_set_texture_id(Tint); /* TextureID */
@ -383,11 +384,8 @@ void EXPORT call_togl_triedron_echo (
/* Graduated trihedron */ /* 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, void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic); const Graphic3d_CGraduatedTrihedron &cubic);
void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view); 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 ( void EXPORT call_togl_text2d (
char *s, Techar *s,
float x, float x,
float y, float y,
float height float height
@ -1297,7 +1295,7 @@ void EXPORT call_togl_text2d (
void EXPORT call_togl_textsize2d ( void EXPORT call_togl_textsize2d (
char *s, Techar *s,
float height, float height,
float *width, float *width,
float *ascent, float *ascent,

View File

@ -116,7 +116,6 @@ static float layerFontRed = -1.;
static float layerFontGreen = -1.; static float layerFontGreen = -1.;
static float layerFontBlue = -1.; static float layerFontBlue = -1.;
static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular; static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular;
static Tint FTGLLayerFontHeight = 16; static Tint FTGLLayerFontHeight = 16;
static Tint FTGLLayerFontAscent = 0; static Tint FTGLLayerFontAscent = 0;
@ -593,19 +592,18 @@ call_togl_rectangle2d
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void EXPORT void EXPORT
call_togl_text2d ( char *s, call_togl_text2d ( Techar *s,
float x, float x,
float y, float y,
float height ) float height )
{ {
call_def_ptrLayer ptrLayer;
#ifndef WNT #ifndef WNT
Tint dispWidth, dispHeight; Tint dispWidth, dispHeight;
#endif #endif
GLdouble objx1, objy1, objz1; GLdouble objx1, objy1, objz1;
ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
if (ptrLayer == NULL) return; if (!ptrLayer) return;
if (ptrLayer->listIndex == 0) return; if (ptrLayer->listIndex == 0) return;
#ifdef TRACE_TEXT #ifdef TRACE_TEXT
printf ("call_togl_text2d %d\n", ptrLayer->listIndex); printf ("call_togl_text2d %d\n", ptrLayer->listIndex);
@ -624,6 +622,15 @@ call_togl_text2d ( char *s,
objy1 = y, objy1 = y,
objz1 = 0.0; 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 * 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); printf ("texte normal %f %f\n", objx1, objy1);
#endif #endif
textRender->RenderText(s , fontBase, 1, (float )objx1, (float )objy1, 0.f ); textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f );
break; break;
case 1 : /* Aspect_TODT_SubTitle */ case 1 : /* Aspect_TODT_SubTitle */
@ -721,8 +728,7 @@ call_togl_text2d ( char *s,
glColor3f (layerRed, layerGreen, layerBlue); glColor3f (layerRed, layerGreen, layerBlue);
#endif /* OK */ #endif /* OK */
textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
textRender->RenderText(s, fontBase, 1, (float )objx1, (float )objy1, 0.f);
break; break;
case 2 : /* Aspect_TODT_Dekale */ case 2 : /* Aspect_TODT_Dekale */
@ -774,7 +780,7 @@ call_togl_text2d ( char *s,
OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); 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; winx2 = winx1-1;
@ -787,7 +793,7 @@ call_togl_text2d ( char *s,
printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
#endif #endif
textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f); textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
winx2 = winx1-1; winx2 = winx1-1;
@ -801,7 +807,7 @@ call_togl_text2d ( char *s,
#endif #endif
textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f); textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
winx2 = winx1+1; winx2 = winx1+1;
winy2 = winy1-1; winy2 = winy1-1;
@ -813,12 +819,12 @@ call_togl_text2d ( char *s,
printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
#endif #endif
textRender->RenderText(s, fontBase, 1, objx2, objy2, 0.f); textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
glColor3f (layerRed, layerGreen, layerBlue); glColor3f (layerRed, layerGreen, layerBlue);
#endif /* OK */ #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 #ifdef DEBUG
printf ("---------------------\n"); printf ("---------------------\n");
@ -853,7 +859,7 @@ call_togl_text2d ( char *s,
#else #else
glColor3f (layerRed, layerGreen, layerBlue); 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 #endif //WNT
@ -864,7 +870,7 @@ call_togl_text2d ( char *s,
printf ("texte blend %f %f\n", objx1, objy1); printf ("texte blend %f %f\n", objx1, objy1);
#endif #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 #ifdef DEBUG
printf ("---------------------\n"); printf ("---------------------\n");
@ -872,37 +878,49 @@ call_togl_text2d ( char *s,
#endif /* OK */ #endif /* OK */
break; break;
} }
//szv: delete temporary wide string
if (sizeof(Techar) != sizeof(wchar_t))
delete[] s1;
} }
void EXPORT void EXPORT
call_togl_textsize2d call_togl_textsize2d
( (
char *s, Techar *s,
float height, float height,
float *width, float *width,
float *ascent, float *ascent,
float *descent float *descent
) )
{ {
call_def_ptrLayer ptrLayer;
#ifndef WNT #ifndef WNT
Tint dispWidth, dispHeight; Tint dispWidth, dispHeight;
#endif #endif
call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; if (!ptrLayer) return;
if (ptrLayer == NULL) return;
if (ptrLayer->listIndex == 0) 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; layerFontFlag = IsNotModified;
FTGLLayerFontHeight = height; FTGLLayerFontHeight = height;
OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight); 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; *width = (float) FTGLLayerFontWidth;
*ascent = (float) FTGLLayerFontAscent; *ascent = (float) FTGLLayerFontAscent;

View File

@ -1,3 +1,8 @@
// File: OpenGl_togl_graduatedtrihedron.cxx
// Created: 6 March 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE SA 2011
#include <OpenGl_graduatedtrihedron.hxx> #include <OpenGl_graduatedtrihedron.hxx>
#include <OpenGl_tsm_ws.hxx> #include <OpenGl_tsm_ws.hxx>
@ -7,14 +12,8 @@
#include <InterfaceGraphic_Aspect.hxx> #include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx> #include <InterfaceGraphic_Visual3d.hxx>
void EXPORT call_togl_graduatedtrihedron_get(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic)
{
call_graduatedtrihedron_get(view->WsId, cubic);
}
void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view, void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic) const Graphic3d_CGraduatedTrihedron &cubic)
{ {
call_graduatedtrihedron_display(view->WsId, cubic); call_graduatedtrihedron_display(view->WsId, cubic);
} }

View File

@ -78,7 +78,6 @@ call_togl_text
call_func_set_anno_char_up_vec (up_vect); call_func_set_anno_char_up_vec (up_vect);
call_func_set_anno_path (path); call_func_set_anno_path (path);
call_func_set_anno_align (hor_align, ver_align); 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); if (! agroup->IsOpen) call_togl_closegroup (agroup);
return;
} }

View File

@ -299,7 +299,6 @@ TStatus call_triedron_redraw (
GLuint fontBase = 0; GLuint fontBase = 0;
GLint mode; GLint mode;
char AxeName[]="X\0";
#ifdef QTOCC_PATCH /* PCD 10/02/08 */ #ifdef QTOCC_PATCH /* PCD 10/02/08 */
/* Fix to problem with clipping planes chopping off pieces of the triedron */ /* 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(); OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* Axe X */ /* Axe X */
strcpy ( AxeName, "X\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ; TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + 0.0; TriedronCoord[1] = TriedronOrigin[1] + 0.0;
TriedronCoord[2] = TriedronOrigin[2] - rayon ; 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 */ /* Axe Y */
strcpy ( AxeName, "Y\0" );
TriedronCoord[0] = TriedronOrigin[0] + rayon ; TriedronCoord[0] = TriedronOrigin[0] + rayon ;
TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ; TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
TriedronCoord[2] = TriedronOrigin[2] + ( 2.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 */ /* Axe Z */
strcpy ( AxeName, "Z\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ; TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ; TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ; TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ;
textRender->RenderText(L"Z", 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]);
#ifdef QTOCC_PATCH /* PCD 10/02/08 */ #ifdef QTOCC_PATCH /* PCD 10/02/08 */
/* Recover the clip planes */ /* Recover the clip planes */
@ -658,7 +654,6 @@ TStatus call_zbuffer_triedron_redraw (
GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 }; GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 };
GLuint fontBase = 0; GLuint fontBase = 0;
char AxeName[]="X\0";
GLuint startList; GLuint startList;
GLUquadricObj* aQuadric; GLUquadricObj* aQuadric;
@ -1092,27 +1087,22 @@ TStatus call_zbuffer_triedron_redraw (
OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* Axe X */ /* Axe X */
strcpy ( AxeName, "X\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ; TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + 0.0; TriedronCoord[1] = TriedronOrigin[1] + 0.0;
TriedronCoord[2] = TriedronOrigin[2] - rayon ; 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 */ /* Axe Y */
strcpy ( AxeName, "Y\0" );
TriedronCoord[0] = TriedronOrigin[0] + rayon ; TriedronCoord[0] = TriedronOrigin[0] + rayon ;
TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ; TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon ); TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon );
textRender->RenderText(L"Y", 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 Z */ /* Axe Z */
strcpy ( AxeName, "Z\0" );
TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ; TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ; TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ; 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 #ifdef QTOCC_PATCH
/*PCD 17/06/07 */ /*PCD 17/06/07 */

View File

@ -142,7 +142,9 @@ uses
GraphicCallbackProc from Aspect, GraphicCallbackProc from Aspect,
FillMethod from Aspect, FillMethod from Aspect,
GradientFillMethod from Aspect, GradientFillMethod from Aspect,
FontAspect from OSD FontAspect from OSD,
AsciiString from TCollection,
ExtendedString from TCollection
raises raises
@ -479,63 +481,39 @@ is
GetGraduatedTrihedron(me; GetGraduatedTrihedron(me;
-- Names of axes -- -- Names of axes --
xname : out CString from Standard; xname, yname, zname : out ExtendedString from TCollection;
yname : out CString from Standard;
zname : out CString from Standard;
-- Draw names -- -- Draw names --
xdrawname : out Boolean from Standard; xdrawname, ydrawname, zdrawname : out Boolean from Standard;
ydrawname : out Boolean from Standard;
zdrawname : out Boolean from Standard;
-- Draw values -- -- Draw values --
xdrawvalues : out Boolean from Standard; xdrawvalues, ydrawvalues, zdrawvalues : out Boolean from Standard;
ydrawvalues : out Boolean from Standard;
zdrawvalues : out Boolean from Standard;
-- Draw grid -- -- Draw grid --
drawgrid : out Boolean from Standard; drawgrid : out Boolean from Standard;
-- Draw axes -- -- Draw axes --
drawaxes : out Boolean from Standard; drawaxes : out Boolean from Standard;
-- Number of splits along axes -- -- Number of splits along axes --
nbx : out Integer from Standard; nbx, nby, nbz : out Integer from Standard;
nby : out Integer from Standard;
nbz : out Integer from Standard;
-- Offset for drawing values -- -- Offset for drawing values --
xoffset : out Integer from Standard; xoffset, yoffset, zoffset : out Integer from Standard;
yoffset : out Integer from Standard;
zoffset : out Integer from Standard;
-- Offset for drawing names of axes -- -- Offset for drawing names of axes --
xaxisoffset : out Integer from Standard; xaxisoffset, yaxisoffset, zaxisoffset : out Integer from Standard;
yaxisoffset : out Integer from Standard;
zaxisoffset : out Integer from Standard;
-- Draw tickmarks -- -- Draw tickmarks --
xdrawtickmarks : out Boolean from Standard; xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : out Boolean from Standard;
ydrawtickmarks : out Boolean from Standard;
zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks -- -- Length of tickmarks --
xtickmarklength : out Integer from Standard; xtickmarklength, ytickmarklength, ztickmarklength : out Integer from Standard;
ytickmarklength : out Integer from Standard;
ztickmarklength : out Integer from Standard;
-- Grid color -- -- Grid color --
gridcolor : out Color from Quantity; gridcolor : out Color from Quantity;
-- X name color -- -- Colors of axis names --
xnamecolor : out Color from Quantity; xnamecolor, ynamecolor, znamecolor : out Color from Quantity;
-- Y name color -- -- Colors of axis and values --
ynamecolor : out Color from Quantity; xcolor, ycolor, zcolor : 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 -- -- Name of font for names of axes --
fontOfNames : out CString from Standard; fontOfNames : out AsciiString from TCollection;
-- Style of names of axes -- -- Style of names of axes --
styleOfNames : out FontAspect from OSD; styleOfNames : out FontAspect from OSD;
-- Size of names of axes -- -- Size of names of axes --
sizeOfNames : out Integer from Standard; sizeOfNames : out Integer from Standard;
-- Name of font for values -- -- Name of font for values --
fontOfValues : out CString from Standard; fontOfValues : out AsciiString from TCollection;
-- Style of values -- -- Style of values --
styleOfValues : out FontAspect from OSD; styleOfValues : out FontAspect from OSD;
-- Size of values -- -- Size of values --
@ -545,9 +523,9 @@ is
GraduatedTrihedronDisplay(me : mutable; GraduatedTrihedronDisplay(me : mutable;
-- Names of axes -- -- Names of axes --
xname : CString from Standard = "X\0"; xname : ExtendedString from TCollection = "X";
yname : CString from Standard = "Y\0"; yname : ExtendedString from TCollection = "Y";
zname : CString from Standard = "Z\0"; zname : ExtendedString from TCollection = "Z";
-- Draw names -- -- Draw names --
xdrawname : Boolean from Standard = Standard_True; xdrawname : Boolean from Standard = Standard_True;
ydrawname : Boolean from Standard = Standard_True; ydrawname : Boolean from Standard = Standard_True;
@ -595,13 +573,13 @@ is
-- Z color of axis and values -- -- Z color of axis and values --
zcolor : Color from Quantity = Quantity_NOC_BLUE1; zcolor : Color from Quantity = Quantity_NOC_BLUE1;
-- Name of font for names of axes -- -- Name of font for names of axes --
fontOfNames : CString from Standard = "Arial"; fontOfNames : AsciiString from TCollection = "Arial";
-- Style of names of axes -- -- Style of names of axes --
styleOfNames : FontAspect from OSD = OSD_FA_Bold; styleOfNames : FontAspect from OSD = OSD_FA_Bold;
-- Size of names of axes -- -- Size of names of axes --
sizeOfNames : Integer from Standard = 12; sizeOfNames : Integer from Standard = 12;
-- Name of font for values -- -- Name of font for values --
fontOfValues : CString from Standard = "Arial"; fontOfValues : AsciiString from TCollection = "Arial";
-- Style of values -- -- Style of values --
styleOfValues : FontAspect from OSD = OSD_FA_Regular; styleOfValues : FontAspect from OSD = OSD_FA_Regular;
-- Size of values -- -- Size of values --

View File

@ -493,9 +493,9 @@ void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType ) {
} }
void V3d_View::GetGraduatedTrihedron(/* Names of axes */ void V3d_View::GetGraduatedTrihedron(/* Names of axes */
Standard_CString& xname, TCollection_ExtendedString &xname,
Standard_CString& yname, TCollection_ExtendedString &yname,
Standard_CString& zname, TCollection_ExtendedString &zname,
/* Draw names */ /* Draw names */
Standard_Boolean& xdrawname, Standard_Boolean& xdrawname,
Standard_Boolean& ydrawname, Standard_Boolean& ydrawname,
@ -543,13 +543,13 @@ void V3d_View::GetGraduatedTrihedron(/* Names of axes */
/* Z color of axis and values */ /* Z color of axis and values */
Quantity_Color& zcolor, Quantity_Color& zcolor,
/* Name of font for names of axes */ /* Name of font for names of axes */
Standard_CString& fontOfNames, TCollection_AsciiString &fontOfNames,
/* Style of names of axes */ /* Style of names of axes */
OSD_FontAspect& styleOfNames, OSD_FontAspect& styleOfNames,
/* Size of names of axes */ /* Size of names of axes */
Standard_Integer& sizeOfNames, Standard_Integer& sizeOfNames,
/* Name of font for values */ /* Name of font for values */
Standard_CString& fontOfValues, TCollection_AsciiString &fontOfValues,
/* Style of values */ /* Style of values */
OSD_FontAspect& styleOfValues, OSD_FontAspect& styleOfValues,
/* Size of values */ /* Size of values */
@ -620,9 +620,9 @@ void V3d_View::GetGraduatedTrihedron(/* Names of axes */
} }
void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */ void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */
const Standard_CString xname, const TCollection_ExtendedString &xname,
const Standard_CString yname, const TCollection_ExtendedString &yname,
const Standard_CString zname, const TCollection_ExtendedString &zname,
/* Draw names */ /* Draw names */
const Standard_Boolean xdrawname, const Standard_Boolean xdrawname,
const Standard_Boolean ydrawname, const Standard_Boolean ydrawname,
@ -670,13 +670,13 @@ void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */
/* Z color of axis and values */ /* Z color of axis and values */
const Quantity_Color& zcolor, const Quantity_Color& zcolor,
/* Name of font for names of axes */ /* Name of font for names of axes */
const Standard_CString fontOfNames, const TCollection_AsciiString &fontOfNames,
/* Style of names of axes */ /* Style of names of axes */
const OSD_FontAspect styleOfNames, const OSD_FontAspect styleOfNames,
/* Size of names of axes */ /* Size of names of axes */
const Standard_Integer sizeOfNames, const Standard_Integer sizeOfNames,
/* Name of font for values */ /* Name of font for values */
const Standard_CString fontOfValues, const TCollection_AsciiString &fontOfValues,
/* Style of values */ /* Style of values */
const OSD_FontAspect styleOfValues, const OSD_FontAspect styleOfValues,
/* Size of values */ /* Size of values */
@ -750,4 +750,3 @@ void V3d_View::GraduatedTrihedronErase()
{ {
MyView->GraduatedTrihedronErase(); MyView->GraduatedTrihedronErase();
} }

View File

@ -1,7 +1,7 @@
// File: ViewerTest_ObjectsCommands.cxx // File: ViewerTest_ObjectsCommands.cxx
// Created: Thu Nov 12 15:50:42 1998 // Created: Thu Nov 12 15:50:42 1998
// Author: Robert COUBLANC // Author: Robert COUBLANC
// <rob@robox.paris1.matra-dtv.fr> // 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) DEFINE_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject)
class MyTextClass:public AIS_InteractiveObject{ class MyTextClass:public AIS_InteractiveObject
{
public: public:
// CASCADE RTTI // CASCADE RTTI
DEFINE_STANDARD_RTTI(MyTextClass ); DEFINE_STANDARD_RTTI(MyTextClass );
@ -1989,7 +1989,6 @@ IMPLEMENT_STANDARD_HANDLE(MyTextClass, AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(MyTextClass, AIS_InteractiveObject) IMPLEMENT_STANDARD_RTTIEXT(MyTextClass, AIS_InteractiveObject)
MyTextClass::MyTextClass( const TCollection_ExtendedString& text, const gp_Pnt& position, MyTextClass::MyTextClass( const TCollection_ExtendedString& text, const gp_Pnt& position,
Quantity_Color color = Quantity_NOC_YELLOW, Quantity_Color color = Quantity_NOC_YELLOW,
Standard_Integer aHJust = Graphic3d_HTA_LEFT, 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) static int VDrawText (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
// Verification des arguments // Check arguments
if ( argc > 17 ) {di<<argv[0]<<" Syntaxe error"<<"\n"; return 1;} if (argc < 14)
Quantity_Parameter R, G, B; {
Quantity_Color aColor; di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
Standard_Real angle; di<<"Usage: type help "<<argv[0]<<"\n";
Standard_Real height; return 1; //TCL_ERROR
Standard_Boolean zoom; }
OSD_FontAspect aspect;
TCollection_AsciiString font;
gp_Pnt pnt;
int hor_align;
int ver_align;
TCollection_AsciiString aFont;
TCollection_AsciiString name = argv[1];
//Declarations et creation des objets par default Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
Standard_Real X,Y,Z;
X = atof(argv[2]);
Y = atof(argv[3]);
Z = atof(argv[4]);
pnt.SetCoord(X,Y,Z);
R = atof(argv[5])/255.; // Create 3D view if it doesn't exist
G = atof(argv[6])/255.; if ( aContext.IsNull() )
B = atof(argv[7])/255.; {
ViewerTest::ViewerInit();
aContext = ViewerTest::GetAISContext();
if( aContext.IsNull() )
{
di << "Error: Cannot create a 3D view\n";
return 1; //TCL_ERROR
}
}
hor_align = atoi(argv[8]); // Text position
ver_align = atoi(argv[9]); const Standard_Real X = atof(argv[2]);
const Standard_Real Y = atof(argv[3]);
const Standard_Real Z = atof(argv[4]);
const gp_Pnt pnt(X,Y,Z);
angle = atof(argv[10]); // Text color
const Quantity_Parameter R = atof(argv[5])/255.;
const Quantity_Parameter G = atof(argv[6])/255.;
const Quantity_Parameter B = atof(argv[7])/255.;
const Quantity_Color aColor( R, G, B, Quantity_TOC_RGB );
zoom = atoi(argv[11]); // Text alignment
const int hor_align = atoi(argv[8]);
const int ver_align = atoi(argv[9]);
height = atof(argv[12]); // Text angle
const Standard_Real angle = atof(argv[10]);
aspect = OSD_FontAspect(atoi(argv[13])); // Text zooming
const Standard_Boolean zoom = atoi(argv[11]);
if(argc == 14) // Text height
const Standard_Real height = atof(argv[12]);
// Text aspect
const OSD_FontAspect aspect = OSD_FontAspect(atoi(argv[13]));
// Text font
TCollection_AsciiString font;
if(argc < 15)
font.AssignCat("Courier"); font.AssignCat("Courier");
if(argc == 15) else
font.AssignCat(argv[14]); font.AssignCat(argv[14]);
if(argc == 16)
// Text is multibyte
const Standard_Boolean isMultibyte = (argc < 16)? Standard_False : (atoi(argv[15]) != 0);
// Read text string
TCollection_ExtendedString name;
if (isMultibyte)
{ {
font.AssignCat(argv[14]); const char *str = argv[1];
font.AssignCat(" "); while (*str)
font.AssignCat(argv[15]); {
unsigned short c1 = *str++;
unsigned short c2 = *str++;
if (!c1 || !c2) break;
name += (Standard_ExtCharacter)((c1 << 8) | c2);
}
} }
if(argc == 17) else
{ {
font.AssignCat(argv[14]); name += argv[1];
font.AssignCat(" ");
font.AssignCat(argv[15]);
font.AssignCat(" ");
font.AssignCat(argv[16]);
} }
aColor.SetValues( R, G, B, Quantity_TOC_RGB ); if (name.Length())
Handle(AIS_InteractiveContext) aContext= ViewerTest::GetAISContext();
Handle(MyTextClass) my=new MyTextClass(argv[1],pnt,aColor,hor_align,ver_align,angle,zoom,height,aspect,font.ToCString());
aContext->Display(my,Standard_True);
if(aContext.IsNull())
{ {
di << "use 'vinit' command before " << argv[0] << "\n"; Handle(MyTextClass) myT = new MyTextClass(name,pnt,aColor,hor_align,ver_align,angle,zoom,height,aspect,font.ToCString());
return -1; aContext->Display(myT,Standard_True);
} }
return 0; return 0;
} }
@ -2794,7 +2808,7 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
__FILE__,VCircleBuilder,group); __FILE__,VCircleBuilder,group);
theCommands.Add("vdrawtext", 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); __FILE__,VDrawText,group);
theCommands.Add("vdrawsphere", theCommands.Add("vdrawsphere",
@ -2804,5 +2818,4 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
theCommands.Add("vclipplane", theCommands.Add("vclipplane",
"vclipplane : vclipplane [x y z dx dy dz] [planeId {on/off/del/display/hide}]", "vclipplane : vclipplane [x y z dx dy dz] [planeId {on/off/del/display/hide}]",
__FILE__,VClipPlane,group); __FILE__,VClipPlane,group);
} }

View File

@ -1661,51 +1661,102 @@ static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char
//function : VGraduatedTrihedron //function : VGraduatedTrihedron
//purpose : Displays a graduated trihedron //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) static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{ {
Handle(V3d_View) V3dView = ViewerTest::CurrentView(); // Check arguments
if (V3dView.IsNull()) if (argc != 2 && argc < 5)
return 1;
if (argc < 2)
{ {
di << argv[0] << " Invalid number of arguments" << "\n"; di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
return 1; di<<"Usage: type help "<<argv[0]<<"\n";
return 1; //TCL_ERROR
} }
Standard_CString xname = "X (mm)"; Handle(V3d_View) aV3dView = ViewerTest::CurrentView();
Standard_CString yname = "Y (mm)";
Standard_CString zname = "Z (mm)";
if (argc > 2) // Create 3D view if it doesn't exist
if ( aV3dView.IsNull() )
{ {
if (argc != 5) ViewerTest::ViewerInit();
{ aV3dView = ViewerTest::CurrentView();
di << argv[0] << " Define all X, Y and Z axes names, please" << "\n"; if( aV3dView.IsNull() )
return 1; {
} di << "Error: Cannot create a 3D view\n";
xname = argv[2]; return 1; //TCL_ERROR
yname = argv[3]; }
zname = argv[4];
} }
int display = atoi(argv[1]); // Erase (==0) or display (!=0)
const int display = atoi(argv[1]);
if (display) if (display)
V3dView->GraduatedTrihedronDisplay(xname, yname, zname, {
Standard_True/*xdrawname*/, Standard_True/*ydrawname*/, Standard_True/*zdrawname*/, // Text font
Standard_True/*xdrawvalues*/, Standard_True/*ydrawvalues*/, Standard_True/*zdrawvalues*/, TCollection_AsciiString font;
Standard_True/*drawgrid*/, if (argc < 6)
Standard_True/*drawaxes*/, font.AssignCat("Courier");
5/*nbx*/, 5/*nby*/, 5/*nbz*/, else
10/*xoffset*/, 10/*yoffset*/, 10/*zoffset*/, font.AssignCat(argv[5]);
30/*xaxisoffset*/, 30/*yaxisoffset*/, 30/*zaxisoffset*/,
Standard_True/*xdrawtickmarks*/, Standard_True/*ydrawtickmarks*/, Standard_True/*zdrawtickmarks*/, // Text is multibyte
10/*xtickmarklength*/, 10/*ytickmarklength*/, 10/*ztickmarklength*/); 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 else
V3dView->GraduatedTrihedronErase(); aV3dView->GraduatedTrihedronErase();
ViewerTest::GetAISContext()->UpdateCurrentViewer(); ViewerTest::GetAISContext()->UpdateCurrentViewer();
V3dView->Redraw(); aV3dView->Redraw();
return 0; 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", "vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
__FILE__,VColorScale,group); __FILE__,VColorScale,group);
theCommands.Add("vgraduatedtrihedron", theCommands.Add("vgraduatedtrihedron",
"vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname]", "vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname [Font [isMultibyte]]]",
__FILE__,VGraduatedTrihedron,group); __FILE__,VGraduatedTrihedron,group);
} }

View File

@ -106,7 +106,10 @@ uses
ExportFormat from Graphic3d, ExportFormat from Graphic3d,
SortType from Graphic3d, SortType from Graphic3d,
Color from Quantity, Color from Quantity,
FontAspect from OSD FontAspect from OSD,
AsciiString from TCollection,
ExtendedString from TCollection,
CGraduatedTrihedron from Graphic3d
raises raises
TransformError from Visual3d, TransformError from Visual3d,
@ -591,129 +594,82 @@ is
GetGraduatedTrihedron(me; GetGraduatedTrihedron(me;
-- Names of axes -- -- Names of axes --
xname : out CString from Standard; xname, yname, zname : out ExtendedString from TCollection;
yname : out CString from Standard;
zname : out CString from Standard;
-- Draw names -- -- Draw names --
xdrawname : out Boolean from Standard; xdrawname, ydrawname, zdrawname : out Boolean from Standard;
ydrawname : out Boolean from Standard;
zdrawname : out Boolean from Standard;
-- Draw values -- -- Draw values --
xdrawvalues : out Boolean from Standard; xdrawvalues, ydrawvalues, zdrawvalues : out Boolean from Standard;
ydrawvalues : out Boolean from Standard;
zdrawvalues : out Boolean from Standard;
-- Draw grid -- -- Draw grid --
drawgrid : out Boolean from Standard; drawgrid : out Boolean from Standard;
-- Draw axes -- -- Draw axes --
drawaxes : out Boolean from Standard; drawaxes : out Boolean from Standard;
-- Number of splits along axes -- -- Number of splits along axes --
nbx : out Integer from Standard; nbx, nby, nbz : out Integer from Standard;
nby : out Integer from Standard;
nbz : out Integer from Standard;
-- Offset for drawing values -- -- Offset for drawing values --
xoffset : out Integer from Standard; xoffset, yoffset, zoffset : out Integer from Standard;
yoffset : out Integer from Standard;
zoffset : out Integer from Standard;
-- Offset for drawing names of axes -- -- Offset for drawing names of axes --
xaxisoffset : out Integer from Standard; xaxisoffset, yaxisoffset, zaxisoffset : out Integer from Standard;
yaxisoffset : out Integer from Standard;
zaxisoffset : out Integer from Standard;
-- Draw tickmarks -- -- Draw tickmarks --
xdrawtickmarks : out Boolean from Standard; xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : out Boolean from Standard;
ydrawtickmarks : out Boolean from Standard;
zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks -- -- Length of tickmarks --
xtickmarklength : out Integer from Standard; xtickmarklength, ytickmarklength, ztickmarklength : out Integer from Standard;
ytickmarklength : out Integer from Standard;
ztickmarklength : out Integer from Standard;
-- Grid color -- -- Grid color --
gridcolor : out Color from Quantity; gridcolor : out Color from Quantity;
-- X name color -- -- Colors of axis names --
xnamecolor : out Color from Quantity; xnamecolor, ynamecolor, znamecolor : out Color from Quantity;
-- Y name color -- -- Colors of axis and values --
ynamecolor : out Color from Quantity; xcolor, ycolor, zcolor : 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 -- -- Name of font for names of axes --
fontOfNames : out CString from Standard; fontOfNames : out AsciiString from TCollection;
-- Style of names of axes -- -- Style of names of axes --
styleOfNames : out FontAspect from OSD; styleOfNames : out FontAspect from OSD;
-- Size of names of axes -- -- Size of names of axes --
sizeOfNames : out Integer from Standard; sizeOfNames : out Integer from Standard;
-- Name of font for values -- -- Name of font for values --
fontOfValues : out CString from Standard; fontOfValues : out AsciiString from TCollection;
-- Style of values -- -- Style of values --
styleOfValues : out FontAspect from OSD; styleOfValues : out FontAspect from OSD;
-- Size of values -- -- Size of values --
sizeOfValues : out Integer from Standard) sizeOfValues : out Integer from Standard)
---Purpose: Returns data of a graduated trihedron. returns Boolean from Standard
is static; is static;
---Purpose: Returns data of a graduated trihedron if displayed (return value is True)
GraduatedTrihedronDisplay(me : mutable; GraduatedTrihedronDisplay(me : mutable;
-- Names of axes -- -- Names of axes --
xname : CString from Standard; xname, yname, zname : ExtendedString from TCollection;
yname : CString from Standard;
zname : CString from Standard;
-- Draw names -- -- Draw names --
xdrawname : Boolean from Standard; xdrawname, ydrawname, zdrawname : Boolean from Standard;
ydrawname : Boolean from Standard;
zdrawname : Boolean from Standard;
-- Draw values -- -- Draw values --
xdrawvalues : Boolean from Standard; xdrawvalues, ydrawvalues, zdrawvalues : Boolean from Standard;
ydrawvalues : Boolean from Standard;
zdrawvalues : Boolean from Standard;
-- Draw grid -- -- Draw grid --
drawgrid : Boolean from Standard; drawgrid : Boolean from Standard;
-- Draw axes -- -- Draw axes --
drawaxes : Boolean from Standard; drawaxes : Boolean from Standard;
-- Number of splits along axes -- -- Number of splits along axes --
nbx : Integer from Standard; nbx, nby, nbz : Integer from Standard;
nby : Integer from Standard;
nbz : Integer from Standard;
-- Offset for drawing values -- -- Offset for drawing values --
xoffset : Integer from Standard; xoffset, yoffset, zoffset : Integer from Standard;
yoffset : Integer from Standard;
zoffset : Integer from Standard;
-- Offset for drawing names of axes -- -- Offset for drawing names of axes --
xaxisoffset : Integer from Standard; xaxisoffset, yaxisoffset, zaxisoffset : Integer from Standard;
yaxisoffset : Integer from Standard;
zaxisoffset : Integer from Standard;
-- Draw tickmarks -- -- Draw tickmarks --
xdrawtickmarks : Boolean from Standard; xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : Boolean from Standard;
ydrawtickmarks : Boolean from Standard;
zdrawtickmarks : Boolean from Standard;
-- Length of tickmarks -- -- Length of tickmarks --
xtickmarklength : Integer from Standard; xtickmarklength, ytickmarklength, ztickmarklength : Integer from Standard;
ytickmarklength : Integer from Standard;
ztickmarklength : Integer from Standard;
-- Grid color -- -- Grid color --
gridcolor : Color from Quantity; gridcolor : Color from Quantity;
-- X name color -- -- Colors of axis names --
xnamecolor : Color from Quantity; xnamecolor, ynamecolor, znamecolor : Color from Quantity;
-- Y name color -- -- Colors of axis and values --
ynamecolor : Color from Quantity; xcolor, ycolor, zcolor : 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 -- -- Name of font for names of axes --
fontOfNames : CString from Standard; fontOfNames : AsciiString from TCollection;
-- Style of names of axes -- -- Style of names of axes --
styleOfNames : FontAspect from OSD; styleOfNames : FontAspect from OSD;
-- Size of names of axes -- -- Size of names of axes --
sizeOfNames : Integer from Standard; sizeOfNames : Integer from Standard;
-- Name of font for values -- -- Name of font for values --
fontOfValues : CString from Standard; fontOfValues : AsciiString from TCollection;
-- Style of values -- -- Style of values --
styleOfValues : FontAspect from OSD; styleOfValues : FontAspect from OSD;
-- Size of values -- -- Size of values --
@ -1327,6 +1283,8 @@ fields
-- Booleans -- Booleans
MyCBitFields : CBitFields8 from Graphic3d; MyCBitFields : CBitFields8 from Graphic3d;
MyGTrihedron : CGraduatedTrihedron from Graphic3d;
friends friends
class ViewManager from Visual3d class ViewManager from Visual3d

View File

@ -3672,268 +3672,258 @@ void SetMinMaxValuesCallback(void* Visual3dView)
} }
} }
void Visual3d_View::GetGraduatedTrihedron(/* Names of axes */ Standard_Boolean Visual3d_View::GetGraduatedTrihedron
Standard_CString& xname, (/* Names of axes */
Standard_CString& yname, TCollection_ExtendedString& xname,
Standard_CString& zname, TCollection_ExtendedString& yname,
/* Draw names */ TCollection_ExtendedString& zname,
Standard_Boolean& xdrawname, /* Draw names */
Standard_Boolean& ydrawname, Standard_Boolean& xdrawname,
Standard_Boolean& zdrawname, Standard_Boolean& ydrawname,
/* Draw values */ Standard_Boolean& zdrawname,
Standard_Boolean& xdrawvalues, /* Draw values */
Standard_Boolean& ydrawvalues, Standard_Boolean& xdrawvalues,
Standard_Boolean& zdrawvalues, Standard_Boolean& ydrawvalues,
/* Draw grid */ Standard_Boolean& zdrawvalues,
Standard_Boolean& drawgrid, /* Draw grid */
/* Draw axes */ Standard_Boolean& drawgrid,
Standard_Boolean& drawaxes, /* Draw axes */
/* Number of splits along axes */ Standard_Boolean& drawaxes,
Standard_Integer& nbx, /* Number of splits along axes */
Standard_Integer& nby, Standard_Integer& nbx,
Standard_Integer& nbz, Standard_Integer& nby,
/* Offset for drawing values */ Standard_Integer& nbz,
Standard_Integer& xoffset, /* Offset for drawing values */
Standard_Integer& yoffset, Standard_Integer& xoffset,
Standard_Integer& zoffset, Standard_Integer& yoffset,
/* Offset for drawing names of axes */ Standard_Integer& zoffset,
Standard_Integer& xaxisoffset, /* Offset for drawing names of axes */
Standard_Integer& yaxisoffset, Standard_Integer& xaxisoffset,
Standard_Integer& zaxisoffset, Standard_Integer& yaxisoffset,
/* Draw tickmarks */ Standard_Integer& zaxisoffset,
Standard_Boolean& xdrawtickmarks, /* Draw tickmarks */
Standard_Boolean& ydrawtickmarks, Standard_Boolean& xdrawtickmarks,
Standard_Boolean& zdrawtickmarks, Standard_Boolean& ydrawtickmarks,
/* Length of tickmarks */ Standard_Boolean& zdrawtickmarks,
Standard_Integer& xtickmarklength, /* Length of tickmarks */
Standard_Integer& ytickmarklength, Standard_Integer& xtickmarklength,
Standard_Integer& ztickmarklength, Standard_Integer& ytickmarklength,
/* Grid color */ Standard_Integer& ztickmarklength,
Quantity_Color& gridcolor, /* Grid color */
/* X name color */ Quantity_Color& gridcolor,
Quantity_Color& xnamecolor, /* Colors of axis names */
/* Y name color */ Quantity_Color& xnamecolor,
Quantity_Color& ynamecolor, Quantity_Color& ynamecolor,
/* Z name color */ Quantity_Color& znamecolor,
Quantity_Color& znamecolor, /* Colors of axis and values */
/* X color of axis and values */ Quantity_Color& xcolor,
Quantity_Color& xcolor, Quantity_Color& ycolor,
/* Y color of axis and values */ Quantity_Color& zcolor,
Quantity_Color& ycolor, /* Name of font for names of axes */
/* Z color of axis and values */ TCollection_AsciiString& fontOfNames,
Quantity_Color& zcolor, /* Style of names of axes */
/* Name of font for names of axes */ OSD_FontAspect& styleOfNames,
Standard_CString& fontOfNames, /* Size of names of axes */
/* Style of names of axes */ Standard_Integer& sizeOfNames,
OSD_FontAspect& styleOfNames, /* Name of font for values */
/* Size of names of axes */ TCollection_AsciiString& fontOfValues,
Standard_Integer& sizeOfNames, /* Style of values */
/* Name of font for values */ OSD_FontAspect& styleOfValues,
Standard_CString& fontOfValues, /* Size of values */
/* Style of values */ Standard_Integer& sizeOfValues) const
OSD_FontAspect& styleOfValues,
/* Size of values */
Standard_Integer& sizeOfValues) const
{ {
MyGraphicDriver->GetGraduatedTrihedron(MyCView, if (!MyGTrihedron.ptrVisual3dView)
/* Names of axes */ return Standard_False;
xname,
yname, /* Names of axes */
zname, xname = MyGTrihedron.xname;
/* Draw names */ yname = MyGTrihedron.yname;
xdrawname, zname = MyGTrihedron.zname;
ydrawname, /* Draw names */
zdrawname, xdrawname = MyGTrihedron.xdrawname;
/* Draw values */ ydrawname = MyGTrihedron.ydrawname;
xdrawvalues, zdrawname = MyGTrihedron.zdrawname;
ydrawvalues, /* Draw values */
zdrawvalues, xdrawvalues = MyGTrihedron.xdrawvalues;
/* Draw grid */ ydrawvalues = MyGTrihedron.ydrawvalues;
drawgrid, zdrawvalues = MyGTrihedron.zdrawvalues;
/* Draw axes */ /* Draw grid */
drawaxes, drawgrid = MyGTrihedron.drawgrid;
/* Number of splits along axes */ /* Draw axes */
nbx, drawaxes = MyGTrihedron.drawaxes;
nby, /* Number of splits along axes */
nbz, nbx = MyGTrihedron.nbx;
/* Offset for drawing values */ nby = MyGTrihedron.nby;
xoffset, nbz = MyGTrihedron.nbz;
yoffset, /* Offset for drawing values */
zoffset, xoffset = MyGTrihedron.xoffset;
/* Offset for drawing names of axes */ yoffset = MyGTrihedron.yoffset;
xaxisoffset, zoffset = MyGTrihedron.zoffset;
yaxisoffset, /* Offset for drawing names of axes */
zaxisoffset, xaxisoffset = MyGTrihedron.xaxisoffset;
/* Draw tickmarks */ yaxisoffset = MyGTrihedron.yaxisoffset;
xdrawtickmarks, zaxisoffset = MyGTrihedron.zaxisoffset;
ydrawtickmarks, /* Draw tickmarks */
zdrawtickmarks, xdrawtickmarks = MyGTrihedron.xdrawtickmarks;
/* Length of tickmarks */ ydrawtickmarks = MyGTrihedron.ydrawtickmarks;
xtickmarklength, zdrawtickmarks = MyGTrihedron.zdrawtickmarks;
ytickmarklength, /* Length of tickmarks */
ztickmarklength, xtickmarklength = MyGTrihedron.xtickmarklength;
/* Grid color */ ytickmarklength = MyGTrihedron.ytickmarklength;
gridcolor, ztickmarklength = MyGTrihedron.ztickmarklength;
/* X name color */ /* Grid color */
xnamecolor, gridcolor = MyGTrihedron.gridcolor;
/* Y name color */ /* Colors of axis names */
ynamecolor, xnamecolor = MyGTrihedron.xnamecolor;
/* Z name color */ ynamecolor = MyGTrihedron.ynamecolor;
znamecolor, znamecolor = MyGTrihedron.znamecolor;
/* X color of axis and values */ /* Colors of axis and values */
xcolor, xcolor = MyGTrihedron.xcolor;
/* Y color of axis and values */ ycolor = MyGTrihedron.ycolor;
ycolor, zcolor = MyGTrihedron.zcolor;
/* Z color of axis and values */ /* Name of font for names of axes */
zcolor, fontOfNames = MyGTrihedron.fontOfNames;
/* Name of font for names of axes */ /* Style of names of axes */
fontOfNames, styleOfNames = MyGTrihedron.styleOfNames;
/* Style of names of axes */ /* Size of names of axes */
styleOfNames, sizeOfNames = MyGTrihedron.sizeOfNames;
/* Size of names of axes */ /* Name of font for values */
sizeOfNames, fontOfValues = MyGTrihedron.fontOfValues;
/* Name of font for values */ /* Style of values */
fontOfValues, styleOfValues = MyGTrihedron.styleOfValues;
/* Style of values */ /* Size of values */
styleOfValues, sizeOfValues = MyGTrihedron.sizeOfValues;
/* Size of values */
sizeOfValues); return Standard_True;
} }
void Visual3d_View::GraduatedTrihedronDisplay(/* Names of axes */ void Visual3d_View::GraduatedTrihedronDisplay
const Standard_CString xname, (/* Names of axes */
const Standard_CString yname, const TCollection_ExtendedString &xname,
const Standard_CString zname, const TCollection_ExtendedString &yname,
/* Draw names */ const TCollection_ExtendedString &zname,
const Standard_Boolean xdrawname, /* Draw names */
const Standard_Boolean ydrawname, const Standard_Boolean xdrawname,
const Standard_Boolean zdrawname, const Standard_Boolean ydrawname,
/* Draw values */ const Standard_Boolean zdrawname,
const Standard_Boolean xdrawvalues, /* Draw values */
const Standard_Boolean ydrawvalues, const Standard_Boolean xdrawvalues,
const Standard_Boolean zdrawvalues, const Standard_Boolean ydrawvalues,
/* Draw grid */ const Standard_Boolean zdrawvalues,
const Standard_Boolean drawgrid, /* Draw grid */
/* Draw axes */ const Standard_Boolean drawgrid,
const Standard_Boolean drawaxes, /* Draw axes */
/* Number of splits along axes */ const Standard_Boolean drawaxes,
const Standard_Integer nbx, /* Number of splits along axes */
const Standard_Integer nby, const Standard_Integer nbx,
const Standard_Integer nbz, const Standard_Integer nby,
/* Offset for drawing values */ const Standard_Integer nbz,
const Standard_Integer xoffset, /* Offset for drawing values */
const Standard_Integer yoffset, const Standard_Integer xoffset,
const Standard_Integer zoffset, const Standard_Integer yoffset,
/* Offset for drawing names of axes */ const Standard_Integer zoffset,
const Standard_Integer xaxisoffset, /* Offset for drawing names of axes */
const Standard_Integer yaxisoffset, const Standard_Integer xaxisoffset,
const Standard_Integer zaxisoffset, const Standard_Integer yaxisoffset,
/* Draw tickmarks */ const Standard_Integer zaxisoffset,
const Standard_Boolean xdrawtickmarks, /* Draw tickmarks */
const Standard_Boolean ydrawtickmarks, const Standard_Boolean xdrawtickmarks,
const Standard_Boolean zdrawtickmarks, const Standard_Boolean ydrawtickmarks,
/* Length of tickmarks */ const Standard_Boolean zdrawtickmarks,
const Standard_Integer xtickmarklength, /* Length of tickmarks */
const Standard_Integer ytickmarklength, const Standard_Integer xtickmarklength,
const Standard_Integer ztickmarklength, const Standard_Integer ytickmarklength,
/* Grid color */ const Standard_Integer ztickmarklength,
const Quantity_Color& gridcolor, /* Grid color */
/* X name color */ const Quantity_Color& gridcolor,
const Quantity_Color& xnamecolor, /* Colors of axis names */
/* Y name color */ const Quantity_Color& xnamecolor,
const Quantity_Color& ynamecolor, const Quantity_Color& ynamecolor,
/* Z name color */ const Quantity_Color& znamecolor,
const Quantity_Color& znamecolor, /* Colors of axis and values */
/* X color of axis and values */ const Quantity_Color& xcolor,
const Quantity_Color& xcolor, const Quantity_Color& ycolor,
/* Y color of axis and values */ const Quantity_Color& zcolor,
const Quantity_Color& ycolor, /* Name of font for names of axes */
/* Z color of axis and values */ const TCollection_AsciiString &fontOfNames,
const Quantity_Color& zcolor, /* Style of names of axes */
/* Name of font for names of axes */ const OSD_FontAspect styleOfNames,
const Standard_CString fontOfNames, /* Size of names of axes */
/* Style of names of axes */ const Standard_Integer sizeOfNames,
const OSD_FontAspect styleOfNames, /* Name of font for values */
/* Size of names of axes */ const TCollection_AsciiString &fontOfValues,
const Standard_Integer sizeOfNames, /* Style of values */
/* Name of font for values */ const OSD_FontAspect styleOfValues,
const Standard_CString fontOfValues, /* Size of values */
/* Style of values */ const Standard_Integer sizeOfValues)
const OSD_FontAspect styleOfValues,
/* Size of values */
const Standard_Integer sizeOfValues)
{ {
CALL_DEF_GRADUATEDTRIHEDRON cubic; /* Names of axes */
cubic.ptrVisual3dView = this; MyGTrihedron.xname = xname;
cubic.cbCubicAxes = SetMinMaxValuesCallback; MyGTrihedron.yname = yname;
MyGraphicDriver->GraduatedTrihedronDisplay(MyCView, MyGTrihedron.zname = zname;
cubic, /* Draw names */
/* Names of axes */ MyGTrihedron.xdrawname = xdrawname;
xname, MyGTrihedron.ydrawname = ydrawname;
yname, MyGTrihedron.zdrawname = zdrawname;
zname, /* Draw values */
/* Draw names */ MyGTrihedron.xdrawvalues = xdrawvalues;
xdrawname, MyGTrihedron.ydrawvalues = ydrawvalues;
ydrawname, MyGTrihedron.zdrawvalues = zdrawvalues;
zdrawname, /* Draw grid */
/* Draw values */ MyGTrihedron.drawgrid = drawgrid;
xdrawvalues, /* Draw axes */
ydrawvalues, MyGTrihedron.drawaxes = drawaxes;
zdrawvalues, /* Number of splits along axes */
/* Draw grid */ MyGTrihedron.nbx = nbx;
drawgrid, MyGTrihedron.nby = nby;
/* Draw axes */ MyGTrihedron.nbz = nbz;
drawaxes, /* Offset for drawing values */
/* Number of splits along axes */ MyGTrihedron.xoffset = xoffset;
nbx, MyGTrihedron.yoffset = yoffset;
nby, MyGTrihedron.zoffset = zoffset;
nbz, /* Offset for drawing names of axes */
/* Offset for drawing values */ MyGTrihedron.xaxisoffset = xaxisoffset;
xoffset, MyGTrihedron.yaxisoffset = yaxisoffset;
yoffset, MyGTrihedron.zaxisoffset = zaxisoffset;
zoffset, /* Draw tickmarks */
/* Offset for drawing names of axes */ MyGTrihedron.xdrawtickmarks = xdrawtickmarks;
xaxisoffset, MyGTrihedron.ydrawtickmarks = ydrawtickmarks;
yaxisoffset, MyGTrihedron.zdrawtickmarks = zdrawtickmarks;
zaxisoffset, /* Length of tickmarks */
/* Draw tickmarks */ MyGTrihedron.xtickmarklength = xtickmarklength;
xdrawtickmarks, MyGTrihedron.ytickmarklength = ytickmarklength;
ydrawtickmarks, MyGTrihedron.ztickmarklength = ztickmarklength;
zdrawtickmarks, /* Grid color */
/* Length of tickmarks */ MyGTrihedron.gridcolor = gridcolor;
xtickmarklength, /* Colors of axis names */
ytickmarklength, MyGTrihedron.xnamecolor = xnamecolor;
ztickmarklength, MyGTrihedron.ynamecolor = ynamecolor;
/* Grid color */ MyGTrihedron.znamecolor = znamecolor;
gridcolor, /* Colors of axis and values */
/* X name color */ MyGTrihedron.xcolor = xcolor;
xnamecolor, MyGTrihedron.ycolor = ycolor;
/* Y name color */ MyGTrihedron.zcolor = zcolor;
ynamecolor, /* Name of font for names of axes */
/* Z name color */ MyGTrihedron.fontOfNames = fontOfNames;
znamecolor, /* Style of names of axes */
/* X color of axis and values */ MyGTrihedron.styleOfNames = styleOfNames;
xcolor, /* Size of names of axes */
/* Y color of axis and values */ MyGTrihedron.sizeOfNames = sizeOfNames;
ycolor, /* Name of font for values */
/* Z color of axis and values */ MyGTrihedron.fontOfValues = fontOfValues;
zcolor, /* Style of values */
/* Name of font for names of axes */ MyGTrihedron.styleOfValues = styleOfValues;
fontOfNames, /* Size of values */
/* Style of names of axes */ MyGTrihedron.sizeOfValues = sizeOfValues;
styleOfNames,
/* Size of names of axes */ MyGTrihedron.ptrVisual3dView = this;
sizeOfNames, MyGTrihedron.cbCubicAxes = SetMinMaxValuesCallback;
/* Name of font for values */ MyGraphicDriver->GraduatedTrihedronDisplay(MyCView,MyGTrihedron);
fontOfValues,
/* Style of values */
styleOfValues,
/* Size of values */
sizeOfValues);
} }
void Visual3d_View::GraduatedTrihedronErase() void Visual3d_View::GraduatedTrihedronErase()
{ {
MyGTrihedron.ptrVisual3dView = NULL;
MyGraphicDriver->GraduatedTrihedronErase(MyCView); MyGraphicDriver->GraduatedTrihedronErase(MyCView);
} }