]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement different actor classes for main and segemented views
authorapo <apo@opencascade.com>
Wed, 28 Sep 2005 08:55:03 +0000 (08:55 +0000)
committerapo <apo@opencascade.com>
Wed, 28 Sep 2005 08:55:03 +0000 (08:55 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsActorFactory.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VVTK/VVTK_Renderer.cxx

index 36c8b75aa8c54ffa6e301cb70dcf061d9eb591c5..049819c446cae2d1665f2cd11df33246dcefea29 100644 (file)
@@ -39,7 +39,6 @@
 #include <vtkPointPicker.h>
 #include <vtkScalarBarWidget.h>
 
-#include <vtkTextActor.h>
 #include <vtkTextMapper.h>
 #include <vtkTextProperty.h>
 
 #include <vtkCell.h>
 #include <vtkMath.h>
 
-#include <vtkActor.h>
-#include <vtkConeSource.h>
-#include <vtkPolyDataMapper.h>
-
 #include <vtkViewport.h>
 
 #include "utilities.h"
@@ -82,253 +77,80 @@ static int MYDEBUG = 0;
 #endif
 
 
-//----------------------------------------------------------------
-class VISU_CursorPyramid : public vtkObject 
-{
-public:
-  vtkTypeMacro(VISU_CursorPyramid, vtkObject);
-
-  static
-  VISU_CursorPyramid* 
-  New();
-
-  void
-  AddToRender(vtkRenderer* theRenderer)
-  { 
-    for(int i = 0; i < myNbCones; ++i)
-      theRenderer->AddActor(myActors[i].GetPointer());
-  }
-
-  void
-  RemoveFromRender(vtkRenderer* theRenderer)
-  { 
-    for(int i = 0; i < myNbCones; ++i)
-      theRenderer->RemoveActor(myActors[i].GetPointer());
-  }
-
-  void
-  SetVisibility(int theVisibility)
-  {
-    for(int i = 0; i < myNbCones; ++i)
-      myActors[i]->SetVisibility(theVisibility);
-  }
+//============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct);
 
-  void
-  Init(float theHeight,
-       float theRadius,
-       float thePos[3],
-       float theColor[3])
-  {
-    for(int i = 0; i < myNbCones; ++i){
-      mySources[i]->SetHeight(theHeight);
-      // Set the angle of the cone. As a side effect, the angle plus height sets 
-      // the base radius of the cone.
-      mySources[i]->SetAngle(20.0);
-
-      myActors[i]->SetPosition(thePos[0],thePos[1],thePos[2]);
-      myActors[i]->GetProperty()->SetColor(theColor);
-    }
-    
-    float aD = -0.5*theHeight - theRadius;
-
-    // X
-    mySources[0]->SetCenter(aD, 0.,0.);
-    mySources[1]->SetCenter(aD, 0.,0.);
-
-    // Y
-    mySources[2]->SetDirection(0., 1., 0.);
-    mySources[2]->SetCenter(0, aD, 0.);
-
-    mySources[3]->SetDirection(0., 1., 0.); 
-    mySources[3]->SetCenter(0., aD, 0.);
-
-    // Z
-    mySources[4]->SetDirection(0., 0., 1.); 
-    mySources[4]->SetCenter(0, 0., aD);
-
-    mySources[5]->SetDirection(0., 0., 1.); 
-    mySources[5]->SetCenter(0., 0., aD);
-  }
-
-protected:
-  VISU_CursorPyramid():
-    myNbCones(6)
-  {
-    for(int i = 0; i < myNbCones; i++){
-      vtkConeSource* aConeSource = vtkConeSource::New();
-      aConeSource->SetResolution(4);
-
-      vtkPolyDataMapper* aPolyDataMapper = vtkPolyDataMapper::New();
-      aPolyDataMapper->SetInput(aConeSource->GetOutput());
-      aConeSource->Delete();
-
-      vtkActor* anActor = vtkActor::New();
-      anActor->SetMapper(aPolyDataMapper);
-      anActor->SetVisibility(0);
-      anActor->SetPickable(0);
-      aPolyDataMapper->Delete();
-
-      mySources[i] = aConeSource;
-      myMappers[i] = aPolyDataMapper;
-      myActors[i] = anActor; 
-      anActor->Delete();
-    }
-    
-    myActors[1]->SetOrientation(0.  ,180.,0.);
-    myActors[3]->SetOrientation(0.  , 0. ,180.);
-    myActors[5]->SetOrientation(180., 0. ,0.);
-  }
-
-  int myNbCones;
-  vtkSmartPointer<vtkConeSource> mySources[6];
-  vtkSmartPointer<vtkPolyDataMapper> myMappers[6];
-  vtkSmartPointer<vtkActor> myActors[6];
-};
-
-vtkStandardNewMacro(VISU_CursorPyramid);
-
-
-//----------------------------------------------------------------
-class VISU_GPTextActor : public vtkTextActor 
-{
-public:
-  vtkTypeMacro(VISU_GPTextActor, vtkTextActor);
-
-  static
-  VISU_GPTextActor* 
-  New();
-
-  void
-  Init(const float theWorldPoint[4],
-       const float theDistance = 10.0)
-  {
-    for(int i = 0; i < 4; i++)
-      myWorldPoint[i] = theWorldPoint[i];
-  }
-  
-  virtual
-  int
-  RenderOpaqueGeometry(vtkViewport *theViewport)
-  {
-    float aSelectionPoint[3];
-    theViewport->SetWorldPoint(myWorldPoint); 
-    theViewport->WorldToDisplay();
-    theViewport->GetDisplayPoint(aSelectionPoint);
-
-    aSelectionPoint[0] += myDistance;
-    aSelectionPoint[1] += myDistance;
-
-    SetPosition(aSelectionPoint);
-    Superclass::RenderOpaqueGeometry(theViewport);
-  }
-protected:
-  float myWorldPoint[4];
-  float myDistance;
-};
-
-vtkStandardNewMacro(VISU_GPTextActor);
-
-
-//----------------------------------------------------------------
-VISU_GaussPtsAct*
-VISU_GaussPtsAct
-::New(bool theIsSegmented)
-{
-  return new VISU_GaussPtsAct(theIsSegmented);
-}
-
-//----------------------------------------------------------------
+//----------------------------------------------------------------------------
 VISU_GaussPtsAct
-::VISU_GaussPtsAct(bool theIsSegmented):
+::VISU_GaussPtsAct():
   myEventCallbackCommand(vtkCallbackCommand::New()),
-  myIsSegmented(theIsSegmented),
+  myDeviceActor(VISU_GaussPtsDeviceActor::New()),
   myWidget(NULL),
   myGaussPointsPL(NULL),
+  myLastObjPointID(-1),
   myTextMapper(vtkTextMapper::New()),
   myTextActor(VISU_GPTextActor::New()),
-  myLastObjPointID(-1),
   mySphereSource(vtkSphereSource::New()),
   mySphereMapper(vtkPolyDataMapper::New()),
   mySphereActor(vtkActor::New()),
-  myCursorPyramid(VISU_CursorPyramid::New())
+  myCursorPyramid(VISU_CursorPyramid::New()),
+  mySphereSourceSelected(vtkSphereSource::New()),
+  mySphereActorSelected(vtkActor::New()),
+  myCellSource(vtkUnstructuredGrid::New()),
+  myCellActor(vtkActor::New())
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
 
   myEventCallbackCommand->Delete();
+  myDeviceActor->Delete();
+
+  myTextMapper->Delete();
+  myTextActor->Delete();
+
+  mySphereSource->Delete();
+  mySphereMapper->Delete();
+  mySphereActor->Delete();
+
+  myCursorPyramid->Delete();
+
+  mySphereSourceSelected->Delete();
+  mySphereActorSelected->Delete();
+
+  myCellSource->Delete();
+  myCellActor->Delete();
 
   myEventCallbackCommand->SetClientData(this); 
   myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
 
-  if(!theIsSegmented){
-    myDeviceActor = VISU_GaussPtsDeviceActor::New();
-    myDeviceActor->SetProperty(GetProperty());
-    myDeviceActor->SetVisibility(true);
-    myDeviceActor->SetPickable(false);
-    myDeviceActor->Delete();
-
-    myOutsideDeviceActor = VISU_GaussPtsDeviceActor::New();
-    myOutsideDeviceActor->SetProperty(GetProperty());
-    myOutsideDeviceActor->SetVisibility(false);
-    myOutsideDeviceActor->SetPickable(false);
-    myOutsideDeviceActor->Delete();
-  }
-  myInsideDeviceActor = VISU_GaussPtsDeviceActor::New();
-  myInsideDeviceActor->SetProperty(GetProperty());
-  myInsideDeviceActor->SetVisibility(theIsSegmented);
-  myInsideDeviceActor->SetPickable(false);
-  myInsideDeviceActor->Delete();
-
-  myTextMapper->Delete();
-  myTextActor->Delete();
+  myDeviceActor->SetProperty(GetProperty());
+  myDeviceActor->SetVisibility(true);
+  myDeviceActor->SetPickable(false);
 
   vtkTextProperty* aTextProperty = myTextMapper->GetTextProperty();
   aTextProperty->SetVerticalJustification(VTK_TEXT_BOTTOM);
   aTextProperty->SetJustification(VTK_TEXT_LEFT);
 
   myTextActor->SetMapper(myTextMapper.GetPointer());
-  //myTextActor->SetAlignmentPoint(3);
   myTextActor->SetVisibility(false);
   myTextActor->SetPickable(false);
 
-  mySphereSource->Delete();
-  mySphereMapper->Delete();
-  mySphereActor->Delete();
-
   mySphereMapper->SetInput(mySphereSource->GetOutput());
   mySphereActor->SetMapper(mySphereMapper.GetPointer());
   mySphereActor->SetVisibility(false);
   mySphereActor->SetPickable(false);
-  //
-  myCursorPyramid->Delete();
-  //
-  mySphereSourceSelected = vtkSphereSource::New();
-  mySphereSourceSelected->Delete();
 
-  mySphereMapperSelected = vtkPolyDataMapper::New();
-  mySphereMapperSelected->Delete();
-  mySphereMapperSelected->SetInput(mySphereSourceSelected->GetOutput());
+  vtkPolyDataMapper* aSphereMapperSelected = vtkPolyDataMapper::New();
+  aSphereMapperSelected->SetInput(mySphereSourceSelected->GetOutput());
 
-  mySphereActorSelected = vtkActor::New();
-  mySphereActorSelected->Delete();
-  mySphereActorSelected->SetMapper(mySphereMapperSelected.GetPointer());
+  mySphereActorSelected->SetMapper(aSphereMapperSelected);
+  mySphereActorSelected->GetProperty()->SetColor(1.0,1.0,1.0);
   mySphereActorSelected->SetVisibility(false);
   mySphereActorSelected->SetPickable(false);
-  float aColorSelected[3] = {1.,1.,1.};
-  mySphereActorSelected->GetProperty()->SetColor(aColorSelected);
-  // 
-  // Cell 
-  myCellSource = vtkUnstructuredGrid::New();
-  myCellSource->Delete();
+
   myCellSource->Allocate();
-  //
-  myCellMapper = vtkDataSetMapper::New();
-  myCellMapper->Delete();
-  myCellMapper->SetInput(myCellSource.GetPointer());
-  //
-  myCellActor = vtkActor::New();
-  myCellActor->Delete();
-  myCellActor->SetMapper(myCellMapper.GetPointer());
+  vtkDataSetMapper* aCellMapper = vtkDataSetMapper::New();
+  aCellMapper->SetInput(myCellSource.GetPointer());
+  myCellActor->SetMapper(aCellMapper);
   myCellActor->SetVisibility(0);
   myCellActor->SetPickable(0);
   myCellActor->GetProperty()->SetAmbient(1.0);
@@ -342,15 +164,22 @@ VISU_GaussPtsAct
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
 }
 
