]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
MPV: Merge V1_2d
authorsmh <smh@opencascade.com>
Thu, 29 Jan 2004 12:44:09 +0000 (12:44 +0000)
committersmh <smh@opencascade.com>
Thu, 29 Jan 2004 12:44:09 +0000 (12:44 +0000)
src/OBJECT/Makefile.in
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_LookupTable.cxx [deleted file]
src/OBJECT/VISU_LookupTable.hxx [deleted file]
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_ScalarBarActor.cxx [deleted file]
src/OBJECT/VISU_ScalarBarActor.hxx [deleted file]

index 310b27250ca343566f4db82207576831dc428737..229ffeea7f87c852af54a683b7ff3b873a854275 100644 (file)
@@ -45,12 +45,9 @@ LIB_CLIENT_IDL =
 BIN = 
 BIN_SRC        =
 
-CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) \
+CPPFLAGS+= $(OCC_INCLUDES) $(VTK_INCLUDES) \
        -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=$(VTK_LIBS) -lSalomeObject \
-       -lVisuPipeLine -L${KERNEL_ROOT_DIR}/lib/salome
-
-%_moc.cxx: %.h
-       $(MOC) $< -o $@
+LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lVisuPipeLine \
+       -L${KERNEL_ROOT_DIR}/lib/salome
 
 @CONCLUDE@
index 6a2ccc1087e0a5583857781406e14788ddffdc7e..62d1477847b6d2a1f5d4c30c6ff49620677ed32e 100644 (file)
 #include "VISU_Actor.h"
 #include "VISU_PipeLine.hxx"
 #include "SALOME_PassThroughFilter.h"
+#include "utilities.h"
  
 // VTK Includes
 #include <vtkProperty.h>
 #include <vtkDataSetMapper.h>
 #include <vtkShrinkPolyData.h>
+#include <vtkGeometryFilter.h>
 #include <vtkObjectFactory.h>
 
 using namespace std;
 
