@COMMENCE@
EXPORT_HEADERS = \
- VISU_Actor.h \
VISU_ActorFactory.h \
+ VISU_GaussPtsActorFactory.h \
+ VISU_Actor.h \
VISU_MeshAct.h \
VISU_ScalarMapAct.h \
VISU_GaussPtsAct.h \
setName(anActor->getName());
if(anActor->hasIO()) setIO(anActor->getIO());
}
- SALOME_Actor::ShallowCopy(prop);
+ Superclass::ShallowCopy(prop);
}
//----------------------------------------------------------------------------
::~VISU_Actor()
{
if(MYDEBUG) MESSAGE("~VISU_Actor() - this = "<<this);
- SALOME_Actor::SetProperty(NULL);
+ Superclass::SetProperty(NULL);
}
//----------------------------------------------------------------------------
VISU_Actor
::setIO(const Handle(SALOME_InteractiveObject)& theIO)
{
- SALOME_Actor::setIO(theIO);
+ Superclass::setIO(theIO);
myName = theIO->getName();
}
myActorFactory = theActorFactory;
}
-void
-VISU_Actor
-::Connect(VISU_Actor* theActor)
-{
- mySetVisibilitySignal.connect(boost::bind(&VISU_Actor::SetVisibility,theActor,_1));
-}
-
void
VISU_Actor
::Update()
{
myActorFactory->UpdateActor(this);
- SALOME_Actor::Update();
+ Superclass::Update();
}
//----------------------------------------------------------------------------
-void
-VISU_Actor
-::SetVisibility(int theMode)
-{
- SALOME_Actor::SetVisibility(theMode);
- mySetVisibilitySignal(GetVisibility());
-}
-
-int
-VISU_Actor
-::GetVisibility()
-{
- return SALOME_Actor::GetVisibility();
-}
-
void
VISU_Actor
::SetRepresentation(int theMode)
{
- SALOME_Actor::SetRepresentation(theMode);
+ Superclass::SetRepresentation(theMode);
if(myRepresentation == VTK_POINTS)
UnShrink();
}
#define VTKOCC_EXPORT VTK_EXPORT
#endif
+namespace VISU
+{
+ class Prs3d_i;
+}
+
+//----------------------------------------------------------------------------
class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor
{
public:
void
SetFactory(VISU::TActorFactory* theActorFactory);
- virtual
- void
- Connect(VISU_Actor* theActor);
-
virtual
void
Update();
SetPipeLine(VISU_PipeLine* thePipeLine) ;
//----------------------------------------------------------------------------
- virtual
- void
- SetVisibility(int theMode);
-
- virtual
- int
- GetVisibility();
-
virtual
void
SetRepresentation(int theMode);
vtkSmartPointer<vtkDataSetMapper> myMapper;
VISU::TActorFactory* myActorFactory;
- boost::signal1<void,int> mySetVisibilitySignal;
vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
bool myIsShrinkable;
#ifndef VISU_ACTOR_FACTORY_H
#define VISU_ACTOR_FACTORY_H
-#include "SALOME_InteractiveObject.hxx"
-
class VISU_Actor;
-class vtkImplicitFunction;
+//----------------------------------------------------------------------------
namespace VISU
{
- class Prs3d_i;
-
struct TActorFactory
{
- virtual
- VISU_Actor*
- CloneActor(VISU_Actor* theActor) = 0;
-
virtual
void
UpdateActor(VISU_Actor* theActor) = 0;
-
- virtual
- void
- UpdateFromActor(VISU_Actor* theActor) = 0;
-
- virtual
- void
- SetImplicitFunction(VISU_Actor* theActor,
- vtkImplicitFunction* theImplicitFunction) = 0;
};
}
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
#include <vtkInteractorStyle.h>
-#include <vtkInteractorObserver.h>
#include <vtkRenderWindowInteractor.h>
#include <sstream>
VISU_GaussPtsAct
::VISU_GaussPtsAct():
- myInteractorObserver(vtkInteractorObserver::New()),
myEventCallbackCommand(vtkCallbackCommand::New()),
myPSMapper(VISU_OpenGLPointSpriteMapper::New()),
myGaussPointsPL(NULL),
mySphereActor(vtkActor::New()),
myCursorPyramid(VISU_CursorPyramid::New())
{
- myInteractorObserver->Delete();
myEventCallbackCommand->Delete();
myEventCallbackCommand->SetClientData(this);
Superclass::SetPipeLine(thePipeLine);
}
+VISU_GaussPointsPL*
+VISU_GaussPtsAct
+::GetGaussPointsPL()
+{
+ return myGaussPointsPL.GetPointer();
+}
+
void
VISU_GaussPtsAct
::SetFactory(VISU::TActorFactory* theActorFactory)
{
- VISU_Actor::SetFactory(theActorFactory);
- myUpdatePrs3dSignal.connect(boost::bind(&VISU::TActorFactory::UpdateFromActor,
- theActorFactory,
- _1));
+ using namespace VISU;
+ if(TGaussPtsActorFactory* aFactory = dynamic_cast<TGaussPtsActorFactory*>(theActorFactory)){
+ myUpdatePrs3dSignal.connect(boost::bind(&TGaussPtsActorFactory::UpdateFromActor,
+ aFactory,
+ _1));
+ VISU_Actor::SetFactory(theActorFactory);
+ myGaussPtsActorFactory = aFactory;
+ }
}
-VISU_GaussPointsPL*
+VISU::TGaussPtsActorFactory*
VISU_GaussPtsAct
-::GetGaussPointsPL()
+::GetGaussPtsFactory()
{
- return myGaussPointsPL.GetPointer();
+ 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);
+ mySetVisibilitySignal(GetVisibility());
}
bool
#define VISU_GaussPtsAct_HeaderFile
#include "VISU_ScalarMapAct.h"
+#include "VISU_GaussPtsActorFactory.h"
+
#include <vtkSmartPointer.h>
class VISU_GaussPointsPL;
class vtkInteractorObserver;
class vtkCallbackCommand;
-
//----------------------------------------------------------------------------
class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct
{
void
SetPipeLine(VISU_PipeLine* thePipeLine) ;
+ VISU_GaussPointsPL*
+ GetGaussPointsPL();
+
virtual
void
SetFactory(VISU::TActorFactory* theActorFactory);
+
+ VISU::TGaussPtsActorFactory*
+ GetGaussPtsFactory();
- VISU_GaussPointsPL*
- GetGaussPointsPL();
+ virtual
+ void
+ Connect(VISU_GaussPtsAct* theActor);
+
+ virtual
+ void
+ SetVisibility(int theMode);
bool
ChangeMagnification();
SetMapperInput(vtkDataSet* theDataSet);
//----------------------------------------------------------------------------
- vtkSmartPointer<vtkInteractorObserver> myInteractorObserver;
vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
// Main process VTK event method
void
OnInteractorEvent(unsigned long theEvent);
- boost::signal1<void,VISU_Actor*> myUpdatePrs3dSignal;
+ VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
+ boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
+ boost::signal1<void,int> mySetVisibilitySignal;
bool myChangeMagnification;
//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VISU_ScalarMapAct.h
+// Author : Laurent CORNABE with help of Nicolas REJNERI
+// Module : VISU
+// $Header$
+
+#ifndef VISU_GAUSSPTS_ACTOR_FACTORY_H
+#define VISU_GAUSSPTS_ACTOR_FACTORY_H
+
+#include "VISU_ActorFactory.h"
+
+class vtkImplicitFunction;
+class VISU_GaussPtsAct;
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TGaussPtsActorFactory: virtual TActorFactory
+ {
+ virtual
+ VISU_GaussPtsAct*
+ CloneActor(VISU_GaussPtsAct* theActor) = 0;
+
+ virtual
+ void
+ UpdateFromActor(VISU_GaussPtsAct* theActor) = 0;
+ };
+}
+
+
+#endif
// Module :
#include "VISU_GaussPoints_i.hh"
-#include "VISU_GaussPointsPL.hxx"
-#include "VISU_GaussPtsAct.h"
+
#include "VISU_Result_i.hh"
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPointsPL.hxx"
+
using namespace VISU;
using namespace std;
VISU::GaussPoints_i
::GetPipeLine()
{
- return GetPL();
+ // We create a new PipeLine instamce in order to provide
+ // different representation for different actors (basic and segmented)
+ VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
+ aPipeLine->ShallowCopy(myPipeLine);
+ aPipeLine->Update();
+ return aPipeLine;
}
}
//----------------------------------------------------------------------------
-VISU_Actor*
+VISU_GaussPtsAct*
VISU::GaussPoints_i
-::CloneActor(VISU_Actor* theActor)
+::CloneActor(VISU_GaussPtsAct* theActor)
{
- VISU::ScalarMap_i::CloneActor(theActor);
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(CreateActor())){
+ theActor->Connect(anActor);
+ return anActor;
+ }
+ return NULL;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::UpdateFromActor(VISU_Actor* theActor)
-{
- if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
- bool aChangeMagnification = anActor->ChangeMagnification();
- if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this<<
- "; aChangeMagnification = "<<aChangeMagnification);
- myGaussPointsPL->ChangeMagnification(aChangeMagnification);
- }
- VISU::Prs3d_i::UpdateFromActor(theActor);
-}
-
-//----------------------------------------------------------------------------
-void
-VISU::GaussPoints_i
-::SetImplicitFunction(VISU_Actor* theActor,
- vtkImplicitFunction* theImplicitFunction)
+::UpdateFromActor(VISU_GaussPtsAct* theActor)
{
- if(VISU_PipeLine* aPipeLine = theActor->GetPipeLine())
- aPipeLine->SetImplicitFunction(theImplicitFunction);
+ bool aChangeMagnification = theActor->ChangeMagnification();
+ if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
+ myGaussPointsPL->ChangeMagnification(aChangeMagnification);
+ UpdateActors();
}
#define VISU_GaussPoints_i_HeaderFile
#include "VISU_ScalarMap_i.hh"
+#include "VISU_GaussPtsActorFactory.h"
class VISU_GaussPointsPL;
namespace VISU
{
class GaussPoints_i : public virtual POA_VISU::GaussPoints,
+ public virtual VISU::TGaussPtsActorFactory,
public virtual ScalarMap_i
{
static int myNbPresent;
CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
virtual
- VISU_Actor*
- CloneActor(VISU_Actor* theActor);
+ VISU_GaussPtsAct*
+ CloneActor(VISU_GaussPtsAct* theActor);
virtual
void
virtual
void
- UpdateFromActor(VISU_Actor* theActor);
-
- //----------------------------------------------------------------------------
- virtual
- void
- SetImplicitFunction(VISU_Actor* theActor,
- vtkImplicitFunction* theImplicitFunction);
+ UpdateFromActor(VISU_GaussPtsAct* theActor);
};
}
}
}
-VISU_Actor*
-VISU::Prs3d_i
-::CloneActor(VISU_Actor* theActor)
-{
- VISU_Actor* anActor = CreateActor();
- theActor->Connect(anActor);
- return anActor;
-}
-
void
VISU::Prs3d_i
::UpdateActor(VISU_Actor* theActor)
theActor->Modified();
}
-void
-VISU::Prs3d_i
-::UpdateFromActor(VISU_Actor* theActor)
-{
- if(MYDEBUG) MESSAGE("Prs3d_i::UpdateFromActor - this = "<<this);
- UpdateActors();
-}
-
void
VISU::Prs3d_i
::UpdateActors()
//----------------------------------------------------------------------------
-void
-VISU::Prs3d_i
-::SetImplicitFunction(VISU_Actor* theActor,
- vtkImplicitFunction* theImplicitFunction)
-{
- myPipeLine->SetImplicitFunction(theImplicitFunction);
-}
-
// Clipping planes
void
VISU::Prs3d_i
VISU_Actor*
CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
- virtual
- VISU_Actor*
- CloneActor(VISU_Actor* theActor);
-
virtual
void
UpdateActor(VISU_Actor* theActor);
- virtual
- void
- UpdateFromActor(VISU_Actor* theActor);
-
virtual
void
UpdateActors();
//----------------------------------------------------------------------------
- virtual
- void
- SetImplicitFunction(VISU_Actor* theActor,
- vtkImplicitFunction* theImplicitFunction);
-
// Clipping planes
void
RemoveAllClippingPlanes();
VVTK_View.h
CPPFLAGS += \
- $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) \
+ $(QT_INCLUDES) \
+ $(OCC_INCLUDES) \
+ $(VTK_INCLUDES) \
+ $(BOOST_CPPFLAGS) \
-I$(KERNEL_ROOT_DIR)/include/salome \
- -I$(GUI_ROOT_DIR)/include/salome
+ -I$(GUI_ROOT_DIR)/include/salome \
+ -I${MED_ROOT_DIR}/include/salome
LDFLAGS += \
- $(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) \
+ $(QT_MT_LIBS) \
+ $(OCC_LIBS) \
+ $(VTK_LIBS) \
-L$(KERNEL_ROOT_DIR)/lib/salome \
-L$(GUI_ROOT_DIR)/lib/salome
#include "VVTK_Renderer.h"
#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPointsPL.hxx"
#include "VISU_ImplicitFunctionWidget.h"
#include <vtkObjectFactory.h>
VVTK_Renderer2
::AddActor(VTKViewer_Actor* theActor)
{
- SVTK_Renderer::AddActor(theActor);
- if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor))
- if(VISU::TActorFactory* aFactory = anActor->GetFactory()){
- aFactory->SetImplicitFunction(anActor,myImplicitFunction.GetPointer());
+ using namespace VISU;
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ if(TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
+ if(VISU_GaussPtsAct* anActor2 = aFactory->CloneActor(anActor)){
+ anActor2->GetGaussPointsPL()->SetImplicitFunction(myImplicitFunction.GetPointer());
+ SVTK_Renderer::AddActor(theActor);
+ }
}
+ }
}
//----------------------------------------------------------------------------
VVTK_Renderer2
::RemoveActor(VTKViewer_Actor* theActor)
{
- if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor))
- if(VISU::TActorFactory* aFactory = anActor->GetFactory())
- aFactory->SetImplicitFunction(anActor,NULL);
- SVTK_Renderer::RemoveActor(theActor);
+ using namespace VISU;
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ if(TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
+ if(VISU_GaussPtsAct* anActor2 = aFactory->CloneActor(anActor)){
+ anActor2->GetGaussPointsPL()->SetImplicitFunction(NULL);
+ SVTK_Renderer::RemoveActor(theActor);
+ }
+ }
+ }
}
#include "VVTK_ViewModel.h"
#include "VVTK_View.h"
-#include "VISU_GaussPtsAct.h"
-
#include "SUIT_Session.h"
#include "VVTK_Renderer.h"
+#include "SVTK_Selector.h"
#include "SVTK_InteractorStyle.h"
#include "SVTK_RenderWindowInteractor.h"
#include "SVTK_GenericRenderWindowInteractor.h"
bool theIsUpdate)
{
myMainWindow1->AddActor(theActor,theIsUpdate);
- if(VISU_Actor* anAct = dynamic_cast<VISU_Actor*>(theActor))
- if(VISU::TActorFactory* aFactory = anAct->GetFactory())
- if(VISU_Actor* anActor = aFactory->CloneActor(anAct))
- myMainWindow2->AddActor(anActor,theIsUpdate);
+ myMainWindow2->AddActor(theActor,theIsUpdate);
}
//----------------------------------------------------------------------------