-//----------------------------------------------------------------
-VISU_OpenGLPointSpriteMapper*
+
+//----------------------------------------------------------------------------
+void
 VISU_GaussPtsAct
-::GetPSMapper()
+::SetPipeLine(VISU_PipeLine* thePipeLine) 
 {
-  if(!myIsSegmented)
-    return myDeviceActor->GetPSMapper();
-  else
-    return myInsideDeviceActor->GetPSMapper();
+  myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+
+  Superclass::SetPipeLine(thePipeLine);
+}
+
+VISU_GaussPointsPL*
+VISU_GaussPtsAct
+::GetGaussPointsPL()
+{
+  return myGaussPointsPL.GetPointer();
 }
 
 void
@@ -359,53 +188,42 @@ VISU_GaussPtsAct
 {
   Superclass::ShallowCopyPL(thePipeLine);
 
-  vtkPolyData* aDatsSet = GetPSMapper()->GetInput();
-  GetPSMapper()->ShallowCopy(thePipeLine->GetMapper());
+  VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+  myDeviceActor->ShallowCopyPL(aPipeLine);
+}
 
-  // To restore mapper input from pipeline
-  GetPSMapper()->SetInput(aDatsSet);
 
-  if(VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
-    if(!myIsSegmented){
-      myDeviceActor->ShallowCopyPL(aPipeLine);
-      myOutsideDeviceActor->ShallowCopyPL(aPipeLine);
-    }
-    myInsideDeviceActor->ShallowCopyPL(aPipeLine);
-
-    // Restore implicit function
-    if(myWidget){
-      vtkImplicitFunction* aFunction = myWidget->ImplicitFunction();
-      if(!myIsSegmented){
-       myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
-       myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
-       myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
-      }
-      myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
-    }
-  }
+//----------------------------------------------------------------------------
+VISU_OpenGLPointSpriteMapper*
+VISU_GaussPtsAct
+::GetPSMapper()
+{
+  return myDeviceActor->GetPSMapper();
 }
 
 vtkDataSet* 
 VISU_GaussPtsAct
 ::GetInput()
 {
-  vtkDataSet* aDataSet = GetMapper()->GetInput();
-  aDataSet->Update();
-  return aDataSet;
+  return GetMapper()->GetInput();
 }
 
