EgtGraphics 1.5k3 :
- insieme con punto snap si prende la direzione e l'id dell'oggetto generatore - si marca anche l'inizio delle curve, quando richiesto.
This commit is contained in:
+137
-3
@@ -31,6 +31,9 @@ using namespace std ;
|
||||
bool
|
||||
Scene::GetGraphicSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Point3d& ptSel)
|
||||
{
|
||||
// reset dati associati a ultimo punto snap
|
||||
m_nLastSnapId = GDB_ID_NULL ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
// se Snap Sketch o Grid, devo trovare il punto sulla griglia
|
||||
if ( nSnap == SP_SKETCH || nSnap == SP_GRID)
|
||||
return GetGridSnapPoint( ( nSnap == SP_SKETCH), ptWin, ptSel) ;
|
||||
@@ -139,6 +142,8 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
}
|
||||
}
|
||||
// se vettore
|
||||
@@ -151,6 +156,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pGV->GetVector() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// se frame
|
||||
@@ -163,12 +172,24 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
}
|
||||
}
|
||||
// se curva
|
||||
else if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( m_pGeomDB->GetGeoObj( nIds[i])) ;
|
||||
// recupero eventuale spessore di estrusione
|
||||
bool bExtr = false ;
|
||||
double dTh ;
|
||||
Vector3d vtExtr ;
|
||||
if ( pCrv->GetExtrusion( vtExtr) && ! vtExtr.IsSmall() &&
|
||||
pCrv->GetThickness( dTh) && fabs( dTh) > EPS_SMALL) {
|
||||
vtExtr *= dTh ;
|
||||
vtExtr.ToGlob( frEnt) ;
|
||||
bExtr = true ;
|
||||
}
|
||||
// recupero il punto
|
||||
Point3d ptP ;
|
||||
switch ( nSnap) {
|
||||
@@ -179,6 +200,24 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetStartDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
m_vtLastSnapDir.Invert() ;
|
||||
}
|
||||
// eventuale verifica dell'estruso
|
||||
if ( bExtr) {
|
||||
ptP += vtExtr ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetStartDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
m_vtLastSnapDir.Invert() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// punto finale
|
||||
@@ -187,6 +226,22 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetEndDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
// eventuale verifica dell'estruso
|
||||
if ( bExtr) {
|
||||
ptP += vtExtr ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetEndDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@@ -196,6 +251,22 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetMidDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
// eventuale verifica dell'estruso
|
||||
if ( bExtr) {
|
||||
ptP += vtExtr ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
pCrv->GetMidDir( m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@@ -205,6 +276,18 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
}
|
||||
// eventuale verifica dell'estruso
|
||||
if ( bExtr) {
|
||||
ptP += vtExtr ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@@ -217,16 +300,45 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
// lo porto nel frame della curva
|
||||
ptRef.ToLoc( frEnt) ;
|
||||
// determino il punto più vicino della curva a questo
|
||||
int nFlag ;
|
||||
MinDistPCInfo mdInfo ;
|
||||
DistPointCurve dstPtCurve( ptRef, *pCrv) ;
|
||||
if ( dstPtCurve.GetMinDistPoint( 0, ptP, nFlag)) {
|
||||
if ( dstPtCurve.GetMinDistInfo( 0, mdInfo)) {
|
||||
ptP = mdInfo.ptQ ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
Point3d ptTmp ;
|
||||
pCrv->GetPointTang( mdInfo.dPar, ICurve::FROM_MINUS, ptTmp, m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
} break ;
|
||||
// eventuale verifica dell'estruso
|
||||
if ( bExtr) {
|
||||
Vector3d vtTemp = - vtExtr ;
|
||||
vtTemp.ToLoc( frEnt) ;
|
||||
// determino il punto più vicino della curva a questo
|
||||
MinDistPCInfo mdInfo ;
|
||||
DistPointCurve dstPtCurve( ptRef, *pCrv) ;
|
||||
if ( dstPtCurve.GetMinDistInfo( 0, mdInfo)) {
|
||||
ptP = mdInfo.ptQ ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
ptP += vtExtr ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
Point3d ptTmp ;
|
||||
pCrv->GetPointTang( mdInfo.dPar, ICurve::FROM_MINUS, ptTmp, m_vtLastSnapDir) ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// se testo
|
||||
@@ -243,6 +355,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pTxt->GetDirVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto sopra iniziale
|
||||
@@ -251,6 +367,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pTxt->GetDirVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto finale
|
||||
@@ -259,6 +379,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pTxt->GetDirVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto sopra finale
|
||||
@@ -267,6 +391,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pTxt->GetDirVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@@ -277,6 +405,10 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pTxt->GetDirVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@@ -287,6 +419,8 @@ Scene::GetSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Po
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
ptSel = ptP ;
|
||||
m_nLastSnapId = nIds[i] ;
|
||||
m_bLastSnapDirOk = false ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
Reference in New Issue
Block a user