if ( myOperation != ZOOMVIEW ) {
QPixmap zoomPixmap (imageZoomCursor);
QCursor zoomCursor (zoomPixmap);
- setTransformRequested ( ZOOMVIEW );
- myViewPort->setCursor( zoomCursor );
+ if( setTransformRequested ( ZOOMVIEW ) )
+ myViewPort->setCursor( zoomCursor );
}
}
if ( myOperation != PANVIEW ) {
QCursor panCursor (Qt::SizeAllCursor);
- setTransformRequested ( PANVIEW );
- myViewPort->setCursor( panCursor );
+ if( setTransformRequested ( PANVIEW ) )
+ myViewPort->setCursor( panCursor );
}
}
if ( myOperation != ROTATE ) {
QPixmap rotatePixmap (imageRotateCursor);
QCursor rotCursor (rotatePixmap);
- setTransformRequested ( ROTATE );
- myViewPort->setCursor( rotCursor );
+ if( setTransformRequested ( ROTATE ) )
+ myViewPort->setCursor( rotCursor );
}
}
aView3d->FitAll(0.01, false);
myCursor = cursor(); // save old cursor
myViewPort->fitAll(); // fits view before selecting a new scene center
- setTransformRequested( PANGLOBAL );
- myViewPort->setCursor( glPanCursor );
+ if( setTransformRequested( PANGLOBAL ) )
+ myViewPort->setCursor( glPanCursor );
}
}
if ( myOperation != WINDOWFIT ) {
QCursor handCursor (Qt::PointingHandCursor);
- setTransformRequested ( WINDOWFIT );
- myViewPort->setCursor ( handCursor );
- myCursorIsHand = true;
+ if( setTransformRequested ( WINDOWFIT ) )
+ {
+ myViewPort->setCursor ( handCursor );
+ myCursorIsHand = true;
+ }
}
}
/*!
\brief Start delayed viewer operation.
*/
-void OCCViewer_ViewWindow::setTransformRequested( OperationType op )
+bool OCCViewer_ViewWindow::setTransformRequested( OperationType op )
{
- myOperation = op;
- myViewPort->setMouseTracking( myOperation == NOTHING );
+ bool ok = transformEnabled( op );
+ myOperation = ok ? op : NOTHING;
+ myViewPort->setMouseTracking( myOperation == NOTHING );
+ return ok;
}
-
/*!
\brief Handle mouse move event.
\param theEvent mouse event
{
myEventStarted = bOn;
}
+
+/*!
+ Set enabled state of transformation (rotate, zoom, etc)
+*/
+void OCCViewer_ViewWindow::setTransformEnabled( const OperationType id, const bool on )
+{
+ if( id==NOTHING )
+ return;
+ myStatus.insert( id, on );
+}
+
+/*!
+ \return enabled state of transformation (rotate, zoom, etc)
+*/
+bool OCCViewer_ViewWindow::transformEnabled( const OperationType id ) const
+{
+ if( myStatus.contains( id ) )
+ return myStatus[ id ];
+ return true;
+}
int interactionStyle() const;
void setInteractionStyle( const int );
+ void setTransformEnabled( const OperationType, const bool );
+ bool transformEnabled( const OperationType ) const;
+
public slots:
void onFrontView();
void onViewFitAll();
/* Transformation selected but not started yet */
bool transformRequested() const;
- void setTransformRequested ( OperationType );
+ bool setTransformRequested ( OperationType );
/* Transformation is selected and already started */
bool transformInProcess() const;
QtxRectRubberBand* myRectBand; //!< selection rectangle rubber band
int myInteractionStyle;
+
+ typedef QMap<OperationType, bool> MapOfTransformStatus;
+ MapOfTransformStatus myStatus;
};
#ifdef WIN32