-//----------------------------------------------------------------
+vtkMapper* 
+VISU_GaussPtsAct
+::GetMapper()
+{
+  return GetPSMapper();
+}
+
+
+//----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct
 ::AddToRender(vtkRenderer* theRenderer)
 {
   Superclass::AddToRender(theRenderer);
 
-  if(!myIsSegmented){
-    myDeviceActor->AddToRender(theRenderer);
-    myOutsideDeviceActor->AddToRender(theRenderer);
-  }
-  myInsideDeviceActor->AddToRender(theRenderer);
+  myDeviceActor->AddToRender(theRenderer);
 
   theRenderer->AddActor(myTextActor.GetPointer());
   theRenderer->AddActor(mySphereActor.GetPointer());
@@ -421,11 +239,7 @@ VISU_GaussPtsAct
 {
   Superclass::RemoveFromRender(theRenderer);
 
-  if(!myIsSegmented){
-    myDeviceActor->RemoveFromRender(theRenderer);
-    myOutsideDeviceActor->RemoveFromRender(theRenderer);
-  }
-  myInsideDeviceActor->RemoveFromRender(theRenderer);
+  myDeviceActor->RemoveFromRender(theRenderer);
   
   theRenderer->RemoveActor(mySphereActor.GetPointer());
   theRenderer->RemoveActor(myTextActor.GetPointer());
@@ -439,14 +253,9 @@ void
 VISU_GaussPtsAct
 ::SetTransform(VTKViewer_Transform* theTransform)
 {
-  if(!myIsSegmented){
-    myDeviceActor->SetTransform(theTransform);
-    myOutsideDeviceActor->SetTransform(theTransform);
-  }
-  myInsideDeviceActor->SetTransform(theTransform);
-  
   Superclass::SetTransform(theTransform);
-  Modified();
+
+  myDeviceActor->SetTransform(theTransform);
 }
 
 int
@@ -464,7 +273,7 @@ VISU_GaussPtsAct
 }
 
 
-//----------------------------------------------------------------
+//----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct
 ::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
@@ -476,18 +285,17 @@ VISU_GaussPtsAct
   theWidget->AddObserver(vtkCommand::DisableEvent, 
                         myEventCallbackCommand.GetPointer(), 
                         0.0);
-  if(!myIsSegmented)
-    myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
-  myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
-  
-  if(myWidget->IsEnabled())
-    OnInteractorEvent(vtkCommand::EnableEvent);
-  else
-    OnInteractorEvent(vtkCommand::DisableEvent);
+}
+
+bool
+VISU_GaussPtsAct
+::ChangeMagnification()
+{
+  return myChangeMagnification;
 }
 
 
