1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 #include "SMESH_ActorUtils.h"
23 #include "SUIT_Tools.h"
24 #include "SUIT_Session.h"
25 #include "SUIT_ResourceMgr.h"
27 #include "utilities.h"
29 #include <vtkUnstructuredGrid.h>
30 #include <vtkUnstructuredGridWriter.h>
33 static int MYDEBUG = 1;
35 static int MYDEBUG = 0;
40 float GetFloat( const QString& theValue, float theDefault )
42 int pos = theValue.find( ":" );
43 float val = theDefault;
46 QString name = theValue.right( theValue.length()-pos-1 ),
47 sect = theValue.left( pos );
48 if( !name.isEmpty() && !sect.isEmpty() )
49 val = GetFloat( name, sect, theDefault );
54 float GetFloat( const QString& theValue, const QString& theSection, float theDefault )
56 float val = theDefault;
57 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
59 val = (float) mgr->doubleValue( theValue, theSection, theDefault );
64 void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
65 vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
66 aWriter->SetFileName(theFileName);
67 aWriter->SetInput(theGrid);
68 if(theGrid->GetNumberOfCells()){
74 QColor GetColor( const QString& theSect, const QString& theName, const QColor& def )
77 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
79 c = mgr->colorValue( theSect, theName, def );
83 void GetColor( const QString& theSect, const QString& theName, int& r, int& g, int& b, const QColor& def )
86 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
88 c = mgr->colorValue( theSect, theName, def );
90 SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b );
93 void GetColor( const QString& theSect, const QString& theName, float& r, float& g, float& b, const QColor& def )
95 int ir( 0 ), ig( 0 ), ib( 0 );
96 GetColor( theSect, theName, ir, ig, ib, def );