1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +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>

View File

@ -1,22 +1,70 @@
/*============================================================================*/
/*==== Titre: Graphic3d_CGraduatedTrihedron.hxx */
/*==== Role : The header file of primitive type "CGraduatedTrihedron" from Graphic3d */
/*==== */
/*==== Implementation: This is a primitive type implemented with typedef */
/*============================================================================*/
// File: Graphic3d_CGraduatedTrihedron.hxx
// Created: 6 March 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE SA 2011
#ifndef _Graphic3d_CGraduatedTrihedron_HeaderFile
#define _Graphic3d_CGraduatedTrihedron_HeaderFile
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
typedef CALL_DEF_GRADUATEDTRIHEDRON Graphic3d_CGraduatedTrihedron;
#if defined(__cplusplus) || defined(c_plusplus)
/*==== Definition de Type ====================================================*/
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
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*/

View File

@ -927,138 +927,9 @@ is
---Category: Graduated trihedron
---------------------------------
GetGraduatedTrihedron(me;
view : CView from Graphic3d;
-- Names of axes --
xname : out CString from Standard;
yname : out CString from Standard;
zname : out CString from Standard;
-- Draw names --
xdrawname : out Boolean from Standard;
ydrawname : out Boolean from Standard;
zdrawname : out Boolean from Standard;
-- Draw values --
xdrawvalues : out Boolean from Standard;
ydrawvalues : out Boolean from Standard;
zdrawvalues : out Boolean from Standard;
-- Draw grid --
drawgrid : out Boolean from Standard;
-- Draw axes --
drawaxes : out Boolean from Standard;
-- Number of splits along axes --
nbx : out Integer from Standard;
nby : out Integer from Standard;
nbz : out Integer from Standard;
-- Offset for drawing values --
xoffset : out Integer from Standard;
yoffset : out Integer from Standard;
zoffset : out Integer from Standard;
-- Offset for drawing names of axes --
xaxisoffset : out Integer from Standard;
yaxisoffset : out Integer from Standard;
zaxisoffset : out Integer from Standard;
-- Draw tickmarks --
xdrawtickmarks : out Boolean from Standard;
ydrawtickmarks : out Boolean from Standard;
zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks --
xtickmarklength : out Integer from Standard;
ytickmarklength : out Integer from Standard;
ztickmarklength : out Integer from Standard;
-- Grid color --
gridcolor : out Color from Quantity;
-- X name color --
xnamecolor : out Color from Quantity;
-- Y name color --
ynamecolor : out Color from Quantity;
-- Z name color --
znamecolor : out Color from Quantity;
-- X color of axis and values --
xcolor : out Color from Quantity;
-- Y color of axis and values --
ycolor : out Color from Quantity;
-- Z color of axis and values --
zcolor : out Color from Quantity;
-- Name of font for names of axes --
fontOfNames : out CString from Standard;
-- Style of names of axes --
styleOfNames : out FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : out Integer from Standard;
-- Name of font for values --
fontOfValues : out CString from Standard;
-- Style of values --
styleOfValues : out FontAspect from OSD;
-- Size of values --
sizeOfValues : out Integer from Standard)
---Purpose: call_togl_graduatedtrihedron_get
is virtual;
GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d;
cubic : in out CGraduatedTrihedron from Graphic3d;
-- Names of axes --
xname : CString from Standard;
yname : CString from Standard;
zname : CString from Standard;
-- Draw names --
xdrawname : Boolean from Standard;
ydrawname : Boolean from Standard;
zdrawname : Boolean from Standard;
-- Draw values --
xdrawvalues : Boolean from Standard;
ydrawvalues : Boolean from Standard;
zdrawvalues : Boolean from Standard;
-- Draw grid --
drawgrid : Boolean from Standard;
-- Draw axes --
drawaxes : Boolean from Standard;
-- Number of splits along axes --
nbx : Integer from Standard;
nby : Integer from Standard;
nbz : Integer from Standard;
-- Offset for drawing values --
xoffset : Integer from Standard;
yoffset : Integer from Standard;
zoffset : Integer from Standard;
-- Offset for drawing names of axes --
xaxisoffset : Integer from Standard;
yaxisoffset : Integer from Standard;
zaxisoffset : Integer from Standard;
-- Draw tickmarks --
xdrawtickmarks : Boolean from Standard;
ydrawtickmarks : Boolean from Standard;
zdrawtickmarks : Boolean from Standard;
-- Length of tickmarks --
xtickmarklength : Integer from Standard;
ytickmarklength : Integer from Standard;
ztickmarklength : Integer from Standard;
-- Grid color --
gridcolor : Color from Quantity;
-- X name color --
xnamecolor : Color from Quantity;
-- Y name color --
ynamecolor : Color from Quantity;
-- Z name color --
znamecolor : Color from Quantity;
-- X color of axis and values --
xcolor : Color from Quantity;
-- Y color of axis and values --
ycolor : Color from Quantity;
-- Z color of axis and values --
zcolor : Color from Quantity;
-- Name of font for names of axes --
fontOfNames : CString from Standard;
-- Style of names of axes --
styleOfNames : FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : Integer from Standard;
-- Name of font for values --
fontOfValues : CString from Standard;
-- Style of values --
styleOfValues : FontAspect from OSD;
-- Size of values --
sizeOfValues : Integer from Standard)
cubic : CGraduatedTrihedron from Graphic3d)
---Purpose: call_togl_graduatedtrihedron_display
is deferred;

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&,
Graphic3d_CGraduatedTrihedron&,
/* Names of axes */
const Standard_CString,
const Standard_CString,
const Standard_CString,
/* Draw names */
const Standard_Boolean,
const Standard_Boolean,
const Standard_Boolean,
/* Draw values */
const Standard_Boolean,
const Standard_Boolean,
const Standard_Boolean,
/* Draw grid */
const Standard_Boolean,
/* Draw axes */
const Standard_Boolean,
/* Number of splits along axes */
const Standard_Integer,
const Standard_Integer,
const Standard_Integer,
/* Offset for drawing values */
const Standard_Integer,
const Standard_Integer,
const Standard_Integer,
/* Offset for drawing names of axes */
const Standard_Integer,
const Standard_Integer,
const Standard_Integer,
/* Draw tickmarks */
const Standard_Boolean,
const Standard_Boolean,
const Standard_Boolean,
/* Length of tickmarks */
const Standard_Integer,
const Standard_Integer,
const Standard_Integer,
/* Grid color */
const Quantity_Color&,
/* X name color */
const Quantity_Color&,
/* Y name color */
const Quantity_Color&,
/* Z name color */
const Quantity_Color&,
/* X color of axis and values */
const Quantity_Color&,
/* Y color of axis and values */
const Quantity_Color&,
/* Z color of axis and values */
const Quantity_Color&,
/* Name of font for names of axes */
const Standard_CString,
/* Style of names of axes */
const OSD_FontAspect,
/* Size of names of axes */
const Standard_Integer,
/* Name of font for values */
const Standard_CString,
/* Style of values */
const OSD_FontAspect,
/* Size of values */
const Standard_Integer)
const Graphic3d_CGraduatedTrihedron&)
{
}

View File

