EXPORT_HEADERS = \
VISU_Actor.h \
+ VISU_ActorFactory.h \
VISU_MeshAct.h \
VISU_ScalarMapAct.h \
VISU_GaussPtsAct.h \
-I${GUI_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS)
-LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lVisuPipeLine \
+LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lSVTK -lVisuPipeLine \
-L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
@CONCLUDE@
static int MYDEBUG = 0;
#endif
-//=======================================================================
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_Actor);
+//----------------------------------------------------------------------------
VISU_Actor::VISU_Actor():
myIsVTKMapping(false),
myParent(this),
myPrs3d(NULL),
myPipeLine(NULL),
+ myActorFactory(NULL),
myMapper(vtkDataSetMapper::New()),
myIsShrunk(false),
myIsShrinkable(false),
myAnnotationActor.GetPointer()->SetVisibility(0);
}
-VISU_Actor::~VISU_Actor(){
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::ShallowCopy(vtkProp *prop)
+{
+ VISU_Actor *anActor = VISU_Actor::SafeDownCast(prop);
+ if(anActor != NULL){
+ setName(anActor->getName());
+ if(anActor->hasIO()) setIO(anActor->getIO());
+ }
+ SALOME_Actor::ShallowCopy(prop);
+}
+
+//----------------------------------------------------------------------------
+VISU_Actor
+::~VISU_Actor()
+{
SALOME_Actor::SetProperty(NULL);
myMapper->Delete();
myShrinkFilter->Delete();
}
-void VISU_Actor::setIO(const Handle(SALOME_InteractiveObject)& theIO){
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::setIO(const Handle(SALOME_InteractiveObject)& theIO)
+{
SALOME_Actor::setIO(theIO);
myName = theIO->getName();
}
-void VISU_Actor::SetPrs3d(VISU::Prs3d_i* thePrs3d){
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetPrs3d(VISU::Prs3d_i* thePrs3d)
+{
myPrs3d = thePrs3d;
}
-void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) {
+VISU::Prs3d_i*
+VISU_Actor
+::GetPrs3d()
+{
+ return myPrs3d;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetFactory(VISU::TActorFactory* theActorFactory)
+{
+ myActorFactory = theActorFactory;
+}
+
+VISU::TActorFactory*
+VISU_Actor
+::GetFactory()
+{
+ return myActorFactory;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetPipeLine(VISU_PipeLine* thePipeLine)
+{
if (myPipeLine != thePipeLine){
if (myPipeLine != NULL) myPipeLine->UnRegister(this);
myPipeLine = thePipeLine;
throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
if(!aDataSet->GetNumberOfCells())
throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
- //Bug SAL4221: Mesh with less than 10 cells : shrink mode disable
- //SetShrinkable(aDataSet->GetNumberOfCells() > 10);
SetShrinkable(thePipeLine->IsShrinkable());
- //Now, we use vtkShrinkPolyData (not vtkShrinkFilter),
- //and the class there is no such limitation.
myMapper->SetInput(aDataSet);
SetMapper(myMapper);
}
}
-void VISU_Actor::SetParent(VISU_Actor* theParent){
+VISU_PipeLine*
+VISU_Actor
+::GetPipeLine()
+{
+ return myPipeLine;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetParent(VISU_Actor* theParent)
+{
myParent = theParent;
}
-void VISU_Actor::SetRepresentation(int theMode) {
- SALOME_Actor::SetRepresentation(theMode);
- if(myRepresentation == VTK_POINTS)
- UnShrink();
+VISU_Actor*
+VISU_Actor
+::GetParent()
+{
+ return myParent;
}
-void VISU_Actor::SetOpacity(float theValue){
- GetProperty()->SetOpacity(theValue);
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetVisibility(int theMode)
+{
+ SALOME_Actor::SetVisibility(theMode);
}
-float VISU_Actor::GetOpacity(){
- return GetProperty()->GetOpacity();
+int
+VISU_Actor
+::GetVisibility()
+{
+ return SALOME_Actor::GetVisibility();
+}
+
+void
+VISU_Actor
+::SetRepresentation(int theMode)
+{
+ SALOME_Actor::SetRepresentation(theMode);
+ if(myRepresentation == VTK_POINTS)
+ UnShrink();
}
-void VISU_Actor::SetShrink(){
- if(!myIsShrinkable) return;
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetShrink()
+{
+ if(!myIsShrinkable)
+ return;
if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
myShrinkFilter->SetInput(aDataSet);
myPassFilter[1]->SetInput(myShrinkFilter->GetOutput());
}
}
-void VISU_Actor::UnShrink(){
- if(!myIsShrunk) return;
+void
+VISU_Actor
+::UnShrink()
+{
+ if(!myIsShrunk)
+ return;
if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
myPassFilter[1]->SetInput(aDataSet);
myPassFilter[1]->Modified();
}
}
-void VISU_Actor::SetShrinkable(bool theIsShrinkable){
+bool
+VISU_Actor
+::IsShrunk()
+{
+ return myIsShrunk;
+}
+
+void
+VISU_Actor
+::SetShrinkable(bool theIsShrinkable)
+{
myIsShrinkable = theIsShrinkable;
}
-void VISU_Actor::SetShrinkFactor(float theValue){
+bool
+VISU_Actor
+::IsShrunkable()
+{
+ return myIsShrinkable;
+}
+
+void
+VISU_Actor
+::SetShrinkFactor(float theValue)
+{
myShrinkFilter->SetShrinkFactor(theValue);
Modified();
}
-float VISU_Actor::GetShrinkFactor(){
+float
+VISU_Actor
+::GetShrinkFactor()
+{
return myShrinkFilter->GetShrinkFactor();
}
//----------------------------------------------------------------------------
-void VISU_Actor::SetVisibility(int theMode){
- SALOME_Actor::SetVisibility(theMode);
+void
+VISU_Actor
+::SetOpacity(float theValue)
+{
+ GetProperty()->SetOpacity(theValue);
}
-int VISU_Actor::GetVisibility(){
- return SALOME_Actor::GetVisibility();
+float
+VISU_Actor
+::GetOpacity()
+{
+ return GetProperty()->GetOpacity();
}
-void VISU_Actor::SetLineWidth(float theLineWidth){
+void
+VISU_Actor
+::SetLineWidth(float theLineWidth)
+{
GetProperty()->SetLineWidth(theLineWidth);
}
-float VISU_Actor::GetLineWidth(){
+float
+VISU_Actor
+::GetLineWidth()
+{
return GetProperty()->GetLineWidth();
}
-//----------------------------------------------------------------------------
-void VISU_Actor::ShallowCopy(vtkProp *prop){
- VISU_Actor *anActor = VISU_Actor::SafeDownCast(prop);
- if(anActor != NULL){
- setName(anActor->getName());
- if(anActor->hasIO()) setIO(anActor->getIO());
- }
- SALOME_Actor::ShallowCopy(prop);
+//==================================================================
+// function: AddToRender
+// purpose :
+//==================================================================
+void
+VISU_Actor
+::AddToRender(vtkRenderer* theRenderer)
+{
+ Superclass::AddToRender(theRenderer);
+ theRenderer->AddActor(myAnnotationActor.GetPointer());
+}
+
+//==================================================================
+// function: RemoveFromRender
+// purpose :
+//==================================================================
+void
+VISU_Actor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+ theRenderer->RemoveActor(myAnnotationActor.GetPointer());
+ Superclass::RemoveFromRender(theRenderer);
+
}
//----------------------------------------------------------------------------
myIsVTKMapping = theIsVTKMapping;
}
+bool
+VISU_Actor
+::IsVTKMapping() const
+{
+ return myIsVTKMapping;
+}
+
//----------------------------------------------------------------------------
vtkDataSet*
VISU_Actor
return bRet;
}
-//==================================================================
-// function: AddToRender
-// purpose :
-//==================================================================
-void VISU_Actor::AddToRender(vtkRenderer* theRenderer)
-{
-
- Superclass::AddToRender(theRenderer);
- theRenderer->AddActor(myAnnotationActor.GetPointer());
-}
-//==================================================================
-// function: RemoveFromRender
-// purpose :
-//==================================================================
-void VISU_Actor::RemoveFromRender(vtkRenderer* theRenderer)
-{
- theRenderer->RemoveActor(myAnnotationActor.GetPointer());
- Superclass::RemoveFromRender(theRenderer);
-
-}
#define VISU_ACTOR_H
#include "SALOME_Actor.h"
+#include "VISU_ActorFactory.h"
#include <string>
#include <vtkSmartPointer.h>
class VTKViewer_ShrinkFilter;
class VISU_PipeLine;
-namespace VISU {
- class Prs3d_i;
-}
-
#ifdef _WIN_32
#define VTKOCC_EXPORT __declspec (dllexport)
#else
{
public:
vtkTypeMacro(VISU_Actor,SALOME_Actor);
- void ShallowCopy(vtkProp *prop);
- static VISU_Actor* New();
- virtual ~VISU_Actor();
- virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
+ static
+ VISU_Actor*
+ New();
+
+ void
+ ShallowCopy(vtkProp *prop);
+
+ virtual
+ ~VISU_Actor();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+ VISU::Prs3d_i*
+ GetPrs3d();
+
+ virtual
+ void
+ SetPrs3d(VISU::Prs3d_i* thePrs3d);
+
+ VISU::TActorFactory*
+ GetFactory();
+
+ virtual
+ void
+ SetFactory(VISU::TActorFactory* theActorFactory);
+
+ virtual
+ VISU_PipeLine*
+ GetPipeLine();
+
+ virtual
+ void
+ SetPipeLine(VISU_PipeLine* thePipeLine) ;
+
+ VISU_Actor*
+ GetParent();
+
+ virtual
+ void
+ SetParent(VISU_Actor* theParent);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetVisibility(int theMode);
+
+ virtual
+ int
+ GetVisibility();
+
+ virtual
+ void
+ SetRepresentation(int theMode);
+
+ //----------------------------------------------------------------------------
+ virtual
+ bool
+ IsShrunkable();
- VISU::Prs3d_i* GetPrs3d(){ return myPrs3d;}
- virtual void SetPrs3d(VISU::Prs3d_i* thePrs3d);
+ virtual
+ bool
+ IsShrunk();
- virtual VISU_PipeLine* GetPipeLine() { return myPipeLine;}
- virtual void SetPipeLine(VISU_PipeLine* thePipeLine) ;
+ virtual
+ void
+ SetShrink();
+
+ virtual
+ void
+ UnShrink();
- VISU_Actor* GetParent(){ return myParent;}
- virtual void SetParent(VISU_Actor* theParent);
+ virtual
+ void
+ SetShrinkable(bool theIsShrinkable);
- virtual void SetOpacity(float theValue);
- virtual float GetOpacity();
+ virtual
+ void
+ SetShrinkFactor(float theFactor = 0.8);
- virtual void SetRepresentation(int theMode);
+ virtual
+ float
+ GetShrinkFactor();
- virtual bool IsShrunkable() { return myIsShrinkable;}
- virtual bool IsShrunk() { return myIsShrunk;}
- virtual void SetShrink();
- virtual void UnShrink();
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetOpacity(float theValue);
- virtual void SetShrinkable(bool theIsShrinkable);
- virtual void SetShrinkFactor(float theFactor = 0.8);
- virtual float GetShrinkFactor();
+ virtual
+ float
+ GetOpacity();
- virtual void SetVisibility(int theMode);
- virtual int GetVisibility();
+ virtual
+ void
+ SetLineWidth(float theLineWidth);
- virtual void SetLineWidth(float theLineWidth);
- virtual float GetLineWidth();
+ virtual
+ float
+ GetLineWidth();
- virtual void AddToRender( vtkRenderer* );
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ AddToRender( vtkRenderer* );
- virtual void RemoveFromRender( vtkRenderer* );
+ virtual
+ void
+ RemoveFromRender( vtkRenderer* );
- virtual bool PreHighlight( SVTK_Selector*,
- vtkInteractorStyle*,
- SVTK_SelectionEvent,
- bool );
+ //----------------------------------------------------------------------------
+ virtual
+ bool
+ PreHighlight( SVTK_Selector*,
+ vtkInteractorStyle*,
+ SVTK_SelectionEvent,
+ bool );
virtual
void
virtual
bool
- IsVTKMapping() const
- {
- return myIsVTKMapping;
- }
+ IsVTKMapping() const;
virtual
vtkDataSet*
VISU::Prs3d_i* myPrs3d;
VISU_PipeLine* myPipeLine;
vtkDataSetMapper* myMapper;
+ VISU::TActorFactory* myActorFactory;
VTKViewer_ShrinkFilter* myShrinkFilter;
bool myIsShrinkable;
--- /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 :
+// Author :
+// Module : VISU
+// $Header$
+
+#ifndef VISU_ACTOR_FACTORY_H
+#define VISU_ACTOR_FACTORY_H
+
+#include "SALOME_InteractiveObject.hxx"
+
+class VISU_Actor;
+class vtkPlane;
+
+namespace VISU
+{
+ class Prs3d_i;
+
+ struct TActorFactory
+ {
+ virtual
+ VISU_Actor*
+ CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
+
+ virtual
+ bool
+ AddClippingPlane(VISU_Actor* theActor,
+ vtkPlane* thePlane) = 0;
+
+ virtual
+ void
+ RemoveAllClippingPlanes(VISU_Actor* theActor) = 0;
+ };
+}
+
+
+#endif //VISU_ACTOR_FACTORY_H
#include <vtkRenderer.h>
#include <vtkPointPicker.h>
+#include <vtkScalarBarWidget.h>
#include <vtkTextActor.h>
#include <vtkTextMapper.h>
//
Superclass::RenderOpaqueGeometry(theViewport);
}
+
+
//
//VISU_GaussPtsAct
+//----------------------------------------------------------------
vtkStandardNewMacro(VISU_GaussPtsAct);
VISU_GaussPtsAct
myLastObjPointID(-1),
mySphereSource(vtkSphereSource::New()),
mySphereMapper(vtkPolyDataMapper::New()),
- mySphereActor(vtkActor::New())
- ,myCursorPyramid(VISU_CursorPyramid::New())
+ mySphereActor(vtkActor::New()),
+ myCursorPyramid(VISU_CursorPyramid::New())
{
myTextMapper->Delete();
myTextActor->Delete();
::~VISU_GaussPtsAct()
{}
+
+//----------------------------------------------------------------
void
VISU_GaussPtsAct
::AddToRender(vtkRenderer* theRenderer)
Superclass::RemoveFromRender(theRenderer);
}
+
+//----------------------------------------------------------------
void
VISU_GaussPtsAct
::SetPipeLine(VISU_PipeLine* thePipeLine)
Superclass::SetPipeLine(thePipeLine);
}
+VISU_GaussPointsPL*
+VISU_GaussPtsAct
+::GetGaussPointsPL()
+{
+ return myGaussPointsPL.GetPointer();
+}
+
//----------------------------------------------------------------
bool
VISU_GaussPtsAct
#include <vtkSmartPointer.h>
class VISU_GaussPointsPL;
+
class vtkTextMapper;
class vtkTextActor;
virtual
void
SetPipeLine(VISU_PipeLine* thePipeLine) ;
+
+ VISU_GaussPointsPL*
+ GetGaussPointsPL();
virtual
void
virtual ~VISU_GaussPtsAct();
vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
+
vtkSmartPointer<vtkTextMapper> myTextMapper;
vtkSmartPointer<VISU_GPTextActor> myTextActor;
vtkIdType myLastObjPointID;
aPresent->Build();
aPresent->Init();
aPresent->SetSourceRange();
+ vtkDataSet* anOutput = aPresent->GetMapper()->GetInput();
+ for(int i = 0, iEnd = anOutput->GetNumberOfCells(); i < iEnd; i++){
+ cout<<aPresent->GetPointSize(i)<<endl;
+ }
//aPresent->SetNumberOfContours(50);
//aPresent->SetNbParts(1);
//aPresent->SetOrientation(VISU_CutPlanesPL::XY,0.0,0.0);
#include <vtkXMLImageDataReader.h>
#include <vtkGeometryFilter.h>
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_GaussPointsPL);
+//----------------------------------------------------------------------------
VISU_GaussPointsPL
::VISU_GaussPointsPL():
myRelativeMinSize(0.03),
myGeomFilter = vtkGeometryFilter::New();
}
+void
+VISU_GaussPointsPL
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
+ SetIDMapper(thePipeLine->GetIDMapper());
+ myMapper->ShallowCopy(thePipeLine->GetMapper());
+ Build();
+
+ if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
+ SetScalarRange(aPipeLine->GetScalarRange());
+ SetScalarMode(aPipeLine->GetScalarMode());
+ SetNbColors(aPipeLine->GetNbColors());
+ SetScaling(aPipeLine->GetScaling());
+
+ SetGaussMesh(aPipeLine->GetGaussMesh());
+ SetRelativeMinSize(aPipeLine->GetRelativeMinSize());
+ SetRelativeMaxSize(aPipeLine->GetRelativeMaxSize());
+ Init();
+ }
+}
+
+
+//----------------------------------------------------------------------------
VISU_PipeLine::TMapper*
VISU_GaussPointsPL
::GetMapper()
return myPSMapper;
}
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Build()
{
- //cout << "VISU_GaussPointsPL::Build" << endl;
-
myExtractor->SetInput( GetInput2() );
myFieldTransform->SetInput( myExtractor->GetOutput() );
myGeomFilter->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
myPSMapper->SetInput( myGeomFilter->GetOutput() );
- /*
- // Create lots of points
- vtkPointSource* blob = vtkPointSource::New();
- blob->SetRadius( 1 );
- blob->SetCenter( 0.0, 0.0, 0.0 );
- blob->SetNumberOfPoints( 10000 );
- blob->SetDistributionToUniform();
-
- // Give them some colour
- vtkElevationFilter* elev = vtkElevationFilter::New();
- elev->SetInput( blob->GetOutput() );
- elev->SetLowPoint( -1.0, 0.0, 0.0 );
- elev->SetHighPoint( 1.0, 0.0, 0.0 );
- myPSMapper->SetInput( elev->GetPolyDataOutput() );
- */
- // Create a Gaussian splat to use as sprite
- vtkImageGaussianSource* gaussian = vtkImageGaussianSource::New();
- gaussian->SetWholeExtent( 0, 63, 0, 63, 0, 0 );
- gaussian->SetCenter( 31.5, 31.5, 0.0 );
- gaussian->SetMaximum( 255 );
- gaussian->SetStandardDeviation( 15 );
-
- // Create a sprite mapper.
- // Set Accumulate mode rendering
- // Use Point fading to reduce size of points to sensible demo size
- myPSMapper->SetImmediateModeRendering( 1 );
- myPSMapper->SetRenderModeToAccumulate();
- myPSMapper->SetQuadraticPointDistanceAttenuation( 1.0, 20.0, 0.0 );
- myPSMapper->SetParticleImage( gaussian->GetOutput() );
- /*
- // texture for intensity
- vtkXMLImageDataReader* aReader1 = vtkXMLImageDataReader::New();
- aReader1->SetFileName( "/dn06/salome/ouv/SALOME3/TextureIntensity.vti" );
- cout << "1st : " << aReader1->GetOutput() << endl;
- GLuint textureIntensity = myPSMapper->LoadTexture( aReader1->GetOutput() );
- myPSMapper->SetTextureIntensity( textureIntensity );
-
- // texture for alpha channel
- vtkXMLImageDataReader* aReader2 = vtkXMLImageDataReader::New();
- aReader2->SetFileName( "/dn06/salome/ouv/SALOME3/TextureAlphaChannel.vti" );
- cout << "2nd : " << aReader2->GetOutput() << endl;
- GLuint textureAlphaChannel = myPSMapper->LoadTexture( aReader2->GetOutput() );
- myPSMapper->SetTextureAlphaChannel( textureAlphaChannel );
-
- aReader1->Delete();
- aReader2->Delete();
- */
}
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL::
Init()
myScalarArray = aCellData->GetScalars();
}
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Update()
myPSMapper->SetScalarRange( myMapperTable->GetRange() );
}
+//----------------------------------------------------------------------------
VISU_GaussPointsPL
::~VISU_GaussPointsPL()
{
}
}
-//=======================================================================
+//----------------------------------------------------------------------------
VISU::TGaussPointID
VISU_GaussPointsPL
::GetObjID(vtkIdType theID) const
return myGaussMesh;
}
-//=======================================================================
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetRelativeMinSize(float theRelativeMinSize)
Modified();
}
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetRelativeMaxSize(float theRelativeMaxSize)
Modified();
}
+//----------------------------------------------------------------------------
float
VISU_GaussPointsPL
::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray)
return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange;
}
+//----------------------------------------------------------------------------
float
VISU_GaussPointsPL
::GetPointSize(vtkIdType theID)
return GetPointSize(theID,aScalarArray);
}
+//----------------------------------------------------------------------------
float
VISU_GaussPointsPL
::GetMaxPointSize()
static
VISU_GaussPointsPL* New();
+
+ virtual
+ void
+ ShallowCopy(VISU_PipeLine *thePipeLine);
virtual
TMapper*
SetGaussMesh(const VISU::PGaussMesh& theGaussMesh);
const VISU::PGaussMesh&
- GetGaussMesh()const;
+ GetGaussMesh() const;
void
SetRelativeMinSize(float theRelativeMinSize);
myMapper->Delete();
}
-void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
- SetInput(thePipeLine->GetInput());
+void
+VISU_PipeLine
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
+ SetIDMapper(thePipeLine->GetIDMapper());
myMapper->ShallowCopy(thePipeLine->GetMapper());
myExtractGeometry->SetImplicitBoolean(thePipeLine->myExtractGeometry->GetImplicitBoolean());
Build();
static int MYDEBUG = 0;
#endif
+//----------------------------------------------------------------------------
int
VISU::GaussPoints_i
::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
return 0;
}
+//----------------------------------------------------------------------------
int VISU::GaussPoints_i::myNbPresent = 0;
-QString VISU::GaussPoints_i::GenerateName()
+
+QString
+VISU::GaussPoints_i
+::GenerateName()
{
return VISU::GenerateName("Gauss Points",myNbPresent++);
}
+//----------------------------------------------------------------------------
const string VISU::GaussPoints_i::myComment = "GAUSSPOINTS";
+
const char*
-VISU::GaussPoints_i::GetComment() const
+VISU::GaussPoints_i
+::GetComment() const
{
return myComment.c_str();
}
+//----------------------------------------------------------------------------
VISU::GaussPoints_i::
GaussPoints_i(Result_i* theResult,
bool theAddToStudy) :
}
+//----------------------------------------------------------------------------
VISU::GaussPoints_i::
GaussPoints_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject) :
}
+//----------------------------------------------------------------------------
VISU::Storable*
VISU::GaussPoints_i
::Create(const char* theMeshName, VISU::Entity theEntity,
}
+//----------------------------------------------------------------------------
VISU::Storable*
VISU::GaussPoints_i
::Restore(const Storable::TRestoringMap& theMap)
}
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::ToStream(std::ostringstream& theStr)
}
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::DoSetInput(Result_i* theResult)
}
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::DoHook()
ScalarMap_i::DoHook();
}
+
+//----------------------------------------------------------------------------
+VISU_PipeLine*
+VISU::GaussPoints_i
+::GetPipeLine()
+{
+ VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
+ aPipeLine->ShallowCopy(myPipeLine);
+ aPipeLine->Update();
+ return aPipeLine;
+}
+
+
+//----------------------------------------------------------------------------
VISU_Actor*
VISU::GaussPoints_i
::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
}
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::UpdateActor(VISU_Actor* theActor)
{
VISU::ScalarMap_i::UpdateActor(theActor);
}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::RemoveAllClippingPlanes(VISU_Actor* theActor)
+{
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
+ if(VISU_GaussPointsPL* aPipeLine = anActor->GetGaussPointsPL())
+ aPipeLine->RemoveAllClippingPlanes();
+}
+
+bool
+VISU::GaussPoints_i
+::AddClippingPlane(VISU_Actor* theActor,
+ vtkPlane* thePlane)
+{
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
+ if(VISU_GaussPointsPL* aPipeLine = anActor->GetGaussPointsPL())
+ aPipeLine->AddClippingPlane(thePlane);
+}
+
virtual void DoSetInput(Result_i* theResult);
virtual void DoHook();
+ virtual
+ VISU_PipeLine*
+ GetPipeLine();
+
VISU_GaussPointsPL *myGaussPointsPL;
public:
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration, int isMemoryCheck = true);
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ static
+ int
+ IsPossible(Result_i* theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ int theIteration,
+ int isMemoryCheck = true);
+ virtual
+ Storable*
+ Create(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ int theIteration);
static const std::string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void ToStream(std::ostringstream& theStr);
+ virtual
+ const char*
+ GetComment() const;
+
+ virtual
+ QString
+ GenerateName();
- virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+ virtual
+ void
+ ToStream(std::ostringstream& theStr);
+
+ virtual
+ Storable*
+ Restore(const Storable::TRestoringMap& theMap);
virtual
VISU_Actor*
CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- virtual void UpdateActor(VISU_Actor* theActor) ;
+ virtual
+ void
+ UpdateActor(VISU_Actor* theActor);
+
+ virtual
+ void
+ RemoveAllClippingPlanes(VISU_Actor* theActor);
+
+ virtual
+ bool
+ AddClippingPlane(VISU_Actor* theActor,
+ vtkPlane* thePlane);
};
}
static int MYDEBUG = 0;
#endif
-VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
+VISU::Prs3d_i
+::Prs3d_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
myResult(theResult),
myResult->Register();
}
-VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
+VISU::Prs3d_i
+::Prs3d_i(Result_i* theResult,
bool theAddToStudy) :
PrsObject_i(theResult->GetStudyDocument()),
myResult(theResult),
myResult->Register();
}
-void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
+void
+VISU::Prs3d_i
+::SameAs(const Prs3d_i* theOrigin)
{
if (Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin)) {
myPipeLine->SameAs(aOrigin->GetPL());
}
}
-VISU::Prs3d_i::~Prs3d_i() {
+VISU::Prs3d_i
+::~Prs3d_i()
+{
if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this
<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
myPipeLine->Delete();
myResult->Destroy();
}
-void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
+void
+VISU::Prs3d_i
+::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
{
try{
Update();
- // if(myAddToStudy){
Handle(SALOME_InteractiveObject) anIO = theIO;
if(anIO.IsNull() && (!mySObject->_is_nil())){
anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
theActor->setIO(anIO);
}
- // }
theActor->SetPipeLine(GetPipeLine());
+ theActor->SetFactory(this);
theActor->SetPrs3d(this);
theActor->SetPosition(myOffset);
}catch(std::bad_alloc& ex){
}
}
-void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
+void
+VISU::Prs3d_i
+::UpdateActor(VISU_Actor* theActor)
+{
if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
theActor->SetPosition(myOffset);
theActor->Modified();
}
-VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
+VISU::Storable*
+VISU::Prs3d_i
+::Restore(const Storable::TRestoringMap& theMap)
{
myName = VISU::Storable::FindValue(theMap,"myName").latin1();
myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat();
return this;
}
-void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
+void
+VISU::Prs3d_i
+::ToStream(std::ostringstream& theStr)
+{
Storable::DataToStream( theStr, "myName", myName.c_str() );
Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] );
Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] );
Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] );
}
-void VISU::Prs3d_i::Update() {
+void
+VISU::Prs3d_i
+::Update()
+{
if(MYDEBUG) MESSAGE("Prs3d_i::Update() - this = "<<this);
try{
myPipeLine->Update();
}
}
-VISU_PipeLine* VISU::Prs3d_i::GetPipeLine(){
+VISU_PipeLine*
+VISU::Prs3d_i
+::GetPipeLine()
+{
return GetPL();
}
-VISU_PipeLine* VISU::Prs3d_i::GetPL(){
+VISU_PipeLine*
+VISU::Prs3d_i
+::GetPL()
+{
return myPipeLine;
}
-vtkUnstructuredGrid* VISU::Prs3d_i::GetInput(){
+vtkUnstructuredGrid*
+VISU::Prs3d_i::
+GetInput()
+{
return myPipeLine->GetInput();
}
-SALOMEDS::SObject_var VISU::Prs3d_i::GetSObject(){
+SALOMEDS::SObject_var
+VISU::Prs3d_i::GetSObject()
+{
if (CORBA::is_nil(mySObject.in())) {
const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
CORBA::String_var anIOR = GetID();
return mySObject;
}
-void VISU::Prs3d_i::GetBounds(float aBounds[6]){
+void
+VISU::Prs3d_i
+::GetBounds(float aBounds[6])
+{
myPipeLine->GetMapper()->GetBounds(aBounds);
}
// Clipping planes
-void VISU::Prs3d_i::RemoveAllClippingPlanes(){
+void
+VISU::Prs3d_i
+::RemoveAllClippingPlanes()
+{
myPipeLine->RemoveAllClippingPlanes();
}
-vtkIdType VISU::Prs3d_i::GetNumberOfClippingPlanes() const{
- return myPipeLine->GetNumberOfClippingPlanes();
+void
+VISU::Prs3d_i
+::RemoveAllClippingPlanes(VISU_Actor* theActor)
+{
+ RemoveAllClippingPlanes();
}
-bool VISU::Prs3d_i::AddClippingPlane(vtkPlane* thePlane){
+bool
+VISU::Prs3d_i
+::AddClippingPlane(vtkPlane* thePlane)
+{
return myPipeLine->AddClippingPlane(thePlane);
}
-vtkPlane* VISU::Prs3d_i::GetClippingPlane(vtkIdType theID) const{
+bool
+VISU::Prs3d_i
+::AddClippingPlane(VISU_Actor* theActor,
+ vtkPlane* thePlane)
+{
+ AddClippingPlane(thePlane);
+}
+
+vtkIdType
+VISU::Prs3d_i
+::GetNumberOfClippingPlanes() const
+{
+ return myPipeLine->GetNumberOfClippingPlanes();
+}
+
+vtkPlane*
+VISU::Prs3d_i::
+GetClippingPlane(vtkIdType theID) const
+{
return myPipeLine->GetClippingPlane(theID);
}
-void VISU::Prs3d_i::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane) {
+void
+VISU::Prs3d_i
+::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane)
+{
myPipeLine->SetPlaneParam(theDir, theDist, thePlane);
}
-VISU::Result_i* VISU::GetResult(SALOMEDS::SObject_ptr theSObject){
+VISU::Result_i*
+VISU::GetResult(SALOMEDS::SObject_ptr theSObject)
+{
VISU::Result_var aResult = FindResult(theSObject);
if(!aResult->_is_nil())
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
return NULL;
}
-void VISU::Prs3d_i::SetOffset(const float* theOffsets)
+void
+VISU::Prs3d_i
+::SetOffset(const float* theOffsets)
{
myOffset[0] = theOffsets[0];
myOffset[1] = theOffsets[1];
myOffset[2] = theOffsets[2];
}
-void VISU::Prs3d_i::SetOffset(float theDx, float theDy, float theDz)
+void
+VISU::Prs3d_i
+::SetOffset(float theDx, float theDy, float theDz)
{
myOffset[0] = theDx;
myOffset[1] = theDy;
myOffset[2] = theDz;
}
-void VISU::Prs3d_i::GetOffset(float* theOffsets)
+void
+VISU::Prs3d_i
+::GetOffset(float* theOffsets)
{
theOffsets[0] = myOffset[0];
theOffsets[1] = myOffset[1];
theOffsets[2] = myOffset[2];
}
-void VISU::Prs3d_i::GetOffset(float& theDx, float& theDy, float& theDz)
+
+void
+VISU::Prs3d_i
+::GetOffset(float& theDx, float& theDy, float& theDz)
{
theDx = myOffset[0];
theDy = myOffset[1];
#define VISU_Prs3d_i_HeaderFile
#include "VISU_PrsObject_i.hh"
-#include "SALOME_GenericObj_i.hh"
-#include "Handle_SALOME_InteractiveObject.hxx"
+#include "VISU_ActorFactory.h"
#include "VISU_Convertor.hxx"
+#include "SALOME_GenericObj_i.hh"
+#include "SALOME_InteractiveObject.hxx"
+
#include <vtkPlaneSource.h>
class VISU_PipeLine;
class Prs3d_i :
public virtual POA_VISU::Prs3d,
public virtual SALOME::GenericObj_i,
+ public virtual TActorFactory,
public virtual PrsObject_i
{
explicit
Prs3d_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject);
- virtual void SameAs(const Prs3d_i* theOrigin);
- virtual ~Prs3d_i();
+ virtual
+ void
+ SameAs(const Prs3d_i* theOrigin);
+
+ virtual
+ ~Prs3d_i();
protected:
bool myAddToStudy;
SALOMEDS::SObject_var mySObject;
std::string myMeshName;
- void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL);
- virtual VISU_PipeLine* GetPipeLine();
+ void
+ CreateActor(VISU_Actor* theActor,
+ const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+ virtual
+ VISU_PipeLine*
+ GetPipeLine();
public:
- virtual void Update() ;
- VISU_PipeLine* GetPL();
+ virtual
+ void
+ Update();
+
+ VISU_PipeLine*
+ GetPL();
+
+ vtkUnstructuredGrid*
+ GetInput();
+
+ void
+ GetBounds(float aBounds[6]);
+
+ void
+ SetOffset(const float* theOffsets);
- vtkUnstructuredGrid* GetInput();
+ virtual
+ void
+ SetOffset(float theDx, float theDy, float theDz);
- void GetBounds(float aBounds[6]);
+ void
+ GetOffset(float* theOffsets);
- void SetOffset(const float* theOffsets);
- virtual void SetOffset(float theDx, float theDy, float theDz);
+ virtual
+ void
+ GetOffset(float& theDx, float& theDy, float& theDz);
- void GetOffset(float* theOffsets);
- virtual void GetOffset(float& theDx, float& theDy, float& theDz);
+ virtual
+ const char*
+ GetComment() const = 0;
- virtual const char* GetComment() const = 0;
- virtual QString GenerateName() = 0;
+ virtual
+ QString
+ GenerateName() = 0;
- virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+ virtual
+ Storable*
+ Restore(const Storable::TRestoringMap& theMap);
- virtual void ToStream(std::ostringstream& theStr);
+ virtual
+ void
+ ToStream(std::ostringstream& theStr);
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
+ virtual
+ VISU_Actor*
+ CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
- virtual void UpdateActor(VISU_Actor* theActor) ;
+ virtual
+ void
+ UpdateActor(VISU_Actor* theActor);
- Result_i* GetResult() const { return myResult;}
- virtual SALOMEDS::SObject_var GetSObject();
- const std::string& GetMeshName() const { return myMeshName; }
+ Result_i*
+ GetResult() const
+ {
+ return myResult;
+ }
+
+ virtual
+ SALOMEDS::SObject_var
+ GetSObject();
+
+ const std::string&
+ GetMeshName() const
+ {
+ return myMeshName;
+ }
// Clipping planes
- void RemoveAllClippingPlanes();
- vtkIdType GetNumberOfClippingPlanes() const;
- bool AddClippingPlane(vtkPlane* thePlane);
- vtkPlane* GetClippingPlane(vtkIdType theID) const;
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ void
+ RemoveAllClippingPlanes(VISU_Actor* theActor);
+
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ bool
+ AddClippingPlane(VISU_Actor* theActor,
+ vtkPlane* thePlane);
+
+ vtkIdType
+ GetNumberOfClippingPlanes() const;
+
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID) const;
- void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
+ void
+ SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
};
- Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+ Result_i*
+ GetResult(SALOMEDS::SObject_ptr theSObject);
template<class TPrs3d>
- Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap)
+ Storable*
+ Restore(SALOMEDS::SObject_ptr theSObject,
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap)
{
VISU::Result_i* pResult = GetResult(theSObject);
if(pResult != NULL){