-//----------------------------------------------------------------
+//----------------------------------------------------------------------------
 namespace
 {
   VISU_GaussPointsPL*
@@ -504,46 +312,8 @@ void
 VISU_GaussPtsAct
 ::SetMapperInput(vtkDataSet* theDataSet) 
 {
-  if(vtkPolyData* aPolyData = dynamic_cast<vtkPolyData*>(theDataSet)){
-    if(!myIsSegmented){
-      myDeviceActor->SetPipeLine(GetGaussPointsPL());
-      if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
-       myInsideDeviceActor->SetPipeLine(aPipeLine);
-       aPipeLine->Delete();
-      }
-      if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
-       myOutsideDeviceActor->SetPipeLine(aPipeLine);
-       myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
-       myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
-       aPipeLine->Delete();
-      }
-    }else
-      myInsideDeviceActor->SetPipeLine(GetGaussPointsPL());
-    vtkLODActor::SetMapper(GetMapper());
-  }
-}
-
-vtkMapper* 
-VISU_GaussPtsAct
-::GetMapper()
-{
-  return GetPSMapper();
-}
-
-void
-VISU_GaussPtsAct
-::SetPipeLine(VISU_PipeLine* thePipeLine) 
-{
-  myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
-
-  Superclass::SetPipeLine(thePipeLine);
-}
-
-VISU_GaussPointsPL*
-VISU_GaussPtsAct
-::GetGaussPointsPL()
-{
-  return myGaussPointsPL.GetPointer();
+  myDeviceActor->SetPipeLine(GetGaussPointsPL());
+  vtkLODActor::SetMapper(GetMapper());
 }
 
 void
@@ -551,13 +321,11 @@ VISU_GaussPtsAct
 ::SetFactory(VISU::TActorFactory* theActorFactory)
 { 
   using namespace VISU;
-  if(TGaussPtsActorFactory* aFactory = dynamic_cast<TGaussPtsActorFactory*>(theActorFactory)){
-    myUpdatePrs3dSignal.connect(boost::bind(&TGaussPtsActorFactory::UpdateFromActor,
-                                           aFactory,
-                                           _1));
-    VISU_Actor::SetFactory(theActorFactory);
-    myGaussPtsActorFactory = aFactory;
-  }
+  myGaussPtsActorFactory = dynamic_cast<TGaussPtsActorFactory*>(theActorFactory);
+  myUpdatePrs3dSignal.connect(boost::bind(&TGaussPtsActorFactory::UpdateFromActor,
+                                         myGaussPtsActorFactory,
+                                         _1));
+  Superclass::SetFactory(theActorFactory);
 }
 
 VISU::TGaussPtsActorFactory*
@@ -567,36 +335,13 @@ VISU_GaussPtsAct
   return myGaussPtsActorFactory;
 }
 
-void 
-VISU_GaussPtsAct
-::Connect(VISU_GaussPtsAct* theActor)
-{
-  mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct::SetVisibility,theActor,_1));
-}
-
 void
 VISU_GaussPtsAct
 ::SetVisibility(int theMode)
 {
   Superclass::SetVisibility(theMode);
-
-  if(!myIsSegmented){
-    myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
-    myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
-  }
-  myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
-  
-  mySetVisibilitySignal(GetVisibility());
-}
-
-bool
-VISU_GaussPtsAct
-::ChangeMagnification()
-{
-  return myChangeMagnification;
 }
 
-
 //----------------------------------------------------------------------------
 void
 VISU_GaussPtsAct
@@ -651,23 +396,13 @@ VISU_GaussPtsAct
     myUpdatePrs3dSignal(this);
     break;
   }
-  case vtkCommand::EnableEvent: 
-  case vtkCommand::DisableEvent:
-    if(!myIsSegmented){
-      myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
-      myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
-      myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
-      myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
-    }
-    myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
-    break;
   default:
     break;
   }
 }
 
 
-//----------------------------------------------------------------
+//----------------------------------------------------------------------------
 bool
 VISU_GaussPtsAct
 ::PreHighlight(SVTK_Selector* theSelector, 
@@ -713,7 +448,7 @@ VISU_GaussPtsAct
 
          // To calculate display (2D) position of the annotation
          float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0};
-         myTextActor->Init(aWorldCoord);
+         myTextActor->Init(aWorldCoord,10.0);
          // To prepare the annotation text
          std::ostringstream aStr;
          aStr<<"Global ID: "<<anObjId;
@@ -775,10 +510,7 @@ VISU_GaussPtsAct
 }
 
 
-//==================================================================
-// function : Highlight
-// purpose  :
-//==================================================================
+//----------------------------------------------------------------------------
 bool
 VISU_GaussPtsAct
 ::Highlight(SVTK_Selector* theSelector, 
@@ -847,7 +579,7 @@ VISU_GaussPtsAct
        //
        // To calculate display (2D) position of the annotation
        float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
-       myTextActor->Init(aWorldCoord);
+       myTextActor->Init(aWorldCoord,10);
        //
        // Selected
        mySphereSourceSelected->SetCenter(aNodeCoord);
@@ -1002,3 +734,242 @@ VISU_GaussPtsAct
   //mySphereActor->SetVisibility(aSphereVisibility);
   return bRet;
 }