+static int MYVTKDEBUG = 0;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
 //=======================================================================
 
 vtkStandardNewMacro(VISU_Actor);
 
 VISU_Actor::VISU_Actor(){
+  SetDebug(MYVTKDEBUG);
   myIsShrunk = false;
   myIsShrinkable = false;
   myParent = this;
@@ -65,7 +78,9 @@ VISU_Actor::VISU_Actor(){
 }
 
 VISU_Actor::~VISU_Actor(){
+  SALOME_Actor::SetProperty(NULL);
   HighlightProperty->Delete();
+  if(myPipeLine) myPipeLine->UnRegister(this);
 }
 
 void VISU_Actor::setIO(const Handle(SALOME_InteractiveObject)& theIO){
@@ -86,18 +101,21 @@ void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) throw(std::runtime_erro
     vtkMapper *aMapper = myPipeLine->GetMapper();
     vtkDataSet *aDataSet = aMapper->GetInput();
     if(!aDataSet)
-      throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data");
+      throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data !!!");
     aDataSet->Update();
     static float eps = VTK_LARGE_FLOAT * 0.1 ;
     if(aDataSet->GetLength() > eps)
-      throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large");
+      throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
     if(!aDataSet->GetNumberOfCells())
       throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
-    SetShrinkable(aDataSet->GetNumberOfCells() > 10);
-
+    //Bug SAL4221:  Mesh with less than 10 cells : shrink mode disable
+    //SetShrinkable(aDataSet->GetNumberOfCells() > 10);
+    SetShrinkable(true);
+    //Now, we use vtkShrinkPolyData (not vtkShrinkFilter), 
+    //and the class there is no such limitation.
+    
     vtkDataSetMapper* aNewMapper = vtkDataSetMapper::New();
     aNewMapper->SetInput(aDataSet);
-    aMapper->ShallowCopy(aMapper);
     SetMapper(aNewMapper);
     aNewMapper->Delete();
   }
@@ -107,6 +125,26 @@ void VISU_Actor::SetParent(VISU_Actor* theParent){
   myParent = theParent;
 }
 
+void VISU_Actor::SetRepresentation(int theMode) { 
+  int aRepresent = GetRepresentation();
+  SALOME_Actor::SetRepresentation(theMode);
+  if(GetMapper() && GetMapper()->GetInput()){
+    vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
+    aGeometryFilter->SetInput(GetMapper()->GetInput());
+    vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
+    aPolyData->Update();
+    static int INCMEMORY = 7;
+    float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
+    int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
+    if(MYDEBUG) MESSAGE("SetRepresentation - aSize = "<<aSize<<"; isPoss = "<<isPoss);
+    aPolyData->Delete();
+    if(!isPoss){
+      SALOME_Actor::SetRepresentation(aRepresent);
+      throw std::runtime_error("SetRepresentation >> There is no enough memory !!!");
+    }
+  }
+}
+
 void VISU_Actor::SetShrinkable(bool theIsShrinkable){
   myIsShrinkable = theIsShrinkable;
 }
index 1d8b34186b12f9ddacae59e858be6293772da2e9..88f4e26d28f5233933b79587c460823ec8902fe3 100644 (file)
@@ -75,6 +75,8 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
   virtual void SetShrinkable(bool theIsShrinkable);
   virtual bool GetShrinkable() { return myIsShrinkable;}
 
+  virtual void SetRepresentation(int theMode);
+
   virtual bool IsShrunk() { return myIsShrunk;}
   virtual void SetShrink(float theFactor = 0.8); 
   virtual void UnShrink(); 
diff --git a/src/OBJECT/VISU_LookupTable.cxx b/src/OBJECT/VISU_LookupTable.cxx
deleted file mode 100644 (file)
index be0f137..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VISU_LookupTable.cxx
-//  Author : Vitaliy Smetannikov
-//  Module : VISU
-
-using namespace std;
-#include "VISU_LookupTable.hxx"
-
-VISU_LookupTable *VISU_LookupTable::New() {
-  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_LookupTable");
-  if(ret)
-    return (VISU_LookupTable*)ret;
-  return new VISU_LookupTable;
-}
-
-VISU_LookupTable::VISU_LookupTable(int sze, int ext)
-  : vtkLookupTable(sze, ext), myScale(1.0) {}
-
-int VISU_LookupTable::ComputeLogRange(float inRange[2], float outRange[2]){
-  if(inRange[0] >= inRange[1])
-    return -1;
-  if(0.0 <= inRange[0] && 0.0 < inRange[1]){
-    if(inRange[0] != 0.0)
-      outRange[0] = log10((double)inRange[0]);
-    else
-      outRange[0] = log10((double)inRange[1]*1.0E-6);
-    outRange[1] = log10((double)inRange[1]);
-    return 0;
-  }else if(inRange[0] < 0.0 && inRange[1] <= 0.0){
-    outRange[0] = log10((double)-inRange[0]);
-    outRange[1] = log10((double)-inRange[1]);
-    return 1;
-  }else
-    return -1;
-}
-
-unsigned char* VISU_LookupTable::MapValue(float v) {
-  if(GetScale() == VTK_SCALE_LOG10) {
-    float aLowBound = log10(this->TableRange[0]);
-    v = pow(10.0f,aLowBound + (v - aLowBound)*myScale);
-    return vtkLookupTable::MapValue(v);
-  }else{
-    v = this->TableRange[0] + (v - this->TableRange[0])*myScale;
-    return vtkLookupTable::MapValue(v);
-  }
-}
diff --git a/src/OBJECT/VISU_LookupTable.hxx b/src/OBJECT/VISU_LookupTable.hxx
deleted file mode 100644 (file)
index 960b9d5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VISU_LookupTable.h
-//  Author : Vitaliy Smetannikov
-//  Module : VISU
-
-#ifndef VISU_LookupTable_H
-#define VISU_LookupTable_H
-
-//#include <vtkLookupTable.h>
-#include "VTKViewer_Common.h"
-#include <vtkLogLookupTable.h>
-
-class VISU_LookupTable: public vtkLookupTable {
- public:
-   vtkTypeMacro(VISU_LookupTable,vtkLogLookupTable);
-   static VISU_LookupTable *New();
-
-   float GetMapScale() { return myScale; }
-   void SetMapScale(float theScale) { myScale = theScale; Modified(); }
-
-   static int ComputeLogRange(float inRange[2], float outRange[2]);
-   unsigned char *MapValue(float v);
-
- protected:
-   VISU_LookupTable(int sze=256, int ext=256);
-   ~VISU_LookupTable() {};
-   
-   float myScale;
-};
-#endif // VISU_LookupTable_H
index eb9203b91d3d000e3f93565f6b7d43802a50a810..416e0673de4077392e6d2d5717f38773c36a842f 100644 (file)
@@ -164,13 +164,17 @@ void VISU_MeshAct::SetRepresentation(int theMode){
   mySurfaceActor->VisibilityOff();
   myEdgeActor->VisibilityOff();
   myNodeActor->VisibilityOff();
+  myEdgeActor->PickableOff();
+  myNodeActor->PickableOff();
   switch(theMode){
   case 0: //POINTS
     myNodeActor->VisibilityOn();
+    myNodeActor->PickableOn();
     break;
   case 1: //WIREFRAME
     myEdgeActor->VisibilityOn();
     myEdgeActor->SetRepresentation(1);
+    myEdgeActor->PickableOn();
     break;
   case 2: //SURFACE
     mySurfaceActor->VisibilityOn();
@@ -178,6 +182,7 @@ void VISU_MeshAct::SetRepresentation(int theMode){
   case 3: //INSIDEFRAME
     myEdgeActor->VisibilityOn();
     myEdgeActor->SetRepresentation(3);
+    myEdgeActor->PickableOn();
     break;
   case 4: //SURFACEFRAME
     myEdgeActor->VisibilityOn();
diff --git a/src/OBJECT/VISU_ScalarBarActor.cxx b/src/OBJECT/VISU_ScalarBarActor.cxx
deleted file mode 100644 (file)
index 7859100..0000000
+++ /dev/null
@@ -1,575 +0,0 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VISU_ScalarBarActor.cxx
-//  Author : Alexey PETROV
-//  Module : VISU
-
-using namespace std;
-#include "VISU_ScalarBarActor.hxx"
-
-vtkCxxRevisionMacro(VISU_ScalarBarActor, "$Revision$");
-
-vtkCxxSetObjectMacro(VISU_ScalarBarActor,LookupTable,VISU_LookupTable);
-vtkCxxSetObjectMacro(VISU_ScalarBarActor,LabelTextProperty,vtkTextProperty);
-vtkCxxSetObjectMacro(VISU_ScalarBarActor,TitleTextProperty,vtkTextProperty);
-
-//------------------------------------------------------------------------------
-VISU_ScalarBarActor* VISU_ScalarBarActor::New(){
-  vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_ScalarBarActor");
-  if(ret)
-    return (VISU_ScalarBarActor*)ret;
-  return new VISU_ScalarBarActor;
-}
-
-VISU_ScalarBarActor::VISU_ScalarBarActor()
-{
-  this->LookupTable = NULL;
-  this->Position2Coordinate->SetValue(0.17, 0.8);
-  
-  this->PositionCoordinate->SetCoordinateSystemToNormalizedViewport();
-  this->PositionCoordinate->SetValue(0.82,0.1);
-  
-  this->MaximumNumberOfColors = 64;
-  this->NumberOfLabels = 5;
-  this->NumberOfLabelsBuilt = 0;
-  this->Orientation = VTK_ORIENT_VERTICAL;
-  this->Title = NULL;
-
-  this->LabelTextProperty = vtkTextProperty::New();
-  this->LabelTextProperty->SetFontSize(12);
-  this->LabelTextProperty->SetBold(1);
-  this->LabelTextProperty->SetItalic(1);
-  this->LabelTextProperty->SetShadow(1);
-  this->LabelTextProperty->SetFontFamilyToArial();
-
-  this->TitleTextProperty = vtkTextProperty::New();
-  this->TitleTextProperty->ShallowCopy(this->LabelTextProperty);
-
-  this->LabelFormat = new char[8]; 
-  sprintf(this->LabelFormat,"%s","%-#6.3g");
-
-  this->TitleMapper = vtkTextMapper::New();
-  this->TitleActor = vtkActor2D::New();
-  this->TitleActor->SetMapper(this->TitleMapper);
-  this->TitleActor->GetPositionCoordinate()->
-    SetReferenceCoordinate(this->PositionCoordinate);
-  
-  this->TextMappers = NULL;
-  this->TextActors = NULL;
-
-  this->ScalarBar = vtkPolyData::New();
-  this->ScalarBarMapper = vtkPolyDataMapper2D::New();
-  this->ScalarBarMapper->SetInput(this->ScalarBar);
-  this->ScalarBarActor = vtkActor2D::New();
-  this->ScalarBarActor->SetMapper(this->ScalarBarMapper);
-  this->ScalarBarActor->GetPositionCoordinate()->
-    SetReferenceCoordinate(this->PositionCoordinate);
-  this->LastOrigin[0] = 0;
-  this->LastOrigin[1] = 0;
-  this->LastSize[0] = 0;
-  this->LastSize[1] = 0;
-}
-
-void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win)
-{
-  this->TitleActor->ReleaseGraphicsResources(win);
-  if (this->TextMappers != NULL )
-    {
-    for (int i=0; i < this->NumberOfLabelsBuilt; i++)
-      {
-      this->TextActors[i]->ReleaseGraphicsResources(win);
-      }
-    }
-  this->ScalarBarActor->ReleaseGraphicsResources(win);
-}
-
-VISU_ScalarBarActor::~VISU_ScalarBarActor()
-{
-  if (this->LabelFormat) 
-    {
-    delete [] this->LabelFormat;
-    this->LabelFormat = NULL;
-    }
-
-  this->TitleMapper->Delete();
-  this->TitleActor->Delete();
-
-  if (this->TextMappers != NULL )
-    {
-    for (int i=0; i < this->NumberOfLabelsBuilt; i++)
-      {
-      this->TextMappers[i]->Delete();
-      this->TextActors[i]->Delete();
-      }
-    delete [] this->TextMappers;
-    delete [] this->TextActors;
-    }
-
-  this->ScalarBar->Delete();
-  this->ScalarBarMapper->Delete();
-  this->ScalarBarActor->Delete();
-
-  if (this->Title)
-    {
-    delete [] this->Title;
-    this->Title = NULL;
-    }
-  
-  this->SetLookupTable(NULL);
-  this->SetLabelTextProperty(NULL);
-  this->SetTitleTextProperty(NULL);
-}
-
-int VISU_ScalarBarActor::RenderOverlay(vtkViewport *viewport)
-{
-  int renderedSomething = 0;
-  int i;
-  
-  // Everything is built, just have to render
-  if (this->Title != NULL)
-    {
-    renderedSomething += this->TitleActor->RenderOverlay(viewport);
-    }
-  this->ScalarBarActor->RenderOverlay(viewport);
-  if( this->TextActors == NULL)
-    {
-     vtkWarningMacro(<<"Need a mapper to render a scalar bar");
-     return renderedSomething;
-    }
-  
-  for (i=0; i<this->NumberOfLabels; i++)
-    {
-    renderedSomething += this->TextActors[i]->RenderOverlay(viewport);
-    }
-
-  renderedSomething = (renderedSomething > 0)?(1):(0);
-
-  return renderedSomething;
-}
-
-int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
-{
-  int renderedSomething = 0;
-  int i;
-  int size[2];
-  
-  if (!this->LookupTable)
-    {
-    vtkWarningMacro(<<"Need a mapper to render a scalar bar");
-    return 0;
-    }
-
-  if (!this->TitleTextProperty)
-    {
-    vtkErrorMacro(<<"Need title text property to render a scalar bar");
-    return 0;
-    }
-
-  if (!this->LabelTextProperty)
-    {
-    vtkErrorMacro(<<"Need label text property to render a scalar bar");
-    return 0;
-    }
-
-  // Check to see whether we have to rebuild everything
-  int positionsHaveChanged = 0;
-  if (viewport->GetMTime() > this->BuildTime || 
-      (viewport->GetVTKWindow() && 
-       viewport->GetVTKWindow()->GetMTime() > this->BuildTime))
-    {
-    // if the viewport has changed we may - or may not need
-    // to rebuild, it depends on if the projected coords chage
-    int *barOrigin;
-    barOrigin = this->PositionCoordinate->GetComputedViewportValue(viewport);
-    size[0] = 
-      this->Position2Coordinate->GetComputedViewportValue(viewport)[0] -
-      barOrigin[0];
-    size[1] = 
-      this->Position2Coordinate->GetComputedViewportValue(viewport)[1] -
-      barOrigin[1];
-    if (this->LastSize[0] != size[0] || 
-        this->LastSize[1] != size[1] ||
-        this->LastOrigin[0] != barOrigin[0] || 
-        this->LastOrigin[1] != barOrigin[1])
-      {
-      positionsHaveChanged = 1;
-      }
-    }
-  
-  // Check to see whether we have to rebuild everything
-  if (positionsHaveChanged ||
-      this->GetMTime() > this->BuildTime || 
-      this->LookupTable->GetMTime() > this->BuildTime ||
-      this->LabelTextProperty->GetMTime() > this->BuildTime ||
-      this->TitleTextProperty->GetMTime() > this->BuildTime)
-    {
-
-    // Delete previously constructed objects
-    //
-    if (this->TextMappers != NULL )
-      {
-      for (i=0; i < this->NumberOfLabelsBuilt; i++)
-        {
-        this->TextMappers[i]->Delete();
-        this->TextActors[i]->Delete();
-        }
-      delete [] this->TextMappers;
-      delete [] this->TextActors;
-      }
-
-    // Build scalar bar object; determine its type
-    //
-    VISU_LookupTable *lut = this->LookupTable; //SALOME specific
-    int isLogTable = lut->GetScale() == VTK_SCALE_LOG10;
-    
-    // we hard code how many steps to display
-    int numColors = this->MaximumNumberOfColors;
-    float *range = lut->GetRange();
-
-    int numPts = 2*(numColors + 1);
-    vtkPoints *pts = vtkPoints::New();
-    pts->SetNumberOfPoints(numPts);
-    vtkCellArray *polys = vtkCellArray::New();
-    polys->Allocate(polys->EstimateSize(numColors,4));
-    vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
-    colors->SetNumberOfComponents(3);
-    colors->SetNumberOfTuples(numColors);
-
-    this->ScalarBarActor->SetProperty(this->GetProperty());
-    this->ScalarBar->Initialize();
-    this->ScalarBar->SetPoints(pts);
-    this->ScalarBar->SetPolys(polys);
-    this->ScalarBar->GetCellData()->SetScalars(colors);
-    pts->Delete(); polys->Delete(); colors->Delete();
-
-    // get the viewport size in display coordinates
-    int *barOrigin, barWidth, barHeight;
-    barOrigin = this->PositionCoordinate->GetComputedViewportValue(viewport);
-    size[0] = 
-      this->Position2Coordinate->GetComputedViewportValue(viewport)[0] -
-      barOrigin[0];
-    size[1] = 
-      this->Position2Coordinate->GetComputedViewportValue(viewport)[1] -
-      barOrigin[1];
-    this->LastOrigin[0] = barOrigin[0];
-    this->LastOrigin[1] = barOrigin[1];
-    this->LastSize[0] = size[0];
-    this->LastSize[1] = size[1];
-    
-    // Update all the composing objects
-    this->TitleActor->SetProperty(this->GetProperty());
-    this->TitleMapper->SetInput(this->Title);
-    if (this->TitleTextProperty->GetMTime() > this->BuildTime)
-      {
-      // Shallow copy here so that the size of the title prop is not affected
-      // by the automatic adjustment of its text mapper's size (i.e. its
-      // mapper's text property is identical except for the font size
-      // which will be modified later). This allows text actors to
-      // share the same text property, and in that case specifically allows
-      // the title and label text prop to be the same.
-      this->TitleMapper->GetTextProperty()->ShallowCopy(this->TitleTextProperty);
-      this->TitleMapper->GetTextProperty()->SetJustificationToCentered();
-      }
-    
-    // find the best size for the title font
-    int titleSize[2];
-    this->SizeTitle(titleSize, size, viewport);
-    
-    // find the best size for the ticks
-    int labelSize[2];
-    this->AllocateAndSizeLabels(labelSize, size, viewport,range);
-    this->NumberOfLabelsBuilt = this->NumberOfLabels;
-    
-    // generate points
-    float x[3]; x[2] = 0.0;
-    float delta, val;
-    if ( this->Orientation == VTK_ORIENT_VERTICAL )
-      {
-      barWidth = size[0] - 4 - labelSize[0];
-      barHeight = (int)(0.86*size[1]);
-      delta=(float)barHeight/numColors;
-      for (i=0; i<numPts/2; i++)
-        {
-        x[0] = 0;
-        x[1] = i*delta;
-        pts->SetPoint(2*i,x);
-        x[0] = barWidth;
-        pts->SetPoint(2*i+1,x);
-        }
-      }
-    else
-      {
-      barWidth = size[0];
-      barHeight = (int)(0.4*size[1]);
-      delta=(float)barWidth/numColors;
-      for (i=0; i<numPts/2; i++)
-        {
-        x[0] = i*delta;
-        x[1] = barHeight;
-        pts->SetPoint(2*i,x);
-        x[1] = 0;
-        pts->SetPoint(2*i+1,x);
-        }
-      }
-
-    //polygons & cell colors
-    unsigned char *rgba, *rgb;
-    vtkIdType ptIds[4];
-    for (i=0; i<numColors; i++)
-      {
-      ptIds[0] = 2*i;
-      ptIds[1] = ptIds[0] + 1;
-      ptIds[2] = ptIds[1] + 2;
-      ptIds[3] = ptIds[0] + 2;
-      polys->InsertNextCell(4,ptIds);
-
-      if ( isLogTable ){ //SALOME specific
-        float rgbval = log10(range[0]) + 
-          i*(log10(range[1])-log10(range[0]))/(numColors -1);
-        rgba = lut->MapValue(rgbval);
-      }else{
-        rgba = lut->MapValue(range[0] + (range[1] - range[0])*
-                             ((float)i /(numColors-1.0)));
-      }
-
-      rgb = colors->GetPointer(3*i); //write into array directly
-      rgb[0] = rgba[0];
-      rgb[1] = rgba[1];
-      rgb[2] = rgba[2];
-    }
-
-    // Now position everything properly
-    //
-    if (this->Orientation == VTK_ORIENT_VERTICAL)
-      {
-      int sizeTextData[2];
-      
-      // center the title
-      this->TitleActor->SetPosition(size[0]/2, 0.9*size[1]);
-      
-      for (i=0; i < this->NumberOfLabels; i++)
-        {
-        val = (float)i/(this->NumberOfLabels-1) *barHeight;
-        this->TextMappers[i]->GetSize(viewport,sizeTextData);
-        this->TextMappers[i]->GetTextProperty()->SetJustificationToLeft();
-        this->TextActors[i]->SetPosition(barWidth+3,
-                                         val - sizeTextData[1]/2);
-        }
-      }
-    else
-      {
-      this->TitleActor->SetPosition(size[0]/2, 
-                                    barHeight + labelSize[1] + 0.1*size[1]);
-      for (i=0; i < this->NumberOfLabels; i++)
-        {
-        this->TextMappers[i]->GetTextProperty()->SetJustificationToCentered();
-        val = (float)i/(this->NumberOfLabels-1) * barWidth;
-        this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]);
-        }
-      }
-
-    this->BuildTime.Modified();
-    }
-
-  // Everything is built, just have to render
-  if (this->Title != NULL)
-    {
-    renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport);
-    }
-  this->ScalarBarActor->RenderOpaqueGeometry(viewport);
-  for (i=0; i<this->NumberOfLabels; i++)
-    {
-    renderedSomething += this->TextActors[i]->RenderOpaqueGeometry(viewport);
-    }
-
-  renderedSomething = (renderedSomething > 0)?(1):(0);
-
-  return renderedSomething;
-}
-
-void VISU_ScalarBarActor::PrintSelf(ostream& os, vtkIndent indent)
-{
-  this->Superclass::PrintSelf(os,indent);
-
-  if ( this->LookupTable )
-    {
-    os << indent << "Lookup Table:\n";
-    this->LookupTable->PrintSelf(os,indent.GetNextIndent());
-    }
-  else
-    {
-    os << indent << "Lookup Table: (none)\n";
-    }
-
-  if (this->TitleTextProperty)
-    {
-    os << indent << "Title Text Property:\n";
-    this->TitleTextProperty->PrintSelf(os,indent.GetNextIndent());
-    }
-  else
-    {
-    os << indent << "Title Text Property: (none)\n";
-    }
-
-  if (this->LabelTextProperty)
-    {
-    os << indent << "Label Text Property:\n";
-    this->LabelTextProperty->PrintSelf(os,indent.GetNextIndent());
-    }
-  else
-    {
-    os << indent << "Label Text Property: (none)\n";
-    }
-
-  os << indent << "Title: " << (this->Title ? this->Title : "(none)") << "\n";
-  os << indent << "Maximum Number Of Colors: " 
-     << this->MaximumNumberOfColors << "\n";
-  os << indent << "Number Of Labels: " << this->NumberOfLabels << "\n";
-  os << indent << "Number Of Labels Built: " << this->NumberOfLabelsBuilt << "\n";
-
-  os << indent << "Orientation: ";
-  if ( this->Orientation == VTK_ORIENT_HORIZONTAL )
-    {
-    os << "Horizontal\n";
-    }
-  else
-    {
-    os << "Vertical\n";
-    }
-
-  os << indent << "Label Format: " << this->LabelFormat << "\n";
-}
-
-void VISU_ScalarBarActor::ShallowCopy(vtkProp *prop)
-{
-  VISU_ScalarBarActor *a = VISU_ScalarBarActor::SafeDownCast(prop);
-  if ( a != NULL )
-    {
-    this->SetPosition2(a->GetPosition2());
-    this->SetLookupTable(a->GetLookupTable());
-    this->SetMaximumNumberOfColors(a->GetMaximumNumberOfColors());
-    this->SetOrientation(a->GetOrientation());
-    this->SetLabelTextProperty(a->GetLabelTextProperty());
-    this->SetTitleTextProperty(a->GetTitleTextProperty());
-    this->SetLabelFormat(a->GetLabelFormat());
-    this->SetTitle(a->GetTitle());
-    this->GetPositionCoordinate()->SetCoordinateSystem(
-      a->GetPositionCoordinate()->GetCoordinateSystem());    
-    this->GetPositionCoordinate()->SetValue(
-      a->GetPositionCoordinate()->GetValue());
-    this->GetPosition2Coordinate()->SetCoordinateSystem(
-      a->GetPosition2Coordinate()->GetCoordinateSystem());    
-    this->GetPosition2Coordinate()->SetValue(
-      a->GetPosition2Coordinate()->GetValue());
-    }
-
-  // Now do superclass
-  this->vtkActor2D::ShallowCopy(prop);
-}
-
-void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size,
-                                              vtkViewport *viewport,
-                                              float *range)
-{
-  labelSize[0] = labelSize[1] = 0;
-
-  this->TextMappers = new vtkTextMapper * [this->NumberOfLabels];
-  this->TextActors = new vtkActor2D * [this->NumberOfLabels];
-
-  char string[512];
-
-  float val;
-  int i;
-  
-  // TODO: this should be optimized, maybe by keeping a list of
-  // allocated mappers, in order to avoid creation/destruction of
-  // their underlying text properties (i.e. each time a mapper is
-  // created, text properties are created and shallow-assigned a font size
-  // which value might be "far" from the target font size).
-
-  VISU_LookupTable *lut = this->LookupTable; //SALOME specific
-  int isLogTable = lut->GetScale() == VTK_SCALE_LOG10;
-
-  for (i=0; i < this->NumberOfLabels; i++)
-    {
-    this->TextMappers[i] = vtkTextMapper::New();
-
-    if(isLogTable && 0 < i && i < this->NumberOfLabels - 1){ // SALOME specific
-      float lval = log10(range[0]) + (float)i/(this->NumberOfLabels-1) *
-        (log10(range[1])-log10(range[0]));
-      val = pow(10,lval);
-    }else{
-      val = range[0] + (float)i/(this->NumberOfLabels-1) * (range[1]-range[0]);
-    }
-    sprintf(string, this->LabelFormat, val);
-    this->TextMappers[i]->SetInput(string);
-
-    // Shallow copy here so that the size of the label prop is not affected
-    // by the automatic adjustment of its text mapper's size (i.e. its
-    // mapper's text property is identical except for the font size
-    // which will be modified later). This allows text actors to
-    // share the same text property, and in that case specifically allows
-    // the title and label text prop to be the same.
-    this->TextMappers[i]->GetTextProperty()->ShallowCopy(
-      this->LabelTextProperty);
-
-    this->TextActors[i] = vtkActor2D::New();
-    this->TextActors[i]->SetMapper(this->TextMappers[i]);
-    this->TextActors[i]->SetProperty(this->GetProperty());
-    this->TextActors[i]->GetPositionCoordinate()->
-      SetReferenceCoordinate(this->PositionCoordinate);
-    }
-
-  if (this->NumberOfLabels)
-    {
-    int targetWidth, targetHeight;
-
-    if ( this->Orientation == VTK_ORIENT_VERTICAL )
-      {
-      targetWidth = (int)(0.6*size[0]);
-      targetHeight = (int)(0.86*size[1]/this->NumberOfLabels);
-      }
-    else
-      {
-      targetWidth = (int)(size[0]*0.8/this->NumberOfLabels);
-      targetHeight = (int)(0.25*size[1]);
-      }
-
-    vtkTextMapper::SetMultipleConstrainedFontSize(viewport, 
-                                                  targetWidth, 
-                                                  targetHeight,
-                                                  this->TextMappers,
-                                                  this->NumberOfLabels,
-                                                  labelSize);
-    }
-}
-
-void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size, 
-                                  vtkViewport *viewport)
-{
-  titleSize[0] = titleSize[1] = 0;
-
-  if (this->Title == NULL || !strlen(this->Title))
-    {
-    return;
-    }
-
-  int targetWidth, targetHeight;
-  
-  targetWidth = size[0];
-  if ( this->Orientation == VTK_ORIENT_VERTICAL )
-    {
-    targetHeight = (int)(0.1*size[1]);
-    }
-  else
-    {
-    targetHeight = (int)(0.25*size[1]);
-    }
-
-  this->TitleMapper->SetConstrainedFontSize(
-    viewport, targetWidth, targetHeight);
-
-  this->TitleMapper->GetSize(viewport, titleSize);
-}
diff --git a/src/OBJECT/VISU_ScalarBarActor.hxx b/src/OBJECT/VISU_ScalarBarActor.hxx
deleted file mode 100644 (file)
index 6852b8c..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VISU_ScalarBarActor.hxx
-//  Author : Alexey PETROV
-//  Module : VISU
-
-#ifndef VISU_ScalarBarActor_HeaderFile
-#define VISU_ScalarBarActor_HeaderFile
-
-#include "VTKViewer_Common.h"
-#include "VISU_LookupTable.hxx"
-#include <vtkPolyDataMapper2D.h>
-
-#define VTK_ORIENT_HORIZONTAL 0
-#define VTK_ORIENT_VERTICAL 1
-
-class VISU_ScalarBarActor : public vtkActor2D
-{
-public:
-  vtkTypeRevisionMacro(VISU_ScalarBarActor,vtkActor2D);
-  void PrintSelf(ostream& os, vtkIndent indent);
-
-  // Description:
-  // Instantiate object with 64 maximum colors; 5 labels; %%-#6.3g label
-  // format, no title, and vertical orientation. The initial scalar bar
-  // size is (0.05 x 0.8) of the viewport size.
-  static VISU_ScalarBarActor *New();
-
-  // Description:
-  // Draw the scalar bar and annotation text to the screen.
-  int RenderOpaqueGeometry(vtkViewport* viewport);
-  int RenderTranslucentGeometry(vtkViewport*) { return 0; };
-  int RenderOverlay(vtkViewport* viewport);
-
-  // Description:
-  // Release any graphics resources that are being consumed by this actor.
-  // The parameter window could be used to determine which graphic
-  // resources to release.
-  virtual void ReleaseGraphicsResources(vtkWindow *);
-
-  // Description:
-  // Set/Get the vtkLookupTable to use. The lookup table specifies the number
-  // of colors to use in the table (if not overridden), as well as the scalar
-  // range.
-  virtual void SetLookupTable(VISU_LookupTable*);
-  vtkGetObjectMacro(LookupTable,VISU_LookupTable);
-
-  // Description:
-  // Set/Get the maximum number of scalar bar segments to show. This may
-  // differ from the number of colors in the lookup table, in which case
-  // the colors are samples from the lookup table.
-  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
-  vtkGetMacro(MaximumNumberOfColors, int);
-  
-  // Description:
-  // Set/Get the number of annotation labels to show.
-  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
-  vtkGetMacro(NumberOfLabels, int);
-  
-  // Description:
-  // Control the orientation of the scalar bar.
-  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
-  vtkGetMacro(Orientation, int);
-  void SetOrientationToHorizontal()
-       {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
-  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
-
-  // Description:
-  // Set/Get the title text property.
-  virtual void SetTitleTextProperty(vtkTextProperty *p);
-  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
-  
-  // Description:
-  // Set/Get the labels text property.
-  virtual void SetLabelTextProperty(vtkTextProperty *p);
-  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
-    
-  // Description:
-  // Set/Get the format with which to print the labels on the scalar
-  // bar.
-  vtkSetStringMacro(LabelFormat);
-  vtkGetStringMacro(LabelFormat);
-
-  // Description:
-  // Set/Get the title of the scalar bar actor,
-  vtkSetStringMacro(Title);
-  vtkGetStringMacro(Title);
-
-  // Description:
-  // Shallow copy of a scalar bar actor. Overloads the virtual vtkProp method.
-  void ShallowCopy(vtkProp *prop);
-
-protected:
-  VISU_ScalarBarActor();
-  ~VISU_ScalarBarActor();
-
-  VISU_LookupTable *LookupTable;
-  vtkTextProperty *TitleTextProperty;
-  vtkTextProperty *LabelTextProperty;
-
-  int   MaximumNumberOfColors;
-  int   NumberOfLabels;
-  int   NumberOfLabelsBuilt;
-  int   Orientation;
-  char  *Title;
-  char  *LabelFormat;
-
-  vtkTextMapper **TextMappers;
-  virtual void AllocateAndSizeLabels(int *labelSize, int *size,
-                                     vtkViewport *viewport, float *range);
-
-private:
-  vtkTextMapper *TitleMapper;
-  vtkActor2D    *TitleActor;
-
-  vtkActor2D    **TextActors;
-
-  vtkPolyData         *ScalarBar;
-  vtkPolyDataMapper2D *ScalarBarMapper;
-  vtkActor2D          *ScalarBarActor;
-
-  vtkTimeStamp  BuildTime;
-  int LastSize[2];
-  int LastOrigin[2];
-
-  void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
-
-private:
-  VISU_ScalarBarActor(const VISU_ScalarBarActor&);  // Not implemented.
-  void operator=(const VISU_ScalarBarActor&);  // Not implemented.
-};
-
-#endif