]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug NPAL13178
authorapo <apo@opencascade.com>
Thu, 6 Dec 2007 10:39:19 +0000 (10:39 +0000)
committerapo <apo@opencascade.com>
Thu, 6 Dec 2007 10:39:19 +0000 (10:39 +0000)
   EDF243 VISU : post_processing for fields at nodes

12 files changed:
src/OBJECT/Makefile.am
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/OBJECT/VISU_ScalarMapAct.cxx
src/OBJECT/VISU_ScalarMapAct.h
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
src/PIPELINE/VISU_PipeLineUtils.cxx
src/VISU_I/VISU_GaussPoints_i.cc
src/VVTK/VVTK_SegmentationCursorDlg.cxx
src/VVTK/VVTK_SegmentationCursorDlg.h

index 47056df0afc626ac50fdc2f60abf6c2a34fb867f..555d1cd73fb775a1fa69faaecc5744788a92147d 100644 (file)
@@ -52,6 +52,7 @@ dist_libVisuObject_la_SOURCES = \
        VISU_VectorsAct.cxx
 
 libVisuObject_la_CPPFLAGS= \
+       $(QT_INCLUDES) \
        @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
        $(VTK_INCLUDES) \
        $(BOOST_CPPFLAGS) \
index 9fcd7c6c4052827ea654eaa678935624540cf767..3ee213001efd8c5852f5f22a9ce0503fd51caa32 100644 (file)
 #include <vtkProperty.h>
 #include <vtkTexture.h>
 #include <vtkPassThroughFilter.h>
+#include <vtkImageData.h>
+
+#include <qfileinfo.h>
 
 #include "utilities.h"
+#include "VISU_PipeLineUtils.hxx"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -51,21 +55,91 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
-using namespace std;
+
+//----------------------------------------------------------------
+namespace VISU
+{
+  inline
+  std::string
+  Image2VTI(const std::string& theImageFileName)
+  {
+    QFileInfo aFileInfo(theImageFileName.c_str());
+    QString aFormat = aFileInfo.extension(FALSE);
+#ifdef WIN32
+    QString aTmpDir = getenv( "TEMP" );
+#else
+    QString aTmpDir = QString( "/tmp/" ) + getenv("USER");
+#endif
+    QString aVTIName = aTmpDir + "-" + aFileInfo.baseName(TRUE) + ".vti";
+    QString aCommand = QString( "VISU_img2vti " ) + aFormat + " " +  theImageFileName + " " + aVTIName;
+
+    if(system( aCommand.latin1() ) == 0)
+      return aVTIName.latin1();
+
+    return "";
+  }
+
+  inline
+  void
+  RemoveFile(const std::string& theFileName)
+  {
+    if( theFileName != "" ){
+#ifndef WNT
+      QString aCommand = QString( "rm -fr " ) + theFileName.c_str();
+#else
+      QString aCommand = QString( "del /F " ) + theFileName.c_str();
+#endif
+      system( aCommand.latin1() );
+    }
+  }
+  
+  
+  TTextureValue
+  GetTexture(const std::string& theMainTexture, 
+            const std::string& theAlphaTexture)
+  {
+    typedef std::pair<std::string,std::string> TTextureKey;
+    typedef std::map<TTextureKey,TTextureValue> TTextureMap;
+    
+    static TTextureMap aTextureMap;
+    
+    TTextureValue aTextureValue;
+    TTextureKey aTextureKey( theMainTexture.c_str(), theAlphaTexture.c_str() );
+    TTextureMap::const_iterator anIter = aTextureMap.find( aTextureKey );
+    if ( anIter != aTextureMap.end() ) {
+      aTextureValue = anIter->second;
+    } else {
+      QString aMainTextureVTI = Image2VTI(theMainTexture);
+      QString anAlphaTextureVTI = Image2VTI(theAlphaTexture);
+      
+      if( !aMainTextureVTI.isNull() && !anAlphaTextureVTI.isNull() ){
+       aTextureValue =
+         VISU_GaussPointsPL::MakeTexture( aMainTextureVTI.latin1(), 
+                                          anAlphaTextureVTI.latin1());
+
+       if( aTextureValue.GetPointer() )
+         aTextureMap[aTextureKey] = aTextureValue;
+      }
+
+      RemoveFile(aMainTextureVTI);
+      RemoveFile(anAlphaTextureVTI);
+    }
+
+    return aTextureValue;
+  }
+}
 
 
 //----------------------------------------------------------------