+
+
+
+//==============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct1);
+
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct1
+::VISU_GaussPtsAct1():
+  myInsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
+  myOutsideDeviceActor(VISU_GaussPtsDeviceActor::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct1::VISU_GaussPtsAct1 - this = "<<this);
+  myInsideDeviceActor->SetProperty(GetProperty());
+  myInsideDeviceActor->SetVisibility(false);
+  myInsideDeviceActor->SetPickable(false);
+  myInsideDeviceActor->Delete();
+
+  myOutsideDeviceActor->SetProperty(GetProperty());
+  myOutsideDeviceActor->SetVisibility(false);
+  myOutsideDeviceActor->SetPickable(false);
+  myOutsideDeviceActor->Delete();
+}
+
+VISU_GaussPtsAct1
+::~VISU_GaussPtsAct1()
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct1::~VISU_GaussPtsAct1 - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  Superclass::ShallowCopyPL(thePipeLine);
+
+  VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+  myInsideDeviceActor->ShallowCopyPL(aPipeLine);
+  myOutsideDeviceActor->ShallowCopyPL(aPipeLine);
+  // Restore implicit function
+  if(myWidget){
+    vtkImplicitFunction* aFunction = myWidget->ImplicitFunction();
+    
+    myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
+    
+    myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
+    myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
+    myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::AddToRender(vtkRenderer* theRenderer)
+{
+  Superclass::AddToRender(theRenderer);
+
+  myInsideDeviceActor->AddToRender(theRenderer);
+  myOutsideDeviceActor->AddToRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct1
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  Superclass::RemoveFromRender(theRenderer);
+
+  myInsideDeviceActor->RemoveFromRender(theRenderer);
+  myOutsideDeviceActor->RemoveFromRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct1
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
+
+  myInsideDeviceActor->SetTransform(theTransform);
+  myOutsideDeviceActor->SetTransform(theTransform);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  Superclass::SetImplicitFunctionWidget(theWidget);
+
+  myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
+  myInsideDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+
+  myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());  
+  myOutsideDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  Superclass::SetMapperInput(theDataSet);
+
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myInsideDeviceActor->SetPipeLine(aPipeLine);
+  }
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myOutsideDeviceActor->SetPipeLine(aPipeLine);
+    myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
+    myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
+  }
+}
+
+void 
+VISU_GaussPtsAct1
+::Connect(VISU_GaussPtsAct2* theActor)
+{
+  mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
+}
+
+void
+VISU_GaussPtsAct1
+::SetVisibility(int theMode)
+{
+  Superclass::SetVisibility(theMode);
+
+  myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
+
+  myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+  myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+
+  mySetVisibilitySignal(GetVisibility());
+}
+
+
+void
+VISU_GaussPtsAct1
+::OnInteractorEvent(unsigned long theEvent)
+{
+  switch(theEvent){
+  case vtkCommand::EnableEvent: 
+  case vtkCommand::DisableEvent:
+    myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
+    myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+    myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+    break;
+  default:
+    break;
+  }
+  Superclass::OnInteractorEvent(theEvent);
+}
+
+
+//==============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct2);
+
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct2
+::VISU_GaussPtsAct2()
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct2::VISU_GaussPtsAct2 - this = "<<this);
+}
+
+VISU_GaussPtsAct2
+::~VISU_GaussPtsAct2()
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct2::~VISU_GaussPtsAct2 - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  Superclass::ShallowCopyPL(thePipeLine);
+  // Restore implicit function
+  if(myWidget){
+    vtkImplicitFunction* aFunction = myWidget->ImplicitFunction();
+    myDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  Superclass::SetMapperInput(theDataSet);
+
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myDeviceActor->SetPipeLine(aPipeLine);
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  Superclass::SetImplicitFunctionWidget(theWidget);
+
+  myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
+  myDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetVisibility(int theMode)
+{
+  Superclass::SetVisibility(theMode);
+
+  myDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+}
+
+void
+VISU_GaussPtsAct2
+::OnInteractorEvent(unsigned long theEvent)
+{
+  switch(theEvent){
+  case vtkCommand::EnableEvent: 
+  case vtkCommand::DisableEvent:
+    myDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+    break;
+  default:
+    break;
+  }
+  Superclass::OnInteractorEvent(theEvent);
+}
+
index e68c056f863286b5e4319769a37f81b2b1a8135f..657c8a349ac75a8f829d08391e13c2d78b10f99a 100644 (file)
@@ -61,26 +61,32 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
 {
  public:
   vtkTypeMacro(VISU_GaussPtsAct,VISU_ScalarMapAct);
+  typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
 
   static
   VISU_GaussPtsAct* 
-  New(bool theIsSegmented = false);
+  New();
 
   //----------------------------------------------------------------------------
   virtual
   void
   SetPipeLine(VISU_PipeLine* thePipeLine) ;
   
+  VISU_GaussPointsPL*
+  GetGaussPointsPL();
+
   virtual
   void
   ShallowCopyPL(VISU_PipeLine* thePipeLine);
 
-  VISU_GaussPointsPL*
-  GetGaussPointsPL();
-
+  //----------------------------------------------------------------------------
   VISU_OpenGLPointSpriteMapper*
   GetPSMapper();
 
+  virtual
+  vtkMapper* 
+  GetMapper();
+
   virtual
   vtkDataSet* 
   GetInput(); 
@@ -93,17 +99,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
   VISU::TGaussPtsActorFactory*
   GetGaussPtsFactory();    
 
-  virtual 
-  void
-  Connect(VISU_GaussPtsAct* theActor);
-
-  virtual
-  void
-  SetVisibility(int theMode);
-
-  bool
-  ChangeMagnification();
-
   //----------------------------------------------------------------------------
   virtual
   void
@@ -121,10 +116,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
   void
   SetTransform(VTKViewer_Transform* theTransform);
 
-  virtual
-  vtkMapper* 
-  GetMapper();
-
   virtual
   int
   RenderOpaqueGeometry(vtkViewport *viewport);
@@ -133,9 +124,18 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
   int
   RenderTranslucentGeometry(vtkViewport *viewport);
 
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  virtual
   void
   SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
 
+  bool
+  ChangeMagnification();
+
   //----------------------------------------------------------------------------
   virtual
   bool
@@ -152,7 +152,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
 
  protected:
   //----------------------------------------------------------------------------
-  VISU_GaussPtsAct(bool theIsSegmented = false);
+  VISU_GaussPtsAct();
 
   virtual 
   ~VISU_GaussPtsAct();
@@ -171,28 +171,24 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
                unsigned long theEvent,
                void* theClientData, 
                void* theCallData);
+  virtual
   void
   OnInteractorEvent(unsigned long theEvent);
 
+  bool myChangeMagnification;
   VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
   boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
-  boost::signal1<void,int> mySetVisibilitySignal;
-  bool myChangeMagnification;
 
   //----------------------------------------------------------------------------
-  typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
   PDeviceActor myDeviceActor;
 
   VISU_ImplicitFunctionWidget* myWidget;
-  PDeviceActor myOutsideDeviceActor;
-  PDeviceActor myInsideDeviceActor;
-  bool myIsSegmented;
 
   vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
 
+  vtkIdType myLastObjPointID;
   vtkSmartPointer<vtkTextMapper> myTextMapper;
   vtkSmartPointer<VISU_GPTextActor> myTextActor;
-  vtkIdType myLastObjPointID;
 
   vtkSmartPointer<vtkSphereSource> mySphereSource;
   vtkSmartPointer<vtkPolyDataMapper> mySphereMapper;
@@ -201,12 +197,120 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
 
   vtkSmartPointer<vtkSphereSource> mySphereSourceSelected;
-  vtkSmartPointer<vtkPolyDataMapper> mySphereMapperSelected;
   vtkSmartPointer<vtkActor> mySphereActorSelected;
 
   vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
-  vtkSmartPointer<vtkDataSetMapper> myCellMapper;
   vtkSmartPointer<vtkActor> myCellActor;
 };
 
