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;
42 GetFloat( const QString& theValue,
43 vtkFloatingPointType theDefault )
45 int pos = theValue.find( ":" );
46 vtkFloatingPointType val = theDefault;
49 QString name = theValue.right( theValue.length()-pos-1 ),
50 sect = theValue.left( pos );
51 if( !name.isEmpty() && !sect.isEmpty() )
52 val = GetFloat( name, sect, theDefault );
58 GetFloat( const QString& theValue,
59 const QString& theSection,
60 vtkFloatingPointType theDefault )
62 vtkFloatingPointType val = theDefault;
63 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
65 val = (vtkFloatingPointType) mgr->doubleValue( theValue, theSection, theDefault );
71 WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
72 const char* theFileName)
74 vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
75 aWriter->SetFileName(theFileName);
76 aWriter->SetInput(theGrid);
77 if(theGrid->GetNumberOfCells()){
84 GetColor( const QString& theSect,
85 const QString& theName,
89 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
91 c = mgr->colorValue( theSect, theName, def );
96 GetColor( const QString& theSect,
97 const QString& theName,
104 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
106 c = mgr->colorValue( theSect, theName, def );
108 SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b );
112 GetColor( const QString& theSect,
113 const QString& theName,
114 vtkFloatingPointType& r,
115 vtkFloatingPointType& g,
116 vtkFloatingPointType& b,
119 int ir( 0 ), ig( 0 ), ib( 0 );
120 GetColor( theSect, theName, ir, ig, ib, def );