-vtkStandardNewMacro(VISU_GaussPtsDeviceActor);
+vtkStandardNewMacro(VISU_GaussDeviceActorBase);
 
 
-VISU_GaussPtsDeviceActor
-::VISU_GaussPtsDeviceActor():
-  myGeomFilter(VTKViewer_GeometryFilter::New()),
+VISU_GaussDeviceActorBase
+::VISU_GaussDeviceActorBase():
   myTransformFilter(VTKViewer_TransformFilter::New())
 {
-  if(MYDEBUG) MESSAGE("VISU_GaussPtsDeviceActor - "<<this);
+  if(MYDEBUG) MESSAGE("VISU_GaussDeviceActorBase - "<<this);
 
-  myGeomFilter->Delete();
   myTransformFilter->Delete();
 
   for(int i = 0; i < 3; i++){
@@ -76,16 +150,16 @@ VISU_GaussPtsDeviceActor
 }
 
 
-VISU_GaussPtsDeviceActor
-::~VISU_GaussPtsDeviceActor()
+VISU_GaussDeviceActorBase
+::~VISU_GaussDeviceActorBase()
 {
-  if(MYDEBUG) MESSAGE("~VISU_GaussPtsDeviceActor - "<<this);
+  if(MYDEBUG) MESSAGE("~VISU_GaussDeviceActorBase - "<<this);
 }
 
 
 //----------------------------------------------------------------
 void
-VISU_GaussPtsDeviceActor
+VISU_GaussDeviceActorBase
 ::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
 {
   if (this->Mapper == NULL)
@@ -125,28 +199,45 @@ VISU_GaussPtsDeviceActor
 
 //----------------------------------------------------------------
 void
-VISU_GaussPtsDeviceActor
-::AddToRender(vtkRenderer* theRenderer)
+VISU_GaussDeviceActorBase
+::SetTransform(VTKViewer_Transform* theTransform)
 {
-  theRenderer->AddActor(this);
+  myTransformFilter->SetTransform(theTransform);
 }
 
-void 
-VISU_GaussPtsDeviceActor
-::RemoveFromRender(vtkRenderer* theRenderer)
+//----------------------------------------------------------------
+void
+VISU_GaussDeviceActorBase
+::SetPointSpriteMapper(VISU_OpenGLPointSpriteMapper* theMapper) 
 {
-  theRenderer->RemoveActor(this);
+  vtkPolyData* aDataSet = theMapper->GetInput();
+  myMapper = theMapper;
+
+  int anId = 0;
+  myPassFilter[ anId ]->SetInput( aDataSet ); 
+  myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+  
+  anId++;
+  myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+  
+  anId++;
+  myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+  
+  myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+  
+  Superclass::SetMapper( theMapper );
 }
 
 void
-VISU_GaussPtsDeviceActor
-::SetTransform(VTKViewer_Transform* theTransform)
+VISU_GaussDeviceActorBase
+::DoMapperShallowCopy( vtkMapper* theMapper,
+                      bool theIsCopyInput )
 {
-  myTransformFilter->SetTransform(theTransform);
+  VISU::CopyMapper( GetMapper(), theMapper, theIsCopyInput );
 }
 
 VISU_OpenGLPointSpriteMapper*
-VISU_GaussPtsDeviceActor
+VISU_GaussDeviceActorBase
 ::GetPointSpriteMapper()
 {
   return myMapper.GetPointer();
@@ -154,32 +245,42 @@ VISU_GaussPtsDeviceActor
 
 //----------------------------------------------------------------------------
 unsigned long int
-VISU_GaussPtsDeviceActor
+VISU_GaussDeviceActorBase
 ::GetMemorySize()
 {
   vtkDataSet* aDataSet = GetMapper()->GetInput();
-  unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+  return aDataSet->GetActualMemorySize() * 1024;
+}
 
-  aSize += GetPipeLine()->GetMemorySize();
 
-  return aSize;
-}
+
+//----------------------------------------------------------------
+vtkStandardNewMacro(VISU_GaussPtsDeviceActor);
+
+
+VISU_GaussPtsDeviceActor
+::VISU_GaussPtsDeviceActor()
+{}
+
+
+VISU_GaussPtsDeviceActor
+::~VISU_GaussPtsDeviceActor()
+{}
+
 
 //----------------------------------------------------------------------------
-int
+void
 VISU_GaussPtsDeviceActor
-::GetPickable()
+::AddToRender(vtkRenderer* theRenderer)
 {
-  if(Superclass::GetPickable()){
-    if(vtkMapper* aMapper = GetMapper()){
-      if(vtkDataSet* aDataSet= aMapper->GetInput()){
-       aDataSet->Update();
-       return aDataSet->GetNumberOfCells() > 0;
-      }
-    }
-  }
+  theRenderer->AddActor(this);
+}
 
-  return false;
+void 
+VISU_GaussPtsDeviceActor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  theRenderer->RemoveActor(this);
 }
 
 
@@ -188,23 +289,9 @@ void
 VISU_GaussPtsDeviceActor
 ::SetPipeLine(VISU_GaussPointsPL* thePipeLine) 
 {
-  myPipeLine = thePipeLine;
-  myMapper = thePipeLine->GetPointSpriteMapper();
-  vtkPolyData* aDataSet = myMapper->GetInput();
+  SetPointSpriteMapper( thePipeLine->GetPointSpriteMapper() );
 
-  int anId = 0;
-  myPassFilter[ anId ]->SetInput( aDataSet ); 
-  myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
-  
-  anId++;
-  myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
-  
-  anId++;
-  myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
-  
-  myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
-  
-  Superclass::SetMapper( myMapper.GetPointer() );
+  myPipeLine = thePipeLine;
 }
 
 VISU_GaussPointsPL* 
@@ -222,6 +309,38 @@ VISU_GaussPtsDeviceActor
 }
 
 
