EgtGraphics :
- gestione punti notevoli delle quotature.
This commit is contained in:
+105
@@ -27,6 +27,7 @@
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGkExtDimension.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkIntersLinePlane.h"
|
||||
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
||||
@@ -358,6 +359,14 @@ Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH)
|
||||
if ( FindTextSnapPoint( nSnap, ptWin, nId, frEnt, pTxt, dMinSqDist))
|
||||
bFound = true ;
|
||||
}
|
||||
// se quotatura
|
||||
else if ( pGObj->GetType() == EXT_DIMENSION) {
|
||||
// recupero la quotatura
|
||||
const IExtDimension* pDim = GetExtDimension( pGObj) ;
|
||||
// verifico i punti notevoli della quotatura
|
||||
if ( FindDimensionSnapPoint( nSnap, ptWin, nId, frEnt, pDim, dMinSqDist))
|
||||
bFound = true ;
|
||||
}
|
||||
}
|
||||
return bFound ;
|
||||
}
|
||||
@@ -1191,6 +1200,102 @@ Scene::FindTextSnapPoint( int nSnap, const Point3d& ptWin, int nId, const Frame3
|
||||
return bFound ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Scene::FindDimensionSnapPoint( int nSnap, const Point3d& ptWin, int nId, const Frame3d& frEnt,
|
||||
const IExtDimension* pDim, double& dMinSqDist)
|
||||
{
|
||||
// cerco il punto
|
||||
bool bFound = false ;
|
||||
Point3d ptP ;
|
||||
switch ( nSnap) {
|
||||
case SP_END :
|
||||
// punto iniziale
|
||||
if ( pDim->IsValid()) {
|
||||
ptP = pDim->GetStart() ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto sopra iniziale
|
||||
if ( pDim->IsValid()) {
|
||||
ptP = pDim->GetOverStart() ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto finale
|
||||
if ( pDim->IsValid()) {
|
||||
ptP = pDim->GetEnd() ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
// punto sopra finale
|
||||
if ( pDim->IsValid()) {
|
||||
ptP = pDim->GetOverEnd() ;
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case SP_MID :
|
||||
// punto medio
|
||||
if ( pDim->GetMidPoint( ptP)) {
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case SP_CENTER :
|
||||
case SP_CENTROID :
|
||||
// centro
|
||||
if ( pDim->GetCenterPoint( ptP)) {
|
||||
ptP.ToGlob( frEnt) ;
|
||||
if ( VerifySnapPoint( ptP, ptWin, dMinSqDist)) {
|
||||
bFound = true ;
|
||||
m_nLastSnapId = nId ;
|
||||
m_ptLastSnapPnt = ptP ;
|
||||
m_bLastSnapDirOk = true ;
|
||||
m_vtLastSnapDir = pDim->GetNormVersor() ;
|
||||
m_vtLastSnapDir.ToGlob( frEnt) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
return bFound ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Scene::GetPlaneSnapPoint( const Point3d& ptWin, const Plane3d& plPlane, Point3d& ptSel) const
|
||||
|
||||
Reference in New Issue
Block a user