1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
24 // File : VisuGUI_FieldFilter.cxx
25 // Author : Oleg UVAROV
28 #include "VisuGUI_FieldFilter.h"
30 #include "VisuGUI_Tools.h"
32 #include "VISUConfig.hh"
33 #include "VISU_ColoredPrs3dFactory.hh"
35 #include <SUIT_Session.h>
37 #include <SalomeApp_Study.h>
38 #include <LightApp_DataOwner.h>
42 VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType ) :
47 VisuGUI_FieldFilter::~VisuGUI_FieldFilter()
51 void VisuGUI_FieldFilter::setPrs3dEntry( const QString& theEntry )
53 myPrs3dEntry = theEntry;
56 bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const
58 const LightApp_DataOwner* anOwner =
59 dynamic_cast<const LightApp_DataOwner*>( theDataOwner );
61 SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>
62 (SUIT_Session::session()->activeApplication()->activeStudy());
64 if( anOwner && anAppStudy )
66 if(myPrs3dEntry == anOwner->entry())
69 _PTR(Study) aStudy = anAppStudy->studyDS();
70 _PTR(SObject) aSObject = aStudy->FindObjectID( (const char*)anOwner->entry().toLatin1() );
75 if( aSObject->ReferencedObject( aRefSO ) )
81 VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap( aSObject );
82 if( aRestoringMap.empty() )
85 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
86 if( aType == VISU::TFIELD ) {
87 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
88 QString aMeshName = aRestoringMap["myMeshName"];
89 int anEntity = aRestoringMap["myEntityId"].toInt();
90 QString aFieldName = aRestoringMap["myName"];
92 VISU::ColoredPrs3dHolder::BasicInput anInput;
93 anInput.myResult = aResult;
94 anInput.myMeshName = CORBA::string_dup( (const char*)aMeshName.toLatin1() );
95 anInput.myEntity = (VISU::Entity)anEntity;
96 anInput.myFieldName = CORBA::string_dup( (const char*)aFieldName.toLatin1() );
97 anInput.myTimeStampNumber = 1;
99 QApplication::setOverrideCursor(Qt::WaitCursor);
101 size_t isOk = VISU::CheckIsPossible( myType, anInput, true );
103 QApplication::restoreOverrideCursor();