+//----------------------------------------------------------------------------
+int
+VISU_GaussPtsDeviceActor
+::GetPickable()
+{
+  if(Superclass::GetPickable()){
+    if(vtkMapper* aMapper = GetMapper()){
+      if(vtkDataSet* aDataSet= aMapper->GetInput()){
+       aDataSet->Update();
+       return aDataSet->GetNumberOfCells() > 0;
+      }
+    }
+  }
+
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsDeviceActor
+::GetMemorySize()
+{
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  aSize += GetPipeLine()->GetMemorySize();
+
+  return aSize;
+}
+
+
+
 //============================================================================
 #include <vtkActor.h>
 #include <vtkProperty.h>
index 253822f61f0ac13e311d9b5bba545aacdd00a730..7ff5c369ea9e729b6e941d242b519ef9436161d4 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef VISU_GAUSS_PTS_DEVICE_ACTOR_H
 #define VISU_GAUSS_PTS_DEVICE_ACTOR_H
 
+#include "VISU_Actor.h"
 #include "VTKViewer_GeometryFilter.h"
 
 #include <vtkLODActor.h>
@@ -41,15 +42,29 @@ class VISU_OpenGLPointSpriteMapper;
 class VISU_GaussPointsPL;
 
 class vtkPassThroughFilter;
+class vtkImageData;
+
 
 //============================================================================
-class VISU_GaussPtsDeviceActor: public vtkLODActor
+namespace VISU
 {
- public:
-  vtkTypeMacro(VISU_GaussPtsDeviceActor,vtkLODActor);
+  typedef vtkSmartPointer<vtkImageData> TTextureValue;
+
+  VTKOCC_EXPORT
+  TTextureValue
+  GetTexture(const std::string& theMainTexture, 
+            const std::string& theAlphaTexture);
+}
 
+
+//============================================================================
+class VISU_GaussDeviceActorBase: public vtkLODActor
+{
+ public:
+  vtkTypeMacro(VISU_GaussDeviceActorBase, vtkLODActor);
+  
   static 
-  VISU_GaussPtsDeviceActor
+  VISU_GaussDeviceActorBase
   New();
 
   virtual
@@ -58,13 +73,59 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor
 
   //----------------------------------------------------------------------------
   void
-  AddToRender(vtkRenderer* theRenderer); 
+  SetTransform(VTKViewer_Transform* theTransform); 
 
+  //----------------------------------------------------------------------------
   void
-  RemoveFromRender(vtkRenderer* theRenderer);
+  SetPointSpriteMapper(VISU_OpenGLPointSpriteMapper* theMapper) ;
 
+  virtual
   void
-  SetTransform(VTKViewer_Transform* theTransform); 
+  DoMapperShallowCopy( vtkMapper* theMapper,
+                      bool theIsCopyInput );
+
+  VISU_OpenGLPointSpriteMapper*
+  GetPointSpriteMapper();
+
+  //----------------------------------------------------------------------------
+  //! Gets memory size used by the instance (bytes).
+  virtual
+  unsigned long int
+  GetMemorySize();
+ protected:
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
+  vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
+
+  typedef vtkSmartPointer<vtkPassThroughFilter> PPassThroughFilter;
+  std::vector<PPassThroughFilter> myPassFilter;
+
+  VISU_GaussDeviceActorBase();
+  ~VISU_GaussDeviceActorBase();
+
+ private:
+  VISU_GaussDeviceActorBase(const VISU_GaussDeviceActorBase&); // Not implemented
+  void operator=(const VISU_GaussDeviceActorBase&); // Not implemented
+};
+
+
+//============================================================================
+class VISU_GaussPtsDeviceActor: public VISU_GaussDeviceActorBase
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsDeviceActor, VISU_GaussDeviceActorBase);
+
+  static 
+  VISU_GaussPtsDeviceActor* 
+  New();
+
+  //----------------------------------------------------------------------------
+  void
+  AddToRender(vtkRenderer* theRenderer); 
+
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
 
   //----------------------------------------------------------------------------
   VISU_GaussPointsPL* 
@@ -76,27 +137,19 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor
   void
   ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
 
-  VISU_OpenGLPointSpriteMapper*
-  GetPointSpriteMapper();
+  virtual
+  int
+  GetPickable();
 
+  //----------------------------------------------------------------------------
   //! Gets memory size used by the instance (bytes).
   virtual
   unsigned long int
   GetMemorySize();
  
-  virtual
-  int
-  GetPickable();
-
  protected:
   //----------------------------------------------------------------------------
   vtkSmartPointer<VISU_GaussPointsPL> myPipeLine;
-  vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
-  vtkSmartPointer<VTKViewer_GeometryFilter> myGeomFilter;
-  vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
-
-  typedef vtkSmartPointer<vtkPassThroughFilter> PPassThroughFilter;
-  std::vector<PPassThroughFilter> myPassFilter;
 
   VISU_GaussPtsDeviceActor();
   ~VISU_GaussPtsDeviceActor();
index bb904374101b7ac6388089336d674df7341eebed..2db6f4163a106e3eb16d3d77e39a5ccf02ec8053 100644 (file)
 #include "VISU_ScalarBarActor.hxx"
 #include "VISU_PipeLine.hxx"
 
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "VISU_GaussPtsDeviceActor.h"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
 #include <vtkProperty.h>
 #include <vtkMapper.h>
 #include <vtkDataSetMapper.h>
 
