e6d64e2c60
- a ExtText aggiunta GetAuxSurf (solo per font di sistema) - molto migliorata gestione anelli e spikes nella creazione di regioni.
147 lines
7.3 KiB
C++
147 lines
7.3 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : ExtText.h Data : 27.05.14 Versione : 1.5f1
|
|
// Contenuto : Dichiarazione della classe Testo.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 27.05.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "ObjGraphicsMgr.h"
|
|
#include "DllMain.h"
|
|
#include "GeoObjRW.h"
|
|
#include "SurfTriMesh.h"
|
|
#include "/EgtDev/Include/EGkExtText.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
class ExtText : public IExtText, public IGeoObjRW
|
|
{
|
|
public : // IGeoObj
|
|
~ExtText( void) override ;
|
|
ExtText* Clone( void) const override ;
|
|
GeoObjType GetType( void) const override ;
|
|
bool IsValid( void) const override
|
|
{ return true ; }
|
|
const std::string& GetTitle( void) const override ;
|
|
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
|
bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const override ;
|
|
bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const override ;
|
|
bool Translate( const Vector3d& vtMove) override ;
|
|
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) override
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) override ;
|
|
bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) override ;
|
|
bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) override ;
|
|
bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) override ;
|
|
bool ToGlob( const Frame3d& frRef) override ;
|
|
bool ToLoc( const Frame3d& frRef) override ;
|
|
bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) override ;
|
|
void SetObjGraphics( IObjGraphics* pOGr) override
|
|
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
|
|
IObjGraphics* GetObjGraphics( void) override
|
|
{ return m_OGrMgr.GetObjGraphics() ; }
|
|
const IObjGraphics* GetObjGraphics( void) const override
|
|
{ return m_OGrMgr.GetObjGraphics() ; }
|
|
void SetTempProp( int nProp) override
|
|
{ m_nTempProp = nProp ; }
|
|
int GetTempProp( void) const override
|
|
{ return m_nTempProp ; }
|
|
|
|
public : // IExtText
|
|
bool CopyFrom( const IGeoObj* pGObjSrc) override ;
|
|
bool Set( const Point3d& ptP, double dAngDeg, const std::string& sText, double dH) override ;
|
|
bool Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
|
const std::string& sText, const std::string& sFont, bool bItl, double dH) override ;
|
|
bool Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
|
const std::string& sText, const std::string& sFont, int nW, bool bItl, double dH,
|
|
double dRat, double dAddAdv, int nInsPos = 7) override ;
|
|
const Point3d& GetPoint( void) const override
|
|
{ return m_ptP ; }
|
|
const Vector3d& GetNormVersor( void) const override
|
|
{ return m_vtN ; }
|
|
const Vector3d& GetDirVersor( void) const override
|
|
{ return m_vtD ; }
|
|
const std::string& GetText( void) const override
|
|
{ return m_sText ; }
|
|
const std::string& GetFont( void) const override
|
|
{ return m_sFont ; }
|
|
int GetWeight( void) const override
|
|
{ return m_nWeight ; }
|
|
bool GetItalic( void) const override
|
|
{ return m_bItalic ; }
|
|
double GetHeight( void) const override
|
|
{ return m_dHeight ; }
|
|
double GetRatio( void) const override
|
|
{ return m_dRatio ; }
|
|
double GetAddAdvance( void) const override
|
|
{ return m_dAddAdvance ; }
|
|
int GetInsPosition( void) const override
|
|
{ return m_nInsPos ; }
|
|
bool GetHeightVersor( Vector3d& vtH) const override ;
|
|
bool GetStartPoint( Point3d& ptStart) const override ;
|
|
bool GetOverStartPoint( Point3d& ptStart) const override ;
|
|
bool GetEndPoint( Point3d& ptEnd) const override ;
|
|
bool GetOverEndPoint( Point3d& ptEnd) const override ;
|
|
bool GetMidPoint( Point3d& ptMid) const override ;
|
|
bool GetCenterPoint( Point3d& ptCen) const override ;
|
|
bool GetOutline( ICURVEPLIST& lstPC) const override ;
|
|
bool SplitOnLineBreak( IEXTTEXTPVECTOR& vText) const override ;
|
|
bool ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const override ;
|
|
bool ApproxWithArcs( double dLinTol, double dAngTolDeg, POLYARCLIST& lstPA) const override ;
|
|
const ISurfTriMesh* GetAuxSurf( void) const override ;
|
|
bool Flip( void) override ;
|
|
bool Mir( bool bOnLen) override ;
|
|
bool ModifyText( const std::string& sText) override ;
|
|
bool ChangeFont( const std::string& sFont) override ;
|
|
bool ChangeHeight( double dH) override ;
|
|
bool ChangeItalic( bool bItl) override ;
|
|
|
|
public : // IGeoObjRW
|
|
int GetNgeId( void) const override ;
|
|
bool Save( NgeWriter& ngeOut) const override ;
|
|
bool Load( NgeReader& ngeIn) override ;
|
|
|
|
public :
|
|
ExtText( void) ;
|
|
ExtText( const ExtText& gpSrc)
|
|
{ if ( ! CopyFrom( gpSrc))
|
|
LOG_ERROR( GetEGkLogger(), "ExtText : copy constructor error") }
|
|
ExtText& operator =( const ExtText& gpSrc)
|
|
{ if ( ! CopyFrom( gpSrc))
|
|
LOG_ERROR( GetEGkLogger(), "ExtText : copy error")
|
|
return *this ; }
|
|
|
|
private :
|
|
bool CopyFrom( const ExtText& gpSrc) ;
|
|
void ResetAuxSurf( void) const ;
|
|
|
|
private :
|
|
static const int MAX_FONT_LEN = 125 ;
|
|
static const int MAX_TXT_LINE = 125 ;
|
|
static const char CHR_SPECIAL = '\a' ;
|
|
|
|
private :
|
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
|
mutable SurfTriMesh* m_pSTM ; // superficie trimesh ausiliaria
|
|
Point3d m_ptP ; // punto di inserimento
|
|
Vector3d m_vtN ; // versore normale
|
|
Vector3d m_vtD ; // versore di direzione
|
|
std::string m_sText ; // testo con codifica UTF-8
|
|
std::string m_sFont ; // font utilizzato
|
|
int m_nWeight ; // 0 (don't care), 100 (thin) - 900 (black)
|
|
bool m_bItalic ; // flag per italico (inclinato)
|
|
double m_dHeight ; // altezza del carattere
|
|
double m_dRatio ; // rapporto tra larghezza e altezza
|
|
double m_dAddAdvance ; // avanzamento addizionale tra caratteri
|
|
int m_nInsPos ; // posizione del punto di inserimento rispetto al testo
|
|
int m_nTempProp ; // proprietà temporanea
|
|
} ;
|