#include "HYDROGUI_ImportGeomObjectOp.h"
#include "HYDROGUI_ShowHideOp.h"
#include "HYDROGUI_Overview.h"
-
+#include <HYDROGUI_ProfileDlg.h>
#include <HYDROData_Tool.h>
#include <HYDROData_Image.h>
#include <HYDROData_Stream.h>
ViewManagerList anOCCViewManagers;
anApp->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
- foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers )
+ foreach ( SUIT_ViewManager* aViewManager, anOCCViewManagers )
{
connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
connect( aViewManager, SIGNAL( activated( SUIT_ViewManager* ) ),
this, SLOT( onViewActivated( SUIT_ViewManager* ) ) );
+ OCCViewer_ViewManager* occ_mgr = dynamic_cast<OCCViewer_ViewManager*>( aViewManager );
+ if( occ_mgr )
+ {
+ occ_mgr->setChainedOperations( true );//TODO: via preferences
+ }
+
foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() )
{
OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWindow );
}
}
+ preferencesChanged( "HYDRO", "zoom_shutoff" );
+
+ preferencesChanged( "HYDRO", "chained_panning" );
+
// Load GEOM data
SalomeApp_Study* aStudy =
dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
}
}
+
// SUIT_DataBrowser* ob = getApp()->objectBrowser();
// SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( ob->model() );
// treeModel->setAppropriate( SUIT_DataObject::VisibilityId, Qtx::Toggled );
ViewManagerList anOCCViewManagers;
getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
- foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
+ foreach ( SUIT_ViewManager* aViewManager, anOCCViewManagers )
+ {
disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+
+ OCCViewer_ViewManager* occ_mgr = dynamic_cast<OCCViewer_ViewManager*>( aViewManager );
+ if( occ_mgr )
+ {
+ occ_mgr->setChainedOperations( false );
+ setAutoZoom( occ_mgr, true );
+ }
}
/* Issues ## 68, 88.
HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
myActiveOperationMap.clear();
+
+ myViewManagerMap.clear();
+
return LightApp_Module::deactivateModule( theStudy );
}
Handle(HYDROData_Stream) aStream =
Handle(HYDROData_Stream)::DownCast( anObject );
if ( !aStream.IsNull() )
- isStreamHasBottom = !aStream->GetBottomPolyline().IsNull();
+ isStreamHasBottom = !aStream->GetBottomPolyline().IsNull();
}
else if( anObjectKind == KIND_CHANNEL )
anIsChannel = true;
// Check if all selected objects are profiles
anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
- ( aNbOfSelectedProfiles == aSeq.Length() );
+ ( aNbOfSelectedProfiles == aSeq.Length() );
// check the selected partitions
if( !anIsSelectedDataObjects && anIsObjectBrowser )
{
switch( aSelectedPartition )
{
- case KIND_IMAGE:
- theMenu->addAction( action( ImportImageId ) );
- break;
- case KIND_BATHYMETRY:
- theMenu->addAction( action( ImportBathymetryId ) );
- break;
- case KIND_ARTIFICIAL_OBJECT:
- theMenu->addAction( action( CreateChannelId ) );
- theMenu->addAction( action( CreateDigueId ) );
- break;
- case KIND_NATURAL_OBJECT:
- theMenu->addAction( action( CreateImmersibleZoneId ) );
- theMenu->addAction( action( CreateStreamId ) );
- break;
- case KIND_OBSTACLE:
- theMenu->addAction( action( ImportObstacleFromFileId ) );
- theMenu->addAction( action( CreateBoxId ) );
- theMenu->addAction( action( CreateCylinderId ) );
- break;
- case KIND_STRICKLER_TABLE:
- theMenu->addAction( action( ImportStricklerTableFromFileId ) );
- break;
- case KIND_LAND_COVER_MAP:
- theMenu->addAction( action( CreateLandCoverMapId ) );
- theMenu->addAction( action( ImportLandCoverMapId ) );
- break;
- case KIND_CALCULATION:
- theMenu->addAction( action( CreateCalculationId ) );
- break;
- case KIND_POLYLINEXY:
- theMenu->addAction( action( ImportPolylineId ) );
- theMenu->addAction( action( CreatePolylineId ) );
- break;
- case KIND_POLYLINE:
- theMenu->addAction( action( CreatePolyline3DId ) );
- break;
- case KIND_PROFILE:
- theMenu->addAction( action( CreateProfileId ) );
- theMenu->addAction( action( ImportProfilesId ) );
- theMenu->addAction( action( AllGeoreferencementId ) );
- break;
- case KIND_VISUAL_STATE:
- theMenu->addAction( action( SaveVisualStateId ) );
- break;
+ case KIND_IMAGE:
+ theMenu->addAction( action( ImportImageId ) );
+ break;
+ case KIND_BATHYMETRY:
+ theMenu->addAction( action( ImportBathymetryId ) );
+ break;
+ case KIND_ARTIFICIAL_OBJECT:
+ theMenu->addAction( action( CreateChannelId ) );
+ theMenu->addAction( action( CreateDigueId ) );
+ break;
+ case KIND_NATURAL_OBJECT:
+ theMenu->addAction( action( CreateImmersibleZoneId ) );
+ theMenu->addAction( action( CreateStreamId ) );
+ break;
+ case KIND_OBSTACLE:
+ theMenu->addAction( action( ImportObstacleFromFileId ) );
+ theMenu->addAction( action( CreateBoxId ) );
+ theMenu->addAction( action( CreateCylinderId ) );
+ break;
+ case KIND_STRICKLER_TABLE:
+ theMenu->addAction( action( ImportStricklerTableFromFileId ) );
+ break;
+ case KIND_LAND_COVER_MAP:
+ theMenu->addAction( action( CreateLandCoverMapId ) );
+ theMenu->addAction( action( ImportLandCoverMapId ) );
+ break;
+ case KIND_CALCULATION:
+ theMenu->addAction( action( CreateCalculationId ) );
+ break;
+ case KIND_POLYLINEXY:
+ theMenu->addAction( action( ImportPolylineId ) );
+ theMenu->addAction( action( CreatePolylineId ) );
+ break;
+ case KIND_POLYLINE:
+ theMenu->addAction( action( CreatePolyline3DId ) );
+ break;
+ case KIND_PROFILE:
+ theMenu->addAction( action( CreateProfileId ) );
+ theMenu->addAction( action( ImportProfilesId ) );
+ theMenu->addAction( action( AllGeoreferencementId ) );
+ break;
+ case KIND_VISUAL_STATE:
+ theMenu->addAction( action( SaveVisualStateId ) );
+ break;
}
theMenu->addSeparator();
}
+ else
+ {
+ Handle(HYDROData_CalculationCase) aCalcCase;
+ QString outStr;
+ HYDROGUI_Tool::IsSelectedPartOfCalcCase(this, aCalcCase, outStr);
+ if (outStr == HYDROGUI_DataModel::partitionName( KIND_REGION ))
+ theMenu->addAction( action( RegenerateRegionColorsId ) );
+ }
}
if( anIsSelectedDataObjects )
theMenu->addAction( action( EditStreamId ) );
if ( action( RiverBottomContextId ) )
{
- theMenu->addAction( action( RiverBottomContextId ) );
- action( RiverBottomContextId )->setEnabled( !isStreamHasBottom );
+ theMenu->addAction( action( RiverBottomContextId ) );
+ action( RiverBottomContextId )->setEnabled( !isStreamHasBottom );
}
theMenu->addAction( action( ProfileInterpolateId ) );
theMenu->addSeparator();
theMenu->addAction( action( LoadVisualStateId ) );
theMenu->addSeparator();
}
+ else if (anIsZone)
+ theMenu->addAction( action( ZoneSetColorId ) );
if ( anIsStream || anIsChannel || anIsDigue || anIsObstacle )
{
theMenu->addAction( action( SetTransparencyId ) );
theMenu->addSeparator();
}
- } else if ( anAllAreProfiles ) {
+ }
+ else if ( anAllAreProfiles )
+ {
+ theMenu->addAction( action( EditProfileId ) );
theMenu->addAction( action( SelectedGeoreferencementId ) );
theMenu->addSeparator();
}
theMenu->addSeparator();
if( anIsImage || anIsPolyline || anIsPolyline3D ||
- anIsImmersibleZone || anIsZone || anIsRegion ||
- anIsBathymetry || anIsObstacle || anIsStream ||
- anIsChannel || anIsDigue || anIsDummyObject3D ||
- anIsValidProfile || anIsGroup || anIsLandCoverMap )
+ anIsImmersibleZone || anIsZone || anIsRegion ||
+ anIsBathymetry || anIsObstacle || anIsStream ||
+ anIsChannel || anIsDigue || anIsDummyObject3D ||
+ anIsValidProfile || anIsGroup || anIsLandCoverMap )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
theMenu->addAction( action( HideAllId ) );
theMenu->addSeparator();
}
-
+
if ( anIsOCCView || anIsVTKView )
{
theMenu->addSeparator();
addPreference( tr( "PREF_VIEWER_AUTO_FITALL" ), viewerGroup,
LightApp_Preferences::Bool, "HYDRO", "auto_fit_all" );
+ addPreference( tr( "PREF_VIEWER_ZOOM_SHUTOFF" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "zoom_shutoff" );
+
+ addPreference( tr( "PREF_VIEWER_CHAINED_PANNING" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "chained_panning" );
+
int StricklerTableGroup = addPreference( tr( "PREF_GROUP_STRICKLER_TABLE" ), genTab );
int defaultStricklerCoef = addPreference( tr( "PREF_DEFAULT_STRICKLER_COEFFICIENT" ), StricklerTableGroup,
LightApp_Preferences::DblSpin, "preferences", "default_strickler_coefficient" );
getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize );
}
}
+ else if (theSection == "HYDRO" && thePref == "zoom_shutoff")
+ {
+ bool aZoomShutoff = resMgr->booleanValue( "HYDRO", "zoom_shutoff" );
+ setAutoZoomToAllViewManagers(!aZoomShutoff);
+ }
+ else if (theSection == "HYDRO" && thePref == "chained_panning")
+ {
+ bool aChainedPan = resMgr->booleanValue( "HYDRO", "chained_panning" );
+ if (!aChainedPan)
+ resetViewState();
+ ViewManagerList aViewManagers = getApp()->viewManagers();
+ foreach (SUIT_ViewManager* aVMgr, aViewManagers)
+ {
+ OCCViewer_ViewManager* anOCCViewMgr = dynamic_cast<OCCViewer_ViewManager*>( aVMgr );
+ if (anOCCViewMgr)
+ anOCCViewMgr->setChainedOperations( aChainedPan );
+ }
+
+ QList<QDockWidget*> docW = getApp()->desktop()->findChildren<QDockWidget*>();
+ foreach (QDockWidget* qw, docW)
+ {
+ HYDROGUI_ProfileDlg* pdlg = dynamic_cast<HYDROGUI_ProfileDlg*>(qw);
+ if (pdlg)
+ pdlg->viewManager()->setChainedOperations(aChainedPan);
+ }
+ }
else
- LightApp_Module::preferencesChanged( theSection, thePref );
+ LightApp_Module::preferencesChanged( theSection, thePref );
}
QCursor HYDROGUI_Module::getPrefEditCursor() const
setUpdateEnabled( true );
+ preferencesChanged( "HYDRO", "zoom_shutoff" );
+
+ preferencesChanged( "HYDRO", "chained_panning" );
+
QApplication::restoreOverrideCursor();
}
else if( theViewManager->getType() == OCCViewer_Viewer::Type() )
{
OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>( theViewManager );
- mgr->setChainedOperations( true );//TODO: via preferences
+ //mgr->setChainedOperations( true );
connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
aViewFrame->onTopView();
HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
-
OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort();
if ( aViewPort ) {
aViewPort->installEventFilter( this );
while( anIdIter.hasNext() )
{
theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
+ myOverview->setTopView();
}
}
myOverview->setMainView( occwnd );
}
+
+void HYDROGUI_Module::setAutoZoomToAllViewManagers(bool bAutoZoom)
+{
+ ViewManagerList aViewManagers = getApp()->viewManagers();
+ foreach (SUIT_ViewManager* aVMgr, aViewManagers)
+ setAutoZoom(aVMgr, bAutoZoom);
+}
+
+void HYDROGUI_Module::setAutoZoom(SUIT_ViewManager* aVMgr, bool bAutoZoom)
+{
+ if (!aVMgr)
+ return;
+ QVector<SUIT_ViewWindow*> aViews = aVMgr->getViews();
+ foreach (SUIT_ViewWindow* aView, aViews)
+ {
+ if (aView)
+ {
+ OCCViewer_ViewFrame* anOCCViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aView );
+ if (anOCCViewFrame)
+ {
+ anOCCViewFrame->setAutomaticZoom(bAutoZoom);
+ for (int i = OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++)
+ {
+ OCCViewer_ViewWindow* aV = anOCCViewFrame->getView(i);
+ if (aV)
+ aV->setAutomaticZoom(bAutoZoom);
+ }
+ }
+ OCCViewer_ViewWindow* anOCCViewWindow = dynamic_cast<OCCViewer_ViewWindow*>( aView );
+ if (anOCCViewWindow)
+ anOCCViewWindow->setAutomaticZoom(bAutoZoom);
+ }
+ }
+}
+