Salome HOME
updating or adding when merging in the main trunk with the version in the
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 72e66bf009c79e83d6b252ff57f56de0e6c6c4dc..861630a2f8fda788e09a873c65392516f573b41f 100644 (file)
@@ -1,12 +1,32 @@
-using namespace std;
-//  File      : SMESHGUI.cxx
-//  Created   : Sun May 05 11:49:46 2002
-//  Author    : Nicolas REJNERI
-//  Project   : SALOME
-//  Module    : SMESH
-//  Copyright : Open CASCADE 2002
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
 //  $Header$
 
+using namespace std;
 #include "SMESHGUI.h"
 #include "SMESHGUI_AddHypothesisDlg.h"
 #include "SMESHGUI_AddAlgorithmDlg.h"
@@ -56,11 +76,6 @@ using namespace std;
 #include "OCCViewer_ViewPort3d.h"
 #include "OCCViewer_Viewer3d.h"
 
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VTKViewer_ViewFrame.h"
-//#include "QAD_ViewPort.h"
-//#include "QAD_ViewPort3d.h"
-
 #include "GEOM_Client.hxx"
 #include "GEOM_InteractiveObject.hxx"
 
@@ -111,25 +126,12 @@ using namespace std;
 #include <qradiobutton.h> 
 
 // VTK Includes
-#include <vtkPoints.h>
-#include <vtkDataSetMapper.h>
-#include <vtkPolyVertex.h>
-#include <vtkVertex.h>
-#include <vtkLine.h>
-#include <vtkTriangle.h>
-#include <vtkPointSet.h>
-#include <vtkShrinkFilter.h>
-#include <vtkMaskPoints.h>
-#include <vtkExtractEdges.h>
-#include <vtkFeatureEdges.h>
-#include <vtkTubeFilter.h>
-#include <vtkExtractEdges.h>
+#include "VTKViewer_Common.h"
+#include "VTKViewer_ViewFrame.h"
 #include <vtkLegendBoxActor.h>
-#include <vtkGlyphSource2D.h>
-#include <vtkIdFilter.h>
-#include <vtkLabeledDataMapper.h>
-#include <vtkCellCenters.h>
-#include <vtkSelectVisiblePoints.h>
+#include <vtkFeatureEdges.h>
+#include <vtkDoubleArray.h>
+
 
 // Open CASCADE Includes
 #include <gp_Pnt.hxx>
@@ -215,7 +217,7 @@ SMESHGUI* SMESHGUI::GetOrCreateSMESHGUI( QAD_Desktop* desktop )
     Engines::Component_var comp = desktop->getEngine("FactoryServer", "SMESH");
     smeshGUI->myComponentMesh = SMESH::SMESH_Gen::_narrow(comp);
     
-    Engines::Component_var comp1 = desktop->getEngine("FactoryServer", "Geometry");    
+    Engines::Component_var comp1 = desktop->getEngine("FactoryServer", "GEOM");    
     smeshGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp1);
       
     /* GetCurrentStudy */
