X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_Module.cxx;h=ff3959f267518b6b619f3cc291fb039f2afd1913;hb=5cae7e874afd2fc1b6f61023e8ebd33a933db3c7;hp=4c2a2cc5e2202f8120d62a027cc4b18585a1c240;hpb=0c405019de08dccfacd64f71f18211cbe912cc1d;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 4c2a2cc5..ff3959f2 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -29,6 +29,7 @@ #include "HYDROGUI_InputPanel.h" #include "HYDROGUI_ObjSelector.h" #include "HYDROGUI_OCCDisplayer.h" +#include "HYDROGUI_OCCSelector.h" #include "HYDROGUI_Operations.h" #include "HYDROGUI_PrsImage.h" #include "HYDROGUI_Tool.h" @@ -36,8 +37,9 @@ #include "HYDROGUI_Shape.h" #include +#include -#include +#include #include #include @@ -204,14 +206,14 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsMustBeUpdatedImage = false; bool anIsPolyline = false; bool anIsCalculation = false; - bool anIsZone = false; + bool anIsImmersibleZone = false; bool anIsVisualState = false; // check the selected data model objects HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this ); for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ ) { - Handle(HYDROData_Object) anObject = aSeq.Value( anIndex ); + Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex ); if( !anObject.IsNull() ) { anIsSelectedDataObjects = true; @@ -226,9 +228,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject ); if( !anImage.IsNull() ) { - anIsImportedImage = anImage->HasTrsfPoints() && !anImage->IsSelfSplitted(); + anIsImportedImage = anImage->HasLocalPoints() && !anImage->IsSelfSplitted(); anIsCompositeImage = anImage->NbReferences() > 0; - if( HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory() ) + if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() ) { if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) ) { @@ -248,8 +250,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsPolyline = true; else if( anObject->GetKind() == KIND_CALCULATION ) anIsCalculation = true; - else if( anObject->GetKind() == KIND_ZONE ) - anIsZone = true; + else if( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) + anIsImmersibleZone = true; else if( anObject->GetKind() == KIND_VISUAL_STATE ) anIsVisualState = true; } @@ -278,8 +280,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, case KIND_CALCULATION: theMenu->addAction( action( CreateCalculationId ) ); break; - case KIND_ZONE: - theMenu->addAction( action( CreateZoneId ) ); + case KIND_IMMERSIBLE_ZONE: + theMenu->addAction( action( CreateImmersibleZoneId ) ); break; } theMenu->addSeparator(); @@ -327,9 +329,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( EditCalculationId ) ); theMenu->addSeparator(); } - else if( anIsZone ) + else if( anIsImmersibleZone ) { - theMenu->addAction( action( EditZoneId ) ); + theMenu->addAction( action( EditImmersibleZoneId ) ); theMenu->addSeparator(); } else if( anIsVisualState && anIsObjectBrowser ) @@ -346,7 +348,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addSeparator(); } - if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsZone ) ) + if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsImmersibleZone ) ) { if( anIsHiddenInSelection ) theMenu->addAction( action( ShowId ) ); @@ -394,7 +396,7 @@ void HYDROGUI_Module::update( const int flags ) // the selection in the object browser. // Note: processEvents() should be called after updateGV(), // otherwise the application crashes from time to time. - qApp->processEvents(); + //RKV: qApp->processEvents(); getApp()->updateObjectBrowser( true ); } @@ -506,7 +508,7 @@ void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager, } bool HYDROGUI_Module::isObjectVisible( const int theViewId, - const Handle(HYDROData_Object)& theObject ) const + const Handle(HYDROData_Entity)& theObject ) const { if( theObject.IsNull() ) return false; @@ -526,7 +528,7 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId, } void HYDROGUI_Module::setObjectVisible( const int theViewId, - const Handle(HYDROData_Object)& theObject, + const Handle(HYDROData_Entity)& theObject, const bool theState ) { if( !theObject.IsNull() ) @@ -538,7 +540,7 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId, } HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId, - const Handle(HYDROData_Object)& theObject ) const + const Handle(HYDROData_Entity)& theObject ) const { HYDROGUI_Shape* aResShape = NULL; if( theObject.IsNull() ) @@ -561,7 +563,7 @@ HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int } void HYDROGUI_Module::setObjectShape( const int theViewId, - const Handle(HYDROData_Object)& theObject, + const Handle(HYDROData_Entity)& theObject, HYDROGUI_Shape* theShape ) { if( theObject.IsNull() ) @@ -572,7 +574,7 @@ void HYDROGUI_Module::setObjectShape( const int theViewId, } void HYDROGUI_Module::removeObjectShape( const int theViewId, - const Handle(HYDROData_Object)& theObject ) + const Handle(HYDROData_Entity)& theObject ) { if ( !myShapesMap.contains( theViewId ) ) return; @@ -623,8 +625,14 @@ void HYDROGUI_Module::customEvent( QEvent* e ) { if( GraphicsView_Viewer* aViewer = dynamic_cast( aViewFrame->getViewer() ) ) { + SUIT_ViewManager* aViewManager = aViewer->getViewManager(); + ViewManagerRole aRole = getViewManagerRole( aViewManager ); + if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() ) { + if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage ) + aViewPort->scale( 1, -1 ); // invert the Y axis direction from down to up + aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect ); aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu ); aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection ); @@ -633,8 +641,6 @@ void HYDROGUI_Module::customEvent( QEvent* e ) //aViewPort->setViewLabelPosition( GraphicsView_ViewPort::VLP_BottomLeft, true ); } - SUIT_ViewManager* aViewManager = aViewer->getViewManager(); - ViewManagerRole aRole = getViewManagerRole( aViewManager ); if( aRole != VMR_TransformImage ) update( UF_Viewer ); @@ -666,8 +672,6 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager ) if( theViewManager->getType() == GraphicsView_Viewer::Type() ) { - createSelector( theViewManager ); // replace the default selector - connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); } @@ -677,6 +681,8 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager ) this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); } + createSelector( theViewManager ); // replace the default selector + ViewManagerInfo anInfo( theViewManager, VMR_General ); myViewManagerMap.insert( ViewManagerId++, anInfo ); } @@ -728,6 +734,7 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow ) void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent ) { + /* ouv: currently unused if( GraphicsView_ViewPort* aViewPort = qobject_cast( sender() ) ) { SUIT_ViewManager* aViewManager = 0; @@ -757,8 +764,8 @@ void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent ) int aXDeg = 0, aYDeg = 0; int aXMin = 0, aYMin = 0; double aXSec = 0, aYSec = 0; - HYDROGUI_Tool::DoubleToLambert( aMouseX, aXDeg, aXMin, aXSec ); - HYDROGUI_Tool::DoubleToLambert( aMouseY, aYDeg, aYMin, aYSec ); + HYDROData_Lambert93::secToDMS( aMouseX, aXDeg, aXMin, aXSec ); + HYDROData_Lambert93::secToDMS( aMouseY, aYDeg, aYMin, aYSec ); QString aDegSymbol( QChar( 0x00B0 ) ); QString aXStr = QString( "%1%2 %3' %4\"" ).arg( aXDeg ).arg( aDegSymbol ).arg( aXMin ).arg( aXSec ); @@ -769,6 +776,7 @@ void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent ) else if( aRole == VMR_TransformImage ) aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( (int)aMouseX ).arg( (int)aMouseY ) ); } + */ } void HYDROGUI_Module::updateGV( const bool theIsInit, @@ -834,12 +842,8 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager ) return; QString aViewType = theViewManager->getType(); - if( aViewType != GraphicsView_Viewer::Type() ) - return; - - GraphicsView_ViewManager* aViewManager = - dynamic_cast( theViewManager ); - if( !aViewManager ) + if( aViewType != GraphicsView_Viewer::Type() && + aViewType != OCCViewer_Viewer::Type()) return; QList aSelectorList; @@ -850,11 +854,25 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager ) for( anIter = aSelectorList.begin(); anIter != anIterEnd; anIter++ ) { SUIT_Selector* aSelector = *anIter; - if( aSelector && !dynamic_cast( aSelector ) ) + if( aSelector && ( !dynamic_cast( aSelector ) && + !dynamic_cast( aSelector ) ) ) aSelector->setEnabled( false ); } - new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr ); + if ( aViewType == GraphicsView_Viewer::Type() ) + { + GraphicsView_ViewManager* aViewManager = + ::qobject_cast( theViewManager ); + if( aViewManager ) + new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr ); + } + else if ( aViewType == OCCViewer_Viewer::Type() ) + { + OCCViewer_ViewManager* aViewManager = + ::qobject_cast( theViewManager ); + if( aViewManager ) + new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr ); + } } bool HYDROGUI_Module::setUpdateEnabled( const bool theState )