EgtGeomKernel 1.6a4 :

- DistPointLine correnta per versore non normalizzato
- aggiunta GetGeoType a GeomDB e a GdbIterator
- in lettura NGE binari aggiunta protezione da contemporanea scrittura
- in PolyLine aggiunta funzione per inserimento punti onde raggiungere massima distanza
- aggiunto oggetto VolZmap per virtual milling (per ora vuoto)
- nuova versione file NGE 1009.
This commit is contained in:
Dario Sassi
2015-01-26 07:49:18 +00:00
parent 339988c139
commit 0b8a267b7b
16 changed files with 410 additions and 15 deletions
+17 -6
View File
@@ -20,11 +20,11 @@
DistPointLine::DistPointLine( const Point3d& ptP,
const ICurveLine& crvLine, bool bIsSegment)
{
// distanza non calcolata
m_dSqDist = - 1 ;
if ( &crvLine == nullptr || ! crvLine.IsValid())
if ( &crvLine == nullptr || ! crvLine.IsValid()) {
// distanza non calcolata
m_dSqDist = - 1 ;
return ;
}
double dLen ;
Vector3d vtDir ;
@@ -38,12 +38,23 @@ DistPointLine::DistPointLine( const Point3d& ptP,
{
double dLen ;
Vector3d vtDir ;
DirDist( ptIni, ptFin, vtDir, dLen) ;
Calculate( ptP, ptIni, vtDir, dLen, bIsSegment) ;
}
//----------------------------------------------------------------------------
DistPointLine::DistPointLine( const Point3d& ptP,
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment)
{
Vector3d vtDirNorm = vtDir ;
if ( dLen > EPS_SMALL && ! vtDirNorm.Normalize( EPS_ZERO)) {
// distanza non calcolata
m_dSqDist = - 1 ;
return ;
}
Calculate( ptP, ptIni, vtDirNorm, dLen, bIsSegment) ;
}
//----------------------------------------------------------------------------
void
DistPointLine::Calculate( const Point3d& ptP,
+1 -2
View File
@@ -28,8 +28,7 @@ class DistPointLine
DistPointLine( const Point3d& ptP,
const Point3d& ptIni, const Point3d& ptFin, bool bIsSegment = true) ;
DistPointLine( const Point3d& ptP,
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment = true)
{ Calculate( ptP, ptIni, vtDir, dLen, bIsSegment) ; }
const Point3d& ptIni, const Vector3d& vtDir, double dLen, bool bIsSegment = true) ;
public :
bool GetSqDist( double& dSqDist) ;
BIN
View File
Binary file not shown.
+3
View File
@@ -320,6 +320,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Triangulate.cpp" />
<ClCompile Include="Vector3d.cpp" />
<ClCompile Include="NgeWriter.cpp" />
<ClCompile Include="VolZmap.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Include\EGkAngle.h" />
@@ -369,6 +370,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EgkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkVector3d.h" />
<ClInclude Include="..\Include\EgkVolZmap.h" />
<ClInclude Include="..\Include\EgnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnStringUtils.h" />
<ClInclude Include="..\Include\EgtILogger.h" />
@@ -432,6 +434,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="SurfTriMesh.h" />
<ClInclude Include="Triangulate.h" />
<ClInclude Include="NgeWriter.h" />
<ClInclude Include="VolZmap.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtGeomKernel.rc" />
+9
View File
@@ -246,6 +246,9 @@
<ClCompile Include="CurveCompositeOffset.cpp">
<Filter>File di origine\Geo</Filter>
</ClCompile>
<ClCompile Include="VolZmap.cpp">
<Filter>File di origine\Geo</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@@ -578,6 +581,12 @@
<ClInclude Include="..\Include\EGkLinePntMinDistCurve.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="VolZmap.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgkVolZmap.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtGeomKernel.rc">
+12
View File
@@ -244,6 +244,18 @@ GdbIterator::GetGdbType( void) const
return GDB_TY_NONE ;
}
//----------------------------------------------------------------------------
int
GdbIterator::GetGeoType( void) const
{
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
return GEO_NONE ;
if ( GetGdbGeo( m_pCurrObj) != nullptr)
return GetGdbGeo( m_pCurrObj)->GetType() ;
else
return GEO_NONE ;
}
//----------------------------------------------------------------------------
IGeoObj*
GdbIterator::GetGeoObj( void)
+1
View File
@@ -35,6 +35,7 @@ class GdbIterator : public IGdbIterator
virtual bool EraseAndGoToPrev( void) ;
virtual int GetGdbType( void) const ;
virtual int GetGeoType( void) const ;
virtual IGeoObj* GetGeoObj( void) ;
virtual const IGeoObj* GetGeoObj( void) const ;
virtual Frame3d* GetGroupFrame( void) ;
+15
View File
@@ -622,6 +622,21 @@ GeomDB::GetGdbType( int nId) const
return GDB_TY_NONE ;
}
//----------------------------------------------------------------------------
int
GeomDB::GetGeoType( int nId) const
{
// recupero l'oggetto
const GdbObj* pGdbObj = GetGdbObj( nId) ;
if ( pGdbObj == nullptr)
return GEO_NONE ;
// se oggetto geometrico
if ( ::GetGdbGeo( pGdbObj) != nullptr)
return ::GetGdbGeo( pGdbObj)->GetType() ;
else
return GEO_NONE ;
}
//----------------------------------------------------------------------------
IGeoObj*
GeomDB::GetGeoObj( int nId)
+1
View File
@@ -50,6 +50,7 @@ class GeomDB : public IGeomDB
virtual int GetLastGroupInGroup( int nIdGroup) const ;
virtual int GetPrevGroup( int nId) const ;
virtual int GetGdbType( int nId) const ;
virtual int GetGeoType( int nId) const ;
virtual IGeoObj* GetGeoObj( int nId) ;
virtual const IGeoObj* GetGeoObj( int nId) const ;
virtual Frame3d* GetGroupFrame( int nId) ;
+9 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : NgeConst.h Data : 28.05.14 Versione : 1.5e10
// File : NgeConst.h Data : 22.01.15 Versione : 1.6a4
// Contenuto : Costanti per file Nge.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 12.04.14 DS Creazione modulo.
// 28.05.14 DS 1.5.7 -> aggiunto aggetto Testo.
// 23.08.14 DS 1007 -> versione con 1 solo int e cambiato nome GDB in "EgtGeomDB".
// 21.01.15 DS 1009 -> Aggiunto ZMAP, cambiato Id di TEXT.
//
//----------------------------------------------------------------------------
@@ -26,7 +27,9 @@ const int NGE_VER_1007 = 1007 ;
// 1007 : nuovo versioning con unico valore
const int NGE_VER_1008 = 1008 ;
// 1008 : aggiunge vtExtr e dThick a tutte le curve
const int NGE_VER_LAST = NGE_VER_1008 ;
const int NGE_VER_1009 = 1009 ;
// 1009 : aggiunto solido ZMAP e cambiato Id di TEXT
const int NGE_VER_LAST = NGE_VER_1009 ;
// Indici KeyWord
const int NGE_START = 0 ;
const int NGE_END = 1 ;
@@ -45,5 +48,6 @@ const int NGE_C_ARC = 13 ;
const int NGE_C_BEZ = 14 ;
const int NGE_C_CMP = 15 ;
const int NGE_S_TRM = 16 ;
const int NGE_E_TXT = 17 ;
const int NGE_LAST_ID = 17 ; // ultimo valore
const int NGE_V_ZMP = 17 ;
const int NGE_E_TXT = 18 ;
const int NGE_LAST_ID = 18 ; // ultimo valore
+2
View File
@@ -37,6 +37,7 @@ const std::string NgeAscKeyW[] = { "START", // NGE_START
"C_BEZ", // NGE_C_BEZ
"C_CMP", // NGE_C_CMP
"S_TRM", // NGE_S_TRM
"V_ZMP", // NGE_V_ZMP
"E_TXT"} ; // NGE_E_TXT
//----------------------------------------------------------------------------
@@ -64,4 +65,5 @@ const int NgeBinKeyW[] = { NGEB_GEN_BASE + 0x0F0F, // NGE_START
NGEB_GEO_BASE + CRV_BEZ, // NGE_C_BEZ
NGEB_GEO_BASE + CRV_COMPO, // NGE_C_CMP
NGEB_GEO_BASE + SRF_TRIMESH, // NGE_S_TRM
NGEB_GEO_BASE + VOL_ZMAP, // NGE_V_ZMP
NGEB_GEO_BASE + EXT_TEXT} ; // NGE_E_TXT
+1 -1
View File
@@ -34,7 +34,7 @@ NgeReader::Init( const std::string& sFileIn)
break ;
case NGE_BINARY :
m_bBinary = true ;
m_InFile.open( stringtoW( sFileIn), ios::in | ios::binary) ;
m_InFile.open( stringtoW( sFileIn), ios::in | ios::binary, _SH_DENYWR) ;
return ( ! m_InFile.fail()) ;
break ;
}
+45
View File
@@ -610,3 +610,48 @@ PolyLine::GetMaxDistanceFromLine( double& dMaxDist, const Point3d& ptAx,
return true ;
}
//----------------------------------------------------------------------------
bool
PolyLine::AdjustForMaxSegmentLen( double& dMaxLen)
{
PNTULIST::iterator iter = m_lUPoints.begin() ;
// se non ci sono punti, esco subito
if ( iter == m_lUPoints.end())
return false ;
// imposto il primo punto come precedente
double dUprec = iter->second ;
Point3d ptPprec = iter->first ;
// passo al secondo
++ iter ;
// ciclo sui punti
try {
while ( iter != m_lUPoints.end()) {
// recupero dati correnti
double dUcurr = iter->second ;
Point3d ptPcurr = iter->first ;
// verifico lunghezza segmento dal precedente
double dSqLen = SqDist( ptPprec, ptPcurr) ;
if ( dSqLen > dMaxLen * dMaxLen) {
double dLen = sqrt( dSqLen) ;
// determino il numero di divisioni
int nStep = int( dLen / dMaxLen + 0.999) ;
// inserisco i punti necessari
for ( int i = 1 ; i < nStep ; ++ i) {
double dCoeff = double( i) / nStep ;
m_lUPoints.insert( iter, POINTU( Media( ptPprec, ptPcurr, dCoeff),
(( 1 - dCoeff) * dUprec + dCoeff * dUcurr))) ;
}
}
// passo al successivo
dUprec = dUcurr ;
ptPprec = ptPcurr ;
++ iter ;
}
}
catch (...) {
return false ;
}
return true ;
}
+1 -1
View File
@@ -2,7 +2,7 @@
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SurfTriMesh.h Data : 26.03.14 Versione : 1.5c9
// Contenuto : Dichiarazione della classe Superfici TriMesh.
// Contenuto : Dichiarazione della classe Superficie TriMesh.
//
//
//
+209
View File
@@ -0,0 +1,209 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
// Contenuto : Implementazione della classe Volume Zmap.
//
//
//
// Modifiche : 22.01.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "VolZmap.h"
#include "GeoObjFactory.h"
using namespace std ;
//----------------------------------------------------------------------------
GEOOBJ_REGISTER( VOL_ZMAP, NGE_V_ZMP, VolZmap) ;
//----------------------------------------------------------------------------
VolZmap::VolZmap( void)
: m_nStatus( TO_VERIFY), m_nTempProp()
{
}
//----------------------------------------------------------------------------
VolZmap::~VolZmap( void)
{
}
//----------------------------------------------------------------------------
VolZmap*
VolZmap::Clone( void) const
{
// alloco oggetto
VolZmap* pVzm = new(nothrow) VolZmap ;
if ( pVzm != nullptr) {
if ( ! pVzm->CopyFrom( *this)) {
delete pVzm ;
return nullptr ;
}
}
return pVzm ;
}
//----------------------------------------------------------------------------
bool
VolZmap::CopyFrom( const IGeoObj* pGObjSrc)
{
const VolZmap* pVzm = dynamic_cast<const VolZmap*>( pGObjSrc) ;
if ( pVzm == nullptr)
return false ;
return CopyFrom( *pVzm) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::CopyFrom( const VolZmap& vzmSrc)
{
return false ;
}
//----------------------------------------------------------------------------
GeoObjType
VolZmap::GetType( void) const
{
return static_cast<GeoObjType>( GEOOBJ_GETTYPE( VolZmap)) ;
}
//----------------------------------------------------------------------------
const string&
VolZmap::GetTitle( void) const
{
static const string sTitle = "Zmap" ;
return sTitle ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Dump( string& sOut, const char* szNewLine) const
{
return false ;
}
//----------------------------------------------------------------------------
int
VolZmap::GetNgeId( void) const
{
return GEOOBJ_GETNGEID( VolZmap) ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Save( NgeWriter& ngeOut) const
{
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Load( NgeReader& ngeIn)
{
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Translate( const Vector3d& vtMove)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::ToGlob( const Frame3d& frRef)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::ToLoc( const Frame3d& frRef)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
{
// verifico lo stato
if ( m_nStatus != OK)
return false ;
return false ;
}
+84
View File
@@ -0,0 +1,84 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : VolZmap.h Data : 22.01.15 Versione : 1.6a4
// Contenuto : Dichiarazione della classe Volume Zmap.
//
//
//
// Modifiche : 22.01.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "ObjGraphicsMgr.h"
#include "DllMain.h"
#include "GeoObjRW.h"
#include "/EgtDev/Include/EGkVolZmap.h"
//----------------------------------------------------------------------------
class VolZmap : public IVolZmap, public IGeoObjRW
{
public : // IGeoObj
virtual ~VolZmap( void) ;
virtual VolZmap* Clone( void) const ;
virtual GeoObjType GetType( void) const ;
virtual bool IsValid( void) const
{ return ( m_nStatus == OK) ; }
virtual const std::string& GetTitle( void) const ;
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
virtual bool Translate( const Vector3d& vtMove) ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
virtual bool ToGlob( const Frame3d& frRef) ;
virtual bool ToLoc( const Frame3d& frRef) ;
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
virtual void SetObjGraphics( IObjGraphics* pOGr)
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
virtual IObjGraphics* GetObjGraphics( void)
{ return m_OGrMgr.GetObjGraphics() ; }
virtual const IObjGraphics* GetObjGraphics( void) const
{ return m_OGrMgr.GetObjGraphics() ; }
virtual void SetTempProp( int nProp)
{ m_nTempProp = nProp ; }
virtual int GetTempProp( void)
{ return m_nTempProp ; }
public : // IVolZmap
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
public : // IGeoObjRW
virtual int GetNgeId( void) const ;
virtual bool Save( NgeWriter& ngeOut) const ;
virtual bool Load( NgeReader& ngeIn) ;
public :
VolZmap( void) ;
VolZmap( const VolZmap& stSrc)
{ if ( ! CopyFrom( stSrc))
LOG_ERROR( GetEGkLogger(), "VolZmap : copy constructor error") }
VolZmap& operator =( const VolZmap& stSrc)
{ if ( ! CopyFrom( stSrc))
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
return *this ; }
private :
bool CopyFrom( const VolZmap& clSrc) ;
private :
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
Status m_nStatus ; // stato
int m_nTempProp ; // proprietà temporanea
} ;