@@ -399,6 +401,7 @@ void SMESHGUI::activeStudyChanged( QAD_Desktop* parent )
 bool SMESHGUI::DefineDlgPosition(QWidget* aDlg, int& x, int& y)
 {
   /* Here the position is on the bottom right corner - 10 */
+       aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
   QAD_Desktop* PP = QAD_Application::getDesktop() ;
   x = abs ( PP->x() + PP->size().width()  - aDlg->size().width()  - 10 ) ;
   y = abs ( PP->y() + PP->size().height() - aDlg->size().height() - 10 ) ;
@@ -845,6 +848,8 @@ void SMESHGUI::CreateAlgorithm( QString TypeAlgo, QString NameAlgo )
       Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
     else if ( TypeAlgo.compare("Hexa_3D") == 0 )
       Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
+    else if ( TypeAlgo.compare("NETGEN_3D") == 0 )
+      Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
     
     if ( !Hyp->_is_nil() ) {
       SALOMEDS::SObject_var SHyp = myStudyAPI.AddNewAlgorithms( Hyp );
@@ -927,7 +932,7 @@ void SMESHGUI::CreateMaxElementVolume( QString TypeHypothesis, QString NameHypot
  *
  */
 //=============================================================================
-void SMESHGUI::CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, double nbSegments )
+void SMESHGUI::CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, int nbSegments )
 {
   QApplication::setOverrideCursor( Qt::waitCursor );
   try {
@@ -1315,8 +1320,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
   case 0 : {
     QApplication::setOverrideCursor( Qt::waitCursor );
     if (ac->getDisplayMode()==2) {
+      bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
       vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
       meshMapper->SetInput(ac->DataSource);
+      meshMapper->SetScalarVisibility(isColored); //SAL3899
     }
     ac->setDisplayMode(0);
     ac->GetProperty()->SetRepresentationToWireframe();
@@ -1327,8 +1334,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
   case 1 : {
     QApplication::setOverrideCursor( Qt::waitCursor );
     if (ac->getDisplayMode()==2) {
+      bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
       vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
       meshMapper->SetInput(ac->DataSource);
+      meshMapper->SetScalarVisibility(isColored); //SAL3899
     }
     ac->setDisplayMode(1);
     ac->GetProperty()->SetRepresentationToSurface();
@@ -1341,13 +1350,14 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
     //    ChangeRepresentation(ac, 1);
     QApplication::setOverrideCursor( Qt::waitCursor );
     ac->setDisplayMode(2);
+    bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
     vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
-    meshMapper->SetInput(ac->DataSource);
     vtkShrinkFilter *shrink = vtkShrinkFilter::New();
-    shrink->SetInput(meshMapper->GetInput());
+    shrink->SetInput(ac->DataSource);
     shrink->SetShrinkFactor(ac->GetShrinkFactor());
     
     meshMapper->SetInput( shrink->GetOutput() );
+    meshMapper->SetScalarVisibility(isColored); //SAL3899
     ac->SetMapper( meshMapper );
     QApplication::restoreOverrideCursor();
     //    }
@@ -1360,13 +1370,29 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
       float backfacecolor[3];
       float nodecolor[3];
       ac->GetColor(color[0],color[1],color[2]);
-      QColor c(color[0]*255,color[1]*255,color[2]*255);
+//       QColor c(color[0]*255,color[1]*255,color[2]*255);
+      int c0 = int(color[0]*255);
+      int c1 = int(color[1]*255);
+      int c2 = int(color[2]*255);
+      QColor c( c0, c1, c2 );
       ac->GetEdgeColor(edgecolor[0],edgecolor[1],edgecolor[2]);
-      QColor e(edgecolor[0]*255,edgecolor[1]*255,edgecolor[2]*255);
+//       QColor e(edgecolor[0]*255,edgecolor[1]*255,edgecolor[2]*255);
+      c0 = int(edgecolor[0]*255);
+      c1 = int(edgecolor[1]*255);
+      c2 = int(edgecolor[2]*255);
+      QColor e( c0, c1, c2 );
       ac->GetBackfaceProperty()->GetColor(backfacecolor);
-      QColor b(backfacecolor[0]*255,backfacecolor[1]*255,backfacecolor[2]*255);
+//       QColor b(backfacecolor[0]*255,backfacecolor[1]*255,backfacecolor[2]*255);
+      c0 = int(backfacecolor[0]*255);
+      c1 = int(backfacecolor[1]*255);
+      c2 = int(backfacecolor[2]*255);
+      QColor b( c0, c1, c2 );
       ac->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2] ) ;
-      QColor n(nodecolor[0]*255, nodecolor[1]*255, nodecolor[2]*255 ) ;
+//       QColor n(nodecolor[0]*255, nodecolor[1]*255, nodecolor[2]*255 ) ;
+      c0 = int(nodecolor[0]*255);
+      c1 = int(nodecolor[1]*255);
+      c2 = int(nodecolor[2]*255);
+      QColor n( c0, c1, c2 ) ;
 
       int Edgewidth = (int)ac->EdgeDevice->GetProperty()->GetLineWidth();
       if ( Edgewidth == 0 )
@@ -1417,6 +1443,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
        ac->SetNodeSize(aDlg->GetIntValue(2)) ;
        
        if (ac->getDisplayMode()==2) {
+         bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
          vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
          meshMapper->SetInput(ac->DataSource);
          vtkShrinkFilter *shrink = vtkShrinkFilter::New();
@@ -1424,6 +1451,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
          shrink->SetShrinkFactor(ac->GetShrinkFactor());
          
          meshMapper->SetInput( shrink->GetOutput() );
+         meshMapper->SetScalarVisibility(isColored); //SAL3899
          ac->SetMapper( meshMapper );
        }
       }
@@ -2282,7 +2310,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,       QAD_Desktop* parent)
              double beforeMaxVolume = MEV->GetMaxElementVolume() ;
              double MaxVolume = smeshGUI->Parameter( res, 
                                                      beforeMaxVolume,
-                                                     tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"), 
+                                                     tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"), 
                                                      tr("SMESH_VALUE"), 
                                                      1.0E-5, 1E6, 6 ) ;
              if ( res && MaxVolume != beforeMaxVolume ) {
@@ -2486,7 +2514,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,      QAD_Desktop* parent)
       }
     case 5020: 
       {
-       smeshGUI->CreateAlgorithm("Hexa_3D","Hexaedral (i,j,k)");       
+       smeshGUI->CreateAlgorithm("Hexa_3D","Hexahedron (i,j,k)");      
+       break;
+      }
+    case 5021: 
+      {
+       smeshGUI->CreateAlgorithm("NETGEN_3D","Tetrahedron (Netgen)");  
        break;
       }
 