@ -1,9 +1,7 @@
// File Graphic3d_Group_10.cxx (Text)
// Created Fevrier 1992
// Author NW,JPB,CAL
//-Copyright MatraDatavision 1991,1992
// File: Graphic3d_Group_10.cxx (Text)
// Created: Fevrier 1992
// Author: NW,JPB,CAL
// Copyright: OPEN CASCADE 1992
//-Version
@ -36,8 +34,8 @@ void Graphic3d_Group::Text (
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax
) {
)
{
if (IsDeleted ()) return;
MyIsEmpty = Standard_False;
@ -54,11 +52,9 @@ Standard_Real X, Y, Z;
if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
}
MyGraphicDriver->Text
(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
Update ();
}
void Graphic3d_Group::Text (
@ -66,8 +62,8 @@ void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax
) {
)
{
if (IsDeleted ()) return;
MyIsEmpty = Standard_False;
@ -87,7 +83,6 @@ Standard_Real X, Y, Z;
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
Update ();
}
void Graphic3d_Group::Text (
@ -99,12 +94,10 @@ void Graphic3d_Group::Text (
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax
) {
)
{
if (IsDeleted ()) return;
if (! AText.IsAscii ()) return;
MyIsEmpty = Standard_False;
// Min-Max Update
@ -119,11 +112,9 @@ Standard_Real X, Y, Z;
if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
}
MyGraphicDriver->Text
(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
Update ();
}
void Graphic3d_Group::Text (
@ -131,12 +122,10 @@ void Graphic3d_Group::Text (
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax
) {
)
{
if (IsDeleted ()) return;
if (! AText.IsAscii ()) return;
MyIsEmpty = Standard_False;
// Min-Max Update
@ -154,5 +143,4 @@ Standard_Real X, Y, Z;
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
Update ();
}

View File

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

View File

@ -246,7 +246,7 @@ typedef struct {
typedef struct {
char *string;
unsigned short *string;
CALL_DEF_POINT Position;

View File

@ -52,8 +52,6 @@ Facility : CAS-CADE V1
#include <Aspect_GraphicCallbackProc.hxx>
#endif
#include <OSD_FontAspect.hxx>
typedef float CALL_DEF_MATRIX4X4[4][4];
/* SOMMET */
@ -256,61 +254,4 @@ typedef struct {
} CALL_DEF_PICK;
/* Graduated trihedron */
typedef void (*minMaxValuesCallback)(void*);
typedef struct
{
/* Names of axes */
char *xname, *yname, *zname;
/* Draw names */
unsigned char xdrawname, ydrawname, zdrawname;
/* Draw values */
unsigned char xdrawvalues, ydrawvalues, zdrawvalues;
/* Draw grid */
unsigned char drawgrid;
/* Draw axes */
unsigned char drawaxes;
/* Number of splits along axes */
unsigned int nbx, nby, nbz;
/* Offset for drawing values */
int xoffset, yoffset, zoffset;
/* Offset for drawing names of axes */
int xaxisoffset, yaxisoffset, zaxisoffset;
/* Draw tickmarks */
unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
/* Length of tickmarks */
unsigned int xtickmarklength, ytickmarklength, ztickmarklength;
/* Grid color */
float gridcolor[3];
/* X name color */
float xnamecolor[3];
/* Y name color */
float ynamecolor[3];
/* Z name color */
float znamecolor[3];
/* X color of axis and values */
float xcolor[3];
/* Y color of axis and values */
float ycolor[3];
/* Z color of axis and values */
float zcolor[3];
/* Font name of names of axes: Courier, Arial, ... */
char* fontOfNames;
/* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
OSD_FontAspect styleOfNames;
/* Size of names of axes: 8, 10, 12, 14, ... */
int sizeOfNames;
/* Font name of values: Courier, Arial, ... */
char* fontOfValues;
/* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
OSD_FontAspect styleOfValues;
/* Size of values: 8, 10, 12, 14, ... */
int sizeOfValues;
/* Callback function to define boundary box of displayed objects */
minMaxValuesCallback cbCubicAxes;
void* ptrVisual3dView;
} CALL_DEF_GRADUATEDTRIHEDRON;
#endif /* InterfaceGraphic_Visual3dHeader */

View File

@ -112,15 +112,6 @@ struct TEL_MATRIX3_DATA
};
typedef TEL_MATRIX3_DATA* tel_matrix3_data;
struct TEL_TEXT_DATA
{
TEL_POINT attach_pt;
Tint length;
Tchar* data;
IMPLEMENT_MEMORY_OPERATORS
};
typedef TEL_TEXT_DATA* tel_text_data;
struct TEL_ALIGN_DATA
{
Tint Hmode;

View File

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

View File

@ -310,7 +310,7 @@ int OpenGl_FontMgr::request_font( const Handle(TCollection_HAsciiString)& fontNa
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 )
{
#ifdef TRACE
@ -363,22 +363,24 @@ void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text,
}
void OpenGl_FontMgr::render_text( const char* text, const Standard_Boolean is2d ){
void OpenGl_FontMgr::render_text ( const wchar_t* text, const Standard_Boolean is2d )
{
render_text( _CurrentFontId, text, is2d );
}
const FTFont* OpenGl_FontMgr::fontById( const Standard_Integer id ){
const FTFont* OpenGl_FontMgr::fontById (const Standard_Integer id)
{
return _FontCache.IsBound( id ) ? _FontCache.Find( id ).Font: NULL;
}
Standard_ShortReal OpenGl_FontMgr::computeWidth( const Standard_Integer id, const char* str ){
Standard_ShortReal OpenGl_FontMgr::computeWidth( const Standard_Integer id, const wchar_t* text )
{
if( !_FontCache.IsBound( id ) )
return 0.f;
OGLFont_Cache cache = _FontCache.Find( id );
Standard_ShortReal w = cache.Font->Advance( str );
Standard_ShortReal w = cache.Font->Advance( text );
return w;
}
@ -397,7 +399,8 @@ void OpenGl_FontMgr::setCurrentScale( const Standard_ShortReal xScale,
#include <Image_ColorImage.hxx>
#include <Quantity_Color.hxx>
void dump_texture( int id) {
void dump_texture( int id)
{
Handle(AlienImage_BMPAlienData) image = new AlienImage_BMPAlienData();
if (!glIsTexture(id))

View File

@ -1,7 +1,6 @@
#ifndef OPENGL_FONT_MGR_H
#define OPENGL_FONT_MGR_H
#ifdef WNT
# include <windows.h>
# include <stdlib.h>
@ -28,18 +27,19 @@ public:
const Standard_Integer fontHeight );
void render_text( const Standard_Integer id,
const char* text,
const Standard_Boolean is2d = 0 );
const wchar_t* text,
const Standard_Boolean is2d = Standard_False );
//render text by last requested font
void render_text( const char* text, const Standard_Boolean is2d = 0 );
void render_text( const wchar_t* text,
const Standard_Boolean is2d = Standard_False );
//returns direct access to FTGL font
//Warning: don't change font pointer.
const FTFont* fontById( const Standard_Integer id );
//returns width of string
Standard_ShortReal computeWidth( const Standard_Integer id, const char* str );
Standard_ShortReal computeWidth( const Standard_Integer id, const wchar_t *str );
bool requestFontList( Graphic3d_NListOfHAsciiString& );

View File

@ -904,138 +904,9 @@ is
---Category: Graduated trihedron
--------------------------------
GetGraduatedTrihedron(me;
view : CView from Graphic3d;
-- Names of axes --
xname : out CString from Standard;
yname : out CString from Standard;
zname : out CString from Standard;
-- Draw names --
xdrawname : out Boolean from Standard;
ydrawname : out Boolean from Standard;
zdrawname : out Boolean from Standard;
-- Draw values --
xdrawvalues : out Boolean from Standard;
ydrawvalues : out Boolean from Standard;
zdrawvalues : out Boolean from Standard;
-- Draw grid --
drawgrid : out Boolean from Standard;
-- Draw axes --
drawaxes : out Boolean from Standard;
-- Number of splits along axes --
nbx : out Integer from Standard;
nby : out Integer from Standard;
nbz : out Integer from Standard;
-- Offset for drawing values --
xoffset : out Integer from Standard;
yoffset : out Integer from Standard;
zoffset : out Integer from Standard;
-- Offset for drawing names of axes --
xaxisoffset : out Integer from Standard;
yaxisoffset : out Integer from Standard;
zaxisoffset : out Integer from Standard;
-- Draw tickmarks --
xdrawtickmarks : out Boolean from Standard;
ydrawtickmarks : out Boolean from Standard;
zdrawtickmarks : out Boolean from Standard;
-- Length of tickmarks --
xtickmarklength : out Integer from Standard;
ytickmarklength : out Integer from Standard;
ztickmarklength : out Integer from Standard;
-- Grid color --
gridcolor : out Color from Quantity;
-- X name color --
xnamecolor : out Color from Quantity;
-- Y name color --
ynamecolor : out Color from Quantity;
-- Z name color --
znamecolor : out Color from Quantity;
-- X color of axis and values --
xcolor : out Color from Quantity;
-- Y color of axis and values --
ycolor : out Color from Quantity;
-- Z color of axis and values --
zcolor : out Color from Quantity;
-- Name of font for names of axes --
fontOfNames : out CString from Standard;
-- Style of names of axes --
styleOfNames : out FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : out Integer from Standard;
-- Name of font for values --
fontOfValues : out CString from Standard;
-- Style of values --
styleOfValues : out FontAspect from OSD;
-- Size of values --
sizeOfValues : out Integer from Standard)
---Purpose: call_togl_graduatedtrihedron_get
is redefined static;
GraduatedTrihedronDisplay(me : mutable;
view : CView from Graphic3d;
cubic : in out CGraduatedTrihedron from Graphic3d;
-- Names of axes --
xname : CString from Standard;
yname : CString from Standard;
zname : CString from Standard;
-- Draw names --
xdrawname : Boolean from Standard;
ydrawname : Boolean from Standard;
zdrawname : Boolean from Standard;
-- Draw values --
xdrawvalues : Boolean from Standard;
ydrawvalues : Boolean from Standard;
zdrawvalues : Boolean from Standard;
-- Draw grid --
drawgrid : Boolean from Standard;
-- Draw axes --
drawaxes : Boolean from Standard;
-- Number of splits along axes --
nbx : Integer from Standard;
nby : Integer from Standard;
nbz : Integer from Standard;
-- Offset for drawing values --
xoffset : Integer from Standard;
yoffset : Integer from Standard;
zoffset : Integer from Standard;
-- Offset for drawing names of axes --
xaxisoffset : Integer from Standard;
yaxisoffset : Integer from Standard;
zaxisoffset : Integer from Standard;
-- Draw tickmarks --
xdrawtickmarks : Boolean from Standard;
ydrawtickmarks : Boolean from Standard;
zdrawtickmarks : Boolean from Standard;
-- Length of tickmarks --
xtickmarklength : Integer from Standard;
ytickmarklength : Integer from Standard;
ztickmarklength : Integer from Standard;
-- Grid color --
gridcolor : Color from Quantity;
-- X name color --
xnamecolor : Color from Quantity;
-- Y name color --
ynamecolor : Color from Quantity;
-- Z name color --
znamecolor : Color from Quantity;
-- X color of axis and values --
xcolor : Color from Quantity;
-- Y color of axis and values --
ycolor : Color from Quantity;
-- Z color of axis and values --
zcolor : Color from Quantity;
-- Name of font for names of axes --
fontOfNames : CString from Standard;
-- Style of names of axes --
styleOfNames : FontAspect from OSD;
-- Size of names of axes --
sizeOfNames : Integer from Standard;
-- Name of font for values --
fontOfValues : CString from Standard;
-- Style of values --
styleOfValues : FontAspect from OSD;
-- Size of values --
sizeOfValues : Integer from Standard)
cubic : CGraduatedTrihedron from Graphic3d)
---Purpose: call_togl_graduatedtrihedron_display
is redefined static;

View File

@ -43,35 +43,11 @@ void OpenGl_GraphicDriver::Text
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean
const Standard_Boolean EvalMinMax
)
{
Graphic3d_CGroup MyCGroup = ACGroup;
Standard_Real X, Y, Z;
CALL_DEF_TEXT atext;
APoint.Coord (X, Y, Z);
atext.Position.x = float (X);
atext.Position.y = float (Y);
atext.Position.z = float (Z);
atext.Height = float (AHeight);
if (atext.Height < 0)
atext.Height = DefaultTextHeight();
atext.Angle = float (AAngle);
atext.Path = int (ATp);
atext.HAlign = int (AHta);
atext.VAlign = int (AVta);
atext.string = (char *) AText;
if (MyTraceLevel) {
PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1);
}
call_togl_text (&MyCGroup, &atext);
TCollection_ExtendedString TheText(AText);
OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,AAngle,ATp,AHta,AVta,EvalMinMax);
}
void OpenGl_GraphicDriver::Text
@ -80,35 +56,11 @@ void OpenGl_GraphicDriver::Text
const Standard_CString AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean
const Standard_Boolean EvalMinMax
)
{
Graphic3d_CGroup MyCGroup = ACGroup;
Standard_Real X, Y, Z;
CALL_DEF_TEXT atext;
APoint.Coord (X, Y, Z);
atext.Position.x = float (X);
atext.Position.y = float (Y);
atext.Position.z = float (Z);
atext.Height = float (AHeight);
if (atext.Height < 0)
atext.Height = DefaultTextHeight();
atext.Angle = float (Standard_PI / 2.);
atext.Path = int (Graphic3d_TP_RIGHT);
atext.HAlign = int (Graphic3d_HTA_LEFT);
atext.VAlign = int (Graphic3d_VTA_BOTTOM);
atext.string = (char *) AText;
if (MyTraceLevel) {
PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1);
}
call_togl_text (&MyCGroup, &atext);
TCollection_ExtendedString TheText(AText);
OpenGl_GraphicDriver::Text(ACGroup,TheText,APoint,AHeight,EvalMinMax);
}
void OpenGl_GraphicDriver::Text
@ -124,14 +76,11 @@ void OpenGl_GraphicDriver::Text
const Standard_Boolean
)
{
Graphic3d_CGroup MyCGroup = ACGroup;
Standard_Real X, Y, Z;
CALL_DEF_TEXT atext;
TCollection_AsciiString ascii (AText,'?');
Standard_Real X, Y, Z;
APoint.Coord (X, Y, Z);
atext.Position.x = float (X);
atext.Position.y = float (Y);
@ -143,15 +92,13 @@ void OpenGl_GraphicDriver::Text
atext.Path = int (ATp);
atext.HAlign = int (AHta);
atext.VAlign = int (AVta);
atext.string = (Standard_PCharacter)ascii.ToCString ();
atext.string = (unsigned short *)AText.ToExtString ();
if (MyTraceLevel) {
PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1);
}
call_togl_text (&MyCGroup, &atext);
ascii.Clear ();
}
void OpenGl_GraphicDriver::Text
@ -161,15 +108,13 @@ void OpenGl_GraphicDriver::Text
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean
) {
)
{
Graphic3d_CGroup MyCGroup = ACGroup;
Standard_Real X, Y, Z;
CALL_DEF_TEXT atext;
TCollection_AsciiString ascii (AText, '?');
Standard_Real X, Y, Z;
APoint.Coord (X, Y, Z);
atext.Position.x = float (X);
atext.Position.y = float (Y);
@ -181,13 +126,11 @@ void OpenGl_GraphicDriver::Text
atext.Path = int (Graphic3d_TP_RIGHT);
atext.HAlign = int (Graphic3d_HTA_LEFT);
atext.VAlign = int (Graphic3d_VTA_BOTTOM);
atext.string = (Standard_PCharacter)ascii.ToCString ();
atext.string = (unsigned short *)AText.ToExtString ();
if (MyTraceLevel) {
PrintFunction ("call_togl_text");
PrintCGroup (MyCGroup, 1);
}
call_togl_text (&MyCGroup, &atext);
ascii.Clear ();
}

