]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/OBJECT/VISU_Actor.cxx
Salome HOME
Update copyright information
[modules/visu.git] / src / OBJECT / VISU_Actor.cxx
index 20a5a8427e62168feacb26bde3c651d4808f1992..53cdcb54ad2461be1431b4bdedb7e40bda15a8ea 100644 (file)
@@ -1,29 +1,30 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU OBJECT : interactive object for VISU entities implementation
 //  File   :
 //  Author :
 //  Module : VISU
-
+//
 #include "VISU_Actor.h"
 
 #include "VISU_ActorFactory.h"
 #include "VISU_SelectVisiblePoints.h"
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_UsedPointsFilter.hxx"
 
 #include "SVTK_Actor.h"
 #include "SVTK_Event.h"
 
+#include "VTKViewer_CellCenters.h"
 #include "VTKViewer_FramedTextActor.h"
 #include "VTKViewer_ShrinkFilter.h"
 #include "VTKViewer_GeometryFilter.h"
@@ -47,6 +50,7 @@
 
 #include <stdexcept>
 #include <sstream>
+#include <cmath> // to use std::abs( int )
 
 // VTK Includes
 #include <vtkProperty.h>
@@ -159,9 +163,12 @@ VISU_Actor
 
   myValLblDataSet = vtkUnstructuredGrid::New();
 
-  myValCellCenters = vtkCellCenters::New();
+  myValCellCenters = VTKViewer_CellCenters::New();
   myValCellCenters->SetInput(myValLblDataSet);
 
+  myValUsedPoints = VISU_UsedPointsFilter::New();
+  myValUsedPoints->SetInput(myValLblDataSet);
+
   myValMaskPoints = vtkMaskPoints::New();
   myValMaskPoints->SetInput(myValCellCenters->GetOutput());
   myValMaskPoints->SetOnRatio(1);
@@ -174,7 +181,8 @@ VISU_Actor
   char aFormat[16] = "%g";
   SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
   if (aResourceMgr) {
-    int aFloatingPrec = aResourceMgr->integerValue("VISU", "floating_point_precision", 6);
+    // san: precision can be negative - this is used by double spin boxes
+    int aFloatingPrec = std::abs( aResourceMgr->integerValue("VISU", "visual_data_precision", 6) );
     sprintf(aFormat, "%%.%dg", aFloatingPrec);
     //cout << "$$$ aFormat = " << aFormat << endl;
   }
@@ -256,6 +264,7 @@ VISU_Actor
   myValLabeledDataMapper->Delete();
   myValSelectVisiblePoints->Delete();
   myValMaskPoints->Delete();
+  myValUsedPoints->Delete();
   myValCellCenters->Delete();
   myValLabels->Delete();
 
@@ -331,7 +340,7 @@ VISU_Actor
   {
     UnShrink();
   }
-  SetFeatureEdgesEnabled( theMode == SVTK::Representation::FeatureEdges );
+  SetFeatureEdgesEnabled( theMode == VTKViewer::Representation::FeatureEdges );
 }
 
 
@@ -1274,7 +1283,10 @@ void VISU_Actor::SetValuesLabeled( const bool theIsValLabeled )
       myValMaskPoints->SetInput( myValCellCenters->GetOutput() );
     }
     else if ( isOnPnt )
-      myValMaskPoints->SetInput( aDataSet );
+    {
+      myValUsedPoints->SetInput( aDataSet );
+      myValMaskPoints->SetInput( myValUsedPoints->GetOutput() );
+    }
 
     myValLabels->SetVisibility( GetVisibility() );
   }