]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
[MEDCalc] Proper autoscale for vector field.
authorabn <adrien.bruneton@cea.fr>
Thu, 4 Aug 2016 14:31:56 +0000 (16:31 +0200)
committerabn <adrien.bruneton@cea.fr>
Thu, 4 Aug 2016 14:31:56 +0000 (16:31 +0200)
+ various bug fixes: component should not be available in
VectorField but should be in Slices
+ scalar bar was wrongly keeping memory of compo selected in previous
presentation

19 files changed:
idl/MEDPresentationManager.idl
src/MEDCalc/cmp/MEDPresentation.cxx
src/MEDCalc/cmp/MEDPresentation.hxx
src/MEDCalc/cmp/MEDPresentation.txx
src/MEDCalc/cmp/MEDPresentationContour.cxx
src/MEDCalc/cmp/MEDPresentationManager_i.cxx
src/MEDCalc/cmp/MEDPresentationManager_i.hxx
src/MEDCalc/cmp/MEDPresentationPointSprite.cxx
src/MEDCalc/cmp/MEDPresentationScalarMap.cxx
src/MEDCalc/cmp/MEDPresentationSlices.cxx
src/MEDCalc/cmp/MEDPresentationVectorField.cxx
src/MEDCalc/cmp/MEDPresentationVectorField.hxx
src/MEDCalc/gui/MEDWidgetHelper.cxx
src/MEDCalc/gui/MEDWidgetHelperComponent.cxx
src/MEDCalc/gui/MEDWidgetHelperSlices.cxx
src/MEDCalc/gui/MEDWidgetHelperSlices.hxx
src/MEDCalc/gui/MEDWidgetHelperVectorField.hxx
src/MEDCalc/tui/__init__.py
src/MEDCalc/tui/medpresentation.py

index c045eec36857c214ad0430e73b0ed59f61755264..2d9e0663436d0a937655a5909c498ec420d69619 100644 (file)
@@ -113,7 +113,6 @@ module MEDCALC
 
   struct VectorFieldParameters {
     long fieldHandlerId;
-    string displayedComponent; // DISPLAY_EUCLIDEAN_NORM or any component name - only used to color the glyphs
     ScalarBarRangeType scalarBarRange;
     ColorMapType colorMap;
   };
index 1060819d17f5d8291e5ddd5c19cc56ef2fcf0819..43ce20db5966c11007c97777d8428f17ee505430 100644 (file)
@@ -76,15 +76,17 @@ MEDPresentation::MEDPresentation(MEDPresentation::TypeID fieldHandlerId, const s
 
   // Python variables:
   int id = GeneratePythonId();
-  std::ostringstream oss_o, oss_d, oss_l, oss_s;
+  std::ostringstream oss_o, oss_d, oss_l, oss_s, oss_r;
   oss_o << "__obj" << id;
   oss_s << "__srcObj" << id;
   oss_d << "__disp" << id;
   oss_l << "__lut" << id;
+  oss_r << "__range" << id;
   _objVar = oss_o.str();
   _srcObjVar = oss_s.str();
   _dispVar = oss_d.str();
   _lutVar = oss_l.str();
+  _rangeVar = oss_r.str();
 }
 
 MEDPresentation::~MEDPresentation()
@@ -321,16 +323,23 @@ MEDPresentation::selectFieldComponent()
  * Needs the LUT, so to be called after selectColorMap for the first time.
  */
 void
-MEDPresentation::fixScalarBarTitle()
+MEDPresentation::scalarBarTitle()
 {
   // get selected component name:
-  std::string compoName("Magnitude");
+  std::string compoName;
   if (_selectedComponentIndex != -1)
     {
       std::ostringstream oss1;
       oss1 << MEDPresentation::PROP_COMPONENT << _selectedComponentIndex;
       compoName = getStringProperty(oss1.str());
     }
+  else
+    {
+      if (getIntProperty(MEDPresentation::PROP_NB_COMPONENTS) == 1)
+        compoName = "";
+      else
+        compoName = "Magnitude";
+    }
   std::ostringstream oss;
   oss << "pvs.GetScalarBar(" << _lutVar << ").ComponentTitle = '" << compoName << "';";
   pushAndExecPyLine(oss.str()); oss.str("");
@@ -356,6 +365,8 @@ MEDPresentation::selectColorMap()
     throw KERNEL::createSalomeException("MEDPresentation::getColorMapCommand(): invalid colormap!");
   }
   pushAndExecPyLine(oss.str());
