X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_AbstractDisplayer.cxx;h=eeda68cf13e322364867193b578829e93383d1d2;hb=cd6ea20d9a76665a24a533d0340385a335961f05;hp=7817f3ccd693e78e24ac61f44d15d2f07ec4d17a;hpb=8c3bb27be497dd3fea078b26d8b801ed77579a47;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx b/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx index 7817f3cc..eeda68cf 100644 --- a/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,6 +26,9 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include +#include + HYDROGUI_AbstractDisplayer::HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule ) : myModule( theModule ) { @@ -35,6 +38,16 @@ HYDROGUI_AbstractDisplayer::~HYDROGUI_AbstractDisplayer() { } +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, @@ -65,14 +78,20 @@ void HYDROGUI_AbstractDisplayer::Update( const HYDROData_SequenceOfObjects& theO // Now dig in the data model HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay; + SUIT_ViewModel* aViewer = module()->getViewManager( theViewerId )->getViewModel(); for( int i = 1, n = theObjs.Length(); i <= n; i++ ) { const Handle(HYDROData_Entity)& anObj = theObjs.Value( i ); - if( anObj.IsNull() ) - anObjectsToErase.Append( anObj ); - else + + if( module()->isObjectVisible( (size_t)aViewer, anObj ) ) + { anObjectsToDisplay.Append( anObj ); + } + else + { + anObjectsToErase.Append( anObj ); + } } if( anObjectsToErase.Length() )