@@ -2583,11 +2616,13 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,     QAD_Desktop* parent)
                ptIds->SetValue(id, idSMDS);
              }
 
-             vtkScalars* newScalars = vtkScalars::New();
-             newScalars->SetData(ptIds);
-             ptGrid->GetPointData()->SetScalars(newScalars);
-
-             newScalars->Delete();
+// mpv porting vtk4.2.2
+             //              vtkScalars* newScalars = vtkScalars::New();
+             //              newScalars->SetData(ptIds);
+             //              ptGrid->GetPointData()->SetScalars(newScalars);
+             ptGrid->GetPointData()->SetScalars(ptIds);
+             //              newScalars->Delete();
+// mpv
              ptIds->Delete();
              
              vtkMaskPoints* mask = vtkMaskPoints::New();
@@ -2667,11 +2702,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID,     QAD_Desktop* parent)
                cellIds->SetValue(id, idSMDS);
              }
 
-             vtkScalars* newScalars = vtkScalars::New();
-             newScalars->SetData(cellIds);
-             elGrid->GetCellData()->SetScalars(newScalars);
+// mpv porting vk4.2.2
+             //              vtkScalars* newScalars = vtkScalars::New();
+             //              newScalars->SetData(cellIds);
+             elGrid->GetCellData()->SetScalars(cellIds);
+             //              elGrid->GetCellData()->SetScalars(newScalars);
+             //              newScalars->Delete();
+//mpv
 
-             newScalars->Delete();
              cellIds->Delete();
            
              vtkCellCenters* cc = vtkCellCenters::New();
@@ -2817,7 +2855,7 @@ void SMESHGUI::Import_Mesh(QAD_Desktop* parent, int theCommandID)
 //    Mesh_Reader* myReader = SMESHDriver::GetMeshReader(myExtension, myClass);
     
     int myMeshId = (smeshGUI->myDocument)->NewMesh();
-    Handle(SMDS_Mesh) myMesh = (smeshGUI->myDocument)->GetMesh(myMeshId);
+    SMDS_Mesh* myMesh = (smeshGUI->myDocument)->GetMesh(myMeshId);
 
     myReader->SetFile(string(filename.latin1()));
     myReader->SetMesh(myMesh);
@@ -2934,7 +2972,7 @@ void SMESHGUI::Import_Document(QAD_Desktop* parent, int theCommandID)
     QApplication::setOverrideCursor( Qt::waitCursor );
     string myClass = string("SMESHDS_Document");
 //    Document_Reader* myReader = SMESHDriver::GetDocumentReader(myExtension, myClass);
-    Handle(SMESHDS_Document) newDocument = new SMESHDS_Document(1);
+       SMESHDS_Document* newDocument = new SMESHDS_Document(1);
 
     myReader->SetFile(string(filename.latin1()));
     myReader->SetDocument(smeshGUI->myDocument);
@@ -4529,7 +4567,9 @@ void SMESHGUI::Control(int theCommandID)
   QApplication::setOverrideCursor( Qt::waitCursor );
   DisplayScalarBar( false );
 
-  vtkScalars *scalars = vtkScalars::New();
+  vtkDoubleArray *scalars = vtkDoubleArray::New();
+  scalars->SetNumberOfComponents(1);
+
   vtkDataSetMapper* meshMapper = 0;
   SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
   int nbSel = Sel->IObjectCount();
@@ -4543,126 +4583,60 @@ void SMESHGUI::Control(int theCommandID)
     return;
   }
 
