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 <vtkXMLUnstructuredGridWriter.h>
33 #include <vtkUnstructuredGridWriter.h>
36 static int MYDEBUG = 1;
38 static int MYDEBUG = 0;
45 GetFloat( const QString& theValue,
46 vtkFloatingPointType theDefault )
48 int pos = theValue.indexOf( ":" );
49 vtkFloatingPointType val = theDefault;
52 QString name = theValue.right( theValue.length()-pos-1 ),
53 sect = theValue.left( pos );
54 if( !name.isEmpty() && !sect.isEmpty() )
55 val = GetFloat( name, sect, theDefault );
61 GetFloat( const QString& theValue,
62 const QString& theSection,
63 vtkFloatingPointType theDefault )
65 vtkFloatingPointType val = theDefault;
66 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
68 val = (vtkFloatingPointType) mgr->doubleValue( theSection, theValue, theDefault );
74 WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
75 const char* theFileName)
77 vtkXMLUnstructuredGridWriter* aWriter = vtkXMLUnstructuredGridWriter::New();
78 aWriter->SetFileName(theFileName);
79 aWriter->SetInput(theGrid);
80 aWriter->SetDataModeToAscii();
81 if(theGrid->GetNumberOfCells()){
88 GetColor( const QString& theSect,
89 const QString& theName,
93 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
95 c = mgr->colorValue( theSect, theName, def );
100 GetColor( const QString& theSect,
101 const QString& theName,
108 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
110 c = mgr->colorValue( theSect, theName, def );
112 SUIT_Tools::rgbSet( SUIT_Tools::rgbSet( c ), r, g, b );
116 GetColor( const QString& theSect,
117 const QString& theName,
118 vtkFloatingPointType& r,
119 vtkFloatingPointType& g,
120 vtkFloatingPointType& b,
123 int ir( 0 ), ig( 0 ), ib( 0 );
124 GetColor( theSect, theName, ir, ig, ib, def );