Include :

- prima versione interfacce per ISurf e ISurfTriMesh
- FromString per vettore di interi.
This commit is contained in:
Dario Sassi
2014-03-27 22:17:36 +00:00
parent 247ada06a3
commit 12e8ce8c6b
3 changed files with 93 additions and 0 deletions
+15
View File
@@ -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 <size_t size>
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)
+34
View File
@@ -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<const ISurf*>(pGObj)) ; }
inline ISurf* GetSurf( IGeoObj* pGObj)
{ if ( pGObj == nullptr || ( pGObj->GetType() & GEO_SURF) == 0)
return nullptr ;
return (static_cast<ISurf*>(pGObj)) ; }
+44
View File
@@ -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<ISurfTriMesh*>( CreateGeoObj( SRF_TRIMESH))) ; }
inline ISurfTriMesh* CloneSurfTriMesh( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH)
return nullptr ;
return (static_cast<ISurfTriMesh*>(pGObj->Clone())) ; }
inline const ISurfTriMesh* GetSurfTriMesh( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH)
return nullptr ;
return (static_cast<const ISurfTriMesh*>(pGObj)) ; }
inline ISurfTriMesh* GetSurfTriMesh( IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_TRIMESH)
return nullptr ;
return (static_cast<ISurfTriMesh*>(pGObj)) ; }