+
+//============================================================================
+class VISU_GaussPtsAct2;
+
+class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
+
+  static
+  VISU_GaussPtsAct1* 
+  New();
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  virtual 
+  void
+  Connect(VISU_GaussPtsAct2* theActor);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddToRender(vtkRenderer* theRenderer); 
+
+  virtual
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform);
+
+  virtual
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_GaussPtsAct1();
+
+  virtual 
+  ~VISU_GaussPtsAct1();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  //----------------------------------------------------------------------------
+  // To process VTK event method
+  virtual 
+  void
+  OnInteractorEvent(unsigned long theEvent);
+
+  boost::signal1<void,int> mySetVisibilitySignal;
+
+  //----------------------------------------------------------------------------
+  PDeviceActor myInsideDeviceActor;
+  PDeviceActor myOutsideDeviceActor;
+};
+
+
+//============================================================================
+class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
+
+  static
+  VISU_GaussPtsAct2* 
+  New();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  virtual
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_GaussPtsAct2();
+
+  virtual 
+  ~VISU_GaussPtsAct2();
+
+  //----------------------------------------------------------------------------
+  // To process VTK event method
+  virtual 
+  void
+  OnInteractorEvent(unsigned long theEvent);
+};
+
+
 #endif
index 5d2731005ed645c6a1ecc7df27961e514ebd1b0e..9557c60af57186a5adf8313b4eb7ee3442fb965b 100644 (file)
@@ -31,8 +31,9 @@
 
 #include "VISU_ActorFactory.h"
 
-class vtkImplicitFunction;
 class VISU_GaussPtsAct;
+class VISU_GaussPtsAct1;
+class VISU_GaussPtsAct2;
 
 //----------------------------------------------------------------------------
 namespace VISU 
@@ -40,8 +41,8 @@ namespace VISU
   struct TGaussPtsActorFactory: virtual TActorFactory
   {
     virtual 
-    VISU_GaussPtsAct* 
-    CloneActor(VISU_GaussPtsAct* theActor) = 0;
+    VISU_GaussPtsAct2
+    CloneActor(VISU_GaussPtsAct1* theActor) = 0;
 
     virtual 
     void
index 938dcdfb79b6d1caf6732396deccd06e1ca5b495..2d66709a07f1fdd2e7e24e91ffea61afa05caa20 100644 (file)
@@ -159,3 +159,140 @@ VISU_GaussPtsDeviceActor
   // To restore mapper input from pipeline
   SetDataSet(myPipeLine->GetPSMapper()->GetInput());
 }