-  bool ValidateScalars = false;
-  if ( result ) {
+  vtkDataSet* aDataSet = MeshActor->DataSource;
+  typedef double (*TScalarFun)(vtkCell* theCell);
+  TScalarFun aScalarFun;
+  if(result){
     QString type;
-    switch (theCommandID)
-      {
-      case 6001: //Length Edges
-       {
-         type = tr( "SMESH_CONTROL_LENGTH_EDGES");
-         meshMapper = (vtkDataSetMapper*)MeshActor->EdgeDevice->GetMapper();
-         vtkUnstructuredGrid* grid = (vtkUnstructuredGrid*)meshMapper->GetInput();
-         MESSAGE ( " init minimum length " << grid->GetNumberOfCells() )
-         for (int i=0; i<grid->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = grid->GetCell(i);
-           float len = SMESHGUI_ComputeScalarValue::LengthEdges(cell);
-           if (len == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,len);
-           }
-         }
-         if (ValidateScalars && (MeshActor->getDisplayMode()!=0))
-           ChangeRepresentation( MeshActor, 1 );// limitation; in Wireframe, colored edges are not visible
-         break;
-       }
-      case 6011: // Area Elements
-       {
-         type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
-         for (int i=0; i< MeshActor->GetMapper()->GetInput()->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->GetMapper()->GetInput()->GetCell(i);
-           float area = SMESHGUI_ComputeScalarValue::AreaElements(cell);
-           if (area == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,area);
-           }
-         }
-         if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
-           ChangeRepresentation( MeshActor, 1 );
-         break;
-       }
-      case 6012: // Taper
-       {
-         type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
-         for (int i=0; i< MeshActor->DataSource->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->DataSource->GetCell(i);
-           float taper = SMESHGUI_ComputeScalarValue::Taper(cell);
-           if (taper == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,taper);
-           }
-         }
-         break;
-       }
-      case 6013: // Aspect ratio
-       {
-         type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
-         for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->DataSource->GetCell(i);
-           float aspect = SMESHGUI_ComputeScalarValue::AspectRatio(cell);
-           if (aspect == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,aspect);
-           }
-         }
-         if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
-           ChangeRepresentation( MeshActor, 1 );
-         break;
-       }
-      case 6014: // Minimum angle
-       {
-         type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
-         for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->DataSource->GetCell(i);
-           float angle = SMESHGUI_ComputeScalarValue::MinimumAngle(cell);
-           if (angle == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,angle);
-           }
-         }
-         if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
-           ChangeRepresentation( MeshActor, 1 );
-         break;
-       }
-      case 6015: // Warp
-       {
-         type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
-         for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->DataSource->GetCell(i);
-           float Warp = SMESHGUI_ComputeScalarValue::Warp(cell);
-           if (Warp == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,Warp);
-           }
-         }
-         break;
-       }
-      case 6016: // Skew
-       {
-         type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
-         for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
-           vtkCell* cell = MeshActor->DataSource->GetCell(i);
-           float angle = SMESHGUI_ComputeScalarValue::Skew(cell);
-           if (angle == 0) continue;
-           else {
-             ValidateScalars = true;
-             scalars->InsertScalar(i,angle);
-           }
-         }
-         break;
-       }
-      }
-
-    if ( !ValidateScalars ) {
-      QApplication::restoreOverrideCursor();
-      return;
+    switch (theCommandID){
+    case 6001: {
+      type = tr( "SMESH_CONTROL_LENGTH_EDGES");
+      aDataSet = MeshActor->EdgeDevice->GetMapper()->GetInput();
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::LengthEdges);
+      MESSAGE ( " init minimum length " << aDataSet->GetNumberOfCells() );
+      if(MeshActor->getDisplayMode() != 0)
+       ChangeRepresentation( MeshActor, 1);// limitation; in Wireframe, colored edges are not visible
+      break;
+    } 
+    case 6011: {
+      type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::AreaElements);
+      if(MeshActor->getDisplayMode() != 1)
+       ChangeRepresentation( MeshActor, 1 );
+      break;
+    }
+    case 6012: {
+      type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::Taper);
+      break;
     }
+    case 6013: {
+      type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::AspectRatio);
+      if(MeshActor->getDisplayMode() != 1)
+       ChangeRepresentation( MeshActor, 1 );
+      break;
+    }
+    case 6014: {
+      type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::MinimumAngle);
+      if(MeshActor->getDisplayMode() != 1)
+       ChangeRepresentation( MeshActor, 1 );
+      break;
+    }
+    case 6015: {
+      type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::Warp);
+      break;
+    }
+    case 6016: {
+      type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
+      aScalarFun = &(SMESHGUI_ComputeScalarValue::Skew);
+      break;
+    }}
+
+    for(int i = 0, iEnd = aDataSet->GetNumberOfCells(); i < iEnd; i++)
+      scalars->InsertTuple1(i,aScalarFun(aDataSet->GetCell(i)));
 
     float range[2];
     scalars->GetRange(range);
@@ -4675,7 +4649,7 @@ void SMESHGUI::Control(int theCommandID)
 
     if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper());
     meshMapper->SetScalarModeToUseCellData();
-    meshMapper->GetInput()->GetCellData()->SetScalars(scalars);
+    MeshActor->DataSource->GetCellData()->SetScalars(scalars);
     meshMapper->SetScalarRange( range );
     meshMapper->ScalarVisibilityOn();
 
@@ -5283,7 +5257,8 @@ void SMESHGUI::DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, floa
     QString SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
     QColor nodecolor(SCr.toInt(), SCg.toInt(), SCb.toInt());
     if ( !nodecolor.isValid() )
-      nodecolor = QColor(0.,1.,0.);
+//       nodecolor = QColor(0.,1.,0.);
+      nodecolor = QColor(0,1,0);
 
     node->GetProperty()->SetColor( float(nodecolor.red())/255.,
                                   float(nodecolor.green())/255.,