diff --git a/EgtGraphics.rc b/EgtGraphics.rc index c9df39c..a04bef4 100644 Binary files a/EgtGraphics.rc and b/EgtGraphics.rc differ diff --git a/Scene.h b/Scene.h index 253df8f..00ea4a3 100644 --- a/Scene.h +++ b/Scene.h @@ -78,17 +78,6 @@ class Scene : public IEGrScene virtual bool Resize( int nW, int nH) ; virtual bool SetBackground( Color colBackTop, Color colBackBottom) ; virtual bool Draw( void) ; - virtual bool Select( const Point3d& ptView, int nW, int nH, int& nSel) ; - virtual bool UnselectableAdd( int nId) ; - virtual bool UnselectableRemove( int nId) ; - virtual bool UnselectableClearAll( void) ; - virtual bool UnselectableFind( int nId) ; - virtual bool GetSelectedObjs( INTVECTOR& nIds) ; - virtual int GetFirstSelectedObj( void) ; - virtual int GetNextSelectedObj( void) ; - virtual double GetSelectedObjWinZ( int nSel = - 1) ; - virtual double GetSelectedObjMinWinZ( int nSel = - 1) ; - virtual bool GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, int& nAux) ; virtual bool Project( const Point3d& ptWorld, Point3d& ptView) ; virtual bool UnProject( const Point3d& ptView, Point3d& ptWorld) ; virtual void Destroy( void) ; @@ -146,8 +135,21 @@ class Scene : public IEGrScene virtual bool SetWinRectAttribs( bool bOutline, Color WRcol) ; virtual bool SetWinRect( const Point3d& ptWinRectP1, const Point3d& ptWinRectP2) ; virtual bool ResetWinRect( void) ; + // Select + virtual bool Select( const Point3d& ptView, int nW, int nH, int& nSel) ; + virtual bool SetObjFilterForSelect( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra) ; + virtual bool UnselectableAdd( int nId) ; + virtual bool UnselectableRemove( int nId) ; + virtual bool UnselectableClearAll( void) ; + virtual bool UnselectableFind( int nId) ; + virtual bool GetSelectedObjs( INTVECTOR& nIds) ; + virtual int GetFirstSelectedObj( void) ; + virtual int GetNextSelectedObj( void) ; + virtual double GetSelectedObjWinZ( int nSel = - 1) ; + virtual double GetSelectedObjMinWinZ( int nSel = - 1) ; + virtual bool GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, int& nAux) ; // Snap - virtual bool SetObjFilterForSnap( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra) ; + // anche per lo snap valgono SetObjFilterForSelect e Unselectable* virtual bool GetGraphicSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Point3d& ptSel) ; virtual bool GetGridSnapPointZ( bool bSketch, const Point3d& ptWin, const Point3d& ptGrid, Point3d& ptSel) ; virtual int GetLastSnapId( void) @@ -244,6 +246,7 @@ class Scene : public IEGrScene bool m_bShowTriaAdvanced ; // flag per abilitare la visualizzazione avanzata dei triangoli // Selection bool m_bSelect ; // flag di selezione attiva + int m_nObjFilterForSelect ; // tipi di oggetti che possono essere selezionati INTVECTOR m_Unsel ; // vettore indici oggetti non selezionabili Point3d m_ptSelCent ; // centro di selezione int m_nSelW ; // larghezza finestra di selezione @@ -253,7 +256,7 @@ class Scene : public IEGrScene static const int DIM_SEL_BUF = 32768 ; SelRec m_nSelBuff[DIM_SEL_BUF] ; // buffer per selezione con OpenGL // Snap - int m_nObjFilterForSnap ; // tipi di oggetti che possono essere sorgenti di snap point + // lo snap a oggetti usa la select, quindi anche per esso valgono m_nObjFilterForSelect e m_Unsel int m_nLastSnapId ; // Id dell'entità generatrice dell'ultimo punto snap Point3d m_ptLastSnapPnt ; // ultimo punto di snap bool m_bLastSnapDirOk ; // flag validità direzione associata a ultimo punto snap diff --git a/SceneBasic.cpp b/SceneBasic.cpp index 4ea4f9c..84c70ff 100644 --- a/SceneBasic.cpp +++ b/SceneBasic.cpp @@ -60,10 +60,10 @@ Scene::Scene( void) m_bShowTriaAdvanced = true ; // Selezione m_bSelect = false ; + m_nObjFilterForSelect = GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA ; m_Unsel.reserve( 50) ; - m_nSelCurr = - 1 ; + m_nSelCurr = GDB_ID_NULL ; // Snap Punti - m_nObjFilterForSnap = GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA ; m_nLastSnapId = GDB_ID_NULL ; m_bLastSnapDirOk = false ; // GeomData diff --git a/SceneGeom.cpp b/SceneGeom.cpp index 0c1a0b5..39d503e 100644 --- a/SceneGeom.cpp +++ b/SceneGeom.cpp @@ -366,9 +366,14 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj) return true ; } - // se in selezione, carico il nome - if ( m_bSelect) + // se in selezione + if ( m_bSelect) { + // vaglio per il filtro di tipo + if ( ( nGeoType & m_nObjFilterForSelect) == 0) + return true ; + // carico il nome glLoadName( iIter.GetId()) ; + } // eseguo visualizzazione return pGraphics->Draw( siObj.nStat, siObj.nMark, bSurfSha, nAlpha, bShowAux) ; diff --git a/SceneSelect.cpp b/SceneSelect.cpp index c5d4565..edf3f3d 100644 --- a/SceneSelect.cpp +++ b/SceneSelect.cpp @@ -109,6 +109,24 @@ Scene::Select( const Point3d& ptSelCenter, int nW, int nH, int& nSel) return true ; } +//---------------------------------------------------------------------------- +bool +Scene::SetObjFilterForSelect( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra) +{ + m_nObjFilterForSelect = 0 ; + if ( bZerodim) + m_nObjFilterForSelect |= GEO_ZERODIM ; + if ( bCurve) + m_nObjFilterForSelect |= GEO_CURVE ; + if ( bSurf) + m_nObjFilterForSelect |= GEO_SURF ; + if ( bVolume) + m_nObjFilterForSelect |= GEO_VOLUME ; + if ( bExtra) + m_nObjFilterForSelect |= GEO_EXTRA ; + return true ; +} + //---------------------------------------------------------------------------- bool Scene::GetSelectedObjs( INTVECTOR& nIds) diff --git a/SceneSnap.cpp b/SceneSnap.cpp index a56a163..dbc2e3d 100644 --- a/SceneSnap.cpp +++ b/SceneSnap.cpp @@ -32,24 +32,6 @@ using namespace std ; -//---------------------------------------------------------------------------- -bool -Scene::SetObjFilterForSnap( bool bZerodim, bool bCurve, bool bSurf, bool bVolume, bool bExtra) -{ - m_nObjFilterForSnap = 0 ; - if ( bZerodim) - m_nObjFilterForSnap |= GEO_ZERODIM ; - if ( bCurve) - m_nObjFilterForSnap |= GEO_CURVE ; - if ( bSurf) - m_nObjFilterForSnap |= GEO_SURF ; - if ( bVolume) - m_nObjFilterForSnap |= GEO_VOLUME ; - if ( bExtra) - m_nObjFilterForSnap |= GEO_EXTRA ; - return true ; -} - //---------------------------------------------------------------------------- bool Scene::GetGraphicSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH, Point3d& ptSel) @@ -222,7 +204,7 @@ Scene::FindSelectedIntersectionPoint( const Point3d& ptWin, int nW, int nH) bool Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH) { - // verifico siano state selezionate delle entità + // seleziono e verifico siano state selezionate delle entità int nSel ; Select( ptWin, nW, nH, nSel) ; if ( nSel <= 0) @@ -239,8 +221,8 @@ Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH) Frame3d frEnt ; if ( ! m_pGeomDB->GetGlobFrame( nId, frEnt)) continue ; - // se punto e abilitato - if ( pGObj->GetType() == GEO_PNT3D && ( m_nObjFilterForSnap & GEO_ZERODIM) != 0) { + // se punto + if ( pGObj->GetType() == GEO_PNT3D) { // recupero il geo-punto const IGeoPoint3d* pGP = GetGeoPoint3d( pGObj) ; // recupero il punto @@ -253,8 +235,8 @@ Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH) m_bLastSnapDirOk = false ; } } - // se vettore e abilitato - else if ( pGObj->GetType() == GEO_VECT3D && ( m_nObjFilterForSnap & GEO_ZERODIM) != 0) { + // se vettore + else if ( pGObj->GetType() == GEO_VECT3D) { // recupero il geo-vettore const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ; // recupero il punto base @@ -269,8 +251,8 @@ Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH) m_vtLastSnapDir.ToGlob( frEnt) ; } } - // se frame e abilitato - else if ( pGObj->GetType() == GEO_FRAME3D && ( m_nObjFilterForSnap & GEO_ZERODIM) != 0) { + // se frame + else if ( pGObj->GetType() == GEO_FRAME3D) { // recupero il geo-frame const IGeoFrame3d* pGF = GetGeoFrame3d( pGObj) ; // recupero l'origine del riferimento @@ -283,32 +265,32 @@ Scene::FindSelectedSnapPoint( int nSnap, const Point3d& ptWin, int nW, int nH) m_bLastSnapDirOk = false ; } } - // se curva composita e abilitata - else if ( pGObj->GetType() == CRV_COMPO && ( m_nObjFilterForSnap & GEO_CURVE) != 0) { + // se curva composita + else if ( pGObj->GetType() == CRV_COMPO) { // recupero la curva composita const ICurveComposite* pCrvCompo = GetCurveComposite( pGObj) ; // verifico i punti notevoli della curva composita if ( FindCurveCompoSnapPoint( nSnap, ptWin, nId, frEnt, pCrvCompo, dMinSqDist)) bFound = true ; } - // se curva semplice e abilitata - else if ( ( pGObj->GetType() & GEO_CURVE) != 0 && ( m_nObjFilterForSnap & GEO_CURVE) != 0) { + // se curva semplice + else if ( ( pGObj->GetType() & GEO_CURVE) != 0) { // recupero la curva const ICurve* pCrv = GetCurve( pGObj) ; // verifico i punti notevoli della curva if ( FindCurveSnapPoint( nSnap, ptWin, nId, frEnt, pCrv, dMinSqDist)) bFound = true ; } - // se superficie trimesh e abilitata - else if ( pGObj->GetType() == SRF_TRIMESH && ( m_nObjFilterForSnap & GEO_SURF) != 0) { + // se superficie trimesh + else if ( pGObj->GetType() == SRF_TRIMESH) { // recupero la superficie const ISurfTriMesh* pStm = GetSurfTriMesh( pGObj) ; // verifico i punti notevoli della superficie if ( FindSurfTMSnapPoint( nSnap, ptWin, nId, frEnt, pStm, dMinSqDist)) bFound = true ; } - // se testo e abilitato - else if ( pGObj->GetType() == EXT_TEXT && ( m_nObjFilterForSnap & GEO_EXTRA) != 0) { + // se testo + else if ( pGObj->GetType() == EXT_TEXT) { // recupero il testo const IExtText* pTxt = GetExtText( pGObj) ; // verifico i punti notevoli del testo