View File

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

View File

@ -1,4 +1,3 @@
// File OpenGl_GraphicDriver_9.cxx
// Created 1/08/97
// Author PCT
@ -269,304 +268,10 @@ void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,cons
call_togl_set_gradient_type( ACView.WsId, FillType);
}
void OpenGl_GraphicDriver::GetGraduatedTrihedron(const Graphic3d_CView& view,
/* Names of axes */
Standard_CString& xname,
Standard_CString& yname,
Standard_CString& zname,
/* Draw names */
Standard_Boolean& xdrawname,
Standard_Boolean& ydrawname,
Standard_Boolean& zdrawname,
/* Draw values */
Standard_Boolean& xdrawvalues,
Standard_Boolean& ydrawvalues,
Standard_Boolean& zdrawvalues,
/* Draw grid */
Standard_Boolean& drawgrid,
/* Draw axes */
Standard_Boolean& drawaxes,
/* Number of splits along axes */
Standard_Integer& nbx,
Standard_Integer& nby,
Standard_Integer& nbz,
/* Offset for drawing values */
Standard_Integer& xoffset,
Standard_Integer& yoffset,
Standard_Integer& zoffset,
/* Offset for drawing names of axes */
Standard_Integer& xaxisoffset,
Standard_Integer& yaxisoffset,
Standard_Integer& zaxisoffset,
/* Draw tickmarks */
Standard_Boolean& xdrawtickmarks,
Standard_Boolean& ydrawtickmarks,
Standard_Boolean& zdrawtickmarks,
/* Length of tickmarks */
Standard_Integer& xtickmarklength,
Standard_Integer& ytickmarklength,
Standard_Integer& ztickmarklength,
/* Grid color */
Quantity_Color& gridcolor,
/* X name color */
Quantity_Color& xnamecolor,
/* Y name color */
Quantity_Color& ynamecolor,
/* Z name color */
Quantity_Color& znamecolor,
/* X color of axis and values */
Quantity_Color& xcolor,
/* Y color of axis and values */
Quantity_Color& ycolor,
/* Z color of axis and values */
Quantity_Color& zcolor,
/* Name of font for names of axes */
Standard_CString& fontOfNames,
/* Style of names of axes */
OSD_FontAspect& styleOfNames,
/* Size of names of axes */
Standard_Integer& sizeOfNames,
/* Name of font for values */
Standard_CString& fontOfValues,
/* Style of values */
OSD_FontAspect& styleOfValues,
/* Size of values */
Standard_Integer& sizeOfValues) const
{
Graphic3d_CGraduatedTrihedron cubic;
call_togl_graduatedtrihedron_get((CALL_DEF_VIEW*)&view, &cubic);
/* Names of axes */
xname = cubic.xname;
yname = cubic.yname;
zname = cubic.zname;
/* Draw names */
xdrawname = cubic.xdrawname;
ydrawname = cubic.ydrawname;
zdrawname = cubic.zdrawname;
/* Draw values */
xdrawvalues = cubic.xdrawvalues;
ydrawvalues = cubic.ydrawvalues;
zdrawvalues = cubic.zdrawvalues;
/* Draw grid */
drawgrid = cubic.drawgrid;
/* Draw axes */
drawaxes = cubic.drawaxes;
/* Number of splits along axes */
nbx = cubic.nbx;
nby = cubic.nby;
nbz = cubic.nbz;
/* Offset for drawing values */
xoffset = cubic.xoffset;
yoffset = cubic.yoffset;
zoffset = cubic.zoffset;
/* Offset for drawing names of axes */
xaxisoffset = cubic.xaxisoffset;
yaxisoffset = cubic.yaxisoffset;
zaxisoffset = cubic.zaxisoffset;
/* Draw tickmarks */
xdrawtickmarks = cubic.xdrawtickmarks;
ydrawtickmarks = cubic.ydrawtickmarks;
zdrawtickmarks = cubic.zdrawtickmarks;
/* Length of tickmarks */
xtickmarklength = cubic.xtickmarklength;
ytickmarklength = cubic.ytickmarklength;
ztickmarklength = cubic.ztickmarklength;
/* Grid color */
gridcolor.SetValues(cubic.gridcolor[0], cubic.gridcolor[1], cubic.gridcolor[2], Quantity_TOC_RGB);
/* X name color */
xnamecolor.SetValues(cubic.xnamecolor[0], cubic.xnamecolor[1], cubic.xnamecolor[2], Quantity_TOC_RGB);
/* Y name color */
ynamecolor.SetValues(cubic.ynamecolor[0], cubic.ynamecolor[1], cubic.ynamecolor[2], Quantity_TOC_RGB);
/* Z name color */
znamecolor.SetValues(cubic.znamecolor[0], cubic.znamecolor[1], cubic.znamecolor[2], Quantity_TOC_RGB);
/* X color of axis and values */
xcolor.SetValues(cubic.xcolor[0], cubic.xcolor[1], cubic.xcolor[2], Quantity_TOC_RGB);
/* Y color of axis and values */
ycolor.SetValues(cubic.ycolor[0], cubic.ycolor[1], cubic.ycolor[2], Quantity_TOC_RGB);
/* Z color of axis and values */
zcolor.SetValues(cubic.zcolor[0], cubic.zcolor[1], cubic.zcolor[2], Quantity_TOC_RGB);
/* Name of font for names of axes */
fontOfNames = cubic.fontOfNames;
/* Style of names of axes */
styleOfNames = cubic.styleOfNames;
/* Size of names of axes */
sizeOfNames = cubic.sizeOfNames;
/* Name of font for values */
fontOfValues = cubic.fontOfValues;
/* Style of values */
styleOfValues = cubic.styleOfValues;
/* Size of values */
sizeOfValues = cubic.sizeOfValues;
/* Name of font for names of axes */
fontOfNames = cubic.fontOfNames;
/* Style of names of axes */
styleOfNames = cubic.styleOfNames;
/* Size of names of axes */
sizeOfNames = cubic.sizeOfNames;
/* Name of font for values */
fontOfValues = cubic.fontOfValues;
/* Style of values */
styleOfValues = cubic.styleOfValues;
/* Size of values */
sizeOfValues = cubic.sizeOfValues;
}
void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& view,
Graphic3d_CGraduatedTrihedron& cubic,
/* Names of axes */
const Standard_CString xname,
const Standard_CString yname,
const Standard_CString zname,
/* Draw names */
const Standard_Boolean xdrawname,
const Standard_Boolean ydrawname,
const Standard_Boolean zdrawname,
/* Draw values */
const Standard_Boolean xdrawvalues,
const Standard_Boolean ydrawvalues,
const Standard_Boolean zdrawvalues,
/* Draw grid */
const Standard_Boolean drawgrid,
/* Draw axes */
const Standard_Boolean drawaxes,
/* Number of splits along axes */
const Standard_Integer nbx,
const Standard_Integer nby,
const Standard_Integer nbz,
/* Offset for drawing values */
const Standard_Integer xoffset,
const Standard_Integer yoffset,
const Standard_Integer zoffset,
/* Offset for drawing names of axes */
const Standard_Integer xaxisoffset,
const Standard_Integer yaxisoffset,
const Standard_Integer zaxisoffset,
/* Draw tickmarks */
const Standard_Boolean xdrawtickmarks,
const Standard_Boolean ydrawtickmarks,
const Standard_Boolean zdrawtickmarks,
/* Length of tickmarks */
const Standard_Integer xtickmarklength,
const Standard_Integer ytickmarklength,
const Standard_Integer ztickmarklength,
/* Grid color */
const Quantity_Color& gridcolor,
/* X name color */
const Quantity_Color& xnamecolor,
/* Y name color */
const Quantity_Color& ynamecolor,
/* Z name color */
const Quantity_Color& znamecolor,
/* X color of axis and values */
const Quantity_Color& xcolor,
/* Y color of axis and values */
const Quantity_Color& ycolor,
/* Z color of axis and values */
const Quantity_Color& zcolor,
/* Name of font for names of axes */
const Standard_CString fontOfNames,
/* Style of names of axes */
const OSD_FontAspect styleOfNames,
/* Size of names of axes */
const Standard_Integer sizeOfNames,
/* Name of font for values */
const Standard_CString fontOfValues,
/* Style of values */
const OSD_FontAspect styleOfValues,
/* Size of values */
const Standard_Integer sizeOfValues)
const Graphic3d_CGraduatedTrihedron& cubic)
{
/* Names of axes */
cubic.xname = (char*) xname;
cubic.yname = (char*) yname;
cubic.zname = (char*) zname;
/* Draw names */
cubic.xdrawname = xdrawname;
cubic.ydrawname = ydrawname;
cubic.zdrawname = zdrawname;
/* Draw values */
cubic.xdrawvalues = xdrawvalues;
cubic.ydrawvalues = ydrawvalues;
cubic.zdrawvalues = zdrawvalues;
/* Draw grid */
cubic.drawgrid = drawgrid;
/* Draw axes */
cubic.drawaxes = drawaxes;
/* Number of splits along axes */
cubic.nbx = nbx;
cubic.nby = nby;
cubic.nbz = nbz;
/* Offset for drawing values */
cubic.xoffset = xoffset;
cubic.yoffset = yoffset;
cubic.zoffset = zoffset;
/* Offset for drawing names of axes */
cubic.xaxisoffset = xaxisoffset;
cubic.yaxisoffset = yaxisoffset;
cubic.zaxisoffset = zaxisoffset;
/* Draw tickmarks */
cubic.xdrawtickmarks = xdrawtickmarks;
cubic.ydrawtickmarks = ydrawtickmarks;
cubic.zdrawtickmarks = zdrawtickmarks;
/* Length of tickmarks */
cubic.xtickmarklength = xtickmarklength;
cubic.ytickmarklength = ytickmarklength;
cubic.ztickmarklength = ztickmarklength;
/* Grid color */
cubic.gridcolor[0] = (Standard_ShortReal) gridcolor.Red();
cubic.gridcolor[1] = (Standard_ShortReal) gridcolor.Green();
cubic.gridcolor[2] = (Standard_ShortReal) gridcolor.Blue();
/* X name color */
cubic.xnamecolor[0] = (Standard_ShortReal) xnamecolor.Red();
cubic.xnamecolor[1] = (Standard_ShortReal) xnamecolor.Green();
cubic.xnamecolor[2] = (Standard_ShortReal) xnamecolor.Blue();
/* Y name color */
cubic.ynamecolor[0] = (Standard_ShortReal) ynamecolor.Red();
cubic.ynamecolor[1] = (Standard_ShortReal) ynamecolor.Green();
cubic.ynamecolor[2] = (Standard_ShortReal) ynamecolor.Blue();
/* Z name color */
cubic.znamecolor[0] = (Standard_ShortReal) znamecolor.Red();
cubic.znamecolor[1] = (Standard_ShortReal) znamecolor.Green();
cubic.znamecolor[2] = (Standard_ShortReal) znamecolor.Blue();
/* X color of axis and values */
cubic.xcolor[0] = (Standard_ShortReal) xcolor.Red();
cubic.xcolor[1] = (Standard_ShortReal) xcolor.Green();
cubic.xcolor[2] = (Standard_ShortReal) xcolor.Blue();
/* Y color of axis and values */
cubic.ycolor[0] = (Standard_ShortReal) ycolor.Red();
cubic.ycolor[1] = (Standard_ShortReal) ycolor.Green();
cubic.ycolor[2] = (Standard_ShortReal) ycolor.Blue();
/* Z color of axis and values */
cubic.zcolor[0] = (Standard_ShortReal) zcolor.Red();
cubic.zcolor[1] = (Standard_ShortReal) zcolor.Green();
cubic.zcolor[2] = (Standard_ShortReal) zcolor.Blue();
/* Name of font for names of axes */
cubic.fontOfNames = (char*) fontOfNames;
/* Style of names of axes */
cubic.styleOfNames = styleOfNames;
/* Size of names of axes */
cubic.sizeOfNames = sizeOfNames;
/* Name of font for values */
cubic.fontOfValues = (char*) fontOfValues;
/* Style of values */
cubic.styleOfValues = styleOfValues;
/* Size of values */
cubic.sizeOfValues = sizeOfValues;
/* Name of font for names of axes */
cubic.fontOfNames = (char*) fontOfNames;
/* Style of names of axes */
cubic.styleOfNames = styleOfNames;
/* Size of names of axes */
cubic.sizeOfNames = sizeOfNames;
/* Name of font for values */
cubic.fontOfValues = (char*) fontOfValues;
/* Style of values */
cubic.styleOfValues = styleOfValues;
/* Size of values */
cubic.sizeOfValues = sizeOfValues;
call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, &cubic);
call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, cubic);
}
void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view)

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

