EgtGraphics :

- piccola modifica in Snap Punto Intersezione (si preferisce il punto sull'eventuale entità selezionata).
This commit is contained in:
Dario Sassi
2025-01-04 13:02:31 +01:00
parent 2fb3ffb614
commit a357df9cd0
+12 -4
View File
@@ -150,6 +150,8 @@ bool
Scene::FindSelectedIntersectionPoint( const Point3d& ptWin, int nW, int nH)
{
// --- l'intersezione viene calcolata nel piano della griglia ---
// salvo eventuale ultima entità precedentemente selezionata
int nPrevSel = GetFirstSelectedObj() ;
// verifico siano state selezionate delle entità
int nSel ;
Select( ptWin, nW, nH, nSel) ;
@@ -158,17 +160,19 @@ Scene::FindSelectedIntersectionPoint( const Point3d& ptWin, int nW, int nH)
// cerco le prime due curve inquadrate con i loro riferimenti
const ICurve* pCrv[2] ;
Frame3d frEnt[2] ;
int nIds[2] ;
double dWinZ = 0 ;
int nCrvNum = 0 ;
for ( int i = GetFirstSelectedObj() ; i != GDB_ID_NULL && nCrvNum < 2 ; i = GetNextSelectedObj()) {
for ( int nObjId = GetFirstSelectedObj() ; nObjId != GDB_ID_NULL && nCrvNum < 2 ; nObjId = GetNextSelectedObj()) {
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = m_pGeomDB->GetGeoObj( i)) == nullptr)
if ( ( pGObj = m_pGeomDB->GetGeoObj( nObjId)) == nullptr)
continue ;
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
pCrv[nCrvNum] = GetCurve( pGObj) ;
if ( ! m_pGeomDB->GetGlobFrame( i, frEnt[nCrvNum]))
if ( ! m_pGeomDB->GetGlobFrame( nObjId, frEnt[nCrvNum]))
return false ;
nIds[nCrvNum] = nObjId ;
dWinZ += 0.5 * GetSelectedObjWinZ() ;
++ nCrvNum ;
}
@@ -199,7 +203,9 @@ Scene::FindSelectedIntersectionPoint( const Point3d& ptWin, int nW, int nH)
SelfIntersCurve sintC( *pCrv[0]) ;
if ( ! sintC.GetIntersPointNearTo( ptNear, m_ptLastSnapPnt))
return false ;
m_nLastSnapId = nIds[0] ;
m_ptLastSnapPnt.ToGlob( frGrid) ;
m_bLastSnapDirOk = false ;
return true ;
}
// altrimenti due curve, procedo normalmente
@@ -231,9 +237,11 @@ Scene::FindSelectedIntersectionPoint( const Point3d& ptWin, int nW, int nH)
ptNear.ToLoc( frGrid) ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
IntersCurveCurve intCC( *pCrv[0], *pCrv[1], true) ;
if ( ! intCC.GetIntersPointNearTo( 0, ptNear, m_ptLastSnapPnt))
if ( ! intCC.GetIntersPointNearTo( ( nPrevSel == nIds[1] ? 1 : 0), ptNear, m_ptLastSnapPnt))
return false ;
m_nLastSnapId = nIds[0] ;
m_ptLastSnapPnt.ToGlob( frGrid) ;
m_bLastSnapDirOk = false ;
return true ;
}