From 12e8ce8c6b6d008afb2d5f38d3d82b58ebe5bb59 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 27 Mar 2014 22:17:36 +0000 Subject: [PATCH] Include : - prima versione interfacce per ISurf e ISurfTriMesh - FromString per vettore di interi. --- EGnStringUtils.h | 15 +++++++++++++++ EgkSurf.h | 34 ++++++++++++++++++++++++++++++++++ EgkSurfTriMesh.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 EgkSurf.h create mode 100644 EgkSurfTriMesh.h diff --git a/EGnStringUtils.h b/EGnStringUtils.h index 90373ec..b015cc8 100644 --- a/EGnStringUtils.h +++ b/EGnStringUtils.h @@ -84,6 +84,21 @@ FromString( const std::string& sVal, double& dVal) pStart = sVal.c_str() ; dVal = strtod( pStart, &pStop) ; return ( pStop != pStart && *pStop == '\0' && errno == 0) ; } +template +bool FromString( const std::string& sVal, int (&nVal)[size]) + { // divido la stringa in parametri + STRVECTOR vsParams ; + Tokenize( sVal, ",", vsParams) ; + // devono essere size parametri + if ( vsParams.size() != size) + return false ; + // recupero il punto + for ( int i = 0 ; i < size ; ++ i) { + if ( ! FromString( vsParams[i], nVal[i])) + return false ; + } + return true ; + } EGN_EXPORT const std::string ToString( int nVal, int nPrec = 1) ; inline const std::string ToString( bool bVal) diff --git a/EgkSurf.h b/EgkSurf.h new file mode 100644 index 0000000..680dca8 --- /dev/null +++ b/EgkSurf.h @@ -0,0 +1,34 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : EgkSurf.h Data : 26.03.14 Versione : 1.5c9 +// Contenuto : Dichiarazione della interfaccia ISurf. +// +// +// +// Modifiche : 26.03.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkGeoObj.h" + +//---------------------------------------------------------------------------- +class __declspec( novtable) ISurf : public IGeoObj +{ + public : + virtual bool IsSimple( void) const = 0 ; + virtual bool IsClosed( void) const = 0 ; +} ; + +//---------------------------------------------------------------------------- +inline const ISurf* GetSurf( const IGeoObj* pGObj) + { if ( pGObj == nullptr || ( pGObj->GetType() & GEO_SURF) == 0) + return nullptr ; + return (static_cast(pGObj)) ; } +inline ISurf* GetSurf( IGeoObj* pGObj) + { if ( pGObj == nullptr || ( pGObj->GetType() & GEO_SURF) == 0) + return nullptr ; + return (static_cast(pGObj)) ; } diff --git a/EgkSurfTriMesh.h b/EgkSurfTriMesh.h new file mode 100644 index 0000000..bc08e25 --- /dev/null +++ b/EgkSurfTriMesh.h @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : EgkSurfTriMesh.h Data : 26.03.14 Versione : 1.5c9 +// Contenuto : Dichiarazione della interfaccia ISurfTriMesh. +// +// +// +// Modifiche : 26.03.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkSurf.h" + +//---------------------------------------------------------------------------- +class __declspec( novtable) ISurfTriMesh : public ISurf +{ + public : + virtual bool Copy( const IGeoObj* pGObjSrc) = 0 ; + virtual bool Init( int nNumVert, int nNumTria) = 0 ; + virtual int AddVertex( const Point3d& ptVert) = 0 ; + virtual int AddTriangle( const int nIdVert[3]) = 0 ; + virtual int GetFirstTriangle( Point3d& ptP0, Point3d& ptP1, Point3d& ptP2) const = 0 ; + virtual int GetNextTriangle( int nId, Point3d& ptP0, Point3d& ptP1, Point3d& ptP2) const = 0 ; +} ; + +//----------------------------------------------------------------------------- +inline ISurfTriMesh* CreateSurfTriMesh( void) + { return (static_cast( CreateGeoObj( SRF_TRIMESH))) ; } +inline ISurfTriMesh* CloneSurfTriMesh( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) + return nullptr ; + return (static_cast(pGObj->Clone())) ; } +inline const ISurfTriMesh* GetSurfTriMesh( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) + return nullptr ; + return (static_cast(pGObj)) ; } +inline ISurfTriMesh* GetSurfTriMesh( IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH) + return nullptr ; + return (static_cast(pGObj)) ; }