View File

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

View File

@ -23,7 +23,6 @@
#include <gl2ps.h>
#endif
/*-----------------------------------------------------------------------------*/
/*
* Prototypes variables statiques
@ -237,7 +236,7 @@ Tint OpenGl_TextRender::FindFont ( Tchar* fontName,
}
/*-----------------------------------------------------------------------------*/
void OpenGl_TextRender::StringSize(char *str, GLint *Width, GLint *Ascent, GLint *Descent)
void OpenGl_TextRender::StringSize(const wchar_t *str, GLint *Width, GLint *Ascent, GLint *Descent)
{
/* int dir, asc, des;*/
@ -261,7 +260,7 @@ void OpenGl_TextRender::StringSize(char *str, GLint *Width, GLint *Ascent, GLint
/*-----------------------------------------------------------------------------*/
void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z )
void OpenGl_TextRender::RenderText ( const wchar_t* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z )
{
GLdouble projMatrix[4][4], modelMatrix[4][4];
GLint viewport[4];
@ -415,7 +414,6 @@ void OpenGl_TextRender::RenderText ( char* str, GLuint base, int is2d, GLfloat x
glPopMatrix();
}
glPopAttrib();
return;
}
@ -465,7 +463,7 @@ int OpenGl_TextRender::alignmentforgl2ps(int vh, int vy)
#endif
/*-----------------------------------------------------------------------------*/
void OpenGl_TextRender::ExportText( char* str, char* fontname, GLfloat height, GLfloat angle, GLint alignment,
void OpenGl_TextRender::ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alignment,
GLfloat x, GLfloat y, GLfloat z, GLboolean is2d )
{
#ifdef HAVE_GL2PS
@ -482,8 +480,12 @@ void OpenGl_TextRender::ExportText( char* str, char* fontname, GLfloat height, G
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
}

View File

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

View File

@ -667,7 +667,7 @@ call_func_set_anno_align( Tint hor, Tint ver )
/*----------------------------------------------------------------------*/
void
call_func_anno_text_rel3( tel_point pt, Tchar *str )
call_func_anno_text_rel3( tel_point pt, Techar *str )
{
CMN_KEY k[2];

View File

@ -1,3 +1,8 @@
// File: OpenGl_graduatedtrihedron.cxx
// Created: 6 March 2011
// Author: Sergey ZERCHANINOV
// Copyright: OPEN CASCADE SA 2011
#include <OpenGl_tgl_all.hxx>
#include <OpenGl_graduatedtrihedron.hxx>
@ -24,49 +29,80 @@
#include <string.h>
#endif
struct TEL_GRADUATEDTRIHEDRON_DATA
{
int WsId;
wchar_t *xname, *yname, *zname;
unsigned char xdrawname, ydrawname, zdrawname;
unsigned char xdrawvalues, ydrawvalues, zdrawvalues;
unsigned char drawgrid;
unsigned char drawaxes;
unsigned int nbx, nby, nbz;
int xoffset, yoffset, zoffset;
int xaxisoffset, yaxisoffset, zaxisoffset;
unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
unsigned int xtickmarklength, ytickmarklength, ztickmarklength;
float gridcolor[3];
float xnamecolor[3];
float ynamecolor[3];
float znamecolor[3];
float xcolor[3];
float ycolor[3];
float zcolor[3];
char* fontOfNames;
OSD_FontAspect styleOfNames;
int sizeOfNames;
char* fontOfValues;
OSD_FontAspect styleOfValues;
int sizeOfValues;
minMaxValuesCallback cbCubicAxes;
void* ptrVisual3dView;
IMPLEMENT_MEMORY_OPERATORS
};
typedef TEL_GRADUATEDTRIHEDRON_DATA* tel_graduatedtrihedron_data;
/* Graduated trihedron data */
static int nbWsIds = 0; /* Number of the views (size of the arrays below */
static int* WsIds = 0; /* The array contans indices of graduated trihedron data corresponding to the view ID */
static CALL_DEF_GRADUATEDTRIHEDRON** graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */
static tel_graduatedtrihedron_data* graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */
/* Bounding box */
float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f;
static void copyData(CALL_DEF_GRADUATEDTRIHEDRON* fromData, CALL_DEF_GRADUATEDTRIHEDRON* toData)
static void copyData(const Graphic3d_CGraduatedTrihedron *fromData, TEL_GRADUATEDTRIHEDRON_DATA* toData)
{
int len;
/* Names of axes */
/* X-name */
if (fromData->xname)
len = strlen(fromData->xname) + 1;
len = fromData->xname.Length();
if (len)
{
Standard_ExtString iname = fromData->xname.ToExtString();
toData->xname = new wchar_t[len+1];
len = 0; while (toData->xname[len] = (wchar_t)(iname[len])) len++;
}
else
len = 1;
toData->xname = (char*) malloc(len * sizeof(char));
if (fromData->xname)
strcpy(toData->xname, fromData->xname);
else
toData->xname[0] = '\0';
toData->xname = NULL;
/* Y-name */
if (fromData->yname)
len = strlen(fromData->yname) + 1;
len = fromData->yname.Length();
if (len)
{
Standard_ExtString iname = fromData->yname.ToExtString();
toData->yname = new wchar_t[len+1];
len = 0; while (toData->yname[len] = (wchar_t)(iname[len])) len++;
}
else
len = 1;
toData->yname = (char*) malloc(len * sizeof(char));
if (fromData->yname)
strcpy(toData->yname, fromData->yname);
else
toData->yname[0] = '\0';
toData->yname = NULL;
/* Z-name */
if (fromData->zname)
len = strlen(fromData->zname) + 1;
len = fromData->zname.Length();
if (len)
{
Standard_ExtString iname = fromData->zname.ToExtString();
toData->zname = new wchar_t[len+1];
len = 0; while (toData->zname[len] = (wchar_t)(iname[len])) len++;
}
else
len = 1;
toData->zname = (char*) malloc(len * sizeof(char));
if (fromData->zname)
strcpy(toData->zname, fromData->zname);
else
toData->zname[0] = '\0';
toData->zname = NULL;
/* Draw names */
toData->xdrawname = fromData->xdrawname;
toData->ydrawname = fromData->ydrawname;
@ -100,43 +136,51 @@ static void copyData(CALL_DEF_GRADUATEDTRIHEDRON* fromData, CALL_DEF_GRADUATEDTR
toData->ytickmarklength = fromData->ytickmarklength;
toData->ztickmarklength = fromData->ztickmarklength;
/* Grid color */
memcpy(toData->gridcolor, fromData->gridcolor, 3 * sizeof(float));
toData->gridcolor[0] = (float) fromData->gridcolor.Red();
toData->gridcolor[1] = (float) fromData->gridcolor.Green();
toData->gridcolor[2] = (float) fromData->gridcolor.Blue();
/* X name color */
memcpy(toData->xnamecolor, fromData->xnamecolor, 3 * sizeof(float));
toData->xnamecolor[0] = (float) fromData->xnamecolor.Red();
toData->xnamecolor[1] = (float) fromData->xnamecolor.Green();
toData->xnamecolor[2] = (float) fromData->xnamecolor.Blue();
/* Y name color */
memcpy(toData->ynamecolor, fromData->ynamecolor, 3 * sizeof(float));
toData->ynamecolor[0] = (float) fromData->ynamecolor.Red();
toData->ynamecolor[1] = (float) fromData->ynamecolor.Green();
toData->ynamecolor[2] = (float) fromData->ynamecolor.Blue();
/* Z name color */
memcpy(toData->znamecolor, fromData->znamecolor, 3 * sizeof(float));
toData->znamecolor[0] = (float) fromData->znamecolor.Red();
toData->znamecolor[1] = (float) fromData->znamecolor.Green();
toData->znamecolor[2] = (float) fromData->znamecolor.Blue();
/* X color of axis and values */
memcpy(toData->xcolor, fromData->xcolor, 3 * sizeof(float));
toData->xcolor[0] = (float) fromData->xcolor.Red();
toData->xcolor[1] = (float) fromData->xcolor.Green();
toData->xcolor[2] = (float) fromData->xcolor.Blue();
/* Y color of axis and values */
memcpy(toData->ycolor, fromData->ycolor, 3 * sizeof(float));
toData->ycolor[0] = (float) fromData->ycolor.Red();
toData->ycolor[1] = (float) fromData->ycolor.Green();
toData->ycolor[2] = (float) fromData->ycolor.Blue();
/* Z color of axis and values */
memcpy(toData->zcolor, fromData->zcolor, 3 * sizeof(float));
toData->zcolor[0] = (float) fromData->zcolor.Red();
toData->zcolor[1] = (float) fromData->zcolor.Green();
toData->zcolor[2] = (float) fromData->zcolor.Blue();
/* Font name of names of axes: Courier, Arial, ... */
if (fromData->fontOfNames)
len = strlen(fromData->fontOfNames) + 1;
len = fromData->fontOfNames.Length();
toData->fontOfNames = new char[len+1];
if (len)
strcpy(toData->fontOfNames, fromData->fontOfNames.ToCString());
else
len = 1;
toData->fontOfNames = (char*) malloc(len * sizeof(char));
if (fromData->fontOfNames)
strcpy(toData->fontOfNames, fromData->fontOfNames);
else
toData->fontOfNames[0] = '\0';
toData->fontOfNames[0] = L'\0';
/* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
toData->styleOfNames = fromData->styleOfNames;
/* Size of names of axes: 8, 10, 12, 14, ... */
toData->sizeOfNames = fromData->sizeOfNames;
/* Font name of values: Courier, Arial, ... */
if (fromData->fontOfValues)
len = strlen(fromData->fontOfValues) + 1;
len = fromData->fontOfValues.Length();
toData->fontOfValues = new char[len+1];
if (len)
strcpy(toData->fontOfValues, fromData->fontOfValues.ToCString());
else
len = 1;
toData->fontOfValues = (char*) malloc(len * sizeof(char));
if (fromData->fontOfValues)
strcpy(toData->fontOfValues, fromData->fontOfValues);
else
toData->fontOfValues[0] = '\0';
toData->fontOfValues[0] = L'\0';
/* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
toData->styleOfValues = fromData->styleOfValues;
/* Size of values: 8, 10, 12, 14, ... */
@ -146,142 +190,49 @@ static void copyData(CALL_DEF_GRADUATEDTRIHEDRON* fromData, CALL_DEF_GRADUATEDTR
toData->ptrVisual3dView = fromData->ptrVisual3dView;
}
static void freeGraduatedTrihedronData(CALL_DEF_GRADUATEDTRIHEDRON* data)
{
/* Names of axes */
if (data->xname)
free(data->xname);
if (data->yname)
free(data->yname);
if (data->zname)
free(data->zname);
/* Fonts */
if (data->fontOfNames)
free(data->fontOfNames);
if (data->fontOfValues)
free(data->fontOfValues);
free(data);
}
static void freeData()
{
int i;
if (WsIds)
if (nbWsIds)
{
free(WsIds);
int i = 0;
tel_graduatedtrihedron_data gtdata;
for (i = 0; i < nbWsIds; i++)
{
freeGraduatedTrihedronData(graduatedTrihedronData[i]);
}
free(graduatedTrihedronData);
gtdata = graduatedTrihedronData[i];
WsIds = 0;
// Names of axes
if (gtdata->xname)
delete[] gtdata->xname;
if (gtdata->yname)
delete[] gtdata->yname;
if (gtdata->zname)
delete[] gtdata->zname;
// Fonts
if (gtdata->fontOfNames)
delete[] gtdata->fontOfNames;
if (gtdata->fontOfValues)
delete[] gtdata->fontOfValues;
delete gtdata;
}
delete graduatedTrihedronData;
graduatedTrihedronData = 0;
nbWsIds = 0;
}
}
static int getGraduatedTrihedronDataIndex(int WsId)
{
int i = 0;
if (!nbWsIds)
return -1;
for (; i < nbWsIds; i++)
{
if (WsIds[i] == WsId)
if (graduatedTrihedronData[i]->WsId == WsId)
return i;
}
return -1;
}
static unsigned char initView(int WsId)
{
int i;
int* newWsIds;
CALL_DEF_GRADUATEDTRIHEDRON** newGraduatedTrihedronData;
/* Extend arrays for +1 */
nbWsIds++;
newWsIds = (int*) calloc(nbWsIds, sizeof(int));
newGraduatedTrihedronData = (CALL_DEF_GRADUATEDTRIHEDRON**) calloc(nbWsIds, sizeof(CALL_DEF_GRADUATEDTRIHEDRON*));
for (i = 0; i < nbWsIds; i++)
{
newGraduatedTrihedronData[i] = (CALL_DEF_GRADUATEDTRIHEDRON*) calloc(1, sizeof(CALL_DEF_GRADUATEDTRIHEDRON));
}
/* Copy data from current arrays to the newly created */
if (nbWsIds > 1)
{
for (i = 0; i < nbWsIds - 1; i++)
{
newWsIds[i] = WsIds[i];
copyData(graduatedTrihedronData[i], newGraduatedTrihedronData[i]);
}
}
/* Delete the previous used arrays */
nbWsIds--; /* Don't delete just created graduated trihedron data */
freeData();
nbWsIds++; /* Return the counter back */
/* Switch to new arrays */
WsIds = newWsIds;
graduatedTrihedronData = newGraduatedTrihedronData;
/* Set view ID */
WsIds[nbWsIds - 1] = WsId;
return TSuccess;
}
/* Erases the trihedron from the view */
static TStatus removeView(int WsId)
{
int index, i, j;
int* newWsIds;
CALL_DEF_GRADUATEDTRIHEDRON** newGraduatedTrihedronData;
index = getGraduatedTrihedronDataIndex(WsId);
if (index == -1)
return TSuccess; /* Nothing to remove */
/* If trihedron is displayed only in one view,
just free the arrays and set nbWsIds equal to 0. */
if (nbWsIds == 1)
{
freeData();
nbWsIds = 0;
return TSuccess;
}
/* create new arrays with nbWsIds - 1 length. */
nbWsIds--;
newWsIds = (int*) calloc(nbWsIds, sizeof(int));
newGraduatedTrihedronData = (CALL_DEF_GRADUATEDTRIHEDRON**) calloc(nbWsIds, sizeof(CALL_DEF_GRADUATEDTRIHEDRON*));
for (i = 0; i < nbWsIds; i++)
{
newGraduatedTrihedronData[i] = (CALL_DEF_GRADUATEDTRIHEDRON*) calloc(1, sizeof(CALL_DEF_GRADUATEDTRIHEDRON));
}
/* Copy data from current arrays to the newly created */
for (i = 0, j = 0; j <= nbWsIds; j++)
{
if (j != index)
{
newWsIds[i] = WsIds[j];
copyData(graduatedTrihedronData[j], newGraduatedTrihedronData[i]);
i++;
}
}
return TSuccess;
}
/* Normal of the view (not normalized!) */
static float getNormal(float* normal)
{
@ -363,11 +314,10 @@ static char getFarestCorner(float d000, float d100, float d010, float d001,
return 8; /* d111 */
}
static void drawText(char* text, char* font, OSD_FontAspect style, int size, float x, float y, float z)
static void drawText(const wchar_t* text, char* font, OSD_FontAspect style, int size, float x, float y, float z)
{
GLuint fontBase = 0;
OpenGl_TextRender* textRenderer = OpenGl_TextRender::instance();
fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size);
const GLuint fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size);
textRenderer->RenderText(text, fontBase, 0, x, y, z);
/* 4 OCC 6.3.1 and older:
@ -442,128 +392,80 @@ static void drawArrow(float x1, float y1, float z1,
glEnd();
}
TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data)
TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data)
{
int index;
/* Get index of the view */
index = getGraduatedTrihedronDataIndex(WsId);
if (index == -1)
{
/* Default values */
data->xname = "X\0";
data->yname = "Y\0";
data->zname = "Z\0";
data->xdrawname = 1;
data->ydrawname = 1;
data->zdrawname = 1;
data->xdrawvalues = 1;
data->ydrawvalues = 1;
data->zdrawvalues = 1;
data->drawgrid = 1;
data->drawaxes = 1;
data->nbx = 3;
data->nby = 3;
data->nbz = 3;
data->xoffset = 10;
data->yoffset = 10;
data->zoffset = 10;
data->xaxisoffset = 30;
data->yaxisoffset = 30;
data->zaxisoffset = 30;
data->xdrawtickmarks = 1;
data->ydrawtickmarks = 1;
data->zdrawtickmarks = 1;
data->xtickmarklength = 10;
data->ytickmarklength = 10;
data->ztickmarklength = 10;
/*Quantity_NOC_WHITE*/;
data->gridcolor[0] = 1.0f;
data->gridcolor[1] = 1.0f;
data->gridcolor[2] = 1.0f;
/* Quantity_NOC_RED */
data->xnamecolor[0] = 1.0f;
data->xnamecolor[1] = 0.0f;
data->xnamecolor[2] = 0.0f;
/* Quantity_NOC_GREEN */
data->ynamecolor[0] = 0.0f;
data->ynamecolor[1] = 1.0f;
data->ynamecolor[2] = 0.0f;
/* Quantity_NOC_BLUE1 */
data->znamecolor[0] = 0.0f;
data->znamecolor[1] = 0.0f;
data->znamecolor[2] = 1.0f;
/* Quantity_NOC_RED */
data->xcolor[0] = 1.0f;
data->xcolor[1] = 0.0f;
data->xcolor[2] = 0.0f;
/* Quantity_NOC_GREEN */
data->ycolor[0] = 0.0f;
data->ycolor[1] = 1.0f;
data->ycolor[2] = 0.0f;
/* Quantity_NOC_BLUE1 */
data->zcolor[0] = 0.0f;
data->zcolor[1] = 0.0f;
data->zcolor[2] = 1.0f;
}
else
{
copyData(graduatedTrihedronData[index], data);
}
return TSuccess;
}
TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data)
{
int index;
/* Initialize data for a new view */
index = getGraduatedTrihedronDataIndex(WsId);
int index = getGraduatedTrihedronDataIndex(WsId);
if (index == -1)
{
initView(WsId);
index = getGraduatedTrihedronDataIndex(WsId);
/* Extend array for +1 */
tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds+1];
/* Copy existing contents */
int i;
for (i = 0; i < nbWsIds; i++)
newGraduatedTrihedronData[i] = graduatedTrihedronData[i];
/* Add new item */
index = nbWsIds++;
newGraduatedTrihedronData[index] = new TEL_GRADUATEDTRIHEDRON_DATA;
newGraduatedTrihedronData[index]->WsId = WsId;
/* Switch to new array */
delete graduatedTrihedronData;
graduatedTrihedronData = newGraduatedTrihedronData;
}
copyData(data, graduatedTrihedronData[index]);
copyData(&data, graduatedTrihedronData[index]);
return call_graduatedtrihedron_redraw(WsId);
}
TStatus call_graduatedtrihedron_erase(int WsId)
{
return removeView(WsId);
int index = getGraduatedTrihedronDataIndex(WsId);
if (index == -1)
return TSuccess; /* Nothing to remove */
/* If trihedron is displayed only in one view, just free the array and set nbWsIds equal to 0. */
if (nbWsIds == 1)
{
freeData();
return TSuccess;
}
/* Reduce array for -1 */
tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds-1];
/* Copy existing contents */
int i, j;
for (i = 0, j = 0; i < nbWsIds; i++)
{
if (graduatedTrihedronData[i]->WsId != WsId)
newGraduatedTrihedronData[j++] = graduatedTrihedronData[i];
}
nbWsIds--;
/* Switch to new array */
delete graduatedTrihedronData;
graduatedTrihedronData = newGraduatedTrihedronData;
return TSuccess;
}
TStatus call_graduatedtrihedron_redraw(int WsId)
{
GLboolean light;
unsigned int i, offset;
unsigned char farestCorner;
float normal[3], center[3];
CALL_DEF_GRADUATEDTRIHEDRON* data;
float d000, d100, d010, d001, d110, d101, d011, d111; /* 0 - min, 1 - max */
float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
float m1[3], m2[3];
float step, d, dpix, dx, dy, dz;
char textValue[128];
int index;
/* Get index of the trihedron data */
index = getGraduatedTrihedronDataIndex(WsId);
int index = getGraduatedTrihedronDataIndex(WsId);
if (index == -1)
return TFailure;
data = graduatedTrihedronData[index];
tel_graduatedtrihedron_data data = graduatedTrihedronData[index];
/* Update boundary box */
if (data->cbCubicAxes)
data->cbCubicAxes(data->ptrVisual3dView);
/* Disable lighting for lines */
light = glIsEnabled(GL_LIGHTING);
GLboolean light = glIsEnabled(GL_LIGHTING);
if (light)
glDisable(GL_LIGHTING);
@ -571,31 +473,40 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
/* Get normal of the view out of user. */
/* Also, the method return distance corresponding to 1 pixel */
dpix = getNormal(normal);
float normal[3];
float dpix = getNormal(normal);
/* Normalize normal */
d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
normal[0] = normal[0] / d;
normal[1] = normal[1] / d;
normal[2] = normal[2] / d;
float d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
normal[0] /= d;
normal[1] /= d;
normal[2] /= d;
/* Get central point of bounding box */
float center[3];
center[0] = 0.5f * (xmin + xmax);
center[1] = 0.5f * (ymin + ymax);
center[2] = 0.5f * (zmin + zmax);
/* Check distance to corners of bounding box along the normal */
d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
float d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
float d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
float d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
float d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
float d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
float d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
float d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
float d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
unsigned char farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
/* Choose axes for the grid. */
float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
/* The first axis will be used for drawing the text and the values. */
switch (farestCorner)
{
@ -874,6 +785,9 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
}
/* Draw the graduated trihedron */
unsigned int i, j, offset;
float m1[3], m2[3];
float step, dx, dy, dz;
/* Grid */
if (data->drawgrid)
@ -941,7 +855,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(LX2[0] + i * step, LX2[1], LX2[2]);
glVertex3f(LX3[0] + i * step, LX3[1], LX3[2]);
glEnd();
i = i + 1;
i++;
}
}
/* Y-Grid lines */
@ -956,7 +870,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(LY2[0], LY2[1] + i * step, LY2[2]);
glVertex3f(LY3[0], LY3[1] + i * step, LY3[2]);
glEnd();
i = i + 1;
i++;
}
}
/* Z-Grid lines */
@ -971,7 +885,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(LZ2[0], LZ2[1], LZ2[2] + i * step);
glVertex3f(LZ3[0], LZ3[1], LZ3[2] + i * step);
glEnd();
i = i + 1;
i++;
}
}
}
@ -991,7 +905,10 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glColor3fv(data->zcolor);
drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]);
}
/* Names of axes & values */
char textValue[128];
wchar_t wtextValue[128];
if (data->xdrawname || data->xdrawvalues)
{
@ -1009,20 +926,13 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
dy = m1[1] - m2[1];
if (fabsf(dy) > 1.e-7f)
{
if (dy > 0.0f)
dy = 1.0f;
else
dy = -1.0f;
dy = (dy > 0.0f)? 1.0f : -1.0f;
}
dz = m1[2] - m2[2];
if (fabsf(dz) > 1.e-7f)
{
if (dz > 0.0f)
dz = 1.0f;
else
dz = -1.0f;
dz = (dz > 0.0f)? 1.0f : -1.0f;
}
m2[1] = dpix * dy;
m2[2] = dpix * dz;
@ -1046,9 +956,10 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
while (i <= data->nbx)
{
sprintf(textValue, "%g", LX1[0] + i * step);
drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
j = 0; while (wtextValue[j] = textValue[j]) j++;
drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
i = i + 1;
i++;
}
}
@ -1065,7 +976,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(LX1[0] + i * step, m1[1], m1[2]);
glVertex3f(LX1[0] + i * step, m1[1] + data->xtickmarklength * m2[1], m1[2] + data->xtickmarklength * m2[2]);
glEnd();
i = i + 1;
i++;
}
}
}
@ -1086,18 +997,12 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
dx = m1[0] - m2[0];
if (fabsf(dx) > 1.e-7f)
{
if (dx > 0.0f)
dx = 1.0f;
else
dx = -1.0f;
dx = (dx > 0.0f)? 1.0f : -1.0f;
}
dz = m1[2] - m2[2];
if (fabsf(dz) > 1.e-7f)
{
if (dz > 0.0f)
dz = 1.0f;
else
dz = -1.0f;
dz = (dz > 0.0f)? 1.0f : -1.0f;
}
m2[0] = dpix * dx;
@ -1123,9 +1028,10 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
while (i <= data->nby)
{
sprintf(textValue, "%g", LY1[1] + i * step);
drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
j = 0; while (wtextValue[j] = textValue[j]) j++;
drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]);
i = i + 1;
i++;
}
}
@ -1142,7 +1048,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(m1[0], LY1[1] + i * step, m1[2]);
glVertex3f(m1[0] + data->ytickmarklength * m2[0], LY1[1] + i * step, m1[2] + data->ytickmarklength * m2[2]);
glEnd();
i = i + 1;
i++;
}
}
}
@ -1163,18 +1069,12 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
dx = m1[0] - m2[0];
if (fabsf(dx) > 1.e-7f)
{
if (dx > 0.0f)
dx = 1.0f;
else
dx = -1.0f;
dx = (dx > 0.0f)? 1.0f : -1.0f;
}
dy = m1[1] - m2[1];
if (fabsf(dy) > 1.e-7f)
{
if (dy > 0.0f)
dy = 1.0f;
else
dy = -1.0f;
dy = (dy > 0.0f)? 1.0f : -1.0f;
}
m2[0] = dpix * dx;
@ -1200,9 +1100,10 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
while (i <= data->nbz)
{
sprintf(textValue, "%g", LZ1[2] + i * step);
drawText(textValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
j = 0; while (wtextValue[j] = textValue[j]) j++;
drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step);
i = i + 1;
i++;
}
}
@ -1219,7 +1120,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId)
glVertex3f(m1[0], m1[1], LZ1[2] + i * step);
glVertex3f(m1[0] + data->ztickmarklength * m2[0], m1[1] + data->ztickmarklength * m2[1], LZ1[2] + i * step);
glEnd();
i = i + 1;
i++;
}
}
}

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_
#define __OPENGL_GRADUATEDTRIHEDRON_H_
@ -9,8 +14,9 @@
#include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
extern TStatus call_graduatedtrihedron_get(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data);
extern TStatus call_graduatedtrihedron_display(int WsId, CALL_DEF_GRADUATEDTRIHEDRON* data);
#include <Graphic3d_CGraduatedTrihedron.hxx>
extern TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data);
extern TStatus call_graduatedtrihedron_redraw(int WsId);
extern TStatus call_graduatedtrihedron_erase(int WsId);
extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,