+
+
+//============================================================================
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkConeSource.h>
+#include <vtkPolyDataMapper.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_CursorPyramid);
+
+
+//----------------------------------------------------------------------------
+void
+VISU_CursorPyramid
+::AddToRender(vtkRenderer* theRenderer)
+{ 
+  for(int i = 0; i < myNbCones; ++i)
+    theRenderer->AddActor(myActors[i].GetPointer());
+}
+
+void
+VISU_CursorPyramid
+::RemoveFromRender(vtkRenderer* theRenderer)
+{ 
+  for(int i = 0; i < myNbCones; ++i)
+    theRenderer->RemoveActor(myActors[i].GetPointer());
+}
+
+void
+VISU_CursorPyramid
+::SetVisibility(int theVisibility)
+{
+  for(int i = 0; i < myNbCones; ++i)
+    myActors[i]->SetVisibility(theVisibility);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_CursorPyramid
+::Init(float theHeight,
+       float theRadius,
+       float thePos[3],
+       float theColor[3])
+{
+  for(int i = 0; i < myNbCones; ++i){
+    mySources[i]->SetHeight(theHeight);
+    // Set the angle of the cone. As a side effect, the angle plus height sets 
+    // the base radius of the cone.
+    mySources[i]->SetAngle(20.0);
+    
+    myActors[i]->SetPosition(thePos[0],thePos[1],thePos[2]);
+    myActors[i]->GetProperty()->SetColor(theColor);
+  }
+  
+  float aD = -0.5*theHeight - theRadius;
+  
+  // X
+  mySources[0]->SetCenter(aD, 0.,0.);
+  mySources[1]->SetCenter(aD, 0.,0.);
+  
+  // Y
+  mySources[2]->SetDirection(0., 1., 0.);
+  mySources[2]->SetCenter(0, aD, 0.);
+  
+  mySources[3]->SetDirection(0., 1., 0.); 
+  mySources[3]->SetCenter(0., aD, 0.);
+  
+  // Z
+  mySources[4]->SetDirection(0., 0., 1.); 
+  mySources[4]->SetCenter(0, 0., aD);
+  
+  mySources[5]->SetDirection(0., 0., 1.); 
+  mySources[5]->SetCenter(0., 0., aD);
+}
+
+//----------------------------------------------------------------------------
+VISU_CursorPyramid
+::VISU_CursorPyramid():
+  myNbCones(6)
+{
+  for(int i = 0; i < myNbCones; i++){
+    vtkConeSource* aConeSource = vtkConeSource::New();
+    aConeSource->SetResolution(4);
+    
+    vtkPolyDataMapper* aPolyDataMapper = vtkPolyDataMapper::New();
+    aPolyDataMapper->SetInput(aConeSource->GetOutput());
+    aConeSource->Delete();
+    
+    vtkActor* anActor = vtkActor::New();
+    anActor->SetMapper(aPolyDataMapper);
+    anActor->SetVisibility(0);
+    anActor->SetPickable(0);
+    aPolyDataMapper->Delete();
+    
+    mySources[i] = aConeSource;
+    myMappers[i] = aPolyDataMapper;
+    myActors[i] = anActor; 
+    anActor->Delete();
+  }
+  
+  myActors[1]->SetOrientation(0.  ,180.,0.);
+  myActors[3]->SetOrientation(0.  , 0. ,180.);
+  myActors[5]->SetOrientation(180., 0. ,0.);
+}
+
+
+//============================================================================
+vtkStandardNewMacro(VISU_GPTextActor);
+
+//----------------------------------------------------------------------------
+void
+VISU_GPTextActor
+::Init(const float theWorldPoint[4],
+       const float theDistance)
+{
+  for(int i = 0; i < 4; i++)
+    myWorldPoint[i] = theWorldPoint[i];
+}
+  
+int
+VISU_GPTextActor
+::RenderOpaqueGeometry(vtkViewport *theViewport)
+{
+  float aSelectionPoint[3];
+  theViewport->SetWorldPoint(myWorldPoint); 
+  theViewport->WorldToDisplay();
+  theViewport->GetDisplayPoint(aSelectionPoint);
+  
+  aSelectionPoint[0] += myDistance;
+  aSelectionPoint[1] += myDistance;
+  
+  SetPosition(aSelectionPoint);
+  Superclass::RenderOpaqueGeometry(theViewport);
+}
+
index c26b6fb81f18b709d1854369a7853be2fa0e2940..bfc657de3fb0c170778d119a3eb4026a6912c88f 100644 (file)
@@ -42,7 +42,7 @@ class VISU_OpenGLPointSpriteMapper;
 class VISU_GaussPointsPL;
 
 
-//----------------------------------------------------------------------------
+//============================================================================
 class VISU_GaussPtsDeviceActor: public vtkLODActor
 {
  public:
@@ -97,4 +97,72 @@ class VISU_GaussPtsDeviceActor: public vtkLODActor
 };
 
 
+//============================================================================
+class vtkActor;
+class vtkConeSource;
+class vtkPolyDataMapper;
+
+#include <vtkObject.h>
+
+class VISU_CursorPyramid : public vtkObject 
+{
+public:
+  vtkTypeMacro(VISU_CursorPyramid, vtkObject);
+
+  static
+  VISU_CursorPyramid* 
+  New();
+
+  void
+  AddToRender(vtkRenderer* theRenderer);
+
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  void
+  SetVisibility(int theVisibility);
+
+  void
+  Init(float theHeight,
+       float theRadius,
+       float thePos[3],
+       float theColor[3]);
+  
+
+protected:
+  VISU_CursorPyramid();
+
+  int myNbCones;
+  vtkSmartPointer<vtkConeSource> mySources[6];
+  vtkSmartPointer<vtkPolyDataMapper> myMappers[6];
+  vtkSmartPointer<vtkActor> myActors[6];
+};
+
+
+//============================================================================
+#include <vtkTextActor.h>
+
+class VISU_GPTextActor : public vtkTextActor 
+{
+public:
+  vtkTypeMacro(VISU_GPTextActor,vtkTextActor);
+
+  static
+  VISU_GPTextActor* 
+  New();
+
+  void
+  Init(const float theWorldPoint[4],
+       const float theDistance);
+
+  virtual
+  int
+  RenderOpaqueGeometry(vtkViewport *theViewport);
+protected:
+  float myWorldPoint[4];
+  float myDistance;
+};
+
+
 #endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H
index aad5a8bce0037dfaa41d173f93dd498c3ca3cc21..95b6f5f882012f8eb5c04a5ed40c49b5398128ae 100644 (file)
@@ -276,38 +276,58 @@ VISU::GaussPoints_i
 
 
 //----------------------------------------------------------------------------
-VISU_GaussPtsAct* 
+bool 
 VISU::GaussPoints_i
-::OnCreateActor(bool theIsSegmented,
+::OnCreateActor(VISU_GaussPtsAct* theActor,
                const Handle(SALOME_InteractiveObject)& theIO)
 {
-  VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(theIsSegmented);
   try{
-    VISU::Prs3d_i::CreateActor(anActor,theIO);
-    anActor->GetPipeLine()->Delete();
-    anActor->SetRepresentation(VTK_POINTS);
-    UpdateActor(anActor);
+    VISU::Prs3d_i::CreateActor(theActor,theIO);
+    theActor->GetPipeLine()->Delete();
+    theActor->SetRepresentation(VTK_POINTS);
+    UpdateActor(theActor);
+    return true;
   }catch(...){
-    anActor->Delete();
+    theActor->Delete();
     throw ;
   }
-  return anActor;
+  return false;
+}
+
+VISU_GaussPtsAct1* 
+VISU::GaussPoints_i
+::OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New();
+  if(OnCreateActor(anActor,theIO))
+    return anActor;
+  return NULL;
+}
+
+VISU_GaussPtsAct2* 
+VISU::GaussPoints_i
+::OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New();
+  if(OnCreateActor(anActor,theIO))
+    return anActor;
+  return NULL;
 }
 
 VISU_Actor* 
 VISU::GaussPoints_i
 ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
 {
-  return OnCreateActor(false,theIO);
+  return OnCreateActor1(theIO);
 }
 
 //----------------------------------------------------------------------------
