#include <SUIT_ViewManager.h>
#include <SUIT_ViewModel.h>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_AbstractDisplayer::HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule )
: myModule( theModule )
{
{
}
-bool HYDROGUI_AbstractDisplayer::IsApplicable( const int theViewerId ) const
+bool HYDROGUI_AbstractDisplayer::IsApplicable( const size_t theViewerId ) const
{
return IsApplicable( myModule->getViewManager( theViewerId ) );
}
return ( theViewMgr && ( theViewMgr->getType() == GetType() ) );
}
-void HYDROGUI_AbstractDisplayer::UpdateAll( const int theViewerId,
+void HYDROGUI_AbstractDisplayer::UpdateAll( const size_t theViewerId,
const bool theIsInit,
const bool theIsForced,
const bool theDoFitAll )
{
+ DEBTRACE("UpdateAll");
if ( theIsInit )
EraseAll( theViewerId );
DisplayAll( theViewerId, theIsForced, theDoFitAll );
}
-void HYDROGUI_AbstractDisplayer::DisplayAll( const int theViewerId,
+void HYDROGUI_AbstractDisplayer::DisplayAll( const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll )
{
+ DEBTRACE("DisplayAll");
HYDROData_SequenceOfObjects aSeq;
HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq );
Update( aSeq, theViewerId, theIsForced, theDoFitAll );
}
void HYDROGUI_AbstractDisplayer::Update( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll )
{
+ DEBTRACE("Update");
// First of all, kill all bad presentations
purgeObjects( theViewerId );
* The view manager method getType is used.
* \param theViewerId viewer identifier
*/
- virtual bool IsApplicable( const int theViewerId ) const;
+ virtual bool IsApplicable( const size_t theViewerId ) const;
/**
* \brief Check if this displayer is applicable to the given view manager.
* \param theIsInit flag used for initial update
* \param theIsForced flag used to update all objects, including the unchanged ones
*/
- virtual void UpdateAll( const int theViewerId,
+ virtual void UpdateAll( const size_t theViewerId,
const bool theIsInit,
const bool theIsForced,
const bool theDoFitAll );
* \param theViewerId viewer identifier
*/
virtual void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId ) = 0;
+ const size_t theViewerId ) = 0;
/**
* \brief Get the applicable viewer type.
* \param theViewerId viewer identifier
* \param theIsForced flag used to update all objects, including the unchanged ones
*/
- virtual void DisplayAll( const int theViewerId,
+ virtual void DisplayAll( const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
* \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
*/
virtual void Update( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
* \brief Erase all viewer objects.
* \param theViewerId viewer identifier
*/
- virtual void EraseAll( const int theViewerId ) = 0;
+ virtual void EraseAll( const size_t theViewerId ) = 0;
/**
* \brief Erase the specified viewer objects.
* \param theViewerId viewer identifier
*/
virtual void Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId ) = 0;
+ const size_t theViewerId ) = 0;
/**
* \brief Display the specified viewer objects.
* \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
*/
virtual void Display( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll ) = 0;
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
- virtual void purgeObjects( const int theViewerId ) = 0;
+ virtual void purgeObjects( const size_t theViewerId ) = 0;
//HYDROGUI_Module* module() const {return myModule;}
#include <QAction>
#include <QApplication>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule ), myIsActive( false )
{
void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
{
+ DEBTRACE("activateSelection " << isActive);
if( myIsActive==isActive )
return;
if( isActive )
{
const int aSelectionMode = 1;
+ //ctx->Deactivate( Standard_True );
//ctx->OpenLocalContext( Standard_True );
foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
{
}
void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
if( !aViewer )
}
}
-void HYDROGUI_Displayer::EraseAll( const int theViewerId )
+void HYDROGUI_Displayer::EraseAll( const size_t theViewerId )
{
GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
if( !aViewer )
}
void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
if( !aViewer )
}
void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll)
{
}
}
-void HYDROGUI_Displayer::purgeObjects( const int theViewerId )
+void HYDROGUI_Displayer::purgeObjects( const size_t theViewerId )
{
GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
if( !aViewer )
* \param theViewerId viewer identifier
*/
void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Get the applicable viewer type.
* \brief Erase all viewer objects.
* \param theViewerId viewer identifier
*/
- void EraseAll( const int theViewerId );
+ void EraseAll( const size_t theViewerId );
/**
* \brief Erase the specified viewer objects.
* \param theViewerId viewer identifier
*/
void Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Display the specified viewer objects.
* \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 size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
- void purgeObjects( const int theViewerId );
+ void purgeObjects( const size_t theViewerId );
private:
/**
#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
-static int ViewManagerId = 0;
+static size_t ViewManagerId = 1;
extern "C" HYDRO_EXPORT CAM_Module* createModule()
{
void HYDROGUI_Module::selectionChanged()
{
+ DEBTRACE("HYDROGUI_Module::selectionChanged");
LightApp_Module::selectionChanged();
updateCommandsStatus();
}
return myVTKDisplayer;
}
-SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
+SUIT_ViewManager* HYDROGUI_Module::getViewManager( const size_t theId ) const
{
- DEBTRACE("HYDROGUI_Module::getViewManager");
+ DEBTRACE("HYDROGUI_Module::getViewManager " << theId);
if( myViewManagerMap.contains( theId ) )
{
return myViewManagerMap[ theId ].first;
return NULL;
}
-GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
+GraphicsView_Viewer* HYDROGUI_Module::getViewer( const size_t theId ) const
{
- DEBTRACE("HYDROGUI_Module::getViewer");
+ DEBTRACE("HYDROGUI_Module::getViewer " << theId);
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
return NULL;
}
-OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
+OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const size_t theId ) const
{
- DEBTRACE("HYDROGUI_Module::getOCCViewer");
+ DEBTRACE("HYDROGUI_Module::getOCCViewer " << theId);
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
return NULL;
}
-SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
+SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const size_t theId ) const
{
- DEBTRACE("HYDROGUI_Module::getVTKViewer");
+ DEBTRACE("HYDROGUI_Module::getVTKViewer " << theId);
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
return NULL;
}
-int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
+size_t HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
{
DEBTRACE("HYDROGUI_Module::getViewManagerId");
ViewManagerMapIterator anIter( myViewManagerMap );
while( anIter.hasNext() )
{
- int anId = anIter.next().key();
+ size_t anId = anIter.next().key();
const ViewManagerInfo& anInfo = anIter.value();
if( anInfo.first == theViewManager )
return anId;
}
- return -1;
+ return 0;
}
HYDROGUI_Module::ViewManagerRole HYDROGUI_Module::getViewManagerRole( SUIT_ViewManager* theViewManager )
{
DEBTRACE("HYDROGUI_Module::getViewManagerRole");
- int anId = getViewManagerId( theViewManager );
- if( anId != -1 )
+ size_t anId = getViewManagerId( theViewManager );
+ if( anId == 0 )
{
const ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
return anInfo.second;
}
/////////////////// OCC SHAPES PROCESSING
-QList<HYDROGUI_Shape*> HYDROGUI_Module::getObjectShapes( const int theViewId,
+QList<HYDROGUI_Shape*> HYDROGUI_Module::getObjectShapes( const size_t theViewId,
ObjectKind theKind ) const
{
QList<HYDROGUI_Shape*> aResult;
return aResult;
}
-HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
+HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const
{
HYDROGUI_Shape* aResShape = NULL;
return aResShape;
}
-void HYDROGUI_Module::setObjectShape( const int theViewId,
+void HYDROGUI_Module::setObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
HYDROGUI_Shape* theShape )
{
aViewShapes.append( theShape );
}
-void HYDROGUI_Module::removeObjectShape( const int theViewId,
+void HYDROGUI_Module::removeObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject )
{
if ( !myShapesMap.contains( theViewId ) )
}
}
-void HYDROGUI_Module::removeViewShapes( const int theViewId )
+void HYDROGUI_Module::removeViewShapes( const size_t theViewId )
{
if ( !myShapesMap.contains( theViewId ) )
return;
/////////////////// END OF OCC SHAPES PROCESSING
/////////////////// VTKPrs PROCESSING
-HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int theViewId,
+HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const
{
HYDROGUI_VTKPrs* aResShape = NULL;
return aResShape;
}
-void HYDROGUI_Module::setObjectVTKPrs( const int theViewId,
+void HYDROGUI_Module::setObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
HYDROGUI_VTKPrs* theShape )
{
aViewShapes.append( theShape );
}
-void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
+void HYDROGUI_Module::removeObjectVTKPrs( const size_t theViewId,
const QString& theEntry )
{
if ( !myVTKPrsMap.contains( theViewId ) )
getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
}
-void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
+void HYDROGUI_Module::removeObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject )
{
if ( !myVTKPrsMap.contains( theViewId ) )
getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
}
-void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
+void HYDROGUI_Module::removeViewVTKPrs( const size_t theViewId )
{
if ( !myVTKPrsMap.contains( theViewId ) )
return;
myVTKPrsMap.remove( theViewId );
}
-void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
+void HYDROGUI_Module::updateVTKZRange( const size_t theViewId, double theRange[] )
{
if ( myVTKPrsMap.contains( theViewId ) )
{
DEBTRACE("HYDROGUI_Module::onViewCreated");
if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
{
+ DEBTRACE("theViewWindow->inherits( 'GraphicsView_ViewFrame' )");
if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
{
+ DEBTRACE("---");
aViewFrame->installEventFilter( this );
GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
}
else if( theViewWindow && theViewWindow->inherits( "OCCViewer_ViewFrame" ) )
{
+ DEBTRACE("theViewWindow->inherits( 'OCCViewer_ViewFrame' )");
if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
{
+ DEBTRACE("---");
aViewFrame->onTopView();
HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
}
else if( theViewWindow && theViewWindow->inherits( "SVTK_ViewWindow" ) )
{
+ DEBTRACE("theViewWindow->inherits( 'SVTK_ViewWindow' )");
if( SVTK_ViewWindow* aViewFrame = dynamic_cast<SVTK_ViewWindow*>( theViewWindow ) )
{
+ DEBTRACE("---");
aViewFrame->installEventFilter( this );
}
}
void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
{
- DEBTRACE("HYDROGUI_Module::createSelector");
+ DEBTRACE("HYDROGUI_Module::createSelector ====================================");
if( !theViewManager )
return;
return;
QString aViewType = theViewManager->getType();
+ DEBTRACE("aViewType " << aViewType.toStdString() << " " << GraphicsView_Viewer::Type().toStdString() << " " << OCCViewer_Viewer::Type().toStdString());
if( aViewType != GraphicsView_Viewer::Type() &&
aViewType != OCCViewer_Viewer::Type())
return;
aSelectionMgr->selectors( aViewType, aSelectorList );
// disable all alien selectors
+ bool isGV = false;
+ bool isOCC = false;
QList<SUIT_Selector*>::iterator anIter, anIterEnd = aSelectorList.end();
for( anIter = aSelectorList.begin(); anIter != anIterEnd; anIter++ )
{
SUIT_Selector* aSelector = *anIter;
- if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
- !dynamic_cast<SVTK_Selector*>( aSelector ) &&
- !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
- aSelector->setEnabled( false );
+// if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
+// !dynamic_cast<SVTK_Selector*>( aSelector ) &&
+// !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
+ bool isOk = false;
+ if (aSelector)
+ {
+ DEBTRACE("Selector " << aSelector->type().toStdString());
+ if (dynamic_cast<HYDROGUI_GVSelector*>( aSelector ))
+ {
+ isOk = true;
+ isGV = true;
+ DEBTRACE("HYDROGUI_GVSelector");
+ }
+ else if (dynamic_cast<SVTK_Selector*>( aSelector ))
+ {
+ isOk = true;
+ DEBTRACE("SVTK_Selector");
+ }
+ else if (dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ))
+ {
+ isOk = true;
+ isOCC = true;
+ DEBTRACE("HYDROGUI_OCCSelector");
+ }
+ if (isOk)
+ {
+ DEBTRACE("Selector enabled " << aSelector->type().toStdString());
+ aSelector->setEnabled( true );
+ }
+ else
+ {
+ DEBTRACE("Selector disabled " << aSelector->type().toStdString());
+ aSelector->setEnabled( false );
+ }
+ }
}
- if ( aViewType == GraphicsView_Viewer::Type() )
+ if ( !isGV && aViewType == GraphicsView_Viewer::Type() )
{
GraphicsView_ViewManager* aViewManager =
::qobject_cast<GraphicsView_ViewManager*>( theViewManager );
if( aViewManager )
- new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
+ {
+ HYDROGUI_GVSelector* sel = new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
+ DEBTRACE("new HYDROGUI_GVSelector " << sel << " " << sel->type().toStdString());
+ sel->setEnabled( true );
+ }
}
- else if ( aViewType == OCCViewer_Viewer::Type() )
+ else if ( !isOCC && aViewType == OCCViewer_Viewer::Type() )
{
OCCViewer_ViewManager* aViewManager =
::qobject_cast<OCCViewer_ViewManager*>( theViewManager );
if( aViewManager )
- new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
+ {
+ HYDROGUI_OCCSelector* sel = new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
+ DEBTRACE("new HYDROGUI_OCCSelector " << sel << " " << sel->type().toStdString());
+ sel->setEnabled( true );
+ }
}
}
Handle(HYDROData_StricklerTable) aTable =
Handle(HYDROData_StricklerTable)::DownCast( theObject );
QList<int> aViewIds;
- QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+ QMutableMapIterator<size_t, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
while ( anIter.hasNext() ) {
if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) ==
HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
typedef QMap< size_t, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap;
typedef QList<HYDROGUI_Shape*> ListOfShapes;
- typedef QMap<int,ListOfShapes> ViewId2ListOfShapes;
+ typedef QMap<size_t,ListOfShapes> ViewId2ListOfShapes;
typedef QList<HYDROGUI_VTKPrs*> ListOfVTKPrs;
- typedef QMap<int,ListOfVTKPrs> ViewId2ListOfVTKPrs;
+ typedef QMap<size_t,ListOfVTKPrs> ViewId2ListOfVTKPrs;
- typedef QMap<int, Handle(HYDROData_StricklerTable)> ViewId2StricklerTable;
+ typedef QMap<size_t, Handle(HYDROData_StricklerTable)> ViewId2StricklerTable;
public:
HYDROGUI_Module();
virtual void selectionChanged();
virtual void studyClosed( SUIT_Study* );
- SUIT_ViewManager* getViewManager( const int theId ) const;
+ SUIT_ViewManager* getViewManager( const size_t 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;
+ GraphicsView_Viewer* getViewer( const size_t theId ) const;
+ OCCViewer_Viewer* getOCCViewer( const size_t theId ) const;
+ SVTK_Viewer* getVTKViewer( const size_t theId ) const;
- int getViewManagerId( SUIT_ViewManager* theViewManager );
+ size_t getViewManagerId( SUIT_ViewManager* theViewManager );
ViewManagerRole getViewManagerRole( SUIT_ViewManager* theViewManager );
void setViewManagerRole( SUIT_ViewManager* theViewManager,
const ViewManagerRole theRole );
*/
void setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
const bool theState = true );
- QList<HYDROGUI_Shape*> getObjectShapes( const int theViewId,
+ QList<HYDROGUI_Shape*> getObjectShapes( const size_t theViewId,
ObjectKind theKind ) const;
- HYDROGUI_Shape* getObjectShape( const int theViewId,
+ HYDROGUI_Shape* getObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const;
- void setObjectShape( const int theViewId,
+ void setObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
HYDROGUI_Shape* theShape );
- void removeViewShapes( const int theViewId );
- void removeObjectShape( const int theViewId,
+ void removeViewShapes( const size_t theViewId );
+ void removeObjectShape( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject );
- HYDROGUI_VTKPrs* getObjectVTKPrs( const int theViewId,
+ HYDROGUI_VTKPrs* getObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const;
- void setObjectVTKPrs( const int theViewId,
+ void setObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
HYDROGUI_VTKPrs* theShape );
- void removeViewVTKPrs( const int theViewId );
- void removeObjectVTKPrs( const int theViewId,
+ void removeViewVTKPrs( const size_t theViewId );
+ void removeObjectVTKPrs( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject );
- void removeObjectVTKPrs( const int theViewId,
+ void removeObjectVTKPrs( const size_t theViewId,
const QString& theEntry );
/**
* Update global imposed range of Z values for the given VTK viewer id
*/
- void updateVTKZRange( const int theViewId, double theRange[] );
+ void updateVTKZRange( const size_t theViewId, double theRange[] );
/**
* Returns true if the object with the given entry can be renamed.
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule )
: HYDROGUI_AbstractDisplayer( theModule )
{
}
void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
if( !aViewer )
aViewer->getViewer3d()->RemoveZLayer( theLayer );
}
-void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId )
+void HYDROGUI_OCCDisplayer::EraseAll( const size_t theViewerId )
{
OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
if( !aViewer )
}
void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
if( !aViewer )
}
}
-HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int theViewerId,
+HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const size_t theViewerId,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Entity)& theObject )
{
+ DEBTRACE("createShape " << theViewerId);
HYDROGUI_Shape* aResShape = NULL;
if ( theContext.IsNull() || theObject.IsNull() )
return aResShape;
}
void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll )
{
UpdateColorScale( aViewer );
}
-void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId )
+void HYDROGUI_OCCDisplayer::purgeObjects( const size_t theViewerId )
{
OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
if( !aViewer )
const OCCViewer_Viewer* theViewer,
const bool theIsForced )
{
+ DEBTRACE("Display");
bool aRes = false;
if ( theObject.IsNull() || theObject->IsRemoved() || !theViewer ) {
myToUpdateColorScale = false;
}
-Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const int theViewerId )
+Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const size_t theViewerId )
{
Handle(AIS_ColorScale) aColorScale;
return aColorScale;
}
-void HYDROGUI_OCCDisplayer::UpdatePolylines( int theViewerId, int theType, int theSize )
+void HYDROGUI_OCCDisplayer::UpdatePolylines( size_t theViewerId, int theType, int theSize )
{
OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
if( !aViewer )
* \param theViewerId viewer identifier
*/
void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Get the applicable viewer type.
* \param theViewerId viewer identifier
* \return the color scale
*/
- Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
+ Handle(AIS_ColorScale) GetColorScale( const size_t theViewerId );
- void UpdatePolylines( int theViewerId, int theType, int theSize );
+ void UpdatePolylines( size_t theViewerId, int theType, int theSize );
void UpdateColorScale( const OCCViewer_Viewer* );
* \brief Erase all viewer objects.
* \param theViewerId viewer identifier
*/
- void EraseAll( const int theViewerId );
+ void EraseAll( const size_t theViewerId );
/**
* \brief Erase the specified viewer objects.
* \param theViewerId viewer identifier
*/
void Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Display the specified viewer objects.
* \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 size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
/**
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
- void purgeObjects( const int theViewerId );
+ void purgeObjects( const size_t theViewerId );
private:
/**
* \param theObject data model object
* \return pointer to new created shape
*/
- HYDROGUI_Shape* createShape( const int theViewerId,
+ HYDROGUI_Shape* createShape( const size_t theViewerId,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Entity)& theObject );
private:
bool myToUpdateColorScale;
- QMap<int, Handle(AIS_ColorScale)> myColorScales;
+ QMap<size_t, Handle(AIS_ColorScale)> myColorScales;
};
#endif
#include <LightApp_DataOwner.h>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_OCCSelector::HYDROGUI_OCCSelector( HYDROGUI_Module* theModule,
OCCViewer_Viewer* theViewer,
SUIT_SelectionMgr* theSelMgr )
void HYDROGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
{
+ DEBTRACE("getSelection");
OCCViewer_Viewer* aViewer = viewer();
if ( !aViewer )
return;
AIS_ListOfInteractive aSelList;
aViewer->getSelectedObjects( aSelList );
+ DEBTRACE(" aSelList.Size(): " << aSelList.Size());
for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() )
if ( !anIt.Value().IsNull() )
{
//if ( !isLocalContext ) {
QString anEntry = entry( anIt.Value() );
+ DEBTRACE(" anEntry: " << anEntry.toStdString());
if ( !anEntry.isEmpty() ) {
aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) );
} else {
// add externally selected objects
SUIT_DataOwnerPtrList::const_iterator anExtIter;
for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) {
+ DEBTRACE(" anExternal");
aList.append(*anExtIter);
}
}
void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
{
+ DEBTRACE("setSelection");
OCCViewer_Viewer* aViewer = viewer();
if ( !aViewer )
return;
}*/
mySelectedExternals.clear();
-
+ DEBTRACE(" ...");
for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
{
const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
if ( owner ) //&& aDisplayed.contains( owner->entry() ) )
{
QString anEntry = owner->entry();
+ DEBTRACE(" anEntry: " << anEntry.toStdString());
Handle(HYDROData_Entity) anEntity = myModule->getDataModel()->objectByEntry( anEntry );
if( !anEntity.IsNull() )
{
}
else {
const HYDROGUI_DataOwner* hydroOwner = dynamic_cast<const HYDROGUI_DataOwner*>( (*itr).operator->() );
+ DEBTRACE(" hydroOwner: " << hydroOwner);
if ( hydroOwner && !hydroOwner->IO().IsNull() ) {
aSelList.Append( hydroOwner->IO() );
} else
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Entity)& theObject,
const int theZLayer )
bool isDeactivateSelection )
{
+ DEBTRACE("update " << isUpdateViewer << " " << isDeactivateSelection);
setIsToUpdate( false );
if ( myContext.IsNull() )
void HYDROGUI_Shape::setVisible( const bool theState,
const bool theIsUpdateViewer )
{
+ DEBTRACE("setVisible")
myIsVisible = theState;
if ( myShapes.empty() )
void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
{
+ DEBTRACE("highlight " << theIsHighlight << " " << isUpdateViewer);
if ( myIsHighlight == theIsHighlight )
return;
bool HYDROGUI_Shape::isHighlighted() const
{
+ DEBTRACE("isHighlighted " << myIsHighlight);
return myIsHighlight;
}
void HYDROGUI_Shape::updateShape( const bool theToDisplay,
const bool theIsUpdateViewer )
{
+ DEBTRACE("updateShape " << theToDisplay << " " << theIsUpdateViewer);
foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
{
const Handle(Prs3d_Drawer)& anAttributes = aShape->Attributes();
void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
{
+ DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode);
// if ( myContext->HasOpenedContext() && mySelectionMode > 0 )
// myContext->CloseLocalContext();
foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
{
- if ( mySelectionMode > 0 )
+ if ( mySelectionMode >= 0 )
// Display object in local context with selection
- myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False );
+ //myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False );
+ myContext->Display( aShape, Standard_False );
else
{
// if ( !myContext->HasOpenedContext() )
}
}
- if ( mySelectionMode > 0 )
+ if ( mySelectionMode >= 0 )
{
- //myContext->OpenLocalContext();
+ //myContext->Deactivate(); //OpenLocalContext();
foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
myContext->Activate( aShape, mySelectionMode, Standard_True );
}
}
void HYDROGUI_VTKPrsDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
if( !aViewer )
}
}
-void HYDROGUI_VTKPrsDisplayer::DisplayAll( const int theViewerId,
+void HYDROGUI_VTKPrsDisplayer::DisplayAll( const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll )
{
EraseScalarBar( theViewerId );
}
-void HYDROGUI_VTKPrsDisplayer::EraseAll( const int theViewerId )
+void HYDROGUI_VTKPrsDisplayer::EraseAll( const size_t theViewerId )
{
SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
if( aViewer )
}
}
-void HYDROGUI_VTKPrsDisplayer::EraseScalarBar( const int theViewerId, const bool theIsDelete )
+void HYDROGUI_VTKPrsDisplayer::EraseScalarBar( const size_t theViewerId, const bool theIsDelete )
{
SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
if( aViewer )
}
void HYDROGUI_VTKPrsDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId )
+ const size_t theViewerId )
{
SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
if( aViewer )
}
void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId,
+ const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll)
{
}
}
-void HYDROGUI_VTKPrsDisplayer::purgeObjects( const int theViewerId )
+void HYDROGUI_VTKPrsDisplayer::purgeObjects( const size_t theViewerId )
{
bool doEraseScalarBar = false;
}
}
-HYDROGUI_VTKPrsDriver* HYDROGUI_VTKPrsDisplayer::getDriver( const int theViewId, const Handle(HYDROData_Entity)& theObj )
+HYDROGUI_VTKPrsDriver* HYDROGUI_VTKPrsDisplayer::getDriver( const size_t theViewId, const Handle(HYDROData_Entity)& theObj )
{
HYDROGUI_VTKPrsDriver* aDriver = NULL;
ObjectKind aKind = theObj->GetKind();
return SVTK_Viewer::Type();
}
-void HYDROGUI_VTKPrsDisplayer::SetZRange( const int theViewId, double theRange[] )
+void HYDROGUI_VTKPrsDisplayer::SetZRange( const size_t theViewId, double theRange[] )
{
myScalarBars[ theViewId ]->GetLookupTable()->SetRange( theRange );
}
-double* HYDROGUI_VTKPrsDisplayer::GetZRange( const int theViewId ) const
+double* HYDROGUI_VTKPrsDisplayer::GetZRange( const size_t theViewId ) const
{
return myScalarBars[ theViewId ]->GetLookupTable()->GetRange();
}
-void HYDROGUI_VTKPrsDisplayer::createScalarBar( const int theViewId )
+void HYDROGUI_VTKPrsDisplayer::createScalarBar( const size_t theViewId )
{
if ( !myScalarBars.contains( theViewId ) )
{
* \param theViewerId viewer identifier
*/
void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Get the applicable viewer type.
/**
* \brief Set the range of Z values for the color legend bar.
*/
- void SetZRange( const int theViewerId, double theRange[] );
+ void SetZRange( const size_t theViewerId, double theRange[] );
/**
* \brief Get the range of Z values for the color legend bar.
*/
- double* GetZRange( const int theViewerId ) const;
+ double* GetZRange( const size_t theViewerId ) const;
/**
* \brief Delete scalar bar for the given viewer id.
* \param theViewerId viewer identifier
*/
- void EraseScalarBar( const int theViewerId, const bool theIsDelete = false );
+ void EraseScalarBar( const size_t theViewerId, const bool theIsDelete = false );
protected:
- virtual void DisplayAll( const int theViewerId,
+ virtual void DisplayAll( const size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
* \brief Erase all viewer objects.
* \param theViewerId viewer identifier
*/
- void EraseAll( const int theViewerId );
+ void EraseAll( const size_t theViewerId );
/**
* \brief Erase the specified viewer objects.
* \param theViewerId viewer identifier
*/
void Erase( const HYDROData_SequenceOfObjects& theObjs,
- const int theViewerId );
+ const size_t theViewerId );
/**
* \brief Display the specified viewer objects.
* \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 size_t theViewerId,
const bool theIsForced,
const bool theDoFitAll );
* \brief Purge all invalid objects in the viewer.
* \param theViewerId viewer identifier
*/
- void purgeObjects( const int theViewerId );
+ void purgeObjects( const size_t theViewerId );
private:
* \brief Create a new scalar bar for the given view id.
* \param theViewId view identifier
*/
- void createScalarBar( const int theViewId );
+ void createScalarBar( const size_t theViewId );
/**
* \brief Get the presentation driver for the specified data object.
* \param theObj data object
*/
- HYDROGUI_VTKPrsDriver* getDriver( const int theViewId, const Handle(HYDROData_Entity)& theObj );
+ HYDROGUI_VTKPrsDriver* getDriver( const size_t theViewId, const Handle(HYDROData_Entity)& theObj );
HYDROGUI_VTKPrsDriver* myDriver;
HYDROGUI_VTKPrsDriver* myShapeDriver;
- QMap<int, vtkSmartPointer<vtkScalarBarActor> > myScalarBars; //!< Colors legend presentations
+ QMap<size_t, vtkSmartPointer<vtkScalarBarActor> > myScalarBars; //!< Colors legend presentations
};
#endif
if( theSelectionMode > 0 )
{
- //context()->OpenLocalContext();
+ context()->Deactivate(); //OpenLocalContext();
context()->Display( theObject, theMode, theSelectionMode, true );
context()->Activate( theObject, theSelectionMode, Standard_True );
}