Salome HOME
Merge from V5_1_main 10/06/2010
[modules/visu.git] / src / PIPELINE / VISU_GaussPointsPL.cxx
index 23fa92231a9ef38ea6fc94ad652868041c747747..06c33ffc3db9f0311fe08501a166dd753e3ee9d8 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  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
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU OBJECT : interactive object for VISU entities implementation
 // File:    VISU_GaussPoints.cxx
 // Author:  Alexey PETROV
@@ -190,7 +191,7 @@ CopyGlyph( vtkGlyph3D* theSource, vtkGlyph3D* theDestination )
 void
 VISU_GaussPointsPL
 ::DoShallowCopy(VISU_PipeLine *thePipeLine,
-               bool theIsCopyInput)
+                bool theIsCopyInput)
 {
   Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
   VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput);
@@ -617,6 +618,24 @@ VISU_GaussPointsPL
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetOpacity(vtkFloatingPointType theOpacity)
+{
+  GetPointSpriteMapper()->SetPointSpriteOpacity( theOpacity );
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_GaussPointsPL
+::GetOpacity()
+{
+  return GetPointSpriteMapper()->GetPointSpriteOpacity();
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
@@ -659,6 +678,10 @@ VISU_GaussPointsPL
   vtkFloatingPointType* aScalarRange = GetScalarRange();
   vtkFloatingPointType aDeltaScalarRange = aScalarRange[1] - aScalarRange[0];
 
+  // to avoid FPE if the minimum is equal to maximum
+  if( aDeltaScalarRange < 1.0 / VTK_LARGE_FLOAT )
+    return aMinSize;
+
   return aMinSize + aDelta*(aVal - aScalarRange[0]) / aDeltaScalarRange;
 }
 
@@ -716,7 +739,7 @@ VISU_GaussPointsPL
 vtkSmartPointer<vtkImageData>
 VISU_GaussPointsPL
 ::MakeTexture( const char* theMainTexture, 
-              const char* theAlphaTexture )
+               const char* theAlphaTexture )
 {
   if( !theMainTexture || !theAlphaTexture )
     return 0;
@@ -827,16 +850,21 @@ VISU_GaussPointsPL
 
 int
 VISU_GaussPointsPL
-::AddGeometry(vtkDataSet* theGeometry)
+::AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName)
 {
+  // Fix for issue 0020167 (like in VISU_ScalarMapPL)
+  if(!IsExternalGeometryUsed())
+    ClearGeometry();
+  AddGeometryName(theGeomName);
   myAppendFilter->AddInput(theGeometry);
   return GetNumberOfGeometry();
 }
 
 vtkDataSet*
 VISU_GaussPointsPL
-::GetGeometry(int theGeomNumber)
+::GetGeometry(int theGeomNumber, VISU::TName& theGeomName)
 {
+  theGeomName = GetGeometryName(theGeomNumber);
   return vtkDataSet::SafeDownCast(myAppendFilter->GetInput(theGeomNumber));
 }
 
@@ -858,9 +886,20 @@ void
 VISU_GaussPointsPL
 ::ClearGeometry()
 {
+  ClearGeometryNames();
   myAppendFilter->RemoveAllInputs();
 }
 
+void
+VISU_GaussPointsPL
+::GetSourceRange(vtkFloatingPointType theRange[2])
+{
+  if(!IsExternalGeometryUsed())
+    Superclass::GetSourceRange(theRange);
+  else
+    GetMergedInput()->GetScalarRange( theRange );
+}
+
 vtkPointSet* 
 VISU_GaussPointsPL
 ::GetMergedInput()