+#include <vtkRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkRenderWindow.h>
+#include <vtkImageData.h>
+
+
+//============================================================================
+class VISU_PointsDeviceActor: public VISU_GaussDeviceActorBase
+{
+ public:
+  vtkTypeMacro(VISU_PointsDeviceActor, VISU_GaussDeviceActorBase);
+
+  static 
+  VISU_PointsDeviceActor* 
+  New();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetInput(vtkDataSet* theDataSet)
+  {
+    myGeomFilter->SetInput( theDataSet );
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  SetInteractor(vtkRenderWindowInteractor* theInteractor)
+  {
+    if(theInteractor == myInteractor)
+      return;
+
+    if(myInteractor)
+      myInteractor->RemoveObserver(myEventCallbackCommand);
+    
+    if(theInteractor)
+      theInteractor->AddObserver(vtkCommand::CharEvent, 
+                                myEventCallbackCommand, 
+                                0.0);
+
+    myInteractor = theInteractor;
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  DoMapperShallowCopy( vtkMapper* theMapper,
+                      bool theIsCopyInput )
+  {
+    Superclass::DoMapperShallowCopy( theMapper, theIsCopyInput );
+
+    vtkDataSet* aDataSet = theMapper->GetInput();
+    vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
+
+    GetPointSpriteMapper()->SetAverageCellSize( aScaleFactor );
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  DeepCopy( VISU_PointsDeviceActor *theActor )
+  {
+    VISU::CopyPointSpriteDataMapper( GetPointSpriteMapper(), theActor->GetPointSpriteMapper(), false );
+  }
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_PointsDeviceActor():
+    myGeomFilter( VTKViewer_GeometryFilter::New() ),
+    myEventCallbackCommand( vtkCallbackCommand::New() ),
+    myInteractor( NULL )
+  {
+    myGeomFilter->SetInside(true);
+
+    VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New();
+    aMapper->SetInput( myGeomFilter->GetOutput() );
+
+    std::string aRootDir( getenv( "VISU_ROOT_DIR") );
+    std::string aMainTexture = aRootDir + "/share/salome/resources/visu/sprite_texture.bmp";
+    std::string anAlphaTexture = aRootDir + "/share/salome/resources/visu/sprite_alpha.bmp";
+    VISU::TTextureValue aTextureValue = VISU::GetTexture( aMainTexture, anAlphaTexture );
+    aMapper->SetImageData( aTextureValue.GetPointer() );
+
+    aMapper->SetUseLookupTableScalarRange(true);
+    aMapper->SetColorModeToMapScalars();
+    aMapper->SetScalarVisibility(true);
+
+    SetPointSpriteMapper( aMapper );
+
+    aMapper->Delete();
+
+    myEventCallbackCommand->SetClientData( this );
+    myEventCallbackCommand->SetCallback( VISU_PointsDeviceActor::ProcessEvents );
+  }
+
+
+  //----------------------------------------------------------------------------
+  ~VISU_PointsDeviceActor()
+  {
+    myGeomFilter->Delete();
+    myEventCallbackCommand->Delete();
+  }
+
+
+  //----------------------------------------------------------------------------
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData)
+  {
+    if ( vtkObject* anObject = reinterpret_cast<vtkObject*>( theClientData ) )
+      if ( VISU_PointsDeviceActor* self = dynamic_cast<VISU_PointsDeviceActor*>( anObject ) )
+       self->OnInteractorEvent( theEvent );
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  OnInteractorEvent(unsigned long theEvent)
+  {
+    switch ( theEvent ) {
+    case vtkCommand::CharEvent: {
+      switch( myInteractor->GetKeyCode() ) {
+      case 'M' :
+      case 'm' : {
+       static vtkFloatingPointType anIncrement = 2;
+       vtkFloatingPointType aMagnification = GetPointSpriteMapper()->GetPointSpriteMagnification();
+       vtkFloatingPointType coefficient = myInteractor->GetShiftKey() ? anIncrement : 1 / anIncrement;
+
+       GetPointSpriteMapper()->SetPointSpriteMagnification( aMagnification * coefficient );
+
+       myInteractor->CreateTimer(VTKI_TIMER_UPDATE);
+       break;
+      }
+      default:
+       return;
+      }
+      break;
+    }
+    default:
+      return;
+    }
+  }
+
+
+  //----------------------------------------------------------------------------
+  vtkCallbackCommand* myEventCallbackCommand;
+  vtkRenderWindowInteractor* myInteractor;
+  VTKViewer_GeometryFilter* myGeomFilter;
+
+ private:
+  VISU_PointsDeviceActor(const VISU_PointsDeviceActor&); // Not implemented
+  void operator=(const VISU_PointsDeviceActor&); // Not implemented
+};
+
+vtkStandardNewMacro(VISU_PointsDeviceActor);
+
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_ScalarMapAct);
 static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
@@ -71,6 +236,9 @@ VISU_ScalarMapAct
   myEdgeActor->SetUserMatrix(m);
   myEdgeActor->GetProperty()->SetColor(255.,255.,255.);
 
+  myPointsActor = VISU_PointsDeviceActor::New();
+  myPointsActor->SetUserMatrix(m);
+
   m->Delete();
 }
 
@@ -79,6 +247,9 @@ VISU_ScalarMapAct
 ::~VISU_ScalarMapAct()
 {
   myScalarBar->Delete();
+
+  myPointsActor->Delete();
+
   mySurfaceActor->Delete();
   myEdgeActor->Delete();
 }
@@ -87,14 +258,11 @@ void
 VISU_ScalarMapAct
 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
 {
-  VISU_Actor::ShallowCopyPL(thePipeLine);
+  VISU_Actor::ShallowCopyPL( thePipeLine );
 
-  myEdgeActor->GetMapper()->ScalarVisibilityOff();
+  myPointsActor->DoMapperShallowCopy( thePipeLine->GetMapper(), false );
 
-  vtkDataSet* aDatsSet = mySurfaceActor->GetDataSetMapper()->GetInput();
-  mySurfaceActor->GetMapper()->ShallowCopy(thePipeLine->GetMapper());
-  // To restore mapper input from pipeline
-  mySurfaceActor->GetDataSetMapper()->SetInput(aDatsSet);
+  VISU::CopyMapper( mySurfaceActor->GetMapper(), thePipeLine->GetMapper(), false );
 }
 
 //----------------------------------------------------------------------------
@@ -102,10 +270,12 @@ void
 VISU_ScalarMapAct
 ::SetMapperInput(vtkDataSet* theDataSet)
 {
-  Superclass::SetMapperInput(theDataSet);
+  Superclass::SetMapperInput( theDataSet );
 
-  mySurfaceActor->SetInput(theDataSet);
-  myEdgeActor->SetInput(theDataSet);
+  myPointsActor->SetInput( theDataSet );
+
+  mySurfaceActor->SetInput( theDataSet );
+  myEdgeActor->SetInput( theDataSet );
 }
 
 //----------------------------------------------------------------------------
@@ -115,6 +285,8 @@ VISU_ScalarMapAct
 {
   Superclass::SetTransform(theTransform);
 
+  myPointsActor->SetTransform(theTransform);
+
   mySurfaceActor->SetTransform(theTransform);
   myEdgeActor->SetTransform(theTransform);
 }
@@ -197,6 +369,7 @@ VISU_ScalarMapAct
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     Superclass::DeepCopy(theActor);
     SetBarVisibility(anActor->GetBarVisibility());
+    myPointsActor->DeepCopy( anActor->myPointsActor );
     SetShading(anActor->IsShading());
   }
 }
@@ -209,6 +382,8 @@ VISU_ScalarMapAct
 {
   Superclass::AddToRender(theRenderer);
 
+  myPointsActor->SetInteractor( myInteractor );
+
   if(myScalarBar)
     theRenderer->AddActor2D(myScalarBar);
 }