View File

@ -1631,7 +1631,7 @@ call_subr_structure_exploration( Tint Id,
else
{
printf( "\tELEM_ANNO_TEXT_REL3\n" );
printf( "\t\tANNOTATION TEXT RELATIVE 3 %s\n",
printf( "\t\tANNOTATION TEXT RELATIVE 3 %S\n",
data.atext3.string );
printf( "\t\treference point %f %f %f\n",
data.atext3.ref_pt.xyz[0],

View File

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

View File

@ -49,9 +49,17 @@ xx-xx-xx : xxx ; Creation.
#include <OpenGl_Extension.hxx>
#include <OpenGl_Memory.hxx>
#include <OpenGl_TextRender.hxx>
struct TEL_TEXT_DATA
{
TEL_POINT attach_pt;
Tint length;
const wchar_t *sdata;
IMPLEMENT_MEMORY_OPERATORS
};
typedef TEL_TEXT_DATA* tel_text_data;
/*----------------------------------------------------------------------*/
/*
* Fonctions statiques
@ -103,12 +111,6 @@ extern int g_nDegenerateModel;
extern float g_fSkipRatio;
#endif
void putText( Tchar* data, Tfloat x, Tfloat y, Tfloat z )
{
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
textRender->RenderText ( (char*)data, fontBase, 0, x, y, z );
}
/*----------------------------------------------------------------------*/
MtblPtr
@ -127,7 +129,7 @@ TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
TEL_POINT def_pt = {{ ( float )0.0, ( float )0.0, ( float )0.0 }};
tel_point pt = &def_pt;
tel_text_data data;
Tchar *str= 0;
Techar *str= 0;
for( i = 0; i < n; i++ )
{
@ -137,23 +139,27 @@ TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
pt = (tel_point)k[i]->data.pdata;
break;
case TEXT_STRING_ID:
str = (Tchar*)k[i]->data.pdata;
str = (Techar*)k[i]->data.pdata;
break;
}
}
i = strlen((char*)str) + 1;
data = new TEL_TEXT_DATA();
if( !data )
return TFailure;
data->data = new Tchar[i];
if( !data->data )
//szv: instead of strlen + 1
i = 0; while (str[i++]);
wchar_t *wstr = new wchar_t[i];
if( !wstr )
return TFailure;
data->attach_pt = *pt;
data->length = i;
memcpy( data->data, str, i );
//szv: instead of memcpy
i = 0; while (wstr[i++] = (wchar_t)(*str++));
data->sdata = wstr;
((tsm_elem_data)(d.pdata))->pdata = data;
@ -225,6 +231,8 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
}
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
/* display type of text */
if (display_type != ASPECT_TODT_NORMAL)
{
@ -237,7 +245,6 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
switch (display_type)
{
case ASPECT_TODT_BLEND:
@ -272,7 +279,7 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
#endif
break;
case ASPECT_TODT_SUBTITLE:
textRender->StringSize((char *)d->data, &sWidth, &sAscent, &sDescent);
textRender->StringSize(d->sdata, &sWidth, &sAscent, &sDescent);
objrefX = (float)d->attach_pt.xyz[0];
objrefY = (float)d->attach_pt.xyz[1];
objrefZ = (float)d->attach_pt.xyz[2];
@ -326,30 +333,30 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
&objX, &objY, &objZ);
glColor3fv( colours.rgb );
putText( d->data, (float)objX, (float)objY,(float)objZ );
textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1-1;
winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
putText( d->data, (float)objX, (float)objY,(float)objZ );
textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1-1;
winy = winy1+1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
putText( d->data, (float)objX, (float)objY,(float)objZ );
textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
winx = winx1+1;
winy = winy1-1;
status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
&objX, &objY, &objZ);
putText( d->data, (float)objX, (float)objY,(float)objZ );
textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
break;
}
}
glColor3fv( colour.rgb );
putText( d->data, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] );
textRender->RenderText( d->sdata, fontBase, 0, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] );
/* maj attributs */
if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
if (display_type == ASPECT_TODT_BLEND)
@ -370,8 +377,12 @@ TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
static TStatus
TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
{
if (data.pdata)
delete data.pdata;
tel_text_data d = (tel_text_data)data.pdata;
if (d)
{
delete[] d->sdata;
delete d;
}
return TSuccess;
}
@ -385,7 +396,7 @@ TextPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
p = (tel_text_data)data.pdata;
fprintf( stdout, "TelText.\n" );
fprintf( stdout, "\t\tString : %s\n", p->data );
fprintf( stdout, "\t\tString : %S\n", p->sdata );
fprintf( stdout, "\t\tAttach Point : %f %f %f\n", p->attach_pt.xyz[0],
p->attach_pt.xyz[1],
p->attach_pt.xyz[2] );
@ -406,7 +417,7 @@ TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
d = (tel_text_data)data.pdata;
size_reqd = d->length;
size_reqd = sizeof(Techar)*d->length;
for( i = 0; i < n; i++ )
{
@ -429,12 +440,15 @@ TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
if( c->size >= size_reqd )
{
w->atext3.string = c->buf;
w->atext3.string = (Techar*)c->buf;
w->atext3.ref_pt = d->attach_pt;
w->atext3.anno.xyz[0] = ( float )0.0;
w->atext3.anno.xyz[1] = ( float )0.0;
w->atext3.anno.xyz[2] = ( float )0.0;
strcpy( (char*)w->atext3.string, (char*)d->data );
//szv: instead of strcpy
Techar *ptr1 = w->atext3.string;
const wchar_t *ptr2 = d->sdata;
while (*ptr1++ = (Techar)(*ptr2++));
status = TSuccess;
}
else

View File

@ -58,6 +58,7 @@ from higher API */
#include <InterfaceGraphic_Visual3d.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_path(Tint); /* path */
extern void call_func_set_anno_align(Tint, Tint); /* hor, ver */
extern void call_func_anno_text_rel3( tel_point, Tchar* );
extern void call_func_anno_text_rel3( tel_point, Techar* );
extern void call_func_dcue_ind(Tint); /* dcid */
extern void call_func_set_do_texturemap(Tint); /* bool */
extern void call_func_set_texture_id(Tint); /* TextureID */
@ -383,11 +384,8 @@ void EXPORT call_togl_triedron_echo (
/* Graduated trihedron */
void EXPORT call_togl_graduatedtrihedron_get(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic);
void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic);
const Graphic3d_CGraduatedTrihedron &cubic);
void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view);
@ -1288,7 +1286,7 @@ void EXPORT call_togl_set_text_scale_factors (
void EXPORT call_togl_text2d (
char *s,
Techar *s,
float x,
float y,
float height
@ -1297,7 +1295,7 @@ void EXPORT call_togl_text2d (
void EXPORT call_togl_textsize2d (
char *s,
Techar *s,
float height,
float *width,
float *ascent,

View File

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

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_tsm_ws.hxx>
@ -7,14 +12,8 @@
#include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
void EXPORT call_togl_graduatedtrihedron_get(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic)
{
call_graduatedtrihedron_get(view->WsId, cubic);
}
void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
CALL_DEF_GRADUATEDTRIHEDRON* cubic)
const Graphic3d_CGraduatedTrihedron &cubic)
{
call_graduatedtrihedron_display(view->WsId, cubic);
}

View File

@ -78,7 +78,6 @@ call_togl_text
call_func_set_anno_char_up_vec (up_vect);
call_func_set_anno_path (path);
call_func_set_anno_align (hor_align, ver_align);
call_func_anno_text_rel3 (&text_pt, (Tchar*)atext->string);
call_func_anno_text_rel3 (&text_pt, (Techar*)atext->string);
if (! agroup->IsOpen) call_togl_closegroup (agroup);
return;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1661,37 +1661,83 @@ static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char
//function : VGraduatedTrihedron
//purpose : Displays a graduated trihedron
//==============================================================================
static void AddMultibyteString (TCollection_ExtendedString &name, const char *arg)
{
const char *str = arg;
while (*str)
{
unsigned short c1 = *str++;
unsigned short c2 = *str++;
if (!c1 || !c2) break;
name += (Standard_ExtCharacter)((c1 << 8) | c2);
}
}
static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
Handle(V3d_View) V3dView = ViewerTest::CurrentView();
if (V3dView.IsNull())
return 1;
if (argc < 2)
// Check arguments
if (argc != 2 && argc < 5)
{
di << argv[0] << " Invalid number of arguments" << "\n";
return 1;
di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
di<<"Usage: type help "<<argv[0]<<"\n";
return 1; //TCL_ERROR
}
Standard_CString xname = "X (mm)";
Standard_CString yname = "Y (mm)";
Standard_CString zname = "Z (mm)";
Handle(V3d_View) aV3dView = ViewerTest::CurrentView();
if (argc > 2)
// Create 3D view if it doesn't exist
if ( aV3dView.IsNull() )
{
if (argc != 5)
ViewerTest::ViewerInit();
aV3dView = ViewerTest::CurrentView();
if( aV3dView.IsNull() )
{
di << argv[0] << " Define all X, Y and Z axes names, please" << "\n";
return 1;
di << "Error: Cannot create a 3D view\n";
return 1; //TCL_ERROR
}
xname = argv[2];
yname = argv[3];
zname = argv[4];
}
int display = atoi(argv[1]);
// Erase (==0) or display (!=0)
const int display = atoi(argv[1]);
if (display)
V3dView->GraduatedTrihedronDisplay(xname, yname, zname,
{
// Text font
TCollection_AsciiString font;
if (argc < 6)
font.AssignCat("Courier");
else
font.AssignCat(argv[5]);
// Text is multibyte
const Standard_Boolean isMultibyte = (argc < 7)? Standard_False : (atoi(argv[6]) != 0);
// Set axis names
TCollection_ExtendedString xname, yname, zname;
if (argc >= 5)
{
if (isMultibyte)
{
AddMultibyteString(xname, argv[2]);
AddMultibyteString(yname, argv[3]);
AddMultibyteString(zname, argv[4]);
}
else
{
xname += argv[2];
yname += argv[3];
zname += argv[4];
}
}
else
{
xname += "X (mm)";
yname += "Y (mm)";
zname += "Z (mm)";
}
aV3dView->GraduatedTrihedronDisplay(xname, yname, zname,
Standard_True/*xdrawname*/, Standard_True/*ydrawname*/, Standard_True/*zdrawname*/,
Standard_True/*xdrawvalues*/, Standard_True/*ydrawvalues*/, Standard_True/*zdrawvalues*/,
Standard_True/*drawgrid*/,
@ -1700,12 +1746,17 @@ static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, cons
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*/);
10/*xtickmarklength*/, 10/*ytickmarklength*/, 10/*ztickmarklength*/,
Quantity_NOC_WHITE/*gridcolor*/,
Quantity_NOC_RED/*xnamecolor*/,Quantity_NOC_GREEN/*ynamecolor*/,Quantity_NOC_BLUE1/*znamecolor*/,
Quantity_NOC_RED/*xcolor*/,Quantity_NOC_GREEN/*ycolor*/,Quantity_NOC_BLUE1/*zcolor*/,font);
}
else
V3dView->GraduatedTrihedronErase();
aV3dView->GraduatedTrihedronErase();
ViewerTest::GetAISContext()->UpdateCurrentViewer();
V3dView->Redraw();
aV3dView->Redraw();
return 0;
}
@ -1773,6 +1824,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
__FILE__,VColorScale,group);
theCommands.Add("vgraduatedtrihedron",
"vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname]",
"vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname [Font [isMultibyte]]]",
__FILE__,VGraduatedTrihedron,group);
}

View File

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

View File

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