myIsRelative(true),
myTopLayerId( 0 ),
myTrihedronSize(100),
- myClippingDlg (NULL)
+ myClippingDlg (NULL),
+ myIsUseLocalSelection(false)
{
// init CasCade viewers
myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() );
break;
case Qt::Key_N:
if ( isPreselectionEnabled() ) {
- if ( getAISContext()->HasOpenedContext() )
+ if ( useLocalSelection() )
getAISContext()->HilightNextDetected( aView->getViewPort()->getView() );
}
break;
return new OCCViewer_ViewWindow(0, this);
}
+/*!
+ Sets using local selection state
+ \param theIsUseLocalSelection - state
+*/
+void OCCViewer_Viewer::setUseLocalSelection(bool theIsUseLocalSelection)
+{
+ myIsUseLocalSelection = theIsUseLocalSelection;
+}
+
+/*
+ * Returns true if local context is opened or view model local state is set
+ */
+bool OCCViewer_Viewer::useLocalSelection() const
+{
+ if (myIsUseLocalSelection)
+ return true;
+
+ Handle(AIS_InteractiveContext) ic = getAISContext();
+ return !ic.IsNull() && ic->HasOpenedContext();
+}
+
// obsolete
QColor OCCViewer_Viewer::backgroundColor( int theViewId ) const
{
virtual OCCViewer_ViewWindow* createSubWindow();
+ void setUseLocalSelection(bool theIsUseLocalSelection);
+ bool useLocalSelection() const;
+
public:
Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;}
Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; }
QString myClippingTexture;
bool myTextureModulated;
double myClippingTextureScale;
-
+ bool myIsUseLocalSelection;
};
#ifdef WIN32
if ( aEvent->modifiers().testFlag(Qt::ControlModifier) ) {
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
- if ( isPreselectionEnabled() && ic->HasOpenedContext() ) {
+ if ( isPreselectionEnabled() && myModel->useLocalSelection() ) {
if ( aEvent->delta() > 0 ) {
ic->HilightNextDetected( myViewPort->getView() );
} else {