case QEvent::Wheel:
{
QWheelEvent* aEvent = (QWheelEvent*) e;
- myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() );
- double delta = (double)( aEvent->delta() ) / ( 15 * 8 );
- int x = aEvent->x();
- int y = aEvent->y();
- int x1 = (int)( aEvent->x() + width()*delta/100 );
- int y1 = (int)( aEvent->y() + height()*delta/100 );
- myViewPort->zoom( x, y, x1, y1 );
- myViewPort->getView()->ZFitAll();
+
+ if ( aEvent->modifiers().testFlag(Qt::ControlModifier) ) {
+ Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
+ if ( ic->HasOpenedContext() ) {
+ if ( aEvent->delta() > 0 ) {
+ ic->HilightNextDetected( myViewPort->getView() );
+ } else {
+ ic->HilightPreviousDetected( myViewPort->getView() );
+ }
+ }
+ } else {
+ myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() );
+ double delta = (double)( aEvent->delta() ) / ( 15 * 8 );
+ int x = aEvent->x();
+ int y = aEvent->y();
+ int x1 = (int)( aEvent->x() + width()*delta/100 );
+ int y1 = (int)( aEvent->y() + height()*delta/100 );
+ myViewPort->zoom( x, y, x1, y1 );
+ myViewPort->getView()->ZFitAll();
+ }
}
return true;
return myEntry.c_str();
}
+/*!
+ Dispatches operation of activation of sub-shapes selection
+*/
+void SALOME_Prs::LocalSelectionIn( SALOME_View*, const std::list<int> ) const
+{
+ // base implementation does nothing
+}
+
/*!
Dispatches display operation to proper Display() method of SALOME_View
*/
*/
void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
- if ( v ) v->LocalSelection( this, mode );
+ std::list<int> modes;
+ modes.push_back( mode );
+ LocalSelectionIn( v, modes );
+}
+
+/*!
+ Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
+{
+ if ( v && !modes.empty() ) v->LocalSelection( this, modes );
}
/*!
*/
void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
{
- prs->LocalSelectionIn( this, mode );
+ std::list<int> modes;
+ modes.push_back( mode );
+ LocalSelection( prs, modes );
+}
+
+/*!
+ Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_View::LocalSelection( const SALOME_Prs* prs, const std::list<int> modes )
+{
+ prs->LocalSelectionIn( this, modes );
}
/*!
// Probably, selection is being activated in uncompatible viewframe." );
}
+/*!
+ Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const std::list<int> )
+{
+// MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
+// Probably, selection is being activated in uncompatible viewframe." );
+}
+
/*!
Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
*/
class Handle_SALOME_InteractiveObject;
#include <string>
+#include <list>
/*!
\class SALOME_Prs
//! Key method for double dispatch of activation of sub-shapes selection
virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
+ virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
// checks if shape is clippable
inline bool IsClippable() const
//! Key method for double dispatch of activation of sub-shapes selection
virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+ virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
};
/*!
//! created anywhere by anybody. It simply passes control to SALOME_Prs object
//! so that it could perform double dispatch.
void LocalSelection( const SALOME_Prs*, const int );
+ void LocalSelection( const SALOME_Prs*, const std::list<int> );
// Interface for derived views
// Add new Erase() methods here...
// LocalSelection() methods for ALL kinds of presentation should appear here
- virtual void LocalSelection( const SALOME_OCCPrs*, const int );//!< Local selection SALOME_OCCPrs
- virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
- virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
+ virtual void LocalSelection( const SALOME_OCCPrs*, const int ); //!< Local selection SALOME_OCCPrs
+ virtual void LocalSelection( const SALOME_OCCPrs*, const std::list<int> );//!< Multiple local selection SALOME_OCCPrs
+ virtual void LocalSelection( const SALOME_VTKPrs*, const int ); //!< Local selection SALOME_VTKPrs
+ virtual void LocalSelection( const SALOME_Prs2d* , const int ); //!< Local selection SALOME_Prs2d
//! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
virtual void GlobalSelection( const bool = false ) const;
/*!
Activates selection of sub-shapes
*/
-void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
+void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const std::list<int> modes )
{
Handle(AIS_InteractiveContext) ic = getAISContext();
Handle(AIS_InteractiveObject) anAIS = aIter.Value();
if ( !anAIS.IsNull() )
{
+ std::list<int>::const_iterator it;
if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
{
ic->Load( anAIS, -1, false );
- ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
+ for( it = modes.begin(); it != modes.end(); ++it )
+ ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)*it ) );
}
else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
{
ic->Load( anAIS, -1, false );
- ic->Activate( anAIS, theMode );
+ for( it = modes.begin(); it != modes.end(); ++it )
+ ic->Activate( anAIS, *it );
}
}
}
}
+/*!
+ Activates selection of sub-shapes
+*/
+void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
+{
+ std::list<int> modes;
+ modes.push_back( theMode );
+ LocalSelection( thePrs, modes );
+}
+
/*!
Deactivates selection of sub-shapes
*/
virtual SALOME_Prs* CreatePrs( const char* entry = 0 );
virtual void LocalSelection( const SALOME_OCCPrs*, const int );
+ virtual void LocalSelection( const SALOME_OCCPrs*, const std::list<int> );
virtual void GlobalSelection( const bool = false ) const;
virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
virtual void GetVisible( SALOME_ListIO& );