- All displayers are inherited from the abstract displayer.
FIND_PACKAGE(SalomeCAS REQUIRED)
+FIND_PACKAGE(SalomeVTK REQUIRED)
+
FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4
FIND_PACKAGE(SalomePyQt4 REQUIRED)
HYDROGUI_UpdateFlags.h
HYDROGUI_UpdateImageOp.h
HYDROGUI_VisualStateOp.h
+ HYDROGUI_VTKPrs.h
+ HYDROGUI_VTKPrsBathymetry.h
+ HYDROGUI_VTKPrsBathymetryDriver.h
+ HYDROGUI_VTKPrsDisplayer.h
+ HYDROGUI_VTKPrsDriver.h
HYDROGUI_Wizard.h
HYDROGUI_Zone.h
HYDROGUI_ImportGeomObjectOp.h
HYDROGUI_TwoImagesOp.cxx
HYDROGUI_UpdateImageOp.cxx
HYDROGUI_VisualStateOp.cxx
+ HYDROGUI_VTKPrs.cxx
+ HYDROGUI_VTKPrsBathymetry.cxx
+ HYDROGUI_VTKPrsBathymetryDriver.cxx
+ HYDROGUI_VTKPrsDisplayer.cxx
+ HYDROGUI_VTKPrsDriver.cxx
HYDROGUI_Wizard.cxx
HYDROGUI_Zone.cxx
HYDROGUI_ImportGeomObjectOp.cxx
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData
${CMAKE_CURRENT_SOURCE_DIR}/../HYDROCurveCreator
+ ${VTK_INCLUDE_DIRS}
)
+
add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC})
target_link_libraries(HYDROGUI HYDROData HYDROCurveCreator
${CAS_TKV3d} ${CAS_TKTopAlgo} ${CAS_TKBrep} ${CAS_TKBO}
- ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std} ${GUI_Event} ${GUI_OCCViewer}
- ${GEOM_GEOM} ${GEOM_GEOMBase}
+ ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std}
+ ${GUI_Event} ${GUI_OCCViewer} ${GEOM_GEOM} ${GEOM_GEOMBase}
+ ${VTK_LIBRARIES} ${SVTK} ${SalomeObject} ${SalomePrs}
)
INSTALL(TARGETS HYDROGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
#include "HYDROGUI_Module.h"
#include "HYDROGUI_Tool.h"
+#include <SUIT_ViewManager.h>
+
HYDROGUI_AbstractDisplayer::HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule )
: myModule( theModule )
{
{
}
+bool HYDROGUI_AbstractDisplayer::IsApplicable( const int theViewerId ) const
+{
+ return IsApplicable( myModule->getViewManager( theViewerId ) );
+}
+
+bool HYDROGUI_AbstractDisplayer::IsApplicable( const SUIT_ViewManager* theViewMgr ) const
+{
+ return ( theViewMgr && ( theViewMgr->getType() == GetType() ) );
+}
+
void HYDROGUI_AbstractDisplayer::UpdateAll( const int theViewerId,
const bool theIsInit,
const bool theIsForced,
#include <HYDROData_Entity.h>
class HYDROGUI_Module;
+class SUIT_ViewManager;
/**
* \class HYDROGUI_DataModel
virtual ~HYDROGUI_AbstractDisplayer();
public:
+ /**
+ * \brief Check if this displayer is applicable to the given view manager.
+ * The view manager method getType is used.
+ * \param theViewerId viewer identifier
+ */
+ virtual bool IsApplicable( const int theViewerId ) const;
+
+ /**
+ * \brief Check if this displayer is applicable to the given view manager.
+ * The view manager method getType is used.
+ * \param theViewMgr the view manager to check
+ */
+ virtual bool IsApplicable( const SUIT_ViewManager* theViewMgr ) const;
+
/**
* \brief Update all objects in the viewer.
* \param theViewerId viewer identifier
virtual void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
const int theViewerId ) = 0;
+ /**
+ * \brief Get the applicable viewer type.
+ */
+ virtual QString GetType() const = 0;
+
protected:
/**
* \brief Update and display all objects in the viewer.
const bool theIsForced,
const bool theDoFitAll ) = 0;
+protected:
/**
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
return aDriver;
}
+
+QString HYDROGUI_Displayer::GetType() const
+{
+ return GraphicsView_Viewer::Type();
+}
class HYDROGUI_PrsDriver;
-class GraphicsView_Viewer;
-
/**
- * \class HYDROGUI_DataModel
- * \brief Class intended to create, display and update the presentations.
+ * \class HYDROGUI_Displayer
+ * \brief Class intended to create, display and update the presentations in 2D graphics viewer.
*/
class HYDROGUI_Displayer : public HYDROGUI_AbstractDisplayer
{
* \param theObjs sequence of objects to update
* \param theViewerId viewer identifier
*/
- void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId );
+
+ /**
+ * \brief Get the applicable viewer type.
+ */
+ virtual QString GetType() const;
protected:
/**
* \brief Erase all viewer objects.
* \param theViewerId viewer identifier
*/
- void EraseAll( const int theViewerId );
+ void EraseAll( const int theViewerId );
/**
* \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 );
+ void Erase( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId );
/**
* \brief Display the specified viewer objects.
* \param theIsForced flag used to update all objects, including the unchanged ones
* \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
*/
- void Display( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
- const bool theIsForced,
- const bool theDoFitAll );
+ void Display( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId,
+ const bool theIsForced,
+ const bool theDoFitAll );
+protected:
/**
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
- void purgeObjects( const int theViewerId );
+ void purgeObjects( const int theViewerId );
private:
/**
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
#include "HYDROGUI_Shape.h"
+#include "HYDROGUI_VTKPrs.h"
+#include "HYDROGUI_VTKPrsDisplayer.h"
+#include "HYDROGUI_AbstractDisplayer.h"
#include <HYDROData_Image.h>
#include <HYDROData_Lambert93.h>
#include <SUIT_Study.h>
#include <SUIT_ViewManager.h>
+#include <SVTK_ViewManager.h>
+#include <SVTK_ViewModel.h>
+#include <SVTK_Selector.h>
+
#include <QAction>
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
myDisplayer = new HYDROGUI_Displayer( this );
myOCCDisplayer = new HYDROGUI_OCCDisplayer( this );
+ myVTKDisplayer = new HYDROGUI_VTKPrsDisplayer( this );
}
bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType();
bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type();
bool anIsOCCView = theClient == OCCViewer_Viewer::Type();
- if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView )
+ bool anIsVTKView = theClient == SVTK_Viewer::Type();
+ if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView && !anIsVTKView )
return;
size_t anActiveViewId = HYDROGUI_Tool::GetActiveViewId( this );
bool anIsSplittedImage = false;
bool anIsMustBeUpdatedImage = false;
bool anIsPolyline = false;
+ bool anIsBathymetry = false;
bool anIsCalculation = false;
bool anIsImmersibleZone = false;
bool anIsVisualState = false;
anIsRegion = true;
else if( anObject->GetKind() == KIND_ZONE )
anIsZone = true;
+ else if( anObject->GetKind() == KIND_BATHYMETRY )
+ anIsBathymetry = true;
else if( anObject->GetKind() == KIND_OBSTACLE )
anIsObstacle = true;
}
theMenu->addAction( action( DeleteId ) );
theMenu->addSeparator();
- if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion || anIsObstacle )
+ if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion || anIsBathymetry || anIsObstacle )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
}
}
- if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView )
+ if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
{
theMenu->addAction( action( ShowAllId ) );
theMenu->addAction( action( HideAllId ) );
// store selected objects
QStringList aSelectedEntries = storeSelection();
+ bool aDoFitAll = flags & UF_FitAll;
if( ( flags & UF_Viewer ) )
- updateGV( flags & UF_GV_Init,
- flags & UF_GV_Forced,
- flags & UF_FitAll );
+ updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll );
if( ( flags & UF_OCCViewer ) )
- updateOCCViewer( flags & UF_OCC_Init,
- flags & UF_OCC_Forced,
- flags & UF_FitAll );
+ updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll );
+
+ if( ( flags & UF_VTKViewer ) )
+ updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll );
if( ( flags & UF_Model ) && getDataModel() && getApp() )
{
return myOCCDisplayer;
}
+HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
+{
+ return myVTKDisplayer;
+}
+
+SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
+{
+ if( myViewManagerMap.contains( theId ) )
+ {
+ return myViewManagerMap[ theId ].first;
+ }
+ return NULL;
+}
+
GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
{
if( myViewManagerMap.contains( theId ) )
return NULL;
}
+SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
+{
+ if( myViewManagerMap.contains( theId ) )
+ {
+ ViewManagerInfo anInfo = myViewManagerMap[ theId ];
+ SVTK_ViewManager* aViewManager =
+ ::qobject_cast<SVTK_ViewManager*>( anInfo.first );
+ if( aViewManager )
+ return dynamic_cast<SVTK_Viewer*>( aViewManager->getViewModel() );
+ }
+ return NULL;
+}
+
int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
{
ViewManagerMapIterator anIter( myViewManagerMap );
}
}
+/////////////////// OCC SHAPES PROCESSING
HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
const Handle(HYDROData_Entity)& theObject ) const
{
myShapesMap.remove( theViewId );
}
+/////////////////// END OF OCC SHAPES PROCESSING
+
+/////////////////// VTKPrs PROCESSING
+HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject ) const
+{
+ HYDROGUI_VTKPrs* aResShape = NULL;
+ if( theObject.IsNull() )
+ return aResShape;
+
+ if ( myVTKPrsMap.contains( theViewId ) )
+ {
+ const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
+ foreach ( HYDROGUI_VTKPrs* aShape, aViewShapes )
+ {
+ if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
+ continue;
+
+ aResShape = aShape;
+ break;
+ }
+ }
+
+ return aResShape;
+}
+
+void HYDROGUI_Module::setObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject,
+ HYDROGUI_VTKPrs* theShape )
+{
+ if( theObject.IsNull() )
+ return;
+
+ ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+ aViewShapes.append( theShape );
+}
+
+void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject )
+{
+ if ( !myVTKPrsMap.contains( theViewId ) )
+ return;
+
+ ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
+ Handle(HYDROData_Entity) anObject;
+ for ( int i = 0; i < aViewShapes.length(); )
+ {
+ HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+ anObject = aShape->getObject();
+ if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
+ {
+ delete aShape;
+ aViewShapes.removeAt( i );
+ continue;
+ }
+
+ ++i;
+ }
+}
+
+void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
+{
+ if ( !myVTKPrsMap.contains( theViewId ) )
+ return;
+
+ const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
+ for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
+ {
+ HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
+ if ( aShape )
+ delete aShape;
+ }
+
+ myVTKPrsMap.remove( theViewId );
+}
+/////////////////// END OF VTKPrs PROCESSING
CAM_DataModel* HYDROGUI_Module::createDataModel()
{
*/
}
-void HYDROGUI_Module::updateGV( const bool theIsInit,
- const bool theIsForced,
- const bool theDoFitAll )
+void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer,
+ const bool theIsInit,
+ const bool theIsForced,
+ const bool theDoFitAll )
{
- if( !getDisplayer() )
- return;
-
QList<int> aViewManagerIdList;
// currently, all views are updated
ViewManagerMapIterator anIter( myViewManagerMap );
while( anIter.hasNext() )
{
- GraphicsView_ViewManager* aViewManager =
- dynamic_cast<GraphicsView_ViewManager*>( anIter.next().value().first );
- if ( !aViewManager )
- continue;
+ SUIT_ViewManager* aViewManager = anIter.next().value().first;
- int anId = anIter.key();
- aViewManagerIdList.append( anId );
+ if ( theDisplayer->IsApplicable( aViewManager ) )
+ {
+ int anId = anIter.key();
+ aViewManagerIdList.append( anId );
+ }
}
QListIterator<int> anIdIter( aViewManagerIdList );
while( anIdIter.hasNext() )
- getDisplayer()->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
-}
-
-void HYDROGUI_Module::updateOCCViewer( const bool theIsInit,
- const bool theIsForced,
- const bool theDoFitAll )
-{
- HYDROGUI_OCCDisplayer* anOCCDisplayer = getOCCDisplayer();
- if( !anOCCDisplayer )
- return;
-
- QList<int> aViewManagerIdList;
-
- // currently, all views are updated
- ViewManagerMapIterator anIter( myViewManagerMap );
- while( anIter.hasNext() )
- {
- OCCViewer_ViewManager* aViewManager =
- ::qobject_cast<OCCViewer_ViewManager*>( anIter.next().value().first );
- if ( !aViewManager )
- continue;
-
- int anId = anIter.key();
- aViewManagerIdList.append( anId );
+ {
+ theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
}
-
- QListIterator<int> anIdIter( aViewManagerIdList );
- while( anIdIter.hasNext() )
- anOCCDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
}
void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
{
SUIT_Selector* aSelector = *anIter;
if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
+ !dynamic_cast<SVTK_Selector*>( aSelector ) &&
!dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
aSelector->setEnabled( false );
}
class QGraphicsSceneMouseEvent;
class GraphicsView_Viewer;
+class OCCViewer_Viewer;
+class SVTK_Viewer;
class SUIT_ViewWindow;
+class SUIT_ViewManager;
class HYDROGUI_DataModel;
class HYDROGUI_Displayer;
class HYDROGUI_OCCDisplayer;
+class HYDROGUI_VTKPrsDisplayer;
+class HYDROGUI_AbstractDisplayer;
class HYDROGUI_Shape;
-
-class OCCViewer_Viewer;
+class HYDROGUI_VTKPrs;
/**\class HYDROGUI_Module
*\brief The class representing the HYDROGUI module
typedef QList<HYDROGUI_Shape*> ListOfShapes;
typedef QMap<int,ListOfShapes> ViewId2ListOfShapes;
+ typedef QList<HYDROGUI_VTKPrs*> ListOfVTKPrs;
+ typedef QMap<int,ListOfVTKPrs> ViewId2ListOfVTKPrs;
+
public:
HYDROGUI_Module();
virtual ~HYDROGUI_Module();
virtual void selectionChanged();
+ SUIT_ViewManager* getViewManager( const int theId ) const;
HYDROGUI_DataModel* getDataModel() const;
HYDROGUI_Displayer* getDisplayer() const;
HYDROGUI_OCCDisplayer* getOCCDisplayer() const;
+ HYDROGUI_VTKPrsDisplayer* getVTKDisplayer() const;
GraphicsView_Viewer* getViewer( const int theId ) const;
OCCViewer_Viewer* getOCCViewer( const int theId ) const;
+ SVTK_Viewer* getVTKViewer( const int theId ) const;
int getViewManagerId( SUIT_ViewManager* theViewManager );
ViewManagerRole getViewManagerRole( SUIT_ViewManager* theViewManager );
void setObjectShape( const int theViewId,
const Handle(HYDROData_Entity)& theObject,
HYDROGUI_Shape* theShape );
- void removeViewShapes( const int theViewId );
+ void removeViewShapes( const int theViewId );
void removeObjectShape( const int theViewId,
const Handle(HYDROData_Entity)& theObject );
+ HYDROGUI_VTKPrs* getObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject ) const;
+ void setObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject,
+ HYDROGUI_VTKPrs* theShape );
+ void removeViewVTKPrs( const int theViewId );
+ void removeObjectVTKPrs( const int theViewId,
+ const Handle(HYDROData_Entity)& theObject );
+
QStringList GetGeomObjectsToImport();
protected:
const QStringList& );
private:
- void updateGV( const bool theIsInit = false,
- const bool theIsForced = false,
- const bool theDoFitAll = false );
-
- void updateOCCViewer( const bool theIsInit = false,
- const bool theIsForced = false,
- const bool theDoFitAll = false );
+ void updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer,
+ const bool theIsInit = false,
+ const bool theIsForced = false,
+ const bool theDoFitAll = false );
void createSelector( SUIT_ViewManager* viewMgr );
private:
HYDROGUI_Displayer* myDisplayer;
HYDROGUI_OCCDisplayer* myOCCDisplayer;
+ HYDROGUI_VTKPrsDisplayer* myVTKDisplayer;
ViewManagerMap myViewManagerMap;
ViewId2Name2ObjectStateMap myObjectStateMap;
ViewId2ListOfShapes myShapesMap;
+ ViewId2ListOfVTKPrs myVTKPrsMap;
bool myIsUpdateEnabled;
}
}
-
+QString HYDROGUI_OCCDisplayer::GetType() const
+{
+ return OCCViewer_Viewer::Type();
+}
void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
const int theViewerId );
+ /**
+ * \brief Get the applicable viewer type.
+ */
+ virtual QString GetType() const;
+
protected:
/**
* \brief Erase all viewer objects.
const bool theIsForced,
const bool theDoFitAll );
+protected:
/**
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
#include <LightApp_Application.h>
#include <OCCViewer_ViewModel.h>
+#include <SVTK_ViewModel.h>
#include <SUIT_ViewManager.h>
{
anUpdateFlags |= UF_OCCViewer;
}
+ else if ( aViewMgr->getType() == SVTK_Viewer::Type() )
+ {
+ anUpdateFlags |= UF_VTKViewer;
+ }
}
module()->update( anUpdateFlags );
( anObject->GetKind() == KIND_POLYLINE ) ||
( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
( anObject->GetKind() == KIND_REGION ) ||
+ ( anObject->GetKind() == KIND_BATHYMETRY ) ||
( anObject->GetKind() == KIND_ZONE ) ||
( anObject->GetKind() == KIND_OBSTACLE ) ) )
{
UF_OCC_Init = 0x00000100, //!< initial update (used with UF_OCCViewer)
UF_OCC_Forced = 0x00000200, //!< to force recomputing all presentations (used with UF_OCCViewer)
+ UF_VTKViewer = 0x00000800, //!< OCC viewer
+ UF_VTK_Init = 0x00001000, //!< initial update (used with UF_OCCViewer)
+ UF_VTK_Forced = 0x00002000, //!< to force recomputing all presentations (used with UF_OCCViewer)
+
UF_FitAll = 0x00000400, //!< to do fit all (used with UF_Viewer or UF_OCCViewer)
UF_All = UF_Base | UF_GV_Init | UF_GV_Forced | UF_OCCViewer | UF_OCC_Init | UF_OCC_Forced//!< all update flags
--- /dev/null
+// 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_VTKPrs.h"
+
+#include "HYDROGUI_DataObject.h"
+
+//=======================================================================
+// name : HYDROGUI_VTKPrs
+// Purpose : Constructor
+//=======================================================================
+HYDROGUI_VTKPrs::HYDROGUI_VTKPrs( const Handle(HYDROData_Entity)& theObject )
+: myObject( theObject ),
+ myIsToUpdate( false )
+{
+ // Define IO for actors to be added:
+ QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject );
+ myIO = new SALOME_InteractiveObject(
+ anEntry.toAscii(), QString::number( theObject->GetKind() ).toAscii(), theObject->GetName().toAscii() );
+}
+
+//=======================================================================
+// name : HYDROGUI_VTKPrs
+// Purpose : Destructor
+//=======================================================================
+HYDROGUI_VTKPrs::~HYDROGUI_VTKPrs()
+{
+}
+
+//=======================================================================
+// name : compute
+// Purpose : Compute the presentation
+//=======================================================================
+void HYDROGUI_VTKPrs::compute()
+{
+}
--- /dev/null
+// 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_VTKPrs_H
+#define HYDROGUI_VTKPrs_H
+
+#include <HYDROData_Entity.h>
+
+#include <SALOME_InteractiveObject.hxx>
+#include <SVTK_Prs.h>
+
+/*
+ Class : HYDROGUI_VTKPrs
+ Description : Base class for all HYDRO presentation in VTK viewer
+*/
+class HYDROGUI_VTKPrs : public SVTK_Prs
+{
+public:
+ HYDROGUI_VTKPrs( const Handle(HYDROData_Entity)& theObject );
+ virtual ~HYDROGUI_VTKPrs();
+
+ virtual void compute();
+
+public:
+ Handle(HYDROData_Entity) getObject() const { return myObject; }
+ Handle(SALOME_InteractiveObject) getIO() const { return myIO; }
+
+ bool getIsToUpdate() const { return myIsToUpdate; }
+ void setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
+
+private:
+ Handle(HYDROData_Entity) myObject;
+ Handle(SALOME_InteractiveObject) myIO;
+ bool myIsToUpdate;
+};
+
+#endif
--- /dev/null
+// 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_VTKPrsBathymetry.h"
+
+#include <HYDROData_Entity.h>
+
+#include <SALOME_Actor.h>
+#include <gp_XYZ.hxx>
+#include <vtkPoints.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkVertex.h>
+
+#include <QString>
+
+//=======================================================================
+// name : HYDROGUI_VTKPrsBathymetry
+// Purpose : Constructor
+//=======================================================================
+HYDROGUI_VTKPrsBathymetry::HYDROGUI_VTKPrsBathymetry( const Handle(HYDROData_Bathymetry)& theObject )
+: HYDROGUI_VTKPrs( theObject )
+{
+}
+
+//=======================================================================
+// name : HYDROGUI_VTKPrsBathymetry
+// Purpose : Destructor
+//=======================================================================
+HYDROGUI_VTKPrsBathymetry::~HYDROGUI_VTKPrsBathymetry()
+{
+}
+
+//================================================================
+// Function : compute
+// Purpose :
+//================================================================
+void HYDROGUI_VTKPrsBathymetry::compute()
+{
+ if ( !getObject().IsNull() )
+ {
+ Handle(HYDROData_Bathymetry) aBathymetry = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
+ if ( !aBathymetry.IsNull() )
+ {
+ HYDROData_Bathymetry::AltitudePoints anAltPoints = aBathymetry->GetAltitudePoints();
+ int aNbPoints = anAltPoints.length();
+
+ HYDROData_Bathymetry::AltitudePoint anAltPnt;
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints( aNbPoints );
+
+ vtkPolyData* aVertexGrid = vtkPolyData::New();
+ aVertexGrid->Allocate( aNbPoints );
+
+ vtkVertex* aVertex = vtkVertex::New();
+
+ for (int i = 0; i < aNbPoints; i++ )
+ {
+ anAltPnt = anAltPoints.at( i );
+ aPoints->InsertPoint( i, anAltPnt.X(), anAltPnt.Y(), anAltPnt.Z() );
+ aVertex->GetPointIds()->SetId( 0, i );
+ aVertexGrid->InsertNextCell( aVertex->GetCellType(), aVertex->GetPointIds());
+ }
+
+ aVertex->Delete();
+
+ aVertexGrid->SetPoints( aPoints );
+ vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
+ aMapper->SetInputData( aVertexGrid );
+ SALOME_Actor* anActor = SALOME_Actor::New();
+ anActor->SetMapper( aMapper );
+ anActor->setIO( getIO() );
+ //anActor->setName( aBathymetry->GetName().toLatin1() );
+ AddObject( anActor );
+ //anActor.AddPosition(0, 0, 6);
+ //anActor.GetProperty().SetDiffuseColor(1, 1, 1);
+ }
+ }
+}
--- /dev/null
+// 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_VTKPrsBathymetry_H
+#define HYDROGUI_VTKPrsBathymetry_H
+
+#include "HYDROGUI_VTKPrs.h"
+
+#include <HYDROData_Bathymetry.h>
+
+/*
+ Class : HYDROGUI_VTKPrsBathymetry
+ Description : Presentation for Bathymetry object
+*/
+class HYDROGUI_VTKPrsBathymetry : public HYDROGUI_VTKPrs
+{
+public:
+ HYDROGUI_VTKPrsBathymetry( const Handle(HYDROData_Bathymetry)& theObject );
+ virtual ~HYDROGUI_VTKPrsBathymetry();
+
+ virtual void compute();
+};
+
+#endif
--- /dev/null
+// 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_VTKPrsBathymetryDriver.h"
+
+#include "HYDROGUI_VTKPrsBathymetry.h"
+
+#include <HYDROData_Bathymetry.h>
+
+HYDROGUI_VTKPrsBathymetryDriver::HYDROGUI_VTKPrsBathymetryDriver()
+{
+}
+
+HYDROGUI_VTKPrsBathymetryDriver::~HYDROGUI_VTKPrsBathymetryDriver()
+{
+}
+
+bool HYDROGUI_VTKPrsBathymetryDriver::Update( const Handle(HYDROData_Entity)& theObj,
+ HYDROGUI_VTKPrs*& thePrs )
+{
+ HYDROGUI_VTKPrsDriver::Update( theObj, thePrs );
+
+ if( theObj.IsNull() )
+ return false;
+
+ Handle(HYDROData_Bathymetry) aBathymetry = Handle(HYDROData_Bathymetry)::DownCast( theObj );
+ if( aBathymetry.IsNull() )
+ return false;
+
+ if( !thePrs )
+ thePrs = new HYDROGUI_VTKPrsBathymetry( aBathymetry );
+
+ HYDROGUI_VTKPrsBathymetry* aPrsBathymetry = (HYDROGUI_VTKPrsBathymetry*)thePrs;
+
+ //aPrsBathymetry->setName( aBathymetry->GetName() );
+ //aPrsBathymetry->setPath( aBathymetry->GetPainterPath() );
+
+ aPrsBathymetry->compute();
+
+ return true;
+}
--- /dev/null
+// 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_VTKPrsBathymetryDRIVER_H
+#define HYDROGUI_VTKPrsBathymetryDRIVER_H
+
+#include <HYDROGUI_VTKPrsDriver.h>
+
+/**
+ * \class HYDROGUI_VTKPrsBathymetryDriver
+ * \brief Presentation driver for Bathymetry objects.
+ */
+class HYDROGUI_VTKPrsBathymetryDriver : public HYDROGUI_VTKPrsDriver
+{
+public:
+ /**
+ * \brief Constructor.
+ */
+ HYDROGUI_VTKPrsBathymetryDriver();
+
+ /**
+ * \brief Destructor.
+ */
+ virtual ~HYDROGUI_VTKPrsBathymetryDriver();
+
+public:
+ /**
+ * \brief Update or create the Bathymetry presentation on a basis of data object.
+ * \param theObj data object
+ * \param thePrs presentation
+ * \return status of the operation
+ */
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
+ HYDROGUI_VTKPrs*& thePrs );
+};
+
+#endif
--- /dev/null
+// 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_VTKPrsDisplayer.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_VTKPrs.h"
+#include "HYDROGUI_VTKPrsBathymetryDriver.h"
+#include "HYDROGUI_Tool.h"
+
+#include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+#include <SALOME_InteractiveObject.hxx>
+#include <SUIT_ViewManager.h>
+#include <SUIT_Accel.h>
+
+#include <QVector>
+
+HYDROGUI_VTKPrsDisplayer::HYDROGUI_VTKPrsDisplayer( HYDROGUI_Module* theModule )
+: HYDROGUI_AbstractDisplayer( theModule ), myDriver( NULL )
+{
+}
+
+HYDROGUI_VTKPrsDisplayer::~HYDROGUI_VTKPrsDisplayer()
+{
+}
+
+void HYDROGUI_VTKPrsDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId )
+{
+ SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
+ if( !aViewer )
+ {
+ HYDROGUI_VTKPrs* anObjShape;
+ for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
+ {
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
+ if( !anObj.IsNull() )
+ {
+ anObjShape = module()->getObjectVTKPrs( (size_t)aViewer, anObj );
+ if ( anObjShape )
+ {
+ anObjShape->setIsToUpdate( true );
+ }
+ }
+ }
+ }
+}
+
+void HYDROGUI_VTKPrsDisplayer::EraseAll( const int theViewerId )
+{
+ SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
+ if( aViewer )
+ {
+ aViewer->EraseAll( true );
+ module()->removeViewVTKPrs( (size_t)aViewer );
+ }
+}
+
+void HYDROGUI_VTKPrsDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId )
+{
+ SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
+ if( aViewer )
+ {
+ HYDROGUI_VTKPrs* aPrs;
+ for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
+ {
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
+ if( anObj.IsNull() )
+ continue;
+
+ aPrs = module()->getObjectVTKPrs( (size_t)aViewer, anObj );
+ if ( aPrs )
+ {
+ aViewer->Erase( aPrs, true );
+ }
+ module()->removeObjectVTKPrs( (size_t)aViewer, anObj );
+ }
+ }
+}
+
+void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId,
+ const bool theIsForced,
+ const bool theDoFitAll)
+{
+ SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
+ if( aViewer )
+ {
+ bool isChanged = false;
+ HYDROGUI_VTKPrs* aPrs;
+ for ( int i = 1, n = theObjs.Length(); i <= n; i++ )
+ {
+ Handle(HYDROData_Entity) anObj = theObjs.Value( i );
+ if( !anObj.IsNull() )
+ {
+ bool anIsVisible = module()->isObjectVisible( (size_t)(aViewer->getViewManager()->getViewModel()), anObj );
+ aPrs = module()->getObjectVTKPrs( (size_t)aViewer, anObj );
+
+ bool anIsInserted = ( aPrs != 0 );
+ if( anIsVisible && ( !aPrs || aPrs->getIsToUpdate() || theIsForced ) )
+ {
+ if( HYDROGUI_VTKPrsDriver* aDriver = getDriver( anObj ) )
+ {
+ if( aDriver->Update( anObj, aPrs ) && aPrs && !anIsInserted )
+ {
+ module()->setObjectVTKPrs( theViewerId, anObj, aPrs );
+ aViewer->Display( aPrs );
+ isChanged = true;
+ }
+ }
+ }
+
+ if( aPrs && !anIsVisible )
+ {
+ aViewer->Erase( aPrs );
+ isChanged = true;
+ }
+ }
+ }
+
+ if ( theDoFitAll )
+ {
+ // Repaint is done inside OnFitAll()
+ aViewer->getViewManager()->getActiveView()->onAccelAction( SUIT_Accel::ZoomFit );
+ }
+ else if ( isChanged )
+ {
+ aViewer->Repaint();
+ }
+ }
+}
+
+void HYDROGUI_VTKPrsDisplayer::purgeObjects( const int theViewerId )
+{
+ SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
+ if( aViewer )
+ {
+ SALOME_ListIO aListIO;
+ aViewer->GetVisible( aListIO );
+
+ HYDROGUI_VTKPrs* aPrs;
+ SALOME_ListIteratorOfListIO anIter( aListIO );
+ for( ; anIter.More(); anIter.Next() )
+ {
+ Handle(SALOME_InteractiveObject) aPrsObj = anIter.Value();
+ if ( !aPrsObj.IsNull() )
+ {
+ Handle(HYDROData_Entity) anOwnerObj =
+ module()->getDataModel()->objectByEntry( aPrsObj->getEntry() );
+ if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() )
+ {
+ aPrs = module()->getObjectVTKPrs( (size_t)aViewer, anOwnerObj );
+ if ( aPrs )
+ {
+ aViewer->Erase( aPrs );
+ }
+ module()->removeObjectVTKPrs( (size_t)aViewer, anOwnerObj );
+ }
+ }
+ }
+ }
+}
+
+HYDROGUI_VTKPrsDriver* HYDROGUI_VTKPrsDisplayer::getDriver( const Handle(HYDROData_Entity)& theObj )
+{
+ HYDROGUI_VTKPrsDriver* aDriver = NULL;
+ ObjectKind aKind = theObj->GetKind();
+ if( theObj->GetKind() == KIND_BATHYMETRY )
+ {
+ if ( !myDriver )
+ {
+ myDriver = new HYDROGUI_VTKPrsBathymetryDriver();
+ }
+ aDriver = myDriver;
+ }
+
+ return aDriver;
+}
+
+QString HYDROGUI_VTKPrsDisplayer::GetType() const
+{
+ return SVTK_Viewer::Type();
+}
--- /dev/null
+// 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_VTKPRSDISPLAYER_H
+#define HYDROGUI_VTKPRSDISPLAYER_H
+
+#include "HYDROGUI_AbstractDisplayer.h"
+
+class HYDROGUI_VTKPrsDriver;
+
+/**
+ * \class HYDROGUI_VTKPrsDisplayer
+ * \brief Class intended to create, display and update the presentations in VTK viewer.
+ */
+class HYDROGUI_VTKPrsDisplayer : public HYDROGUI_AbstractDisplayer
+{
+public:
+ /**
+ * \brief Constructor.
+ * \param theModule module object
+ */
+ HYDROGUI_VTKPrsDisplayer( HYDROGUI_Module* theModule );
+
+ /**
+ * \brief Destructor.
+ */
+ virtual ~HYDROGUI_VTKPrsDisplayer();
+
+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 Get the applicable viewer type.
+ */
+ virtual QString GetType() const;
+
+protected:
+ /**
+ * \brief Erase all viewer objects.
+ * \param theViewerId viewer identifier
+ */
+ void EraseAll( const int theViewerId );
+
+ /**
+ * \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
+ * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
+ */
+ void Display( const HYDROData_SequenceOfObjects& theObjs,
+ const int theViewerId,
+ const bool theIsForced,
+ const bool theDoFitAll );
+
+protected:
+ /**
+ * \brief Purge all invalid objects in the viewer.
+ * \param theViewerId viewer identifier
+ */
+ void purgeObjects( const int theViewerId );
+
+private:
+ /**
+ * \brief Get the presentation driver for the specified data object.
+ * \param theObj data object
+ */
+ HYDROGUI_VTKPrsDriver* getDriver( const Handle(HYDROData_Entity)& theObj );
+
+ HYDROGUI_VTKPrsDriver* myDriver;
+};
+
+#endif
--- /dev/null
+// 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_VTKPrsDriver.h"
+
+#include "HYDROGUI_VTKPrs.h"
+
+HYDROGUI_VTKPrsDriver::HYDROGUI_VTKPrsDriver()
+{
+}
+
+HYDROGUI_VTKPrsDriver::~HYDROGUI_VTKPrsDriver()
+{
+}
+
+bool HYDROGUI_VTKPrsDriver::Update( const Handle(HYDROData_Entity)& theObj,
+ HYDROGUI_VTKPrs*& thePrs )
+{
+ if ( thePrs )
+ thePrs->setIsToUpdate( false );
+ return true;
+}
--- /dev/null
+// 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_VTKPrsDRIVER_H
+#define HYDROGUI_VTKPrsDRIVER_H
+
+#include <HYDROData_Entity.h>
+
+class HYDROGUI_VTKPrs;
+
+/**
+ * \class HYDROGUI_VTKPrsDriver
+ * \brief Base class of presentation driver, which allows to build a
+ * VTK presentation on a basis of data object.
+ */
+class HYDROGUI_VTKPrsDriver
+{
+public:
+ /**
+ * \brief Constructor.
+ */
+ HYDROGUI_VTKPrsDriver();
+
+ /**
+ * \brief Destructor.
+ */
+ virtual ~HYDROGUI_VTKPrsDriver();
+
+public:
+ /**
+ * \brief Virtual method intended to update or create the presentation
+ * on a basis of data object.
+ * \param theObj data object
+ * \param thePrs presentation
+ * \return status of the operation
+ */
+ virtual bool Update( const Handle(HYDROData_Entity)& theObj,
+ HYDROGUI_VTKPrs*& thePrs );
+};
+
+#endif