+
+  selectFieldComponent(); // somehow PV keeps the LUT parameters of the previous presentation, so better reset this.
 }
 
 void
@@ -399,8 +410,16 @@ MEDPresentation::rescaleTransferFunction()
       throw KERNEL::createSalomeException("MEDPresentation::getRescaleCommand(): invalid range!");
   }
   pushAndExecPyLine(oss.str()); oss.str("");
+  // Get min-max
+  oss << _rangeVar << " = [" << _dispVar << ".LookupTable.RGBPoints[0], " << _dispVar << ".LookupTable.RGBPoints[-4]];";
+  pushAndExecPyLine(oss.str());
+
+  // Adapt scalar bar title
+  scalarBarTitle();
 }
 
+
+
 int
 MEDPresentation::GeneratePythonId()
 {
index dc2e7aeeddfe316808a67da4527ebef08f52d5de..b60bb47b9411fe5b2ad4569483ef26f56dea6944 100644 (file)
@@ -84,7 +84,7 @@ protected:
   void showScalarBar();
   void rescaleTransferFunction();
   void selectColorMap();
-  void fixScalarBarTitle();
+  void scalarBarTitle();
   void resetCameraAndRender();
 
   virtual void internalGeneratePipeline();
@@ -150,6 +150,8 @@ protected:
   std::string _dispVar;
   ///! ParaView LUT variable in the Python scripting commands
   std::string _lutVar;
+  ///! ParaView variable in Python holding the data range
+  std::string _rangeVar;
 
 private:
   ///! Pipeline elements
index bb3410b5c902d7b1ac17cbaccbd91cd8c4a41d85..84b4137c4b55dee3d2421171cd294594dc0f6979 100644 (file)
@@ -92,7 +92,6 @@ MEDPresentation::updateComponent(const std::string& newCompo)
     selectFieldComponent();
     // The component has changed, we need to rescale the scalar bar to adapt:
     rescaleTransferFunction();
-    fixScalarBarTitle();   // should be fixed in PV one day!
     pushAndExecPyLine("pvs.Render();");
   }
 }
index f08493b3088ad13553f1608a801d5ddbb530d17c..e32b5ff2ced46b3be7f0c1c71d25b4c8e7e01cbc 100644 (file)
@@ -84,9 +84,10 @@ MEDPresentationContour::internalGeneratePipeline()
   // Set number of contours
   setNumberContours();
   colorBy("POINTS");    // necessarily POINTS because of the conversion above
+
   showScalarBar();
-  rescaleTransferFunction();
   selectColorMap();
+  rescaleTransferFunction();
   resetCameraAndRender();
 }
 
index 876b3ec1ceb5ed730cee66e130148d6eec25d589..c787a16e9c72674418784b843e46bb75f4eee299 100644 (file)
@@ -200,13 +200,12 @@ MEDPresentationManager_i::getSlicesParameters(MEDPresentation::TypeID presentati
   return tmp._retn();
 }
 
-MEDCALC::VectorFieldParameters*
+MEDCALC::VectorFieldParameters
 MEDPresentationManager_i::getVectorFieldParameters(MEDPresentation::TypeID presentationID)
 {
-  MEDCALC::VectorFieldParameters* p = new MEDCALC::VectorFieldParameters();
-  _getParameters<MEDPresentationVectorField>(presentationID, *p);
-  MEDCALC::VectorFieldParameters_var tmp(p);
-  return tmp._retn();
+  MEDCALC::VectorFieldParameters p;
+  _getParameters<MEDPresentationVectorField>(presentationID, p);
+  return p;
 }
 
 MEDCALC::PointSpriteParameters*
index 9f89afcc1ce95bbcbb7dd63e5dddef1aab5ad764..95fd9edf3a0e095d12fe74b4282ec6404406e458 100644 (file)
@@ -57,7 +57,7 @@ class MEDPresentationManager_i: public POA_MEDCALC::MEDPresentationManager,
   MEDCALC_EXPORT MEDCALC::ScalarMapParameters* getScalarMapParameters(MEDPresentation::TypeID presentationID);
   MEDCALC_EXPORT MEDCALC::ContourParameters    getContourParameters(MEDPresentation::TypeID presentationID);
   MEDCALC_EXPORT MEDCALC::SlicesParameters*    getSlicesParameters(MEDPresentation::TypeID presentationID);