@@ -221,6 +396,12 @@ VISU_ScalarMapAct
   if(myScalarBar)
     theRenderer->RemoveActor(myScalarBar);
 
+  if ( vtkWindow* aWindow = theRenderer->GetRenderWindow() ) {
+    myPointsActor->ReleaseGraphicsResources( aWindow );
+    mySurfaceActor->ReleaseGraphicsResources( aWindow );
+    myEdgeActor->ReleaseGraphicsResources( aWindow );
+  }
+
   Superclass::RemoveFromRender(theRenderer);
 }
 
@@ -286,16 +467,13 @@ VISU_ScalarMapAct
 {
   vtkProperty* aProperty = mySurfaceActor->GetProperty();
 
-  if (theOn)
-    {
-      aProperty->SetAmbient(0.0); 
-      aProperty->SetDiffuse(1.0);
-    }
-  else
-    {
-      aProperty->SetAmbient(1.0); 
-      aProperty->SetDiffuse(0.0);
-      }
+  if (theOn) {
+    aProperty->SetAmbient(0.0); 
+    aProperty->SetDiffuse(1.0);
+  } else {
+    aProperty->SetAmbient(1.0); 
+    aProperty->SetDiffuse(0.0);
+  }
 }
 
 //----------------------------------------------------------------------------
@@ -314,19 +492,29 @@ VISU_ScalarMapAct
 {
   GetMatrix(myEdgeActor->GetUserMatrix());
   GetMatrix(mySurfaceActor->GetUserMatrix());
+  GetMatrix(myPointsActor->GetUserMatrix());
 
   using namespace SVTK::Representation;
-  if( GetRepresentation() == Surfaceframe ){ 
+  switch ( GetRepresentation() ) {
+
+  case Surfaceframe:
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     mySurfaceActor->RenderOpaqueGeometry(ren);
 
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
-  }
-  else{
+    break;
+
+  case Points:
+    myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    myPointsActor->RenderOpaqueGeometry(ren);
+    break;
+
+  default:
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderOpaqueGeometry(ren);
   }
+
   return 1;
 }
 
@@ -338,17 +526,26 @@ VISU_ScalarMapAct
   GetMatrix(mySurfaceActor->GetUserMatrix());
 
   using namespace SVTK::Representation;
-  if( GetRepresentation() == Surfaceframe ){
+  switch ( GetRepresentation() ) {
+
+  case Surfaceframe:
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderTranslucentGeometry(ren);
 
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderTranslucentGeometry(ren);
-  }
-  else{
+    break;
+
+  case Points:
+    myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
+    myPointsActor->RenderTranslucentGeometry(ren);
+    break;
+
+  default:
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderTranslucentGeometry(ren);
   }
+
   return 1;
 }
 
@@ -357,7 +554,11 @@ unsigned long int
 VISU_ScalarMapAct
 ::GetMemorySize()
 {
-  return Superclass::GetMemorySize();
+  unsigned long int aSize = Superclass::GetMemorySize();
+
+  aSize += myPointsActor->GetMemorySize();
+
+  return aSize;
 }
 
 //----------------------------------------------------------------------------
index 8f89876418b67080b8721934ac6453e461e71548..8589d05df5c3f9dc2349268526b409b874c8d594 100644 (file)
 #include "VISU_DataSetActor.h"
 
 class VISU_ScalarBarActor;
+class VISU_PointsDeviceActor;
 
+
+//----------------------------------------------------------------------------
 class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor 
 {
  public:
@@ -148,8 +151,12 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor
 
   bool myBarVisibility;
   VISU_ScalarBarActor* myScalarBar;
+
+  VISU_PointsDeviceActor* myPointsActor;
   SVTK_DeviceActor*    mySurfaceActor;
   SVTK_DeviceActor*    myEdgeActor;
 };
+//----------------------------------------------------------------------------
+
 
 #endif
index 6cfa78f4a65f8fc6d193bfe55ca52a29d03ef320..2e9f12c027a663dc3105830e7899141f15878dd8 100644 (file)
 #include "VISU_Plot3DPL.hxx"
 #include "VISU_ScalarBarActor.hxx"
 
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "VTKViewer_GeometryFilter.h"
+#include <vtkMaskPoints.h>
+
 #include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
-typedef VISU_ScalarMapPL TPresent;
+typedef VISU_GaussPointsPL TPresent;
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -89,11 +93,11 @@ CreateColoredPL<VISU_GaussPointsPL>(VISU_Convertor* theConvertor,
 
   char aMainTexture[80];
   strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
-  strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+  strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.bmp" );
   
   char anAlphaTexture[80];
   strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
-  strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+  strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.bmp" );
   
   vtkSmartPointer<vtkImageData> aTextureValue = 
     VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
@@ -230,24 +234,60 @@ main(int argc, char** argv)
          if(aValFieldIter == aValField.end()) return 0;
          int aTimeStamp = aValFieldIter->first;
 
+         vtkActor* anActor = vtkActor::New();
          VISU_ColoredPL* aPresent = NULL;
          if(anEntity != VISU::NODE_ENTITY){
-           continue;
            aPresent = CreateColoredPL<TPresent>(aConvertor,
                                                 aMeshName,
                                                 anEntity,
                                                 aFieldName,
                                                 aTimeStamp);
+
+           anActor->SetMapper(aPresent->GetMapper());
          }else{
+           continue;
            aPresent = CreateColoredPL<TPresent>(aConvertor,
                                                 aMeshName,
                                                 anEntity,
                                                 aFieldName,
                                                 aTimeStamp);
-         }
 
-         vtkActor* anActor = vtkActor::New();
-         anActor->SetMapper(aPresent->GetMapper());
+           VTKViewer_GeometryFilter* aGeometryFilter = VTKViewer_GeometryFilter::New();
+           aGeometryFilter->SetInput(aPresent->GetOutput());
+           aGeometryFilter->SetInside(true);
+
+           vtkMaskPoints* aMaskPoints = vtkMaskPoints::New();
+           aMaskPoints->SetInput(aGeometryFilter->GetOutput());
+           aMaskPoints->SetGenerateVertices(true);
+           aMaskPoints->SetOnRatio(1);
+
+           VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New();
+           aMapper->SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( aPresent->GetOutput() ) );
+  
+           char aMainTexture[80];
+           strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+           strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+           
+           char anAlphaTexture[80];
+           strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+           strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+           
+           vtkSmartPointer<vtkImageData> aTextureValue = 
+             VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+           aMapper->SetImageData( aTextureValue.GetPointer() );
+
+           //vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
+           aMapper->SetLookupTable(aPresent->GetMapperTable());
+           aMapper->SetUseLookupTableScalarRange(true);
+           aMapper->SetColorModeToMapScalars();
+           aMapper->SetScalarVisibility(true);
+
+           aMapper->SetInput(aMaskPoints->GetOutput());
+           aGeometryFilter->Delete();
+
+           anActor->SetMapper(aMapper);
+           aMapper->Delete();
+         }
 
          VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
          aScalarBar->SetLookupTable(aPresent->GetBarTable());
