1 // Copyright (C) 2007-2010 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 #include "SMESH_ActorUtils.h"
25 #include "SUIT_Tools.h"
26 #include "SUIT_Session.h"
27 #include "SUIT_ResourceMgr.h"
29 #include "utilities.h"
31 #include <vtkUnstructuredGrid.h>
32 #include <vtkUnstructuredGridWriter.h>
35 static int MYDEBUG = 1;
37 static int MYDEBUG = 0;
44 GetFloat( const QString& theValue,
45 vtkFloatingPointType theDefault )
47 int pos = theValue.indexOf( ":" );
48 vtkFloatingPointType val = theDefault;
51 QString name = theValue.right( theValue.length()-pos-1 ),
52 sect = theValue.left( pos );
53 if( !name.isEmpty() && !sect.isEmpty() )
54 val = GetFloat( name, sect, theDefault );
60 GetFloat( const QString& theValue,
61 const QString& theSection,
62 vtkFloatingPointType theDefault )
64 vtkFloatingPointType val = theDefault;
65 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
67 val = (vtkFloatingPointType) mgr->doubleValue( theSection, theValue, theDefault );
73 WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
74 const char* theFileName)
76 vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
77 aWriter->SetFileName(theFileName);
78 aWriter->SetInput(theGrid);
79 if(theGrid->GetNumberOfCells()){
86 GetColor( const QString& theSect,
87 const QString& theName,
91 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
93 c = mgr->colorValue( theSect, theName, def );
98 GetColor( const QString& theSect,
99 const QString& theName,
106 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
108 c = mgr->colorValue( theSect, theName, def );
110 SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b );
114 GetColor( const QString& theSect,
115 const QString& theName,
116 vtkFloatingPointType& r,
117 vtkFloatingPointType& g,
118 vtkFloatingPointType& b,
121 int ir( 0 ), ig( 0 ), ib( 0 );
122 GetColor( theSect, theName, ir, ig, ib, def );