EgtGraphics :

- gestione punti notevoli delle quotature.
This commit is contained in:
Dario Sassi
2020-01-02 08:26:55 +00:00
parent a7bc25e723
commit 43e1db36fa
3 changed files with 154 additions and 2 deletions
+5 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2014
// EgalTech 2014-2020
//----------------------------------------------------------------------------
// File : Scene.h Data : 03.02.14 Versione : 1.5b1
// File : Scene.h Data : 02.01.20 Versione : 2.2a1
// Contenuto : Dichiarazione della classe gestione scena.
//
//
@@ -26,6 +26,7 @@ class ISurfTriMesh ;
class ISurfFlatRegion ;
class IVolZmap ;
class IExtText ;
class IExtDimension ;
class ObjEGrGraphics ;
//----------------------------------------------------------------------------
@@ -269,6 +270,8 @@ class Scene : public IEGrScene
const IVolZmap* pVzm, double& dMinSqDist) ;
bool FindTextSnapPoint( int nSnap, const Point3d& ptWin, int nId, const Frame3d& frEnt,
const IExtText* pTxt, double& dMinSqDist) ;
bool FindDimensionSnapPoint( int nSnap, const Point3d& ptWin, int nId, const Frame3d& frEnt,
const IExtDimension* pDim, double& dMinSqDist) ;
private :
// Basic
+44
View File
@@ -25,6 +25,7 @@
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkExtDimension.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkGdbConst.h"
@@ -458,5 +459,48 @@ Scene::GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, in
ptSel = ptP ;
}
}
// se quotatura
else if ( pGObj->GetType() == EXT_DIMENSION) {
// recupero la quotatura
const IExtDimension* pDim = GetExtDimension( pGObj) ;
// verifico sia valida
if ( pDim->IsValid()) {
// cerco il punto
double dMinSqDist = INFINITO * INFINITO ;
Point3d ptP ;
// punto iniziale
ptP = pDim->GetStart() ;
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
// punto sopra iniziale
ptP = pDim->GetOverStart() ;
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
// punto finale
ptP = pDim->GetEnd() ;
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
// punto sopra finale
ptP = pDim->GetOverEnd() ;
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
// punto medio
if ( pDim->GetMidPoint( ptP)) {
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
}
// centro
if ( pDim->GetCenterPoint( ptP)) {
ptP.ToGlob( frEnt) ;
if ( VerifySnapPoint( ptP, ptView, dMinSqDist))
ptSel = ptP ;
}
}
}
return true ;
}
+105
View File
@@ -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