EgtGeomKernel 1.5g4 :
- aggiunto calcolo Biarchi da condizioni tipo Hermite - aggiunta AngleInSpan - migliorata gestione riferimento di gruppi - corrette trasformazioni GeoVector3d per punto base.
This commit is contained in:
@@ -46,3 +46,17 @@ MediaAngle( double dAng1Deg, double dAng2Deg, double dCoeff)
|
||||
|
||||
return ( dAng1Near2Deg * ( 1 - dCoeff) + dAng2Deg * dCoeff) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
AngleInSpan( double dAngDeg, double dAngRefDeg, double dAngSpanDeg)
|
||||
{
|
||||
double dAngDiffDeg = DiffAngle( dAngDeg, dAngRefDeg) ;
|
||||
|
||||
if ( fabs( dAngSpanDeg) < EPS_ANG_ZERO)
|
||||
return ( fabs( dAngDiffDeg) < EPS_ANG_SMALL) ;
|
||||
else if ( dAngSpanDeg > 0)
|
||||
return ( dAngDiffDeg > - EPS_ANG_SMALL && dAngDiffDeg < dAngSpanDeg + EPS_ANG_SMALL) ;
|
||||
else
|
||||
return ( dAngDiffDeg < EPS_ANG_SMALL && dAngDiffDeg > dAngSpanDeg - EPS_ANG_SMALL) ;
|
||||
}
|
||||
|
||||
+3
-4
@@ -85,7 +85,6 @@ GetCircleCenTgArc( const Point3d& ptCen, const ICurveArc& crvArc, const Point3d&
|
||||
return Release( pCrvArc) ;
|
||||
else
|
||||
return nullptr ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -179,8 +178,8 @@ GetArc2PD( const Point3d& ptStart, const Point3d& ptEnd, double dDirStartDeg)
|
||||
vtDiff.z = 0 ;
|
||||
Vector3d vtDir ;
|
||||
vtDir.FromPolar( 1, dDirStartDeg) ;
|
||||
// verifico se i punti sono allineati con la direzione
|
||||
if ( ( vtDiff ^ vtDir).SqLen() < EPS_SMALL * EPS_SMALL) {
|
||||
// verifico se i punti sono allineati con la direzione e nel giusto verso
|
||||
if ( fabs( CrossXY( vtDiff, vtDir)) < EPS_SMALL && ScalarXY( vtDiff, vtDir) > EPS_SMALL) {
|
||||
// creo l'oggetto retta
|
||||
ICurveLine* pLine = CreateCurveLine() ;
|
||||
if ( pLine == nullptr)
|
||||
@@ -248,7 +247,7 @@ GetArcPntDirTgArc( const Point3d& ptP, double dDirStartDeg, const ICurveArc& crv
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
CalcCircleCenTgCircle( const Point3d& ptC, const Point3d& ptCen, double dRad, BIPNTVECTOR& vCenPtg)
|
||||
{
|
||||
// --- si lavora nel piano XY ---
|
||||
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : BiArcs.cpp Data : 30.07.14 Versione : 1.5g4
|
||||
// Contenuto : Implementazione funzioni per calcolo biarchi.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.07.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDev/Include/EGkAngle.h"
|
||||
#include "/EgtDev/Include/EgkBiArcs.h"
|
||||
#include "/EgtDev/Include/EgkCurveLine.h"
|
||||
#include "/EgtDev/Include/EgkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkArcXxTgArc.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static ICurve* CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg) ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ICurve*
|
||||
GetBiArc( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg, double dU)
|
||||
{
|
||||
// calcolo la curva dove giacciono i punti di giunzione tra i due archi del biarco
|
||||
PtrOwner<ICurve> pJCrv( CalcJCurve( ptP0, dDir0Deg, ptP1, dDir1Deg)) ;
|
||||
if ( ! ::IsValid( pJCrv))
|
||||
return false ;
|
||||
|
||||
// limito il parametro nell'intervallo 0 - 1
|
||||
if ( dU < 0)
|
||||
dU = 0 ;
|
||||
else if ( dU > 1)
|
||||
dU = 1 ;
|
||||
|
||||
// recupero il punto di giunzione
|
||||
Point3d ptJ ;
|
||||
if ( ! pJCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptJ))
|
||||
return false ;
|
||||
|
||||
// preparo la curva composita per i biarchi
|
||||
PtrOwner<ICurveComposite> pBiArc( CreateCurveComposite()) ;
|
||||
if ( ! IsValid( pBiArc))
|
||||
return false ;
|
||||
|
||||
// calcolo la curva dal punto iniziale alla giunzione
|
||||
if ( ! AreSamePointApprox( ptP0, ptJ)) {
|
||||
ICurve* pCrv = GetArc2PD( ptP0, ptJ, dDir0Deg) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
pBiArc->AddCurve( pCrv) ;
|
||||
}
|
||||
|
||||
// calcolo la curva dalla giunzione al punto finale
|
||||
if ( ! AreSamePointApprox( ptJ, ptP1)) {
|
||||
// curva dal punto finale, direzione opposta alla giunzione
|
||||
ICurve* pCrv = GetArc2PD( ptP1, ptJ, dDir1Deg + ANG_STRAIGHT) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
// inverto la curva
|
||||
pCrv->Invert() ;
|
||||
pBiArc->AddCurve( pCrv) ;
|
||||
}
|
||||
|
||||
// se il biarco non esiste
|
||||
if ( pBiArc->GetCurveNumber() == 0)
|
||||
return nullptr ;
|
||||
|
||||
return ::Release( pBiArc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static ICurve*
|
||||
CalcJCurve( const Point3d& ptP0, double dDir0Deg, const Point3d& ptP1, double dDir1Deg)
|
||||
{
|
||||
// se i due punti coincidono, non si può fare alcunché
|
||||
if ( AreSamePointApprox( ptP0, ptP1))
|
||||
return nullptr ;
|
||||
|
||||
// angolo di rotazione dalla prima direzione alla seconda -> angolo al centro
|
||||
double dAngDeg = DiffAngle( dDir1Deg, dDir0Deg) ;
|
||||
|
||||
// se rotazione nulla, allora segmento di retta tra i due punti
|
||||
if ( fabs( dAngDeg) < EPS_ANG_SMALL) {
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
if ( ! ::IsValid( pLine) || ! pLine->Set( ptP0, ptP1))
|
||||
return nullptr ;
|
||||
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
||||
pLine->Invert() ;
|
||||
return ::Release( pLine) ;
|
||||
}
|
||||
|
||||
// caso generico
|
||||
Point3d ptMed = 0.5 * ( ptP0 + ptP1) ;
|
||||
ptMed.z = ptP0.z ;
|
||||
Vector3d vtDiff = ptMed - ptP0 ;
|
||||
double dHalfDist = vtDiff.LenXY() ;
|
||||
vtDiff /= dHalfDist ;
|
||||
double dDirDiffDeg ;
|
||||
vtDiff.ToSpherical( nullptr, nullptr, &dDirDiffDeg) ;
|
||||
double dH = dHalfDist / tan( 0.5 * dAngDeg * DEGTORAD) ;
|
||||
vtDiff.Rotate( Z_AX, 0, 1) ;
|
||||
Point3d ptCen = ptMed + dH * vtDiff ;
|
||||
Vector3d vtStart = ptP0 - ptCen ;
|
||||
double dRad, dAngStart ;
|
||||
vtStart.ToSpherical( &dRad, nullptr, &dAngStart) ;
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( ! ::IsValid( pArc) || ! pArc->SetXY( ptCen, dRad, dAngStart, dAngDeg, ( ptP1.z - ptP0.z)))
|
||||
return nullptr ;
|
||||
double dDirStartDeg = dAngStart + ( dAngDeg > 0 ? ANG_RIGHT : - ANG_RIGHT) ;
|
||||
// determinazione regione tra le curve estreme in cui contenere l'arco (tramite angoli su start)
|
||||
// direzione iniziale arco rispetto a direzione P0->P1
|
||||
double dDirStartRelDeg = DiffAngle( dDirStartDeg, dDirDiffDeg) ;
|
||||
// direzione iniziale primo arco limite rispetto a direzione P0->P1
|
||||
double dDir0RelDeg = DiffAngle( dDir0Deg, dDirDiffDeg) ;
|
||||
// direzione iniziale secondo arco limite rispetto a direzione P0->P1 (dalla finale simmetrico e invert)
|
||||
double dDir1RelDeg = - DiffAngle( dDir1Deg, dDirDiffDeg) ;
|
||||
// nel caso di direzioni a 180deg si sceglie la più compatta
|
||||
if ( fabs( fabs( dDir1RelDeg) - ANG_STRAIGHT) < EPS_SMALL)
|
||||
dDir1RelDeg = ( dDir0RelDeg > 0 ? ANG_STRAIGHT : - ANG_STRAIGHT) ;
|
||||
else if ( fabs( fabs( dDir0RelDeg) - ANG_STRAIGHT) < EPS_SMALL)
|
||||
dDir0RelDeg = ( dDir1RelDeg > 0 ? ANG_STRAIGHT : - ANG_STRAIGHT) ;
|
||||
// intervallo angolare ammissibile a partire da direzione iniziale primo arco ammissibile ( == Dir0)
|
||||
double dDeltaAngDeg = - dDir0RelDeg + dDir1RelDeg ;
|
||||
// se non è nella regione, prendo l'altra parte di arco
|
||||
if ( ! AngleInSpan( dDirStartRelDeg, dDir0RelDeg, dDeltaAngDeg))
|
||||
pArc->ToAdditional() ;
|
||||
// inverto per avere parametrizzazione crescente allontanandosi da Dir0 e avvicinandosi a Dir1
|
||||
pArc->Invert() ;
|
||||
return ::Release( pArc) ;
|
||||
}
|
||||
Binary file not shown.
@@ -231,6 +231,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="ArcXxTgArc.cpp" />
|
||||
<ClCompile Include="Attribs.cpp" />
|
||||
<ClCompile Include="BBox3d.cpp" />
|
||||
<ClCompile Include="BiArcs.cpp" />
|
||||
<ClCompile Include="ChainCurves.cpp" />
|
||||
<ClCompile Include="Color.cpp" />
|
||||
<ClCompile Include="DistPointArc.cpp" />
|
||||
@@ -294,6 +295,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
<ClInclude Include="..\Include\EGkArcXxTgArc.h" />
|
||||
<ClInclude Include="..\Include\EGkBBox3d.h" />
|
||||
<ClInclude Include="..\Include\EGkBiArcs.h" />
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkColor.h" />
|
||||
<ClInclude Include="..\Include\EgkCurve.h" />
|
||||
|
||||
@@ -210,6 +210,9 @@
|
||||
<ClCompile Include="ChainCurves.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BiArcs.cpp">
|
||||
<Filter>File di origine\GeoCreate</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
@@ -509,6 +512,9 @@
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkBiArcs.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtGeomKernel.rc">
|
||||
|
||||
+159
-30
@@ -20,8 +20,6 @@
|
||||
#include "GeomDB.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgnCmdParser.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoFrame3d.h"
|
||||
@@ -35,10 +33,13 @@
|
||||
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurveCurve.h"
|
||||
#include "/EgtDev/Include/EgkChainCurves.h"
|
||||
#include "/EgtDev/Include/EgkBiArcs.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgnCmdParser.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -303,6 +304,10 @@ GdbExecutor::ExecuteVector( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( sCmd2 == "" || sCmd2 == "MAKE") {
|
||||
return VectorMake( vsParams) ;
|
||||
}
|
||||
// definizione sferica
|
||||
else if ( sCmd2 == "SPHE" || sCmd2 == "FROMSPHERICAL") {
|
||||
return VectorFromSpherical( vsParams) ;
|
||||
}
|
||||
// definizione come differenza di due punti
|
||||
else if ( sCmd2 == "D" || sCmd2 == "DIFF") {
|
||||
return VectorDifference( vsParams) ;
|
||||
@@ -346,6 +351,39 @@ GdbExecutor::VectorMake( const STRVECTOR& vsParams)
|
||||
return AddGeoObj( vsParams[0], vsParams[1], pGVect) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::VectorFromSpherical( const STRVECTOR& vsParams)
|
||||
{
|
||||
// 5 parametri : Id, IdParent, dLen, dAngVertDeg, dAngOrizzDeg
|
||||
if ( vsParams.size() != 5)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frVect ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frVect))
|
||||
return false ;
|
||||
// recupero la lunghezza
|
||||
double dLen ;
|
||||
if ( ! GetLengthParam( vsParams[2], dLen))
|
||||
return false ;
|
||||
// recupero l'angolo in verticale (non c'è metodo generale)
|
||||
double dAngVertDeg ;
|
||||
if ( ! FromString( vsParams[3], dAngVertDeg))
|
||||
return false ;
|
||||
// recupero l'angolo in orizzontale
|
||||
double dAngOrizzDeg ;
|
||||
if ( ! GetDirParam( vsParams[4], frVect, dAngOrizzDeg))
|
||||
return false ;
|
||||
// creo il vettore
|
||||
IGeoVector3d* pGVect = CreateGeoVector3d() ;
|
||||
if ( pGVect == nullptr)
|
||||
return false ;
|
||||
Vector3d vtV ;
|
||||
vtV.FromSpherical( dLen, dAngVertDeg, dAngOrizzDeg) ;
|
||||
pGVect->Set( vtV) ;
|
||||
return AddGeoObj( vsParams[0], vsParams[1], pGVect) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::VectorDifference( const STRVECTOR& vsParams)
|
||||
@@ -1541,6 +1579,9 @@ GdbExecutor::ExecuteCurveCompo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// creazione come poligono dato il lato
|
||||
else if ( sCmd2 == "POLYGSIDE" || sCmd2 == "FROMPOLYGONSIDE")
|
||||
return CurveCompoFromPolygon( vsParams, POLYG_SIDE) ;
|
||||
// creazione come biarco
|
||||
else if ( sCmd2 == "BIARC" || sCmd2 == "FROMBIARC")
|
||||
return CurveCompoFromBiarc( vsParams) ;
|
||||
// modifica per aggiunta di una curva alla fine
|
||||
else if ( sCmd2 == "AEC" || sCmd2 == "ADDENDCURVE")
|
||||
return CurveCompoAddCurve( vsParams, true) ;
|
||||
@@ -1787,10 +1828,49 @@ GdbExecutor::CurveCompoFromPolygon( const STRVECTOR& vsParams, int nType)
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
// inserisco la linea nel DB
|
||||
// inserisco la curva composita nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::CurveCompoFromBiarc( const STRVECTOR& vsParams)
|
||||
{
|
||||
// 6 o 7 parametri : Id, IdParent, ptP1, Dir1, ptP2, Dir2 [, Par]
|
||||
if ( vsParams.size() != 6 && vsParams.size() != 7)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frRef ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frRef))
|
||||
return false ;
|
||||
// recupero punto P1
|
||||
Point3d ptP1 ;
|
||||
if ( ! GetPointParam( vsParams[2], frRef, ptP1))
|
||||
return false ;
|
||||
// recupero direzione Dir1
|
||||
double dDir1 ;
|
||||
if ( ! GetDirParam( vsParams[3], frRef, dDir1))
|
||||
return false ;
|
||||
// recupero punto P2
|
||||
Point3d ptP2 ;
|
||||
if ( ! GetPointParam( vsParams[4], frRef, ptP2))
|
||||
return false ;
|
||||
// recupero direzione Dir2
|
||||
double dDir2 ;
|
||||
if ( ! GetDirParam( vsParams[5], frRef, dDir2))
|
||||
return false ;
|
||||
// setto o recupero parametro
|
||||
double dPar = 0.5 ;
|
||||
if ( vsParams.size() >= 7 && ! FromString( vsParams[6], dPar))
|
||||
return false ;
|
||||
// costruisco il biarco
|
||||
PtrOwner<ICurve> pBiArc( GetBiArc( ptP1, dDir1, ptP2, dDir2, dPar)) ;
|
||||
if ( ! ::IsValid( pBiArc))
|
||||
return false ;
|
||||
// inserisco la curva nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pBiArc)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::CurveCompoAddCurve( const STRVECTOR& vsParams, bool bEndOrStart)
|
||||
@@ -2445,7 +2525,7 @@ GdbExecutor::TextSimple( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero il testo
|
||||
string sText ;
|
||||
if ( ! GetTextParam( vsParams[2], sText))
|
||||
if ( ! GetStringParam( vsParams[2], sText))
|
||||
return false ;
|
||||
// recupero il punto di inserimento
|
||||
Point3d ptP ;
|
||||
@@ -2483,7 +2563,7 @@ GdbExecutor::TextComplete( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero il testo
|
||||
string sText ;
|
||||
if ( ! GetTextParam( vsParams[2], sText))
|
||||
if ( ! GetStringParam( vsParams[2], sText))
|
||||
return false ;
|
||||
// recupero il punto di inserimento
|
||||
Point3d ptP ;
|
||||
@@ -2554,7 +2634,7 @@ GdbExecutor::TextModifyText( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero il testo
|
||||
string sText ;
|
||||
if ( ! GetTextParam( vsParams[1], sText))
|
||||
if ( ! GetStringParam( vsParams[1], sText))
|
||||
return false ;
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( m_pGDB->GetGeoObj( GetIdParam( vsParams[0]))) ;
|
||||
@@ -2573,7 +2653,7 @@ GdbExecutor::TextChangeFont( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero il nome del font
|
||||
string sFont ;
|
||||
if ( ! GetTextParam( vsParams[1], sFont))
|
||||
if ( ! GetStringParam( vsParams[1], sFont))
|
||||
return false ;
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( m_pGDB->GetGeoObj( GetIdParam( vsParams[0]))) ;
|
||||
@@ -2782,17 +2862,17 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
|
||||
return false ;
|
||||
// se gruppo
|
||||
const IGeoFrame3d* pGF ;
|
||||
if ( ( pGF = m_pGDB->GetGeoFrame( nIdEnt)) != nullptr) {
|
||||
const Frame3d* pGrpF ;
|
||||
if ( ( pGrpF = m_pGDB->GetGroupFrame( nIdEnt)) != nullptr) {
|
||||
switch ( cType) {
|
||||
case 'X' : // versore X
|
||||
vtV = pGF->GetFrame().VersX() ;
|
||||
vtV = pGrpF->VersX() ;
|
||||
return vtV.LocToLoc( frEnt, frVect) ;
|
||||
case 'Y' : // versore Y
|
||||
vtV = pGF->GetFrame().VersY() ;
|
||||
vtV = pGrpF->VersY() ;
|
||||
return vtV.LocToLoc( frEnt, frVect) ;
|
||||
case 'Z' : // versore Z
|
||||
vtV = pGF->GetFrame().VersZ() ;
|
||||
vtV = pGrpF->VersZ() ;
|
||||
return vtV.LocToLoc( frEnt, frVect) ;
|
||||
default :
|
||||
return false ;
|
||||
@@ -2966,11 +3046,11 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
|
||||
return false ;
|
||||
// se gruppo
|
||||
const IGeoFrame3d* pGF ;
|
||||
if ( ( pGF = m_pGDB->GetGeoFrame( nIdEnt)) != nullptr) {
|
||||
const Frame3d* pGrpF ;
|
||||
if ( ( pGrpF = m_pGDB->GetGroupFrame( nIdEnt)) != nullptr) {
|
||||
switch ( cType) {
|
||||
case 'O' : // origine
|
||||
ptP = pGF->GetFrame().Orig() ;
|
||||
ptP = pGrpF->Orig() ;
|
||||
return ptP.LocToLoc( frEnt, frPnt) ;
|
||||
default :
|
||||
return false ;
|
||||
@@ -3059,6 +3139,16 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
}
|
||||
}
|
||||
}
|
||||
// se vettore
|
||||
else if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
switch ( cType) {
|
||||
case 'B' : // base
|
||||
ptP = pGV->GetBase() ;
|
||||
return ptP.LocToLoc( frEnt, frPnt) ;
|
||||
}
|
||||
}
|
||||
// se frame
|
||||
else if ( pGObj->GetType() == GEO_FRAME3D) {
|
||||
// recupero il frame
|
||||
@@ -3383,6 +3473,21 @@ GdbExecutor::GetDirParam( const string& sParam, const Frame3d& frDir, double& dD
|
||||
//case 'I' :
|
||||
}
|
||||
}
|
||||
// altrimenti, se vettore
|
||||
else if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il vettore
|
||||
const IGeoVector3d* pGVect = GetGeoVector3d( pGObj) ;
|
||||
Vector3d vtDir = pGVect->GetVector() ;
|
||||
vtDir.LocToLoc( frEnt, frDir) ;
|
||||
vtDir.ToSpherical( nullptr, nullptr, &dDir) ;
|
||||
// se esiste un secondo parametro è un offset di rotazione
|
||||
if ( vsParams.size() >= 2) {
|
||||
double dOffsetDeg = 0 ;
|
||||
FromString( vsParams[1], dOffsetDeg) ;
|
||||
dDir += dOffsetDeg ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
// altrimenti valore numerico
|
||||
@@ -3466,17 +3571,25 @@ GdbExecutor::GetFrameParam( const string& sParam, const Frame3d& frRef, Frame3d&
|
||||
}
|
||||
// altrimenti nome di gruppo o di frame già nel DB
|
||||
else {
|
||||
// identificativo
|
||||
int nIdEnt = GetIdParam( sParam) ;
|
||||
const IGeoFrame3d* pFr ;
|
||||
if ( ( pFr = m_pGDB->GetGeoFrame( nIdEnt)) == nullptr &&
|
||||
( pFr = GetGeoFrame3d( m_pGDB->GetGeoObj( nIdEnt))) == nullptr)
|
||||
return false ;
|
||||
frF = pFr->GetFrame() ;
|
||||
// recupero il riferimento del frame
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frEnt ;
|
||||
if ( ! m_pGDB->GetGlobFrame( nIdEnt, frEnt))
|
||||
return false ;
|
||||
return frF.LocToLoc( frEnt, frRef) ;
|
||||
// se gruppo
|
||||
if ( m_pGDB->GetGroupFrame( nIdEnt, frF)) {
|
||||
return frF.LocToLoc( frEnt, frRef) ;
|
||||
}
|
||||
// altrimenti entità geometrica
|
||||
else {
|
||||
// verifico se riferimento
|
||||
const IGeoFrame3d* pFr ;
|
||||
if ( ( pFr = GetGeoFrame3d( m_pGDB->GetGeoObj( nIdEnt))) == nullptr)
|
||||
return false ;
|
||||
frF = pFr->GetFrame() ;
|
||||
return frF.LocToLoc( frEnt, frRef) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3530,9 +3643,9 @@ GdbExecutor::GetColorParam( const string& sParam, bool& bByParent, Color& cCol)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::GetTextParam( const string& sParam, string& sText)
|
||||
GdbExecutor::GetStringParam( const string& sParam, string& sString)
|
||||
{
|
||||
return m_pParser->GetTextParam( sParam, sText) ;
|
||||
return m_pParser->GetStringParam( sParam, sString) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -3813,10 +3926,14 @@ GdbExecutor::ExecuteName( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
INTVECTOR vnNames ;
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// recupero il nome
|
||||
string sName ;
|
||||
if ( ! GetStringParam( vsParams[1], sName))
|
||||
return false ;
|
||||
// eseguo assegnazione nome
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetName( *Iter, vsParams[1]))
|
||||
if ( ! m_pGDB->SetName( *Iter, sName))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -3855,10 +3972,18 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
INTVECTOR vnNames ;
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// recupero Key
|
||||
string sKey ;
|
||||
if ( ! GetStringParam( vsParams[1], sKey))
|
||||
return false ;
|
||||
// recupero Info
|
||||
string sInfo ;
|
||||
if ( ! GetStringParam( vsParams[2], sInfo))
|
||||
return false ;
|
||||
// eseguo assegnazione Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( ! m_pGDB->SetInfo( *Iter, vsParams[1], vsParams[2]))
|
||||
if ( ! m_pGDB->SetInfo( *Iter, sKey, sInfo))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -3872,10 +3997,14 @@ GdbExecutor::ExecuteInfo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
INTVECTOR vnNames ;
|
||||
if ( ! GetNamesParam( vsParams[0], vnNames))
|
||||
return false ;
|
||||
// recupero Key
|
||||
string sKey ;
|
||||
if ( ! GetStringParam( vsParams[1], sKey))
|
||||
return false ;
|
||||
// eseguo rimozione nome Info di data Key
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( ! m_pGDB->RemoveInfo( *Iter, vsParams[1]))
|
||||
if ( ! m_pGDB->RemoveInfo( *Iter, sKey))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -4588,7 +4717,7 @@ GdbExecutor::CurveCopyBySplitClass( const STRVECTOR& vsParams)
|
||||
if ( ! m_pGDB->GetGlobFrame( nIdCloCrv, frCloCrv))
|
||||
return false ;
|
||||
// se i riferimenti sono diversi, porto la seconda curva nel riferimento della prima
|
||||
PtrOwner<ICurve> crvTrans( nullptr) ;
|
||||
PtrOwner<ICurve> crvTrans ;
|
||||
if ( ! AreSameFrame( frCrv, frCloCrv)) {
|
||||
crvTrans.Set( pCloCrv->Clone()) ;
|
||||
if ( ! ::IsValid( crvTrans))
|
||||
@@ -4848,7 +4977,7 @@ GdbExecutor::ExecuteOutTextIcci( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( ! m_pGDB->GetGlobFrame( nIdEnt2, frEnt2))
|
||||
return false ;
|
||||
// se i riferimenti sono diversi, porto la seconda entità nel riferimento della prima
|
||||
PtrOwner<ICurve> crvTrans( nullptr) ;
|
||||
PtrOwner<ICurve> crvTrans ;
|
||||
if ( ! AreSameFrame( frEnt1, frEnt2)) {
|
||||
crvTrans.Set( pCrv2->Clone()) ;
|
||||
if ( ! ::IsValid( crvTrans))
|
||||
|
||||
+3
-1
@@ -49,12 +49,13 @@ class GdbExecutor : public IGdbExecutor
|
||||
bool GetDirParam( const std::string& sParam, const Frame3d& frDir, double& dDir) ;
|
||||
bool GetFrameParam( const std::string& sParam, const Frame3d& frRef, Frame3d& frF) ;
|
||||
bool GetColorParam( const std::string& sParam, bool& bByParent, Color& cCol) ;
|
||||
bool GetTextParam( const std::string& sParam, std::string& sText) ;
|
||||
bool GetStringParam( const std::string& sParam, std::string& sString) ;
|
||||
bool GetPolylineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL) ;
|
||||
bool ExecuteGroup( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecutePoint( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteVector( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool VectorMake( const STRVECTOR& vsParams) ;
|
||||
bool VectorFromSpherical( const STRVECTOR& vsParams) ;
|
||||
bool VectorDifference( const STRVECTOR& vsParams) ;
|
||||
bool VectorCrossProduct( const STRVECTOR& vsParams) ;
|
||||
bool VectorModifyBase( const STRVECTOR& vsParams) ;
|
||||
@@ -91,6 +92,7 @@ class GdbExecutor : public IGdbExecutor
|
||||
bool CurveCompoFromPointBulges( const STRVECTOR& vsParams) ;
|
||||
bool CurveCompoFromSplit( const STRVECTOR& vsParams) ;
|
||||
bool CurveCompoFromPolygon( const STRVECTOR& vsParams, int nType) ;
|
||||
bool CurveCompoFromBiarc( const STRVECTOR& vsParams) ;
|
||||
bool CurveCompoAddCurve( const STRVECTOR& vsParams, bool bEndOrStart) ;
|
||||
bool CurveCompoExtractCurve( const STRVECTOR& vsParams, bool bEndOrStart) ;
|
||||
bool CurveCompoChangeStart( const STRVECTOR& vsParams) ;
|
||||
|
||||
+40
-75
@@ -71,7 +71,7 @@ GdbGroup::Clone( int nId, IdManager& IdMgr) const
|
||||
IdMgr.UpdateMaxId( nId) ;
|
||||
|
||||
// copio dati gruppo
|
||||
pGdbGroup->m_gfrFrame = m_gfrFrame ;
|
||||
pGdbGroup->m_frF = m_frF ;
|
||||
|
||||
// clono gli oggetti figli
|
||||
const GdbObj* pObj = GetFirstObj() ;
|
||||
@@ -123,7 +123,7 @@ GdbGroup::Save( NgeWriter& ngeOut) const
|
||||
if ( ! ngeOut.WriteInt( GDB_ID_NULL, nullptr, true))
|
||||
return false ;
|
||||
// frame
|
||||
if ( ! m_gfrFrame.Save( ngeOut))
|
||||
if ( ! ngeOut.WriteFrame( m_frF, ";", true))
|
||||
return false ;
|
||||
|
||||
// salvataggio dei figli
|
||||
@@ -171,7 +171,7 @@ GdbGroup::Load( int nNgeId, NgeReader& ngeIn, int& nParentId)
|
||||
return false ;
|
||||
|
||||
// leggo i dati del riferimento
|
||||
return m_gfrFrame.Load( ngeIn) ;
|
||||
return ngeIn.ReadFrame( m_frF, ";", true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -233,7 +233,7 @@ GdbGroup::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag, int nLev) con
|
||||
return true ;
|
||||
}
|
||||
// ciclo sui figli
|
||||
Frame3d frCurr = m_gfrFrame.GetFrame() * frRef ;
|
||||
Frame3d frCurr = m_frF * frRef ;
|
||||
const GdbObj* pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
BBox3d b3B ;
|
||||
@@ -244,54 +244,33 @@ GdbGroup::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag, int nLev) con
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbGroup::Translate( const Vector3d& vtMove)
|
||||
{
|
||||
return m_gfrFrame.Translate( vtMove) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbGroup::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
return m_gfrFrame.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbGroup::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// parziale scalatura del riferimento (non può essere completa)
|
||||
Frame3d frFrameS = m_gfrFrame.GetFrame() ;
|
||||
frFrameS.PseudoScale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
Frame3d frTrasf = m_frF ;
|
||||
m_frF.PseudoScale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
|
||||
// porto gli oggetti nel nuovo riferimento, senza modificarne la geometria in globale
|
||||
Frame3d frTrasf = m_gfrFrame.GetFrame() ;
|
||||
frTrasf.ToLoc( frFrameS) ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
frTrasf.ToLoc( m_frF) ;
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
pGdbObj->ToGlob( frTrasf) ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
// assegno il nuovo riferimento
|
||||
m_gfrFrame.Set( frFrameS) ;
|
||||
|
||||
// porto il riferimento di scalatura nel riferimento del gruppo
|
||||
// porto il riferimento di scalatura nel nuovo riferimento del gruppo
|
||||
Frame3d frRefLoc = frRef ;
|
||||
frRefLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
frRefLoc.ToLoc( m_frF) ;
|
||||
|
||||
// ciclo sugli oggetti
|
||||
bool bOk = true ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
if ( ! pGdbObj->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ))
|
||||
bOk = false ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -301,38 +280,31 @@ GdbGroup::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
|
||||
bool
|
||||
GdbGroup::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// parziale mirror del riferimento (non può essere completa)
|
||||
Frame3d frFrameS = m_gfrFrame.GetFrame() ;
|
||||
frFrameS.PseudoMirror( ptOn, vtNorm) ;
|
||||
Frame3d frTrasf = m_frF ;
|
||||
m_frF.PseudoMirror( ptOn, vtNorm) ;
|
||||
|
||||
// porto i nodi nel nuovo riferimento, senza modificarne la geometria in globale
|
||||
Frame3d frTrasf = m_gfrFrame.GetFrame() ;
|
||||
frTrasf.ToLoc( frFrameS) ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
frTrasf.ToLoc( m_frF) ;
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
pGdbObj->ToGlob( frTrasf) ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
// assegno il nuovo riferimento
|
||||
m_gfrFrame.Set( frFrameS) ;
|
||||
|
||||
// porto i dati del piano di mirror nel riferimento del gruppo
|
||||
Point3d ptOnLoc = ptOn ;
|
||||
ptOnLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
ptOnLoc.ToLoc( m_frF) ;
|
||||
Vector3d vtNormLoc = vtNorm ;
|
||||
vtNormLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
vtNormLoc.ToLoc( m_frF) ;
|
||||
|
||||
// ciclo sugli oggetti
|
||||
bool bOk = true ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
if ( ! pGdbObj->Mirror( ptOnLoc, vtNormLoc))
|
||||
bOk = false ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -342,40 +314,33 @@ GdbGroup::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
bool
|
||||
GdbGroup::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
||||
{
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// parziale scorrimento del riferimento (non può essere completa)
|
||||
Frame3d frFrameS = m_gfrFrame.GetFrame() ;
|
||||
frFrameS.PseudoShear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
Frame3d frTrasf = m_frF ;
|
||||
m_frF.PseudoShear( ptOn, vtNorm, vtDir, dCoeff) ;
|
||||
|
||||
// porto gli oggetti nel nuovo riferimento, senza modificarne la geometria in globale
|
||||
Frame3d frTrasf = m_gfrFrame.GetFrame() ;
|
||||
frTrasf.ToLoc( frFrameS) ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
frTrasf.ToLoc( m_frF) ;
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
pGdbObj->ToGlob( frTrasf) ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
// assegno il nuovo riferimento
|
||||
m_gfrFrame.Set( frFrameS) ;
|
||||
|
||||
// porto i dati di scorrimento nel riferimento del gruppo
|
||||
Point3d ptOnLoc = ptOn ;
|
||||
ptOnLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
ptOnLoc.ToLoc( m_frF) ;
|
||||
Vector3d vtNormLoc = vtNorm ;
|
||||
vtNormLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
vtNormLoc.ToLoc( m_frF) ;
|
||||
Vector3d vtDirLoc = vtDir ;
|
||||
vtDirLoc.ToLoc( m_gfrFrame.GetFrame()) ;
|
||||
vtDirLoc.ToLoc( m_frF) ;
|
||||
|
||||
// ciclo sugli oggetti
|
||||
bool bOk = true ;
|
||||
pGdbObj = GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
for ( GdbObj* pGdbObj = GetFirstObj() ;
|
||||
pGdbObj != nullptr ;
|
||||
pGdbObj = pGdbObj->GetNext()) {
|
||||
if ( ! pGdbObj->Shear( ptOnLoc, vtNormLoc, vtDirLoc, dCoeff))
|
||||
bOk = false ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -407,14 +372,14 @@ bool
|
||||
GdbGroup::GetGlobFrame( Frame3d& frGlob) const
|
||||
{
|
||||
// assegno il proprio frame
|
||||
frGlob = m_gfrFrame.GetFrame() ;
|
||||
frGlob = m_frF ;
|
||||
|
||||
// mentre ci sono padri
|
||||
const GdbGroup* pParent ;
|
||||
pParent = GetParent() ;
|
||||
while ( pParent != nullptr) {
|
||||
// porto il riferimento corrente sopra il padre
|
||||
frGlob.ToGlob( pParent->m_gfrFrame.GetFrame()) ;
|
||||
frGlob.ToGlob( pParent->GetFrame()) ;
|
||||
// passo al successivo
|
||||
pParent = pParent->GetParent() ;
|
||||
}
|
||||
|
||||
+15
-12
@@ -30,23 +30,22 @@ class GdbGroup : public GdbObj
|
||||
virtual bool Load( int nNgeId, NgeReader& ngeIn, int& nParentId) ;
|
||||
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag, int nLev = 0) const ;
|
||||
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag, int nLev = 0) const ;
|
||||
virtual bool Translate( const Vector3d& vtMove) ;
|
||||
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
||||
virtual bool Translate( const Vector3d& vtMove)
|
||||
{ m_frF.Translate( vtMove) ; return true ; }
|
||||
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)
|
||||
{ return m_frF.Rotate( ptAx, vtAx, dCosAng, 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)
|
||||
{ Frame3d frF = m_gfrFrame.GetFrame() ;
|
||||
return ( frF.ToGlob( frRef) && m_gfrFrame.Set( frF)) ; }
|
||||
{ return m_frF.ToGlob( frRef) ; }
|
||||
virtual bool ToLoc( const Frame3d& frRef)
|
||||
{ Frame3d frF = m_gfrFrame.GetFrame() ;
|
||||
return ( frF.ToLoc( frRef) && m_gfrFrame.Set( frF)) ; }
|
||||
{ return m_frF.ToLoc( frRef) ; }
|
||||
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
{ Frame3d frF = m_gfrFrame.GetFrame() ;
|
||||
return ( frF.LocToLoc( frOri, frDest) && m_gfrFrame.Set( frF)) ; }
|
||||
{ return m_frF.LocToLoc( frOri, frDest) ; }
|
||||
virtual bool OnSetMaterial( void) ;
|
||||
|
||||
public :
|
||||
@@ -68,14 +67,18 @@ class GdbGroup : public GdbObj
|
||||
{ return m_pLastObj ; }
|
||||
|
||||
public :
|
||||
bool SetFrame( const Frame3d& frF)
|
||||
{ if ( ! frF.IsValid())
|
||||
return false ;
|
||||
m_frF = frF ; return true ; }
|
||||
Frame3d& GetFrame( void)
|
||||
{ return m_frF ; }
|
||||
const Frame3d& GetFrame( void) const
|
||||
{ return m_gfrFrame.GetFrame() ; }
|
||||
{ return m_frF ; }
|
||||
bool GetGlobFrame( Frame3d& frGlob) const ;
|
||||
|
||||
public :
|
||||
GeoFrame3d m_gfrFrame ;
|
||||
|
||||
private :
|
||||
Frame3d m_frF ;
|
||||
int m_nObjCount ;
|
||||
GdbObj* m_pFirstObj ;
|
||||
GdbObj* m_pLastObj ;
|
||||
|
||||
+4
-4
@@ -261,8 +261,8 @@ GdbIterator::GetGeoObj( void)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGeoFrame3d*
|
||||
GdbIterator::GetGeoFrame( void)
|
||||
Frame3d*
|
||||
GdbIterator::GetGroupFrame( void)
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return nullptr ;
|
||||
@@ -271,7 +271,7 @@ GdbIterator::GetGeoFrame( void)
|
||||
if ( ( pGdbGroup = GetGdbGroup( m_pCurrObj)) == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
return &( pGdbGroup->m_gfrFrame) ;
|
||||
return &( pGdbGroup->GetFrame()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -286,7 +286,7 @@ GdbIterator::GetGroupFrame( Frame3d& frGlob) const
|
||||
return false ;
|
||||
|
||||
// copio il riferimento
|
||||
frGlob = pGdbGroup->m_gfrFrame.GetFrame() ;
|
||||
frGlob = pGdbGroup->GetFrame() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class GdbIterator : public IGdbIterator
|
||||
|
||||
virtual int GetGdbType( void) const ;
|
||||
virtual IGeoObj* GetGeoObj( void) ;
|
||||
virtual IGeoFrame3d* GetGeoFrame( void) ;
|
||||
virtual Frame3d* GetGroupFrame( void) ;
|
||||
virtual bool GetGroupFrame( Frame3d& frGlob) const ;
|
||||
virtual bool GetGroupGlobFrame( Frame3d& frGlob) const ;
|
||||
virtual int GetGroupObjs( void) const ;
|
||||
|
||||
@@ -72,6 +72,8 @@ GeoFrame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirZ)
|
||||
bool
|
||||
GeoFrame3d::Set( const Frame3d& frF)
|
||||
{
|
||||
if ( ! frF.IsValid())
|
||||
return false ;
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// assegno i dati
|
||||
|
||||
+17
-10
@@ -31,27 +31,34 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
|
||||
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ;
|
||||
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
|
||||
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ;
|
||||
virtual bool GetVector( Vector3d& vtV) const
|
||||
{ vtV = m_vtV ; return true ;}
|
||||
virtual bool Translate( const Vector3d& vtMove)
|
||||
{ return true ; }
|
||||
{ m_OGrMgr.Reset() ; m_ptBase.Translate( vtMove) ; return true ; }
|
||||
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)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.Rotate( vtAx, dCosAng, dSinAng) ; }
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.Rotate( vtAx, dCosAng, dSinAng) &&
|
||||
m_ptBase.Rotate( ptAx, vtAx, dCosAng, dSinAng)) ; }
|
||||
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) &&
|
||||
m_ptBase.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ)) ; }
|
||||
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.Mirror( vtNorm) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.Mirror( vtNorm) && m_ptBase.Mirror( ptOn, vtNorm)) ; }
|
||||
virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.Shear( vtNorm, vtDir, dCoeff) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.Shear( vtNorm, vtDir, dCoeff) && m_ptBase.Shear( ptOn, vtNorm, vtDir, dCoeff)) ; }
|
||||
virtual bool ToGlob( const Frame3d& frRef)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.ToGlob( frRef) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.ToGlob( frRef) && m_ptBase.ToGlob( frRef)) ; }
|
||||
virtual bool ToLoc( const Frame3d& frRef)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.ToLoc( frRef) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.ToLoc( frRef) && m_ptBase.ToLoc( frRef)) ; }
|
||||
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
{ m_OGrMgr.Reset() ; return m_vtV.LocToLoc( frOri, frDest) ;}
|
||||
{ m_OGrMgr.Reset() ;
|
||||
return ( m_vtV.LocToLoc( frOri, frDest) && m_ptBase.LocToLoc( frOri, frDest)) ; }
|
||||
virtual void SetObjGraphics( IObjGraphics* pOGr)
|
||||
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
|
||||
virtual IObjGraphics* GetObjGraphics( void)
|
||||
|
||||
+5
-5
@@ -383,7 +383,7 @@ GeomDB::InsertGroup( int nId, int nRefId, int nSonBeforeAfter, const Frame3d& fr
|
||||
// assegno identificativo
|
||||
pGdbGroup->m_nId = nId ;
|
||||
// assegno riferimento
|
||||
pGdbGroup->m_gfrFrame.Set( frFrame) ;
|
||||
pGdbGroup->SetFrame( frFrame) ;
|
||||
// inserisco nel DB
|
||||
if ( ! InsertInGeomDB( pGdbGroup, nRefId, nSonBeforeAfter)) {
|
||||
delete pGdbGroup ;
|
||||
@@ -531,8 +531,8 @@ GeomDB::GetGeoObj( int nId)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGeoFrame3d*
|
||||
GeomDB::GetGeoFrame( int nId)
|
||||
Frame3d*
|
||||
GeomDB::GetGroupFrame( int nId)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
@@ -540,7 +540,7 @@ GeomDB::GetGeoFrame( int nId)
|
||||
return nullptr ;
|
||||
|
||||
// restituisco il suo riferimento
|
||||
return &(pGdbGroup->m_gfrFrame) ;
|
||||
return &(pGdbGroup->GetFrame()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -553,7 +553,7 @@ GeomDB::GetGroupFrame( int nId, Frame3d& frGrp) const
|
||||
return false ;
|
||||
|
||||
// copio il riferimento
|
||||
frGrp = pGdbGroup->m_gfrFrame.GetFrame() ;
|
||||
frGrp = pGdbGroup->GetFrame() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class GeomDB : public IGeomDB
|
||||
virtual int GetPrev( int nId) const ;
|
||||
virtual int GetGdbType( int nId) const ;
|
||||
virtual IGeoObj* GetGeoObj( int nId) ;
|
||||
virtual IGeoFrame3d* GetGeoFrame( int nId) ;
|
||||
virtual Frame3d* GetGroupFrame( int nId) ;
|
||||
virtual bool GetGroupFrame( int nId, Frame3d& frGrp) const ;
|
||||
virtual bool GetGroupGlobFrame( int nId, Frame3d& frGlob) const ;
|
||||
virtual int GetGroupObjs( int nId) const ;
|
||||
|
||||
Reference in New Issue
Block a user