-  MEDCALC_EXPORT MEDCALC::VectorFieldParameters*    getVectorFieldParameters(MEDPresentation::TypeID presentationID);
+  MEDCALC_EXPORT MEDCALC::VectorFieldParameters     getVectorFieldParameters(MEDPresentation::TypeID presentationID);
   MEDCALC_EXPORT MEDCALC::PointSpriteParameters*    getPointSpriteParameters(MEDPresentation::TypeID presentationID);
 
   MEDCALC_EXPORT void updateMeshView(MEDPresentation::TypeID, const MEDCALC::MeshViewParameters&);
index 9dbc17ff884ae5846ea4a384e1e3be06fe850c10..dfa7ddd178c0a3c5d834ecb328f4756e0b3123a9 100644 (file)
@@ -86,8 +86,8 @@ MEDPresentationPointSprite::internalGeneratePipeline()
   pushAndExecPyLine(oss.str()); oss.str("");
 
   showScalarBar();
-  rescaleTransferFunction();
   selectColorMap();
+  rescaleTransferFunction();
   resetCameraAndRender();
 }
 
index 7c0c21a84365b49710434ba7b8b0b9d7d1043dcd..78c228b50a25b669af7bb57f92e7e7c3762c6ca9 100644 (file)
@@ -55,8 +55,8 @@ MEDPresentationScalarMap::internalGeneratePipeline()
   showObject();
   colorBy(_fieldType);
   showScalarBar();
-  rescaleTransferFunction();
   selectColorMap();
+  rescaleTransferFunction();
   resetCameraAndRender();
 
   // Retrieve Python object for internal storage:
index 83945b32d3ca6b552d2b8a4ea2d44636cd9c244d..09447d8ad90a01039a0be9707d2276a5063b4016 100644 (file)
@@ -68,8 +68,8 @@ MEDPresentationSlices::generateAndDisplay()
 
   colorBy(_fieldType);
   showScalarBar();
-  rescaleTransferFunction();
   selectColorMap();
+  rescaleTransferFunction();
   resetCameraAndRender();
 }
 