index e596e4365effee838413981e037cfa19e4d2cb47..85184e7841154019982c556e192e5a1b026094c0 100755 (executable)
@@ -744,6 +744,7 @@ void VISU_OpenGLPointSpriteMapper::InitTextures()
   glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
 }
 
+
 //-----------------------------------------------------------------------------
 int ComputeHue( int r, int g, int b )
 {
@@ -796,84 +797,168 @@ struct TVertex
   GLfloat vx, vy, vz;
 };
 
+
 //-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints,
-                                             vtkUnsignedCharArray *theColors,
-                                             vtkCellArray *theCells,
-                                             vtkActor* theActor)
+struct TColorFunctorBase
 {
-  //cout << "VISU_OpenGLPointSpriteMapper::DrawPoints" << endl;
+  virtual
+  void
+  get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0;
+};
 
-  //if( this->PrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint )
-  //  glEnable( GL_POINT_SMOOTH );
 
-  glPointSize( this->DefaultPointSize );
+//-----------------------------------------------------------------------------
+struct TPropertyColor : TColorFunctorBase
+{
+  vtkFloatingPointType myColor[3];
+  vtkFloatingPointType myHue;
 
-  TVertex* aVertexArr = new TVertex[ this->TotalCells ];
+  TPropertyColor( vtkProperty *theProperty )
+  {
+    theProperty->GetColor( myColor );
+    int aRed = int( myColor[0] * 255 );
+    int aGreen = int( myColor[1] * 255 );
+    int aBlue = int( myColor[2] * 255 );
 
-  vtkFloatingPointType* aPropertyColor = theActor->GetProperty()->GetColor();
-  float aColor[3] = {aPropertyColor[0], aPropertyColor[1], aPropertyColor[2]};
+    myHue = ComputeHue( aRed, aGreen, aBlue );
+  }
 
-  unsigned long i = 0;
-  vtkIdType *pts = 0;
-  vtkIdType npts = 0;
-  for( theCells->InitTraversal(); theCells->GetNextCell( npts, pts ); i++ )
+  virtual
+  void
+  get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
   {
-    TVertex& aVertex = aVertexArr[i];
-    vtkIdType aPointId = pts[0];
-    vtkFloatingPointType* aCoords = thePoints->GetPoint( aPointId );
-    aVertex.vx = aCoords[0];
-    aVertex.vy = aCoords[1];
-    aVertex.vz = aCoords[2];
-
-    int aRed = 0, aGreen = 0, aBlue = 0;
-    if( theColors && this->PointSpriteMode != 1 )
-    {
-      unsigned char *col = theColors->GetPointer(pts[0] << 2);
-      aRed = int(col[0]);
-      aGreen = int(col[1]);
-      aBlue = int(col[2]);
-
-      aColor[0] = aRed / 255.0;
-      aColor[1] = aGreen / 255.0;
-      aColor[2] = aBlue / 255.0;
-    }
+    theVertex.r = myColor[0];
+    theVertex.g = myColor[1];
+    theVertex.b = myColor[2];
 
-    aVertex.r = aColor[0];
-    aVertex.g = aColor[1];
-    aVertex.b = aColor[2];
-    aVertex.hue = ComputeHue( aRed, aGreen, aBlue );
+    theVertex.hue = myHue;
   }
+};
+
+
+//-----------------------------------------------------------------------------
+struct TColors2Color : TColorFunctorBase
+{
+  vtkUnsignedCharArray *myColors;
 
-  GLuint aBufferObjectID = 0;
-  vglGenBuffersARB( 1, &aBufferObjectID );
-  vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+  TColors2Color( vtkUnsignedCharArray *theColors ):
+    myColors( theColors )
+  {}
 
-  int nArrayObjectSize = sizeof( TVertex ) * this->TotalCells;
-  vglBufferDataARB( GL_ARRAY_BUFFER_ARB, nArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
+  virtual
+  void
+  get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
+  {
+    vtkIdType aTupleId = GetTupleId( thePointId, theCellId );
+    unsigned char *aColor = myColors->GetPointer( aTupleId << 2 );
 
-  delete [] aVertexArr;
+    theVertex.r = int( aColor[0] ) / 255.0;
+    theVertex.g = int( aColor[1] ) / 255.0;
+    theVertex.b = int( aColor[2] ) / 255.0;
 
-  vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
-  vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+    theVertex.hue = ComputeHue( aColor[0], aColor[1], aColor[2] );
+  }  
 
-  glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
-  glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
+  virtual
+  vtkIdType
+  GetTupleId( vtkIdType thePointId, vtkIdType theCellId ) = 0;
+};
 
-  glEnableClientState( GL_VERTEX_ARRAY );
-  glEnableClientState( GL_COLOR_ARRAY );
 
-  glDrawArrays( GL_POINTS, 0, this->TotalCells );
+//-----------------------------------------------------------------------------
+struct TPointColors2Color : TColors2Color
+{
+  TPointColors2Color( vtkUnsignedCharArray *theColors ):
+    TColors2Color( theColors )
+  {}
+
+  virtual
+  vtkIdType
+  GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+  {
+    return thePointId;
+  }
+};
 
-  glDisableClientState( GL_COLOR_ARRAY );
-  glDisableClientState( GL_VERTEX_ARRAY );
 
-  vglDeleteBuffersARB( 1, &aBufferObjectID );
+//-----------------------------------------------------------------------------
+struct TCellColors2Color : TColors2Color
+{
+  TCellColors2Color( vtkUnsignedCharArray *theColors ):
+    TColors2Color( theColors )
+  {}
 
-  //if( this->PrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint )
-  //  glDisable( GL_POINT_SMOOTH );
+  virtual
+  vtkIdType
+  GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+  {
+    return theCellId;
+  }
+};
+
+
+//-----------------------------------------------------------------------------
+template < class TCoordinates >
+void DrawPoints( TCoordinates *theStartPoints,
+                vtkCellArray *theCells,
+                TColorFunctorBase* theColorFunctor,
+                TVertex* theVertexArr,
+                vtkIdType &theCellId,
+                vtkIdType &theVertexId )
+{
+  vtkIdType *ptIds = theCells->GetPointer();
+  vtkIdType *endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();
+
+  while ( ptIds < endPtIds ) {
+    vtkIdType nPts = *ptIds;
+    ++ptIds;
+
+    while ( nPts > 0 ) {
+      TVertex& aVertex = theVertexArr[ theVertexId ];
+      vtkIdType aPointId = *ptIds;
+
+      TCoordinates *anOffsetPoints = theStartPoints + 3 * aPointId;
+      aVertex.vx = anOffsetPoints[0];
+      aVertex.vy = anOffsetPoints[1];
+      aVertex.vz = anOffsetPoints[2];
+
+      theColorFunctor->get( aVertex, aPointId, theCellId );
+
+      ++theVertexId;
+      ++ptIds; 
+      --nPts; 
+    }
+
+    ++theCellId;
+  }
 }
 
+
+//-----------------------------------------------------------------------------
+template < class TCoordinates >
+void DrawCellsPoints( vtkPolyData *theInput,
+                     vtkPoints* thePoints,
+                     TColorFunctorBase* theColorFunctor,
+                     TVertex* theVertexArr )
+{
+  vtkIdType aCellId = 0, aVertexId = 0;
+
+  TCoordinates *aStartPoints = (TCoordinates *) thePoints->GetVoidPointer(0);
+
+  if ( vtkCellArray* aCellArray = theInput->GetVerts() )
+    DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+  
+  if ( vtkCellArray* aCellArray = theInput->GetLines() )
+    DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+  
+  if ( vtkCellArray* aCellArray = theInput->GetPolys() )
+    DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
+  
+  if ( vtkCellArray* aCellArray = theInput->GetStrips() )
+    DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId ); 
+}
+
+
 //-----------------------------------------------------------------------------
 int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *theRenderer, vtkActor *theActor)
 {
@@ -914,10 +999,82 @@ int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *theRenderer, vtkActor *theAc
     }
   }
 
