1 // Copyright (C) 2007-2008 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
22 #include "SMESH_ActorUtils.h"
24 #include "SUIT_Tools.h"
25 #include "SUIT_Session.h"
26 #include "SUIT_ResourceMgr.h"
28 #include "utilities.h"
30 #include <vtkUnstructuredGrid.h>
31 #include <vtkUnstructuredGridWriter.h>
34 static int MYDEBUG = 1;
36 static int MYDEBUG = 0;
43 GetFloat( const QString& theValue,
44 vtkFloatingPointType theDefault )
46 int pos = theValue.indexOf( ":" );
47 vtkFloatingPointType val = theDefault;
50 QString name = theValue.right( theValue.length()-pos-1 ),
51 sect = theValue.left( pos );
52 if( !name.isEmpty() && !sect.isEmpty() )
53 val = GetFloat( name, sect, theDefault );
59 GetFloat( const QString& theValue,
60 const QString& theSection,
61 vtkFloatingPointType theDefault )
63 vtkFloatingPointType val = theDefault;
64 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
66 val = (vtkFloatingPointType) mgr->doubleValue( theSection, theValue, theDefault );
72 WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
73 const char* theFileName)
75 vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
76 aWriter->SetFileName(theFileName);
77 aWriter->SetInput(theGrid);
78 if(theGrid->GetNumberOfCells()){
85 GetColor( const QString& theSect,
86 const QString& theName,
90 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
92 c = mgr->colorValue( theSect, theName, def );
97 GetColor( const QString& theSect,
98 const QString& theName,
105 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
107 c = mgr->colorValue( theSect, theName, def );
109 SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b );
113 GetColor( const QString& theSect,
114 const QString& theName,
115 vtkFloatingPointType& r,
116 vtkFloatingPointType& g,
117 vtkFloatingPointType& b,
120 int ir( 0 ), ig( 0 ), ib( 0 );
121 GetColor( theSect, theName, ir, ig, ib, def );