#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 );
}
bool anIsObjectCanBeColored = false;
bool isRoot = false;
bool isStreamHasBottom = false;
+ bool anIsBCPolygon = false;
SUIT_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
SUIT_DataOwnerPtrList anOwners;
anIsStricklerTable = true;
else if( anObjectKind == KIND_LAND_COVER_MAP )
anIsLandCoverMap = true;
+ else if (anObjectKind == KIND_BC_POLYGON)
+ anIsBCPolygon = true;
else if( anObjectKind == KIND_STREAM )
{
anIsStream = true;
case KIND_VISUAL_STATE:
theMenu->addAction( action( SaveVisualStateId ) );
break;
+ case KIND_BC_POLYGON:
+ theMenu->addAction( action( ImportBCPolygonId ) );
+ break;
}
theMenu->addSeparator();
}
theMenu->addAction( action( SplitPolylinesId ) );
theMenu->addAction( action( MergePolylinesId ) );
theMenu->addSeparator();
+ theMenu->addAction( action( ShowAttrPolylinesId ) );
+ theMenu->addSeparator();
}
else if( anIsPolyline3D )
{
}
else if (anIsZone)
theMenu->addAction( action( ZoneSetColorId ) );
+ else if (anIsBCPolygon)
+ theMenu->addAction( action( SetBoundaryTypePolygonId ) );
if ( anIsStream || anIsChannel || anIsDigue || anIsObstacle )
{
anIsImmersibleZone || anIsZone || anIsRegion ||
anIsBathymetry || anIsObstacle || anIsStream ||
anIsChannel || anIsDigue || anIsDummyObject3D ||
- anIsValidProfile || anIsGroup || anIsLandCoverMap )
+ anIsValidProfile || anIsGroup || anIsLandCoverMap ||
+ anIsBCPolygon)
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
addPreference( tr( "PREF_VIEWER_AUTO_FITALL" ), viewerGroup,
LightApp_Preferences::Bool, "HYDRO", "auto_fit_all" );
- addPreference( tr( "PREF_VIEWER_AUTOMATIC_ZOOM" ), viewerGroup, LightApp_Preferences::Bool, "HYDRO", "automatic_zoom" );
+ 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,
getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize );
}
}
- else if (theSection == "HYDRO" && thePref == "automatic_zoom")
+ else if (theSection == "HYDRO" && thePref == "zoom_shutoff")
+ {
+ bool aZoomShutoff = resMgr->booleanValue( "HYDRO", "zoom_shutoff" );
+ setAutoZoomToAllViewManagers(!aZoomShutoff);
+ }
+ else if (theSection == "HYDRO" && thePref == "chained_panning")
{
- bool anAutoZoom = resMgr->booleanValue( "HYDRO", "automatic_zoom" );
+ bool aChainedPan = resMgr->booleanValue( "HYDRO", "chained_panning" );
+ if (!aChainedPan)
+ resetViewState();
ViewManagerList aViewManagers = getApp()->viewManagers();
foreach (SUIT_ViewManager* aVMgr, aViewManagers)
{
- if (aVMgr)
- {
- 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(anAutoZoom);
- for (int i = OCCViewer_ViewFrame::MAIN_VIEW; i<=OCCViewer_ViewFrame::TOP_RIGHT; i++)
- {
- OCCViewer_ViewWindow* aV = anOCCViewFrame->getView(i);
- if (aV)
- aV->setAutomaticZoom(anAutoZoom);
- }
- }
- OCCViewer_ViewWindow* anOCCViewWindow = dynamic_cast<OCCViewer_ViewWindow*>( aView );
- if (anOCCViewWindow)
- anOCCViewWindow->setAutomaticZoom(true);
- }
- }
- }
+ 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 );
update( UF_OCCViewer | UF_VTKViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
}
+bool HYDROGUI_Module::isDraggable( const SUIT_DataObject* what ) const
+{
+ return true;
+}
+
+bool HYDROGUI_Module::isDropAccepted( const SUIT_DataObject* where ) const
+{
+
+ return true;
+}
+
+void HYDROGUI_Module::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
+ const int row, Qt::DropAction action )
+{
+ if ( action != Qt::CopyAction && action != Qt::MoveAction )
+ return;
+
+ if (row == -1)
+ return;
+
+ if (where->level() < 2 )
+ return;
+
+ DataObjectList::ConstIterator it = what.constBegin();
+ for (;it != what.constEnd();++it)
+ {
+ if ((*it)->parent() != where)
+ return;
+ }
+
+ it = what.constBegin();
+
+ int i=0;
+ for (;it != what.constEnd();++it)
+ {
+ SUIT_DataObject* objWhat = *it;
+
+ DataObjectList objInSect = where->children();
+
+ //std::list<SUIT_DataObject*> t1 = where->children().toStdList(); //debug
+ int ind = objInSect.indexOf(objWhat);
+ if (ind != -1)
+ {
+ HYDROGUI_DataModel* aModel = getDataModel();
+ int pos = -1;
+ if (ind >= row)
+ {
+ pos = row + i;
+ i++;
+ }
+ else
+ pos = row - 1;
+ where->moveChildPos(objWhat, pos);
+ //std::list<SUIT_DataObject*> t2 = where->children().toStdList(); //debug
+ }
+ }
+
+ getApp()->updateObjectBrowser(true);
+
+}
+
Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const
{
Handle(HYDROData_StricklerTable) aTable;
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);
+ }
+ }
+}
+