-  // we need to know the total number of cells so that we can report progress
-  this->TotalCells = input->GetVerts()->GetNumberOfCells();
+  {
+    vtkIdType aTotalConnectivitySize = 0;
+
+    if ( vtkCellArray* aCellArray = input->GetVerts() )
+      aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+    if ( vtkCellArray* aCellArray = input->GetLines() )
+      aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+    if ( vtkCellArray* aCellArray = input->GetPolys() )
+      aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+    if ( vtkCellArray* aCellArray = input->GetStrips() )
+      aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
+
+    if ( aTotalConnectivitySize > 0 ) {
+      TVertex* aVertexArr = new TVertex[ aTotalConnectivitySize ];
+
+      vtkFloatingPointType aPropertyColor[3];
+      theActor->GetProperty()->GetColor( aPropertyColor );
+
+      glPointSize( this->DefaultPointSize );
+
+      {
+       TColorFunctorBase* aColorFunctor = NULL;
+       if( colors && this->PointSpriteMode != 1 ) {
+         if ( cellScalars )
+           aColorFunctor = new TCellColors2Color( colors );
+         else
+           aColorFunctor = new TPointColors2Color( colors );
+       } else {
+         aColorFunctor = new TPropertyColor( theActor->GetProperty() );
+       }
+       if ( points->GetDataType() == VTK_FLOAT )
+         ::DrawCellsPoints< float >( input, points, aColorFunctor, aVertexArr );
+       else
+         ::DrawCellsPoints< double >( input, points, aColorFunctor, aVertexArr );
+
+       delete aColorFunctor;
+      }
+
+      GLuint aBufferObjectID = 0;
+      vglGenBuffersARB( 1, &aBufferObjectID );
+      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+      
+      int anArrayObjectSize = sizeof( TVertex ) * aTotalConnectivitySize;
+      vglBufferDataARB( GL_ARRAY_BUFFER_ARB, anArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
+      
+      delete [] aVertexArr;
+      
+      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+      
+      glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
+      glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
+      
+      glEnableClientState( GL_VERTEX_ARRAY );
+      glEnableClientState( GL_COLOR_ARRAY );
+      
+      glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
+      
+      glDisableClientState( GL_COLOR_ARRAY );
+      glDisableClientState( GL_VERTEX_ARRAY );
+      
+      vglDeleteBuffersARB( 1, &aBufferObjectID );
+    }
+
+    input->GetVerts()->GetNumberOfCells() + 
+    input->GetLines()->GetNumberOfCells() + 
+    input->GetPolys()->GetNumberOfCells() + 
+    input->GetStrips()->GetNumberOfCells();
+    
+
+
+  }
 
-  this->DrawPoints(points, colors, input->GetVerts(), theActor);
 
   this->UpdateProgress(1.0);
   return noAbort;
index f7b29ea9eb07016290c2941e975f11178a67fd7a..a36ff1c096d7cd3b5cc209b9aa9410a0c28ce762 100755 (executable)
@@ -217,12 +217,6 @@ protected:
   VISU_OpenGLPointSpriteMapper();
   ~VISU_OpenGLPointSpriteMapper();
 
-  //! Internal method of the Point Sprites drawing.
-  void              DrawPoints(vtkPoints *thePoints,
-                              vtkUnsignedCharArray *theColors,
-                              vtkCellArray *theCells,
-                              vtkActor* theActor);
-
   //! Initializing OpenGL extensions.
   bool              InitExtensions();
 
index 33a97adcd9b4b4f626075e1408de3b120a376ca5..6c31a35605a2e5859be61840e2a5f4b987b905cb 100644 (file)
@@ -84,6 +84,7 @@ namespace VISU
             bool theIsCopyInput)
   {
     // To customize vtkMapper::ShallowCopy ...
+    theTarget->SetLookupTable(theSource->GetLookupTable());
     theTarget->SetScalarVisibility(theSource->GetScalarVisibility());
     if(theIsCopyInput){
       vtkFloatingPointType* aScalarRange = theSource->GetScalarRange();
index fdbd8b681b6df7a78e3e699f0a71511cde1bbfd7..7d9a4152dc4acca3c98992f94f9980b88ab09176 100644 (file)
@@ -31,7 +31,7 @@
 #include "VISU_Result_i.hh"
 #include "VISU_GaussPtsAct.h"
 #include "VISU_GaussPointsPL.hxx"
-#include "VVTK_SegmentationCursorDlg.h"
+#include "VISU_GaussPtsDeviceActor.h"
 
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VISU_ScalarBarCtrl.hxx"
index 55b1fb7aac4f1caf73a8b3138263998ad94dfb23..5730854a3bf1c9ce3a5f8bd83304e05c34a4e2f3 100644 (file)
 #include "QtxDblSpinBox.h"
 #include "QtxIntSpinBox.h"
 
-using namespace std;
-
-
-//----------------------------------------------------------------
-namespace VISU
-{
-  inline
-  QString
-  Image2VTI(const QString& theImageFileName)
-  {
-    QFileInfo aFileInfo(theImageFileName);
-    QString aFormat = aFileInfo.extension(FALSE);
-#ifdef WIN32
-    QString aTmpDir = getenv( "TEMP" );
-#else
-    QString aTmpDir = QString( "/tmp/" ) + getenv("USER");
-#endif
-    QString aVTIName = aTmpDir + "-" + aFileInfo.baseName(TRUE) + ".vti";
-    QString aCommand = QString( "VISU_img2vti " ) + aFormat + " " +  theImageFileName + " " + aVTIName;
-
-    if(system( aCommand.latin1() ) == 0)
-      return aVTIName;
-
-    return QString::null;
-  }
-
-  inline
-  void
-  RemoveFile(const QString& theFileName)
-  {
-    if( !theFileName.isNull() ){
-#ifndef WNT
-      QString aCommand = QString( "rm -fr " ) + theFileName;
-#else:
-      QString aCommand = QString( "del /F " ) + theFileName;
-#endif
-      system( aCommand.latin1() );
-    }
-  }
-  
-  
-  TTextureValue
-  GetTexture(const QString& theMainTexture, 
-            const QString& theAlphaTexture)
-  {
-    typedef std::pair<std::string,std::string> TTextureKey;
-    typedef std::map<TTextureKey,TTextureValue> TTextureMap;
-    
-    static TTextureMap aTextureMap;
-    
-    TTextureValue aTextureValue;
-    TTextureKey aTextureKey(theMainTexture.latin1(),theAlphaTexture.latin1());
-    TTextureMap::const_iterator anIter = aTextureMap.find(aTextureKey);
-    if(anIter != aTextureMap.end()){
-      aTextureValue = anIter->second;
-    }else{
-      QString aMainTextureVTI = Image2VTI(theMainTexture);
-      QString anAlphaTextureVTI = Image2VTI(theAlphaTexture);
-      
-      if( !aMainTextureVTI.isNull() && !anAlphaTextureVTI.isNull() ){
-       aTextureValue =
-         VISU_GaussPointsPL::MakeTexture( aMainTextureVTI.latin1(), 
-                                          anAlphaTextureVTI.latin1());
-
-       if( aTextureValue.GetPointer() )
-         aTextureMap[aTextureKey] = aTextureValue;
-      }
-
-      RemoveFile(aMainTextureVTI);
-      RemoveFile(anAlphaTextureVTI);
-    }
-
-    return aTextureValue;
-  }
-}
-
-
 //----------------------------------------------------------------
 VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const char* name )
   :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
index 50d17609fdf306c1bf1a9d93e97ecf4514c2a850..e6990ffe1594f377f001d7bcd09b65ed6004702e 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "VVTK.h"
 
+#include "VISU_GaussPtsDeviceActor.h"
+
 #include <qdialog.h>
 
 #include <vtkObject.h>
@@ -57,14 +59,6 @@ class VVTK_SizeBox;
 
 class SVTK_RenderWindowInteractor;
 
-namespace VISU
-{
-  typedef vtkSmartPointer<vtkImageData> TTextureValue;
-
-  VVTK_EXPORT TTextureValue
-  GetTexture(const QString& theMainTexture, 
-            const QString& theAlphaTexture);
-}
 
 //! Segmentation Cursor Dialog.
 /*!