-VISU_GaussPtsAct* 
+VISU_GaussPtsAct2
 VISU::GaussPoints_i
-::CloneActor(VISU_GaussPtsAct* theActor) 
+::CloneActor(VISU_GaussPtsAct1* theActor) 
 {
   if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<<this);
-  if(VISU_GaussPtsAct* anActor = OnCreateActor(true)){
+  if(VISU_GaussPtsAct2* anActor = OnCreateActor2()){
     theActor->Connect(anActor);
     return anActor;
   }
index b0daf2b536a417484a00d706a74b3e40cda8be88..a0b0a47e95876cf571f5721f6d7875308fc7fa3b 100644 (file)
@@ -105,11 +105,18 @@ namespace VISU
     virtual 
     VISU_PipeLine* 
     GetPipeLine();
-
-    VISU_GaussPtsAct* 
-    OnCreateActor(bool theIsSegmented,
+    
+    bool
+    OnCreateActor(VISU_GaussPtsAct* theActor,
                  const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
+    VISU_GaussPtsAct1* 
+    OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    VISU_GaussPtsAct2* 
+    OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+
     VISU_GaussPointsPL *myGaussPointsPL;
 
     bool myIsColored;
@@ -158,8 +165,8 @@ namespace VISU
     CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
     virtual 
-    VISU_GaussPtsAct* 
-    CloneActor(VISU_GaussPtsAct* theActor);
+    VISU_GaussPtsAct2
+    CloneActor(VISU_GaussPtsAct1* theActor);
 
     virtual
     void
index 625e2fbe880366f5c3e7153d6ce484e7a818b62c..82a8396e02b13dd3f44677b520c8b3b0d78c0d08 100644 (file)
@@ -153,7 +153,7 @@ VVTK_Renderer1
   pTextProperty->SetJustificationToRight();
   pTextProperty->SetVerticalJustificationToTop();
   pTextProperty->SetFontSize(10);
-  pTextProperty->SetOpacity (0.75);
+  //pTextProperty->SetOpacity (0.75);
   //
   myTextActor->SetMapper(myTextMapper.GetPointer());
   myTextActor->SetPickable(false); 
@@ -177,7 +177,7 @@ void
 VVTK_Renderer1
 ::AddActor(VTKViewer_Actor* theActor)
 {
-  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
     SVTK_Renderer::AddActor(anActor);
   }
@@ -189,7 +189,8 @@ VVTK_Renderer1
 ::RemoveActor(VTKViewer_Actor* theActor)
 {
   using namespace VISU;  
-  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+    anActor->SetImplicitFunctionWidget(NULL);
     SVTK_Renderer::RemoveActor(theActor);
   }
 }
@@ -296,9 +297,9 @@ void
 VVTK_Renderer2
 ::AddActor(VTKViewer_Actor* theActor)
 {
-  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     if(VISU::TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
-      if(VISU_GaussPtsAct* anActor2 = aFactory->CloneActor(anActor)){
+      if(VISU_GaussPtsAct2* anActor2 = aFactory->CloneActor(anActor)){
        anActor2->SetImplicitFunctionWidget(myWidget);
        SVTK_Renderer::AddActor(anActor2);
       }
@@ -312,7 +313,8 @@ VVTK_Renderer2
 ::RemoveActor(VTKViewer_Actor* theActor)
 {
   using namespace VISU;  
-  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+  if(VISU_GaussPtsAct2* anActor = dynamic_cast<VISU_GaussPtsAct2*>(theActor)){
+    anActor->SetImplicitFunctionWidget(NULL);
     SVTK_Renderer::RemoveActor(theActor);
   }
 }