#include "HYDROGUI_PolylineOp.h"
#include "HYDROGUI_SetColorOp.h"
#include "HYDROGUI_ImportGeomObjectOp.h"
+#include "HYDROGUI_ShowHideOp.h"
#include <HYDROData_Image.h>
#include <HYDROData_Profile.h>
HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
+ myActiveOperationMap.clear();
return LightApp_Module::deactivateModule( theStudy );
}
theMenu->addAction( action( EditDigueId ) );
theMenu->addSeparator();
}
+ else if( anIsObstacle )
+ {
+ theMenu->addAction( action( TranslateObstacleId ) );
+ theMenu->addSeparator();
+ }
else if( anIsVisualState && anIsObjectBrowser )
{
theMenu->addAction( action( SaveVisualStateId ) );
HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
if ( aPolylineOp && aPolylineOp->deleteEnabled() )
theMenu->addAction( action( DeleteId ) );
+
+ theMenu->addSeparator();
+ theMenu->addAction( action( SetZLevelId ) );
+ theMenu->addSeparator();
}
if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
theMenu->addAction( action( HideAllId ) );
theMenu->addSeparator();
}
- if ( anIsOCCView || anIsVTKView ) {
+
+ if ( anIsOCCView || anIsVTKView )
+ {
theMenu->addSeparator();
theMenu->addAction( action( CopyViewerPositionId ) );
- myPopupPos = QCursor::pos();
}
}
aViewShapes.append( theShape );
}
+void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
+ const QString& theEntry )
+{
+ if ( !myVTKPrsMap.contains( theViewId ) )
+ return;
+
+ ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+ Handle(HYDROData_Entity) anObject;
+ QString anEntryRef;
+ for ( int i = 0; i < aViewShapes.length(); )
+ {
+ HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+ anObject = aShape->getObject();
+ anEntryRef = HYDROGUI_DataObject::dataObjectEntry( anObject );
+ if ( aShape && (!anObject.IsNull()) && ( anEntryRef == theEntry ) )
+ {
+ delete aShape;
+ aViewShapes.removeAt( i );
+ continue;
+ }
+
+ ++i;
+ }
+
+ // Invalidate global Z range
+ double anInvalidRange[2] = { HYDROGUI_VTKPrs::InvalidZValue(), HYDROGUI_VTKPrs::InvalidZValue() };
+ getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
+}
+
void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
const Handle(HYDROData_Entity)& theObject )
{
bool doShow = false;
HYDROGUI_Displayer* aDisplayer = getDisplayer();
if ( aDisplayer )
- doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, QCursor::pos(), aX, aY, aZ );
+ aDisplayer->SaveCursorViewPosition( theViewWindow );
+ doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, aX, aY, aZ );
if ( doShow )
{
}
/**
- * Get the popup menu position
- * \return the position
+ * Returns stack of active operations;
+ */
+QStack<HYDROGUI_Operation*>& HYDROGUI_Module::getActiveOperations()
+{
+ return myActiveOperationMap;
+}
+
+/**
+ * Returns the module active operation. If the active operation is show/hide,
+ * the method returns the previous operation if it is.
*/
-QPoint HYDROGUI_Module::getPopupPosition() const
+HYDROGUI_Operation* HYDROGUI_Module::activeOperation()
{
- return myPopupPos;
+ HYDROGUI_Operation* anOp = !myActiveOperationMap.empty() ? myActiveOperationMap.top() : 0;
+
+ if ( dynamic_cast<HYDROGUI_ShowHideOp*>( anOp ) )
+ {
+ QVectorIterator<HYDROGUI_Operation*> aVIt( myActiveOperationMap );
+ aVIt.toBack();
+ aVIt.previous(); // skip the top show/hide operation
+ anOp = aVIt.hasPrevious() ? aVIt.previous() : 0;
+ }
+
+ return anOp;
}