index f922e29df090cd3953909a8bbffbdb710f1cd343..e175108154f8a90616e423ca83f2134286c460a3 100644 (file)
@@ -36,6 +36,17 @@ MEDPresentationVectorField::MEDPresentationVectorField(const MEDCALC::VectorFiel
 {
 }
 
+void
+MEDPresentationVectorField::autoScale()
+{
+  std::ostringstream oss;
+  oss << "import medcalc;";
+  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _objVar << ".ScaleFactor = 2.0*medcalc.ComputeCellAverageSize(__srcObj0)/(" << _rangeVar
+      << "[1]-" << _rangeVar << "[0]);";
+  pushAndExecPyLine(oss.str()); oss.str("");
+}
+
 void
 MEDPresentationVectorField::internalGeneratePipeline()
 {
@@ -50,7 +61,7 @@ MEDPresentationVectorField::internalGeneratePipeline()
   fillAvailableFieldComponents();
   if (getIntProperty(MEDPresentation::PROP_NB_COMPONENTS) <= 1)
     {
-      const char * msg = "Vector field presentation does not work for scalar  field!"; // this message will appear in GUI too
+      const char * msg = "Vector field presentation does not work for scalar field!"; // this message will appear in GUI too
       STDLOG(msg);
       throw KERNEL::createSalomeException(msg);
     }
@@ -69,18 +80,18 @@ MEDPresentationVectorField::internalGeneratePipeline()
   pushAndExecPyLine(oss.str()); oss.str("");
   oss << _objVar << ".GlyphMode = 'All Points';";
   pushAndExecPyLine(oss.str()); oss.str("");
-//  oss << _objVar << "GlyphTransform = 'Transform2';";  // not sure this is really needed?
-//  pushAndExecPyLine(oss.str()); oss.str("");
+  oss << _objVar << "GlyphTransform = 'Transform2';";  // not sure this is really needed?
+  pushAndExecPyLine(oss.str()); oss.str("");
   oss << _objVar << ".ScaleFactor = 0.1;";
   pushAndExecPyLine(oss.str()); oss.str("");
-  // Auto-tuning of the scale factor:
-//  oss << "import medcalc; medcalc.SetDefaultScaleFactor(active=" << _objVar << ");";
-//  pushAndExecPyLine(oss.str()); oss.str("");
 
   colorBy("POINTS");
   showScalarBar();
-  rescaleTransferFunction();
   selectColorMap();
+  rescaleTransferFunction();
+
+  autoScale();   // to be called after transfer function so we have the range
+
   resetCameraAndRender();
 }
 
@@ -90,10 +101,12 @@ MEDPresentationVectorField::updatePipeline(const MEDCALC::VectorFieldParameters&
   if (params.fieldHandlerId != _params.fieldHandlerId)
     throw KERNEL::createSalomeException("Unexpected updatePipeline error! Mismatching fieldHandlerId!");
 
-  if (std::string(params.displayedComponent) != std::string(_params.displayedComponent))
-    updateComponent<MEDPresentationVectorField, MEDCALC::VectorFieldParameters>(std::string(params.displayedComponent));
   if (params.scalarBarRange != _params.scalarBarRange)
-    updateScalarBarRange<MEDPresentationVectorField, MEDCALC::VectorFieldParameters>(params.scalarBarRange);
+    {
+      updateScalarBarRange<MEDPresentationVectorField, MEDCALC::VectorFieldParameters>(params.scalarBarRange);
+      autoScale();
+      pushAndExecPyLine("pvs.Render();");
+    }
   if (params.colorMap != _params.colorMap)
     updateColorMap<MEDPresentationVectorField, MEDCALC::VectorFieldParameters>(params.colorMap);
 }
index 3c37fba534285bb066527b136f260663bedbe427..339bf02a0087914ce18fba56d26fe9dba87502ac 100644 (file)
@@ -38,6 +38,7 @@ public:
 
 protected:
   virtual void internalGeneratePipeline();
+  void autoScale();
 
 private:
   MEDCALC::VectorFieldParameters _params;
index 8869c847ba4f0efd38b694243f1153bbca0fba6e..8935a3adeed524a01f18194eaa6a4e81ec98ea0d 100644 (file)
@@ -69,6 +69,8 @@ void MEDWidgetHelper::updateWidget(bool connect)
 
   if (connect)
     {
+      QObject::connect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                              _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
       QObject::connect( _paramWidget, SIGNAL(comboScalarBarRangeIndexChanged(int)), this, SLOT(onScalarBarRangeChanged(int)) );
       QObject::connect( _paramWidget, SIGNAL(comboColorMapIndexChanged(int)), this, SLOT(onColorMapChanged(int)) );
     }
@@ -76,6 +78,8 @@ void MEDWidgetHelper::updateWidget(bool connect)
 
 void MEDWidgetHelper::releaseWidget()
 {
+  QObject::disconnect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
+                          _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
   QObject::disconnect( _paramWidget, SIGNAL(comboScalarBarRangeIndexChanged(int)), this, SLOT(onScalarBarRangeChanged(int)) );
   QObject::disconnect( _paramWidget, SIGNAL(comboColorMapIndexChanged(int)), this, SLOT(onColorMapChanged(int)) );
 
index 01a29e9edf4cd52ed68cf73f5ef59b1664674a86..34136e965b0274904b80e4a8b545150597b4ccba 100644 (file)
@@ -37,8 +37,6 @@ void MEDWidgetHelperComponent::updateWidget(bool connect)
   if (connect)
     {
       // Connect combo box changes
-      QObject::connect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
-                        _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
       QObject::connect( _paramWidget, SIGNAL(comboCompoIndexChanged(int)), this, SLOT(onComponentChanged(int)) );
     }
 }
@@ -47,7 +45,5 @@ void MEDWidgetHelperComponent::releaseWidget()
 {
   MEDWidgetHelper::releaseWidget();
 
-  QObject::disconnect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
-                       _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
   QObject::disconnect( _paramWidget, SIGNAL(comboCompoIndexChanged(int)), this, SLOT(onComponentChanged(int)) );
 }
index eb99e87759f32779982b99a2f93359a816e12f87..f0827b507b790b6d16a670222f7e0ec748087bb0 100644 (file)
@@ -28,7 +28,7 @@
 MEDWidgetHelperSlices::MEDWidgetHelperSlices(const PresentationController * presController,
                                                MEDCALC::MEDPresentationManager_ptr presManager, int presId,
                                                const std::string & presName, WidgetPresentationParameters * paramW):
-  MEDWidgetHelper(presController, presManager, presId, presName, paramW),
+  MEDWidgetHelperComponent(presController, presManager, presId, presName, paramW),
   _nbSlices(-1),
   _sliceOrientation(MEDCALC::SLICE_ORIENTATION_DEFAULT)
 {}
@@ -46,8 +46,7 @@ void MEDWidgetHelperSlices::loadParametersFromEngine()
 
 void MEDWidgetHelperSlices::updateWidget(bool connect)
 {
-  MEDWidgetHelper::updateWidget(connect);
-  STDLOG("MEDWidgetHelperSlices::udpateWidget() nbSlices is " << _nbSlices);
+  MEDWidgetHelperComponent::updateWidget(connect);
 
   _paramWidget->setNbSlices(_nbSlices);
   _paramWidget->setSliceOrientation(_sliceOrientation);
@@ -55,8 +54,6 @@ void MEDWidgetHelperSlices::updateWidget(bool connect)
   // Connect combo box changes
   if (connect)
     {
-      QObject::connect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
-                        _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
       QObject::connect( _paramWidget, SIGNAL(spinBoxValueChanged(int)), this, SLOT(onNbSlicesChanged(int)) );
       QObject::connect( _paramWidget, SIGNAL(comboOrientIndexChanged(int)), this, SLOT(onSliceOrientationChanged(int)) );
     }
@@ -66,8 +63,6 @@ void MEDWidgetHelperSlices::releaseWidget()
 {
   MEDWidgetHelper::releaseWidget();
 
-  QObject::disconnect( this, SIGNAL(presentationUpdateSignal(const PresentationEvent *)),
-                       _presController, SIGNAL(presentationSignal(const PresentationEvent *)) );
   QObject::disconnect( _paramWidget, SIGNAL(spinBoxValueChanged(int)), this, SLOT(onNbSlicesChanged(int)) );
   QObject::disconnect( _paramWidget, SIGNAL(comboOrientIndexChanged(int)), this, SLOT(onSliceOrientationChanged(int)) );
 }
index bce48ef03b681ae2e7e0bcb34e7993209a630fae..c814e9a73e1123a70c2affc0d5a19d4619d2413a 100644 (file)
 #ifndef SRC_MEDCALC_GUI_MEDWIDGETHELPERSLICES_HXX_
 #define SRC_MEDCALC_GUI_MEDWIDGETHELPERSLICES_HXX_
 
-#include "MEDWidgetHelper.hxx"
+#include "MEDWidgetHelperComponent.hxx"
 
 class PresentationController;
 
-class MEDWidgetHelperSlices: public MEDWidgetHelper
+class MEDWidgetHelperSlices: public MEDWidgetHelperComponent
 {
   Q_OBJECT
 
index daca5dfb98c085a4c6b7618d9e7c6191267340c3..6ee04de46b1286cd385add38b7e24452732530ea 100644 (file)
@@ -24,7 +24,7 @@
 
 class PresentationController;
 
-class MEDWidgetHelperVectorField: public MEDWidgetHelperComponent
+class MEDWidgetHelperVectorField: public MEDWidgetHelper
 {
   Q_OBJECT
 
@@ -32,12 +32,12 @@ public:
   MEDWidgetHelperVectorField(const PresentationController* presController,
                            MEDCALC::MEDPresentationManager_ptr presManager, int presId, const std::string & presName,
                            WidgetPresentationParameters * paramW):
-     MEDWidgetHelperComponent(presController, presManager, presId, presName, paramW)
+     MEDWidgetHelper(presController, presManager, presId, presName, paramW)
   {}
-
   virtual ~MEDWidgetHelperVectorField() {}
 
   virtual std::string getPythonTag() const { return "VectorField"; }
+
 };
 
 #endif /* SRC_MEDCALC_GUI_MEDWIDGETHELPERVECTORFIELD_HXX_ */
index 1f1f0fd9df7063036d696e64afa1e3fac1fd5e04..949fadd91f50d28e8157a34dad121b4b02285900 100644 (file)
@@ -64,7 +64,7 @@ from medpresentation import UpdateVectorField
 from medpresentation import UpdatePointSprite
 #from medpresentation import UpdateDeflectionShape
 
-from medpresentation import SetDefaultScaleFactor, ComputeCellAverageSize, GetDomainCenter, GetSliceOrigins
+from medpresentation import ComputeCellAverageSize, GetDomainCenter, GetSliceOrigins
 
 # Console commands
 import medconsole
index 6b23e20bd0258628c5f1a156d7878321c3ef3550..01defc0daaab6eab800321429cb51c33d9a4072e 100644 (file)
@@ -74,13 +74,12 @@ def MakeContour(proxy,
 
 def MakeVectorField(proxy,
                   viewMode=MEDCALC.VIEW_MODE_DEFAULT,
-                  displayedComponent=MEDCALC.DISPLAY_DEFAULT,
                   scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
                   colorMap=MEDCALC.COLOR_MAP_DEFAULT
                   ):
   # Create the presentation instance in CORBA engine
   # The engine in turn creates the ParaView pipeline elements
-  params = MEDCALC.VectorFieldParameters(proxy.id, displayedComponent, scalarBarRange, colorMap)
+  params = MEDCALC.VectorFieldParameters(proxy.id, scalarBarRange, colorMap)
   try:
     presentation_id = __manager.makeVectorField(params, viewMode)
     notifyGui_addPresentation(proxy.id, presentation_id)
@@ -186,91 +185,6 @@ def GetDomainCenter(obj):
   mids = [x[0] + 0.5*(x[1]-x[0]) for x in bb]
   return mids
 
-# Taken from paraview.simple from CEA ParaView's version:
-def SetDefaultScaleFactor(active=None):
-    """Provides a good display to the bounding box of the mesh and min / max of the field.
-    This method available for filters: Warp By Vector, Glyph and Tensor Glyph"""
-    if not active:
-        active = GetActiveSource()
-    if not active:
-        return
-    name = active.__class__.__name__
-    if (name == 'WarpByVector'  or name == 'TensorGlyph') and hasattr(active, 'ScaleFactor'):
-      import math
-      datainfo = active.GetProperty("Input").SMProperty.GetProxy(0).GetDataInformation()
-      if not datainfo:
-          active.ScaleFactor = 1.0
-          return
-      nbcells = datainfo.GetNumberOfCells()
-      nbpoints = datainfo.GetNumberOfPoints()
-      nbelem = nbcells
-      if nbelem == 0:
-          nbelem = nbpoints
-      abounds = datainfo.GetBounds()
-      volume = 1
-      vol = 0
-      idim = 0
-      i = 0
-      eps = 1.0e-38
-      while i < 6 :
-          vol = math.fabs( abounds[i+1] - abounds[i] )
-          if vol > 0:
-            idim += 1
-            volume *= vol
-          i += 2
-      if nbelem == 0 or math.fabs(idim) < eps:
-          active.ScaleFactor = 0.0
-          return
-      volume /= nbelem
-      scalefactor = pow( volume, 1.0 / idim )
-      maximum = 1.0
-      property = active.GetProperty('ScaleFactor')
-      domain = None
-      if property.GetDomain('vector_range').__class__.__name__ == 'vtkSMArrayRangeDomain':
-          domain = property.GetDomain('vector_range')
-      if property.GetDomain('tensor_range').__class__.__name__ == 'vtkSMArrayRangeDomain':
-          domain = property.GetDomain('tensor_range')
-      if not domain is None:
-          if domain.GetMaximumExists(3):
-            maximum = domain.GetMaximum(3)
-      if math.fabs(maximum) > eps:
-          scalefactor /= maximum
-      active.ScaleFactor = scalefactor
-      return
-    if name == 'Glyph' and hasattr(active, 'ScaleFactor') and hasattr(active, 'UseCellsCenter') and hasattr(active, 'ScaleMode'):
-      import math
-      scaledextent = 1.0
-      property = active.GetProperty('ScaleFactor')
-      bounds_domain = property.GetDomain('bounds')
-      if bounds_domain.__class__.__name__ == 'vtkSMBoundsDomain':
-          if bounds_domain.GetMaximumExists(0):
-            scaledextent = bounds_domain.GetMaximum(0)
-      usecellscenter = active.GetProperty('UseCellsCenter').GetData()
-      sdomain = "cells_"
-      if usecellscenter == 0:
-          sdomain = "points_"
-      divisor = 1.0
-      scalemode_domain = active.GetProperty('ScaleMode')
-      scalemode = scalemode_domain.ConvertValue(scalemode_domain.GetData())
-      if scalemode == 0:
-          sdomain += "scalar_range"
-          domain = property.GetDomain(sdomain)
-          if domain.__class__.__name__ == 'vtkSMArrayRangeDomain':
-            if domain.GetMaximumExists(0):
-                divisor = domain.GetMaximum(0)
-      if scalemode == 1 or scalemode == 2:
-          sdomain += "vector_range"
-          domain = property.GetDomain(sdomain)
-          if domain.__class__.__name__ == 'vtkSMArrayRangeDomain':
-            if domain.GetMaximumExists(3):
-                divisor = domain.GetMaximum(3)
-      divisor = math.fabs(divisor)
-      if divisor < 0.000000001:
-          divisor = 1
-      scalefactor = scaledextent / divisor 
-      active.ScaleFactor = scalefactor
-      return
-
 def GetSliceOrigins(obj, nbSlices, normal):
   """
   Compute all origin points for the position of the slices.