From 0c405019de08dccfacd64f71f18211cbe912cc1d Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 27 Sep 2013 10:24:47 +0000 Subject: [PATCH] OCC displayer implementation. --- src/HYDROGUI/CMakeLists.txt | 2 + src/HYDROGUI/HYDROGUI.vcproj | 10 +- src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 12 +- src/HYDROGUI/HYDROGUI_DeleteOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_Module.cxx | 177 +++++++++++++++++- src/HYDROGUI/HYDROGUI_Module.h | 26 ++- src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx | 235 ++++++++++++++++++++++++ src/HYDROGUI/HYDROGUI_OCCDisplayer.h | 136 ++++++++++++++ src/HYDROGUI/HYDROGUI_Shape.cxx | 106 +++++++++-- src/HYDROGUI/HYDROGUI_Shape.h | 41 +++-- src/HYDROGUI/HYDROGUI_ShowHideOp.cxx | 27 ++- src/HYDROGUI/HYDROGUI_Tool.cxx | 32 +++- src/HYDROGUI/HYDROGUI_Tool.h | 22 +++ src/HYDROGUI/HYDROGUI_UpdateFlags.h | 8 +- src/HYDROGUI/HYDROGUI_ZoneOp.cxx | 14 +- 15 files changed, 793 insertions(+), 57 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx create mode 100644 src/HYDROGUI/HYDROGUI_OCCDisplayer.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 73ac8c89..380ea792 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -22,6 +22,7 @@ set(PROJECT_HEADERS HYDROGUI_Module.h HYDROGUI_ObjSelector.h HYDROGUI_ObserveImageOp.h + HYDROGUI_OCCDisplayer.h HYDROGUI_Operation.h HYDROGUI_Operations.h HYDROGUI_PolylineDlg.h @@ -70,6 +71,7 @@ set(PROJECT_SOURCES HYDROGUI_Module.cxx HYDROGUI_ObjSelector.cxx HYDROGUI_ObserveImageOp.cxx + HYDROGUI_OCCDisplayer.cxx HYDROGUI_Operation.cxx HYDROGUI_Operations.cxx HYDROGUI_PolylineDlg.cxx diff --git a/src/HYDROGUI/HYDROGUI.vcproj b/src/HYDROGUI/HYDROGUI.vcproj index bc0513be..fc809839 100644 --- a/src/HYDROGUI/HYDROGUI.vcproj +++ b/src/HYDROGUI/HYDROGUI.vcproj @@ -1,7 +1,7 @@ + + @@ -559,6 +563,10 @@ /> + + diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 6e8aa189..fd48bc16 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -357,13 +357,16 @@ void HYDROGUI_CalculationOp::createPreview() { Region& aRegion = *anIter; if ( aRegion.Shape ) + { + aRegion.Shape->erase( false ); delete aRegion.Shape; + } - aRegion.Shape = new HYDROGUI_Shape( aCtx ); + aRegion.Shape = new HYDROGUI_Shape( aCtx, NULL ); - aRegion.Shape->setFillingColor( aRegion.FillingColor, false ); - aRegion.Shape->setBorderColor( aRegion.BorderColor, false ); - aRegion.Shape->setFace( aRegion.SplitData.Face(), true ); + aRegion.Shape->setFillingColor( aRegion.FillingColor, false, false ); + aRegion.Shape->setBorderColor( aRegion.BorderColor, false, false ); + aRegion.Shape->setFace( aRegion.SplitData.Face(), true, false ); } //Process the draw events for viewer @@ -387,6 +390,7 @@ void HYDROGUI_CalculationOp::closePreview() Region& aRegion = *anIter; if ( aRegion.Shape ) { + aRegion.Shape->erase( false ); delete aRegion.Shape; aRegion.Shape = NULL; } diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index 1e9b8008..8df9ef26 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -99,6 +99,6 @@ void HYDROGUI_DeleteOp::startOperation() } commitDocOperation(); - module()->update( UF_Model | UF_Viewer ); + module()->update( UF_Model | UF_Viewer | UF_OCCViewer ); commit(); } diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 509fc2e3..4c2a2cc5 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -28,10 +28,12 @@ #include "HYDROGUI_GVSelector.h" #include "HYDROGUI_InputPanel.h" #include "HYDROGUI_ObjSelector.h" +#include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Operations.h" #include "HYDROGUI_PrsImage.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_UpdateFlags.h" +#include "HYDROGUI_Shape.h" #include @@ -52,6 +54,10 @@ #include #include +#include +#include +#include + #include #include @@ -78,6 +84,7 @@ extern "C" HYDRO_EXPORT char* getModuleVersion() HYDROGUI_Module::HYDROGUI_Module() : LightApp_Module( "HYDRO" ), myDisplayer( 0 ), + myOCCDisplayer( 0 ), myIsUpdateEnabled( true ) { } @@ -106,6 +113,7 @@ void HYDROGUI_Module::initialize( CAM_Application* theApp ) setToolShown( false ); myDisplayer = new HYDROGUI_Displayer( this ); + myOCCDisplayer = new HYDROGUI_OCCDisplayer( this ); } bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) @@ -141,6 +149,7 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy ) myViewManagerMap.clear(); myObjectStateMap.clear(); + myShapesMap.clear(); // clear the data model's list of copying objects HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() ); @@ -165,7 +174,7 @@ void HYDROGUI_Module::windows( QMap& theMap ) const void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const { - theTypesList << GraphicsView_Viewer::Type(); + theTypesList << OCCViewer_Viewer::Type() << GraphicsView_Viewer::Type(); } void HYDROGUI_Module::contextMenuPopup( const QString& theClient, @@ -175,11 +184,12 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, HYDROGUI_DataModel* aModel = getDataModel(); bool anIsObjectBrowser = theClient == "ObjectBrowser"; - bool anIsGraphicsView = theClient == "GraphicsView"; - if( !anIsObjectBrowser && !anIsGraphicsView ) + bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type(); + bool anIsOCCView = theClient == OCCViewer_Viewer::Type(); + if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView ) return; - size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( this ); + size_t anActiveViewId = HYDROGUI_Tool::GetActiveViewId( this ); bool anIsSelectedDataObjects = false; bool anIsVisibleInSelection = false; @@ -206,7 +216,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, { anIsSelectedDataObjects = true; - bool aVisibility = isObjectVisible( aViewId, anObject ); + bool aVisibility = isObjectVisible( anActiveViewId, anObject ); anIsVisibleInSelection |= aVisibility; anIsHiddenInSelection |= !aVisibility; @@ -346,7 +356,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addSeparator(); } - if( anIsObjectBrowser || anIsGraphicsView ) + if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView ) { theMenu->addAction( action( ShowAllId ) ); theMenu->addAction( action( HideAllId ) ); @@ -372,6 +382,10 @@ void HYDROGUI_Module::update( const int flags ) updateGV( flags & UF_GV_Init, flags & UF_GV_Forced ); + if( ( flags & UF_OCCViewer ) ) + updateOCCViewer( flags & UF_OCC_Init, + flags & UF_OCC_Forced ); + if( ( flags & UF_Model ) && getDataModel() && getApp() ) { getDataModel()->update( getStudyId() ); @@ -425,6 +439,11 @@ HYDROGUI_Displayer* HYDROGUI_Module::getDisplayer() const return myDisplayer; } +HYDROGUI_OCCDisplayer* HYDROGUI_Module::getOCCDisplayer() const +{ + return myOCCDisplayer; +} + GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const { if( myViewManagerMap.contains( theId ) ) @@ -438,6 +457,19 @@ GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const return NULL; } +OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const +{ + if( myViewManagerMap.contains( theId ) ) + { + ViewManagerInfo anInfo = myViewManagerMap[ theId ]; + OCCViewer_ViewManager* aViewManager = + ::qobject_cast( anInfo.first ); + if( aViewManager ) + return aViewManager->getOCCViewer(); + } + return NULL; +} + int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager ) { ViewManagerMapIterator anIter( myViewManagerMap ); @@ -474,7 +506,7 @@ void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager, } bool HYDROGUI_Module::isObjectVisible( const int theViewId, - const Handle(HYDROData_Object)& theObject ) + const Handle(HYDROData_Object)& theObject ) const { if( theObject.IsNull() ) return false; @@ -505,6 +537,77 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId, } } +HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject ) const +{ + HYDROGUI_Shape* aResShape = NULL; + if( theObject.IsNull() ) + return aResShape; + + if ( myShapesMap.contains( theViewId ) ) + { + const ListOfShapes& aViewShapes = myShapesMap.value( theViewId ); + foreach ( HYDROGUI_Shape* aShape, aViewShapes ) + { + if ( !aShape || !IsEqual( aShape->getObject(), theObject ) ) + continue; + + aResShape = aShape; + break; + } + } + + return aResShape; +} + +void HYDROGUI_Module::setObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject, + HYDROGUI_Shape* theShape ) +{ + if( theObject.IsNull() ) + return; + + ListOfShapes& aViewShapes = myShapesMap[ theViewId ]; + aViewShapes.append( theShape ); +} + +void HYDROGUI_Module::removeObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject ) +{ + if ( !myShapesMap.contains( theViewId ) ) + return; + + ListOfShapes& aViewShapes = myShapesMap[ theViewId ]; + for ( int i = 0; i < aViewShapes.length(); ) + { + HYDROGUI_Shape* aShape = aViewShapes.at( i ); + if ( aShape && IsEqual( aShape->getObject(), theObject ) ) + { + delete aShape; + aViewShapes.removeAt( i ); + continue; + } + + ++i; + } +} + +void HYDROGUI_Module::removeViewShapes( const int theViewId ) +{ + if ( !myShapesMap.contains( theViewId ) ) + return; + + const ListOfShapes& aViewShapes = myShapesMap.value( theViewId ); + for ( int i = 0, n = aViewShapes.length(); i < n; ++i ) + { + HYDROGUI_Shape* aShape = aViewShapes.at( i ); + if ( aShape ) + delete aShape; + } + + myShapesMap.remove( theViewId ); +} + CAM_DataModel* HYDROGUI_Module::createDataModel() { return new HYDROGUI_DataModel( this ); @@ -568,6 +671,11 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager ) connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); } + else if( theViewManager->getType() == OCCViewer_Viewer::Type() ) + { + connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), + this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); + } ViewManagerInfo anInfo( theViewManager, VMR_General ); myViewManagerMap.insert( ViewManagerId++, anInfo ); @@ -581,7 +689,18 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager ) int anId = getViewManagerId( theViewManager ); if( anId != -1 ) + { + OCCViewer_ViewManager* anOCCViewManager = + ::qobject_cast( myViewManagerMap[ anId ].first ); + if ( anOCCViewManager ) + { + OCCViewer_Viewer* anOCCViewer = anOCCViewManager->getOCCViewer(); + if ( anOCCViewer ) + removeViewShapes( (size_t)anOCCViewer ); + } + myViewManagerMap.remove( anId ); + } } void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow ) @@ -596,7 +715,13 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow ) connect( aViewPort, SIGNAL( vpMouseEvent( QGraphicsSceneMouseEvent* ) ), this, SLOT( onViewPortMouseEvent( QGraphicsSceneMouseEvent* ) ) ); - return; + } + } + else if( theViewWindow && theViewWindow->inherits( "OCCViewer_ViewFrame" ) ) + { + if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast( theViewWindow ) ) + { + aViewFrame->onTopView(); } } } @@ -657,8 +782,13 @@ void HYDROGUI_Module::updateGV( const bool theIsInit, // currently, all views are updated ViewManagerMapIterator anIter( myViewManagerMap ); while( anIter.hasNext() ) - { - int anId = anIter.next().key(); + { + GraphicsView_ViewManager* aViewManager = + dynamic_cast( anIter.next().value().first ); + if ( !aViewManager ) + continue; + + int anId = anIter.key(); aViewManagerIdList.append( anId ); } @@ -667,6 +797,33 @@ void HYDROGUI_Module::updateGV( const bool theIsInit, getDisplayer()->UpdateAll( anIdIter.next(), theIsInit, theIsForced ); } +void HYDROGUI_Module::updateOCCViewer( const bool theIsInit, + const bool theIsForced ) +{ + HYDROGUI_OCCDisplayer* anOCCDisplayer = getOCCDisplayer(); + if( !anOCCDisplayer ) + return; + + QList aViewManagerIdList; + + // currently, all views are updated + ViewManagerMapIterator anIter( myViewManagerMap ); + while( anIter.hasNext() ) + { + OCCViewer_ViewManager* aViewManager = + ::qobject_cast( anIter.next().value().first ); + if ( !aViewManager ) + continue; + + int anId = anIter.key(); + aViewManagerIdList.append( anId ); + } + + QListIterator anIdIter( aViewManagerIdList ); + while( anIdIter.hasNext() ) + anOCCDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced ); +} + void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager ) { if( !theViewManager ) diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 32e1162e..0f0ac148 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -37,6 +37,10 @@ class SUIT_ViewWindow; class HYDROGUI_DataModel; class HYDROGUI_Displayer; +class HYDROGUI_OCCDisplayer; +class HYDROGUI_Shape; + +class OCCViewer_Viewer; /**\class HYDROGUI_Module *\brief The class representing the HYDROGUI module @@ -67,6 +71,9 @@ public: typedef QMap< QString, ObjectState > Name2ObjectStateMap; typedef QMap< int, Name2ObjectStateMap > ViewId2Name2ObjectStateMap; + typedef QList ListOfShapes; + typedef QMap ViewId2ListOfShapes; + public: HYDROGUI_Module(); virtual ~HYDROGUI_Module(); @@ -86,8 +93,10 @@ public: HYDROGUI_DataModel* getDataModel() const; HYDROGUI_Displayer* getDisplayer() const; + HYDROGUI_OCCDisplayer* getOCCDisplayer() const; GraphicsView_Viewer* getViewer( const int theId ) const; + OCCViewer_Viewer* getOCCViewer( const int theId ) const; int getViewManagerId( SUIT_ViewManager* theViewManager ); ViewManagerRole getViewManagerRole( SUIT_ViewManager* theViewManager ); @@ -95,11 +104,20 @@ public: const ViewManagerRole theRole ); bool isObjectVisible( const int theViewId, - const Handle(HYDROData_Object)& theObject ); + const Handle(HYDROData_Object)& theObject ) const; void setObjectVisible( const int theViewId, const Handle(HYDROData_Object)& theObject, const bool theState ); + HYDROGUI_Shape* getObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject ) const; + void setObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject, + HYDROGUI_Shape* theShape ); + void removeViewShapes( const int theViewId ); + void removeObjectShape( const int theViewId, + const Handle(HYDROData_Object)& theObject ); + protected: CAM_DataModel* createDataModel(); @@ -129,6 +147,9 @@ private: void updateGV( const bool theIsInit = false, const bool theIsForced = false ); + void updateOCCViewer( const bool theIsInit = false, + const bool theIsForced = false ); + void createSelector( SUIT_ViewManager* viewMgr ); bool setUpdateEnabled( const bool theState ); @@ -154,10 +175,13 @@ private: private: HYDROGUI_Displayer* myDisplayer; + HYDROGUI_OCCDisplayer* myOCCDisplayer; ViewManagerMap myViewManagerMap; ViewId2Name2ObjectStateMap myObjectStateMap; + ViewId2ListOfShapes myShapesMap; + bool myIsUpdateEnabled; }; diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx new file mode 100644 index 00000000..d20db248 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -0,0 +1,235 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "HYDROGUI_OCCDisplayer.h" + +#include "HYDROGUI_DataModel.h" +#include "HYDROGUI_Module.h" +#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Shape.h" + +#include +#include +#include + +#include +#include +#include + +#include + +HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule ) +: myModule( theModule ) +{ +} + +HYDROGUI_OCCDisplayer::~HYDROGUI_OCCDisplayer() +{ +} + +void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId ) +{ + OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + if( !aViewer ) + return; + + for ( int i = 1, n = theObjs.Length(); i <= n; i++ ) + { + Handle(HYDROData_Object) anObj = theObjs.Value( i ); + if( anObj.IsNull() ) + continue; + + HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj ); + if ( !anObjShape ) + continue; + + anObjShape->setIsToUpdate( true ); + } +} + +void HYDROGUI_OCCDisplayer::UpdateAll( const int theViewerId, + const bool theIsInit, + const bool theIsForced ) +{ + if ( theIsInit ) + EraseAll( theViewerId ); + + DisplayAll( theViewerId, theIsForced ); +} + +void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId ) +{ + OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + if( !aViewer ) + return; + + myModule->removeViewShapes( (size_t)aViewer ); +} + +void HYDROGUI_OCCDisplayer::DisplayAll( const int theViewerId, + const bool theIsForced ) +{ + HYDROData_SequenceOfObjects aSeq; + HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq ); + Update( aSeq, theViewerId, theIsForced ); +} + +void HYDROGUI_OCCDisplayer::Update( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId, + const bool theIsForced ) +{ + // First of all, kill all bad presentations + purgeObjects( theViewerId ); + + // Now dig in the data model + HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay; + + for( int i = 1, n = theObjs.Length(); i <= n; i++ ) + { + const Handle(HYDROData_Object)& anObj = theObjs.Value( i ); + if( anObj.IsNull() ) + anObjectsToErase.Append( anObj ); + else + anObjectsToDisplay.Append( anObj ); + } + + if( anObjectsToErase.Length() ) + Erase( anObjectsToErase, theViewerId ); + if( anObjectsToDisplay.Length() ) + Display( anObjectsToDisplay, theViewerId, theIsForced ); +} + +void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId ) +{ + OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + if( !aViewer ) + return; + + for ( int i = 1, n = theObjs.Length(); i <= n; i++ ) + { + Handle(HYDROData_Object) anObj = theObjs.Value( i ); + if( anObj.IsNull() ) + continue; + + myModule->removeObjectShape( (size_t)aViewer, anObj ); + } +} + +HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int theViewerId, + const Handle(AIS_InteractiveContext)& theContext, + const Handle(HYDROData_Object)& theObject ) +{ + HYDROGUI_Shape* aResShape = NULL; + if ( theContext.IsNull() || theObject.IsNull() ) + return aResShape; + + ObjectKind anObjectKind = theObject->GetKind(); + if ( anObjectKind != KIND_POLYLINE && + anObjectKind != KIND_ZONE ) + return aResShape; + + aResShape = new HYDROGUI_Shape( theContext, theObject ); + myModule->setObjectShape( theViewerId, theObject, aResShape ); + + return aResShape; +} + +void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId, + const bool theIsForced ) +{ + OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + if( !aViewer ) + return; + + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if( aCtx.IsNull() ) + return; + + for ( int i = 1, n = theObjs.Length(); i <= n; i++ ) + { + Handle(HYDROData_Object) anObj = theObjs.Value( i ); + if ( anObj.IsNull() || anObj->IsRemoved() ) + continue; + + HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj ); + + if ( !anObjShape || anObjShape->getIsToUpdate() || theIsForced ) + { + if ( !anObjShape ) + anObjShape = createShape( (size_t)aViewer, aCtx, anObj ); + + if ( anObjShape ) + anObjShape->update( false ); + } + + if ( anObjShape ) + { + bool anIsVisible = myModule->isObjectVisible( (size_t)aViewer, anObj ); + anObjShape->setVisible( anIsVisible, false ); + } + } + + OCCViewer_ViewManager* aViewManager + = ::qobject_cast( aViewer->getViewManager() ); + if ( aViewManager ) + { + OCCViewer_ViewWindow* aViewWindow = + ::qobject_cast( aViewManager->getActiveView() ); + if ( aViewWindow ) + { + QApplication::processEvents(); //Process the draw events for viewer + aViewWindow->onFitAll(); + } + } +} + +void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId ) +{ + OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + if( !aViewer ) + return; + + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if( aCtx.IsNull() ) + return; + + AIS_ListOfInteractive aDisplayedObjects; + aCtx->DisplayedObjects( aDisplayedObjects ); + + AIS_ListIteratorOfListOfInteractive aListIter( aDisplayedObjects ); + for ( ; aListIter.More(); aListIter.Next() ) + { + Handle(AIS_InteractiveObject) aPrsObj = aListIter.Value(); + if ( aPrsObj.IsNull() ) + continue; + + Handle(HYDROData_Object) anOwnerObj = + Handle(HYDROData_Object)::DownCast( aPrsObj->GetOwner() ); + if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() ) + myModule->removeObjectShape( (size_t)aViewer, anOwnerObj ); + } +} + + diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.h b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h new file mode 100644 index 00000000..f4c013bb --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h @@ -0,0 +1,136 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HYDROGUI_OCCDISPLAYER_H +#define HYDROGUI_OCCDISPLAYER_H + +#include + +class HYDROGUI_Module; +class HYDROGUI_Shape; +class Handle(AIS_InteractiveContext); + +/** + * \class HYDROGUI_OCCDisplayer + * \brief Class intended to create, display and update the presentations on OCC viewer. + */ +class HYDROGUI_OCCDisplayer +{ +public: + /** + * \brief Constructor. + * \param theModule module object + */ + HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule ); + + /** + * \brief Destructor. + */ + virtual ~HYDROGUI_OCCDisplayer(); + +public: + /** + * \brief Force the specified objects to be updated. + * \param theObjs sequence of objects to update + * \param theViewerId viewer identifier + */ + void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId ); + + /** + * \brief Update all objects in the viewer. + * \param theViewerId viewer identifier + * \param theIsInit flag used for initial update + * \param theIsForced flag used to update all objects, including the unchanged ones + */ + void UpdateAll( const int theViewerId, + const bool theIsInit, + const bool theIsForced ); + +protected: + /** + * \brief Erase all viewer objects. + * \param theViewerId viewer identifier + */ + void EraseAll( const int theViewerId ); + + /** + * \brief Update and display all objects in the viewer. + * \param theViewerId viewer identifier + * \param theIsForced flag used to update all objects, including the unchanged ones + */ + void DisplayAll( const int theViewerId, + const bool theIsForced ); + + /** + * \brief Update the specified viewer objects. + * \param theObjs sequence of objects to update + * \param theViewerId viewer identifier + * \param theIsForced flag used to update all objects, including the unchanged ones + */ + void Update( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId, + const bool theIsForced ); + + /** + * \brief Erase the specified viewer objects. + * \param theObjs sequence of objects to erase + * \param theViewerId viewer identifier + */ + void Erase( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId ); + + /** + * \brief Display the specified viewer objects. + * \param theObjs sequence of objects to display + * \param theViewerId viewer identifier + * \param theIsForced flag used to update all objects, including the unchanged ones + */ + void Display( const HYDROData_SequenceOfObjects& theObjs, + const int theViewerId, + const bool theIsForced ); + +private: + /** + * \brief Purge all invalid objects in the viewer. + * \param theViewerId viewer identifier + */ + void purgeObjects( const int theViewerId ); + + /** + * \brief Creates new OCC shape. + * \param theViewerId viewer identifier + * \param theContext context of OCC viwer + * \param theObject data model object + * \return pointer to new created shape + */ + HYDROGUI_Shape* createShape( const int theViewerId, + const Handle(AIS_InteractiveContext)& theContext, + const Handle(HYDROData_Object)& theObject ); + +private: + HYDROGUI_Module* myModule; + +}; + +#endif + diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index b973cefd..33ceeda2 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -33,6 +33,9 @@ #include #include +#include +#include + #include #include @@ -44,12 +47,16 @@ #include -HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext ) +HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext, + const Handle(HYDROData_Object)& theObject ) : myContext( theContext ), + myObject( theObject ), myIsHighlight( false ), - myFillingColor( Qt::green ), + myFillingColor( Qt::transparent ), myBorderColor( Qt::black ), - myHighlightColor( Qt::white ) + myHighlightColor( Qt::white ), + myIsToUpdate( false ), + myIsVisible( true ) { } @@ -63,7 +70,7 @@ HYDROGUI_Shape::~HYDROGUI_Shape() void HYDROGUI_Shape::display( const bool theIsUpdateViewer ) { - if ( !myContext || myShape.IsNull() ) + if ( myContext.IsNull() || myShape.IsNull() ) return; myContext->Display( myShape, theIsUpdateViewer ); @@ -71,12 +78,69 @@ void HYDROGUI_Shape::display( const bool theIsUpdateViewer ) void HYDROGUI_Shape::erase( const bool theIsUpdateViewer ) { - if ( !myContext || myShape.IsNull() ) + if ( myContext.IsNull() || myShape.IsNull() ) return; myContext->Erase( myShape, theIsUpdateViewer ); } +void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) +{ + setIsToUpdate( false ); + + if ( myContext.IsNull() ) + return; + + // Try to retrieve information from object + if ( !myObject.IsNull() ) + { + if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Domain) ) ) + { + Handle(HYDROData_Domain) aDomainObj = + Handle(HYDROData_Domain)::DownCast( myObject ); + + QColor aFillingColor = aDomainObj->GetFillingColor(); + QColor aBorderColor = aDomainObj->GetBorderColor(); + TopoDS_Face aDomainFace = aDomainObj->Face(); + + setFillingColor( aFillingColor, false, false ); + setBorderColor( aBorderColor, false, false ); + setFace( aDomainFace, false, false ); + } + else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) ) + { + Handle(HYDROData_Polyline) aPolyline = + Handle(HYDROData_Polyline)::DownCast( myObject ); + + TopoDS_Wire aPolylineWire = aPolyline->Wire(); + + setWire( aPolylineWire, false, false ); + } + } + + if ( myShape.IsNull() ) + return; + + myContext->Display( myShape, theIsUpdateViewer ); +} + +void HYDROGUI_Shape::setVisible( const bool theState, + const bool theIsUpdateViewer ) +{ + if ( myIsVisible == theState ) + return; + + myIsVisible = theState; + + if ( myShape.IsNull() ) + return; + + if ( myIsVisible ) + myContext->Display( myShape, theIsUpdateViewer ); + else + myContext->Erase( myShape, theIsUpdateViewer ); +} + void HYDROGUI_Shape::highlight( bool theIsHighlight ) { if ( myIsHighlight == theIsHighlight ) @@ -84,7 +148,7 @@ void HYDROGUI_Shape::highlight( bool theIsHighlight ) myIsHighlight = theIsHighlight; - if ( !myContext || myShape.IsNull() ) + if ( myContext.IsNull() || myShape.IsNull() ) return; colorShapeBorder( getActiveColor() ); @@ -97,30 +161,33 @@ bool HYDROGUI_Shape::isHighlighted() const } void HYDROGUI_Shape::setWire( const TopoDS_Wire& theWire, - const bool theToDisplay ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { BRepBuilderAPI_MakeFace aFaceBuilder( theWire, Standard_True ); aFaceBuilder.Build(); if( aFaceBuilder.IsDone() ) { TopoDS_Face aFace = aFaceBuilder.Face(); - setFace( aFace, theToDisplay ); + setFace( aFace, theToDisplay, theIsUpdateViewer ); } } void HYDROGUI_Shape::setFace( const TopoDS_Face& theFace, - const bool theToDisplay ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myFace = theFace; buildShape(); - updateShape( theToDisplay ); + updateShape( theToDisplay, theIsUpdateViewer ); } void HYDROGUI_Shape::setFillingColor( const QColor& theColor, - const bool theToDisplay ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myFillingColor = theColor; - updateShape( theToDisplay ); + updateShape( theToDisplay, theIsUpdateViewer ); } QColor HYDROGUI_Shape::getFillingColor() const @@ -129,10 +196,11 @@ QColor HYDROGUI_Shape::getFillingColor() const } void HYDROGUI_Shape::setBorderColor( const QColor& theColor, - const bool theToDisplay ) + const bool theToDisplay, + const bool theIsUpdateViewer ) { myBorderColor = theColor; - updateShape( theToDisplay ); + updateShape( theToDisplay, theIsUpdateViewer ); } QColor HYDROGUI_Shape::getBorderColor() const @@ -160,6 +228,9 @@ void HYDROGUI_Shape::buildShape() myShape = new AIS_Shape( myFace ); + if ( !myObject.IsNull() ) + myShape->SetOwner( myObject ); + myShape->SetTransparency( 0 ); myShape->SetDisplayMode( AIS_Shaded ); @@ -188,7 +259,8 @@ void HYDROGUI_Shape::buildShape() } } -void HYDROGUI_Shape::updateShape( const bool theIsForce ) +void HYDROGUI_Shape::updateShape( const bool theToDisplay, + const bool theIsUpdateViewer ) { if ( myShape.IsNull() ) return; @@ -213,10 +285,10 @@ void HYDROGUI_Shape::updateShape( const bool theIsForce ) colorShapeBorder( getActiveColor() ); } - if ( !theIsForce || !myContext ) + if ( !theToDisplay || myContext.IsNull() ) return; - myContext->Display( myShape, theIsForce ); + myContext->Display( myShape, theIsUpdateViewer ); } QColor HYDROGUI_Shape::getActiveColor() const diff --git a/src/HYDROGUI/HYDROGUI_Shape.h b/src/HYDROGUI/HYDROGUI_Shape.h index 885e23d0..6572c80d 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.h +++ b/src/HYDROGUI/HYDROGUI_Shape.h @@ -26,19 +26,18 @@ #include #include -#include -#include +#include #include -class BRepBuilderAPI_MakeFace; -class BRepBuilderAPI_MakeWire; -class gp_Pnt; +#include +#include class HYDROGUI_Shape { public: - HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext ); + HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext, + const Handle(HYDROData_Object)& theObject ); ~HYDROGUI_Shape(); public: @@ -48,18 +47,33 @@ public: virtual void highlight( bool theIsHighlight ); virtual bool isHighlighted() const; + Handle(HYDROData_Object) getObject() const { return myObject; } + + virtual void update( const bool theIsUpdateViewer = true ); + + virtual bool getIsToUpdate() const { return myIsToUpdate; } + virtual void setIsToUpdate( bool theState ) { myIsToUpdate = theState; } + + virtual bool isVisible() const { return myIsVisible; } + virtual void setVisible( const bool theState, + const bool theIsUpdateViewer = true ); + virtual void setWire( const TopoDS_Wire& theWire, - const bool theToDisplay = true ); + const bool theToDisplay = true, + const bool theIsUpdateViewer = true ); virtual void setFace( const TopoDS_Face& theFace, - const bool theToDisplay = true ); + const bool theToDisplay = true, + const bool theIsUpdateViewer = true ); virtual void setFillingColor( const QColor& theColor, - const bool theToDisplay = true ); + const bool theToDisplay = true, + const bool theIsUpdateViewer = true ); virtual QColor getFillingColor() const; virtual void setBorderColor( const QColor& theColor, - const bool theToDisplay = true ); + const bool theToDisplay = true, + const bool theIsUpdateViewer = true ); virtual QColor getBorderColor() const; virtual void setHighlightColor( const QColor& theColor ); @@ -67,7 +81,8 @@ public: protected: virtual void buildShape(); - virtual void updateShape( const bool theIsForce = true ); + virtual void updateShape( const bool theToDisplay = true, + const bool theIsUpdateViewer = true ); virtual QColor getActiveColor() const; private: @@ -76,8 +91,12 @@ private: private: Handle(AIS_InteractiveContext) myContext; + Handle(HYDROData_Object) myObject; Handle(AIS_Shape) myShape; + bool myIsToUpdate; + bool myIsVisible; + bool myIsHighlight; TopoDS_Face myFace; diff --git a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx index a2d46be4..064d7785 100644 --- a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx @@ -22,6 +22,8 @@ #include "HYDROGUI_ShowHideOp.h" +#include + #include "HYDROGUI_Module.h" #include "HYDROGUI_Operations.h" #include "HYDROGUI_Tool.h" @@ -30,6 +32,12 @@ #include #include +#include + +#include + +#include + HYDROGUI_ShowHideOp::HYDROGUI_ShowHideOp( HYDROGUI_Module* theModule, int theId ) : HYDROGUI_Operation( theModule ), myId( theId ) @@ -55,7 +63,7 @@ void HYDROGUI_ShowHideOp::startOperation() { HYDROGUI_Operation::startOperation(); - size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() ); + size_t aViewId = HYDROGUI_Tool::GetActiveViewId( module() ); // for all objects if( myId == ShowOnlyId || myId == ShowAllId || myId == HideAllId ) @@ -84,6 +92,21 @@ void HYDROGUI_ShowHideOp::startOperation() } } - module()->update( UF_Viewer ); + int anUpdateFlags = 0; + + SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager(); + if ( aViewMgr ) + { + if ( aViewMgr->getType() == GraphicsView_Viewer::Type() ) + { + anUpdateFlags |= UF_Viewer; + } + else if ( aViewMgr->getType() == OCCViewer_Viewer::Type() ) + { + anUpdateFlags |= UF_OCCViewer; + } + } + + module()->update( anUpdateFlags ); commit(); } diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 4650f24e..ac76bb18 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -37,6 +37,8 @@ #include #include +#include + #include #include @@ -376,11 +378,12 @@ QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule, return aName; } -size_t HYDROGUI_Tool::GetActiveGraphicsViewId( HYDROGUI_Module* theModule ) +size_t HYDROGUI_Tool::GetActiveViewId( HYDROGUI_Module* theModule, + const QString& theViewId ) { size_t aViewId = 0; SUIT_ViewManager* aViewMgr = theModule->getApp()->activeViewManager(); - if( !aViewMgr || aViewMgr->getType() != GraphicsView_Viewer::Type() ) + if( !aViewMgr || ( !theViewId.isEmpty() && aViewMgr->getType() != theViewId ) ) return aViewId; if( SUIT_ViewModel* aViewer = aViewMgr->getViewModel() ) @@ -388,11 +391,22 @@ size_t HYDROGUI_Tool::GetActiveGraphicsViewId( HYDROGUI_Module* theModule ) return aViewId; } -QList HYDROGUI_Tool::GetGraphicsViewIdList( HYDROGUI_Module* theModule ) +size_t HYDROGUI_Tool::GetActiveGraphicsViewId( HYDROGUI_Module* theModule ) +{ + return GetActiveViewId( theModule, GraphicsView_Viewer::Type() ); +} + +size_t HYDROGUI_Tool::GetActiveOCCViewId( HYDROGUI_Module* theModule ) +{ + return GetActiveViewId( theModule, OCCViewer_Viewer::Type() ); +} + +QList getViewIdList( HYDROGUI_Module* theModule, + const QString& theViewId ) { QList aList; ViewManagerList aViewMgrs; - theModule->getApp()->viewManagers( GraphicsView_Viewer::Type(), aViewMgrs ); + theModule->getApp()->viewManagers( theViewId, aViewMgrs ); QListIterator anIter( aViewMgrs ); while( anIter.hasNext() ) { @@ -405,6 +419,16 @@ QList HYDROGUI_Tool::GetGraphicsViewIdList( HYDROGUI_Module* theModule ) return aList; } +QList HYDROGUI_Tool::GetGraphicsViewIdList( HYDROGUI_Module* theModule ) +{ + return getViewIdList( theModule, GraphicsView_Viewer::Type() ); +} + +QList HYDROGUI_Tool::GetOCCViewIdList( HYDROGUI_Module* theModule ) +{ + return getViewIdList( theModule, OCCViewer_Viewer::Type() ); +} + void HYDROGUI_Tool::GetObjectReferences( const Handle(HYDROData_Image)& theImage, HYDROData_SequenceOfObjects& theRefObjects, QStringList& theRefNames ) diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 264adbd5..cb77fb75 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -198,6 +198,14 @@ public: const QString& thePrefix, const QStringList& theUsedNames = QStringList() ); + /** + * \brief Get id of the active view. + * \param theModule module + * \return view id + */ + static size_t GetActiveViewId( HYDROGUI_Module* theModule, + const QString& theViewId = QString() ); + /** * \brief Get id of the active GraphicsView view. * \param theModule module @@ -205,6 +213,13 @@ public: */ static size_t GetActiveGraphicsViewId( HYDROGUI_Module* theModule ); + /** + * \brief Get id of the active OCC view. + * \param theModule module + * \return view id + */ + static size_t GetActiveOCCViewId( HYDROGUI_Module* theModule ); + /** * \brief Get list of ids of existing GraphicsView views. * \param theModule module @@ -212,6 +227,13 @@ public: */ static QList GetGraphicsViewIdList( HYDROGUI_Module* theModule ); + /** + * \brief Get list of ids of existing OCC views. + * \param theModule module + * \return list of view ids + */ + static QList GetOCCViewIdList( HYDROGUI_Module* theModule ); + /** * \brief Get the list of references (recursively) for the specified image object * \param theImage image data object diff --git a/src/HYDROGUI/HYDROGUI_UpdateFlags.h b/src/HYDROGUI/HYDROGUI_UpdateFlags.h index e3ae171b..b01da335 100644 --- a/src/HYDROGUI/HYDROGUI_UpdateFlags.h +++ b/src/HYDROGUI/HYDROGUI_UpdateFlags.h @@ -34,9 +34,15 @@ typedef enum { UF_Base = UF_Forced | UF_Model | UF_Viewer | UF_ObjBrowser | UF_Controls, + UF_GV_Init = 0x00000020, //!< initial update (used with UF_Viewer) UF_GV_Forced = 0x00000040, //!< to force recomputing all presentations (used with UF_Viewer) - UF_All = UF_Base | UF_GV_Init | UF_GV_Forced //!< all update flags + + UF_OCCViewer = 0x00000080, //!< OCC viewer + UF_OCC_Init = 0x00000100, //!< initial update (used with UF_OCCViewer) + UF_OCC_Forced = 0x00000200, //!< to force recomputing all presentations (used with UF_OCCViewer) + + UF_All = UF_Base | UF_GV_Init | UF_GV_Forced | UF_OCCViewer | UF_OCC_Init | UF_OCC_Forced//!< all update flags } HYDRO_UpdateFlags; #endif diff --git a/src/HYDROGUI/HYDROGUI_ZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ZoneOp.cxx index 25cefb60..5825105e 100644 --- a/src/HYDROGUI/HYDROGUI_ZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ZoneOp.cxx @@ -246,8 +246,12 @@ bool HYDROGUI_ZoneOp::processApply( int& theUpdateFlags, aZoneObj->AddBathymetry( aBathymetry ); } + closePreview(); + + if( !myIsEdit ) + module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aZoneObj, true ); - theUpdateFlags = UF_Model; + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced; return true; } @@ -291,7 +295,7 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName ) Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if ( !aCtx.IsNull() ) { - myPreviewPrs = new HYDROGUI_Shape( aCtx ); + myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL ); } } } @@ -300,9 +304,9 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName ) if ( !myPreviewViewManager || !myPreviewPrs ) return; - myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false ); - myPreviewPrs->setBorderColor( aPanel->getBorderColor(), false ); - myPreviewPrs->setWire( aWire, true ); + myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false, false ); + myPreviewPrs->setBorderColor( aPanel->getBorderColor(), false, false ); + myPreviewPrs->setWire( aWire ); } void HYDROGUI_ZoneOp::onLastViewClosed( SUIT_ViewManager* theViewManager ) -- 2.39.2