#include "VTKViewer_GeometryFilter.h"
#include "VTKViewer_PassThroughFilter.h"
-#include "VISU_PipeLineUtils.hxx"
-
#include <stdexcept>
#include <sstream>
#include "utilities.h"
+#include "VISU_PipeLineUtils.hxx"
+
using namespace std;
static int MYVTKDEBUG = 0;
VISU_Actor
::ShallowCopyPL(VISU_PipeLine* thePipeLine)
{
- myPipeLine->ShallowCopy(thePipeLine);
- VISU::CopyMapper(GetMapper(), thePipeLine->GetMapper());
+ myPipeLine->ShallowCopy(thePipeLine, true);
+ vtkDataSetMapper* aTarget = GetDataSetMapper();
+ vtkDataSetMapper* aSource = thePipeLine->GetDataSetMapper();
+ VISU::CopyDataSetMapper(aTarget, aSource, true);
+ aTarget->SetLookupTable(aSource->GetLookupTable());
}
//----------------------------------------------------------------------------
if(vtkMapper *aMapper = myPipeLine->GetMapper()){
if(vtkDataSet *aDataSet = aMapper->GetInput()){
SetShrinkable(thePipeLine->IsShrinkable());
-
SetMapperInput(aDataSet);
}
}
return GetCurrentPL()->GetOutput();
}
+//----------------------------------------------------------------------------
+vtkDataSetMapper*
+VISU_Actor
+::GetDataSetMapper()
+{
+ return myMapper.GetPointer();
+}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_Actor
vtkDataSet*
GetInput();
+ virtual
+ vtkDataSetMapper*
+ GetDataSetMapper();
+
//! Gets memory size used by the instance (bytes).
virtual
unsigned long int
::ShallowCopyPL(VISU_PipeLine* thePipeLine)
{
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::ShallowCopyPL - this = "<<this);
-
+
Superclass::ShallowCopyPL(thePipeLine);
-
+
UpdateInsideCursorSettings();
-
+
Highlight(isHighlighted());
}
vtkDataSet* aDataSet = myDeviceActor->GetMapper()->GetInput();
unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
- //aSize += Superclass::GetMemorySize();
+ aSize += Superclass::GetMemorySize();
return aSize;
}
CreatePipeLine(VISU_GaussPointsPL* thePipeLine)
{
VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
- aPipeLine->SetGaussPtsIDMapper(thePipeLine->GetGaussPtsIDMapper());
- aPipeLine->ShallowCopy(thePipeLine);
+ aPipeLine->ShallowCopy(thePipeLine, true);
aPipeLine->Update();
return aPipeLine;
}
SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
- aPipeline->ShallowCopy(GetGaussPointsPL());
+ aPipeline->ShallowCopy(GetGaussPointsPL(), true);
aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
vtkFloatingPointType aMagnification = aPipeline->GetMagnification();
- aPipeline->ShallowCopy(GetGaussPointsPL());
+ aPipeline->ShallowCopy(GetGaussPointsPL(), true);
aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
anExtractGeometry->SetExtractBoundaryCells(true);
VISU_GaussPtsDeviceActor
::ShallowCopyPL(VISU_GaussPointsPL* thePipeLine)
{
- myPipeLine->ShallowCopy(thePipeLine);
+ myPipeLine->ShallowCopy(thePipeLine, true);
}
void
VISU_CutLinesPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
SetOrientation(aPipeLine->GetPlaneOrientation(1),
else
SetPosition(aPipeLine->GetPosition());
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
void
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
vtkFloatingPointType myDirLn[3];
vtkFloatingPointType myRealDirLn[3];
void
VISU_CutPlanesPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
SetOrientation(aPipeLine->GetPlaneOrientation(),
for (int i = 0, iend = GetNbParts(); i < iend; i++)
if(!aPipeLine->IsPartDefault(i)) SetPartPosition(i, aPipeLine->GetPartPosition(i));
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
void
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
void
SetPartPosition(int theNum = 0);
void
VISU_DeformedShapePL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
SetScale(aPipeLine->GetScale());
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
vtkFloatingPointType
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
vtkFloatingPointType myScaleFactor;
vtkWarpVector *myWarpVector;
::VISU_GaussPointsPL():
myIsDeformed(false),
myScaleFactor(0.0),
- myResolution( 8 ),
myMagnificationIncrement(2)
{
myExtractGeometry->SetExtractInside(0);
myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
mySphereSource = vtkSphereSource::New();
+ mySphereSource->SetThetaResolution( 8 );
+ mySphereSource->SetPhiResolution( 8 );
myGlyph->SetSource( mySphereSource->GetOutput() );
for(int i = 0; i < 2; i++)
VISU_GaussPointsPL
::GetMTime()
{
- unsigned long int aTime = std::max(Superclass::GetMTime(),myPSMapper->GetMTime());
+ unsigned long int aTime = std::max(Superclass::GetMTime(), myPSMapper->GetMTime());
return aTime;
}
//----------------------------------------------------------------------------
void
-CopyGlyph( vtkGlyph3D* source, vtkGlyph3D* dest )
+CopyGlyph( vtkGlyph3D* theSource, vtkGlyph3D* theDestination )
{
- dest->SetRange( source->GetRange() );
- dest->SetScaling( source->GetScaling() );
- dest->SetClamping( source->GetClamping() );
- dest->SetScaleMode( source->GetScaleMode() );
- dest->SetColorMode( source->GetColorMode() );
- dest->SetScaleFactor( source->GetScaleFactor() );
+ vtkFloatingPointType* aSourceRange = theSource->GetRange();
+ vtkFloatingPointType* aDestinationRange = theDestination->GetRange();
+ if(!VISU::CheckIsSameRange(aDestinationRange, aSourceRange))
+ theDestination->SetRange( aSourceRange );
+
+ theDestination->SetScaling( theSource->GetScaling() );
+ theDestination->SetClamping( theSource->GetClamping() );
+ theDestination->SetScaleMode( theSource->GetScaleMode() );
+ theDestination->SetColorMode( theSource->GetColorMode() );
+ theDestination->SetScaleFactor( theSource->GetScaleFactor() );
}
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
SetPrimitiveType(aPipeLine->GetPrimitiveType());
SetIsDeformed( aPipeLine->GetIsDeformed() );
SetScale( aPipeLine->GetScale() );
- mySphereSource->SetRadius( aPipeLine->mySphereSource->GetRadius() );
+ vtkFloatingPointType aRadius = aPipeLine->mySphereSource->GetRadius();
+ if(!VISU::CheckIsSameValue(mySphereSource->GetRadius(), aRadius))
+ mySphereSource->SetRadius( aRadius );
+
CopyGlyph( aPipeLine->myGlyph, this->myGlyph );
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
-::DoCopyMapper(VISU_PipeLine *thePipeLine)
+::DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
- VISU::CopyPointSpriteDataMapper(GetPSMapper(), aPipeLine->GetPSMapper());
+ if(theIsCopyInput)
+ SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
+ Update();
+ VISU::CopyPointSpriteDataMapper(GetPSMapper(),
+ aPipeLine->GetPSMapper(),
+ theIsCopyInput);
}
}
myScalarArray = aCellData->GetScalars();
myPSMapper->SetLookupTable( myMapperTable );
- myPSMapper->SetScalarRange( aScalarRange );
+ if(!VISU::CheckIsSameRange(myPSMapper->GetScalarRange(), aScalarRange))
+ myPSMapper->SetScalarRange( aScalarRange );
this->UpdateGlyph();
- VISU_ScalarMapPL::Update();
+ Superclass::Update();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::UpdateGlyph()
{
- //cout << "VISU_GaussPointsPL::UpdateGlyph()" << endl;
-
vtkFloatingPointType* aScalarRange = GetScalarRange();
if( myPSMapper->GetPointSpriteMode() == 0 ) // Results
{
- //cout << "Results" << endl;
myGlyph->ClampingOn();
myGlyph->SetScaleModeToScaleByScalar();
myGlyph->SetColorModeToColorByScalar();
- vtkFloatingPointType aRange = 0;
+ vtkFloatingPointType aScaleFactor = 0.0;
vtkFloatingPointType aMinSize = GetMinSize();
vtkFloatingPointType aMaxSize = GetMaxSize();
- if( fabs( aMaxSize - aMinSize ) > 0.0001 )
- aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
- vtkFloatingPointType aMinRange = aScalarRange[0] - aMinSize * aRange;
- vtkFloatingPointType aMaxRange = aMinRange + aRange;
-
- myGlyph->SetRange( aMinRange, aMaxRange );
- myGlyph->SetScaleFactor( 1.0 );
+ if(!VISU::CheckIsSameValue(aMaxSize, aMinSize))
+ aScaleFactor = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
+
+ vtkFloatingPointType aMinRange = aScalarRange[0] - aMinSize * aScaleFactor;
+ vtkFloatingPointType aMaxRange = aMinRange + aScaleFactor;
+ vtkFloatingPointType aRange[2] = {aMinRange, aMaxRange};
+
+ if(!VISU::CheckIsSameRange(myGlyph->GetRange(), aRange)){
+ myGlyph->SetRange( aRange );
+ if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), 1.0))
+ myGlyph->SetScaleFactor( 1.0 );
+ }
}
else if( myPSMapper->GetPointSpriteMode() == 1 ) // Geometry
{
- //cout << "Geometry" << endl;
myGlyph->ClampingOff();
myGlyph->SetScaleModeToDataScalingOff();
myGlyph->SetColorModeToColorByScale();
- myGlyph->SetScaleFactor( GetSize() );
+ vtkFloatingPointType aScaleFactor = GetSize();
+ if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), aScaleFactor))
+ myGlyph->SetScaleFactor( aScaleFactor );
}
else if( myPSMapper->GetPointSpriteMode() == 2 ) // Outside
{
- //cout << "Outside" << endl;
myGlyph->ClampingOff();
myGlyph->SetScaleModeToDataScalingOff();
myGlyph->SetColorModeToColorByScalar();
- myGlyph->SetScaleFactor( GetSize() );
+ vtkFloatingPointType aScaleFactor = GetSize();
+ if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), aScaleFactor))
+ myGlyph->SetScaleFactor( aScaleFactor );
}
- mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
+ vtkFloatingPointType aRadius = GetMagnification() * GetAverageCellSize() / 2.0;
+ if(!VISU::CheckIsSameValue(mySphereSource->GetRadius(), aRadius))
+ mySphereSource->SetRadius( aRadius );
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetIsDeformed( bool theIsDeformed )
{
+ if( GetIsDeformed() == theIsDeformed )
+ return;
+
if( theIsDeformed )
{
myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
myIsDeformed = theIsDeformed;
-
- Modified();
}
//----------------------------------------------------------------------------
myMapperTable->SetBicolor( theBicolor );
myBarTable->SetBicolor( theBicolor );
-
- Modified();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetPrimitiveType(int thePrimitiveType)
{
+ if( GetPrimitiveType() == thePrimitiveType )
+ return;
+
if( thePrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
{
myGlyph->SetInput( myGeomFilter->GetOutput() );
myPassFilter[1]->SetInput(myGeomFilter->GetOutput());
myPSMapper->SetPrimitiveType( thePrimitiveType );
-
- Modified();
}
//----------------------------------------------------------------------------
::SetClamp(vtkFloatingPointType theClamp)
{
myPSMapper->SetPointSpriteClamp( theClamp );
- Modified();
}
//----------------------------------------------------------------------------
::SetSize(vtkFloatingPointType theSize)
{
myPSMapper->SetPointSpriteSize( theSize );
- Modified();
}
//----------------------------------------------------------------------------
::SetMinSize(vtkFloatingPointType theMinSize)
{
myPSMapper->SetPointSpriteMinSize( theMinSize );
- Modified();
}
//----------------------------------------------------------------------------
::SetMaxSize(vtkFloatingPointType theMaxSize)
{
myPSMapper->SetPointSpriteMaxSize( theMaxSize );
- Modified();
}
//----------------------------------------------------------------------------
::SetMagnification(vtkFloatingPointType theMagnification)
{
myPSMapper->SetPointSpriteMagnification( theMagnification );
- Modified();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetMagnificationIncrement(vtkFloatingPointType theIncrement)
{
+ if(VISU::CheckIsSameValue(myMagnificationIncrement, theIncrement))
+ return;
+
myMagnificationIncrement = theIncrement;
+ Modified();
}
//----------------------------------------------------------------------------
::SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold)
{
myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
- Modified();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetResolution(int theResolution)
{
- myResolution = theResolution;
- mySphereSource->SetThetaResolution( myResolution );
- mySphereSource->SetPhiResolution( myResolution );
+ mySphereSource->SetThetaResolution( theResolution );
+ mySphereSource->SetPhiResolution( theResolution );
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussPointsPL
+::GetResolution()
+{
+ return mySphereSource->GetThetaResolution();
}
//----------------------------------------------------------------------------
vtkDataSet* aDataSet = aMapper->GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
vtkDataArray* aScalarArray = aCellData->GetScalars();
- return GetPointSize(theID,aScalarArray);
+ return GetPointSize(theID, aScalarArray);
}
//----------------------------------------------------------------------------
::SetAverageCellSize(vtkFloatingPointType theAverageCellSize)
{
myPSMapper->SetAverageCellSize( theAverageCellSize );
- Modified();
}
//----------------------------------------------------------------------------
void VISU_GaussPointsPL::SetScale( vtkFloatingPointType theScale )
{
+ if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
+ return;
+
myWarpVector->SetScaleFactor( theScale );
- myScaleFactor = GetScale();
- Modified();
+ myScaleFactor = theScale;
}
vtkFloatingPointType VISU_GaussPointsPL::GetScale()
void VISU_GaussPointsPL::SetMapScale( vtkFloatingPointType theMapScale )
{
- VISU_ScalarMapPL::SetMapScale( theMapScale );
+ Superclass::SetMapScale( theMapScale );
myWarpVector->SetScaleFactor( myScaleFactor * theMapScale );
Modified();
//! Get resolution of the Geometrical Sphere.
int
- GetResolution() { return myResolution; }
+ GetResolution();
//! Method for changing the Magnification parameter.
void
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
virtual
void
- DoCopyMapper(VISU_PipeLine *thePipeLine);
+ DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
bool myIsDeformed;
vtkFloatingPointType myScaleFactor;
vtkGlyph3D* myGlyph;
vtkSphereSource* mySphereSource;
- int myResolution;
VISU_OpenGLPointSpriteMapper* myPSMapper;
VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
void
VISU_IsoSurfacesPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
SetNbParts(aPipeLine->GetNbParts());
vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
SetRange(aRange);
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
int
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
int myNbParts;
vtkFloatingPointType myRange[2];
*/
free( shader );
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value )
{
vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value );
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPrimitiveType( int thePrimitiveType )
{
return;
this->PrimitiveType = thePrimitiveType;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
{
this->PointSpriteMode = theMode;
this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp )
{
return;
this->PointSpriteClamp = theClamp;
+ this->Modified();
}
+
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetAverageCellSize(float theSize)
+{
+ if( fabs( this->AverageCellSize - theSize ) < Tolerance )
+ return;
+
+ this->AverageCellSize = theSize;
+ this->Modified();
+}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize )
{
return;
this->PointSpriteSize = theSize;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize )
{
return;
this->PointSpriteMinSize = theMinSize;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize )
{
return;
this->PointSpriteMaxSize = theMaxSize;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnification )
{
return;
this->PointSpriteMagnification = theMagnification;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaThreshold )
{
return;
this->PointSpriteAlphaThreshold = theAlphaThreshold;
+ this->Modified();
}
+
//-----------------------------------------------------------------------------
bool VISU_OpenGLPointSpriteMapper::InitExtensions()
{
if( this->UsePointSprites ) //&& this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite )
this->CleanupPointSprites();
}
+
//-----------------------------------------------------------------------------
float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
{
return maximumSupportedSize;
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::InitPointSprites()
{
// Disable material properties
glDisable( GL_COLOR_MATERIAL );
}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
{
VISU_OpenGLPointSpriteMapper
::SetImageData( vtkImageData* theImageData )
{
- //cout << "VISU_OpenGLPointSpriteMapper::SetImageData " << theImageData << endl;
+ if(GetImageData() == theImageData)
+ return;
this->ImageData = theImageData;
+ this->Modified();
}
vtkImageData*
* card for sprite display, then the quadratic factors are adjusted to
* bring the size down.
*/
- vtkSetMacro(DefaultPointSize, float);
-
//! Get the initial point size to be used.
vtkGetMacro(DefaultPointSize, float);
//! Set Average Cell Size.
- vtkSetMacro(AverageCellSize, float);
+ void
+ SetAverageCellSize(float theSize);
//! Get Average Cell Size.
vtkGetMacro(AverageCellSize, float);
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::ShallowCopy(VISU_PipeLine *thePipeLine)
+::ShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
SetImplicitFunction(thePipeLine->GetImplicitFunction());
- DoShallowCopy(thePipeLine);
+ DoShallowCopy(thePipeLine, theIsCopyInput);
}
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
- DoCopyMapper(thePipeLine);
+ DoCopyMapper(thePipeLine, theIsCopyInput);
Build();
}
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::DoCopyMapper(VISU_PipeLine *thePipeLine)
+::DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
- VISU::CopyMapper(GetMapper(), thePipeLine->GetMapper());
+ if(theIsCopyInput)
+ SetIDMapper(thePipeLine->GetIDMapper());
+ Update();
+ VISU::CopyDataSetMapper(GetDataSetMapper(),
+ thePipeLine->GetDataSetMapper(),
+ theIsCopyInput);
}
//----------------------------------------------------------------------------
VISU_PipeLine
::SameAs(VISU_PipeLine *thePipeLine)
{
- DoShallowCopy(thePipeLine);
+ DoShallowCopy(thePipeLine, false);
}
//----------------------------------------------------------------------------
return myMapper.GetPointer();
}
+//----------------------------------------------------------------------------
+vtkDataSetMapper*
+VISU_PipeLine
+::GetDataSetMapper()
+{
+ GetMapper();
+ return myMapper.GetPointer();
+}
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
virtual
void
- ShallowCopy(VISU_PipeLine *thePipeLine);
+ ShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
virtual
void
TMapper*
GetMapper();
+ virtual
+ vtkDataSetMapper*
+ GetDataSetMapper();
+
virtual
void
Init() = 0;
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
virtual
void
- DoCopyMapper(VISU_PipeLine *thePipeLine);
+ DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
virtual
TInput*
namespace VISU
{
bool
- CheckIsSameRange(vtkFloatingPointType* theTarget,
- vtkFloatingPointType* theSource)
+ CheckIsSameValue(vtkFloatingPointType theTarget,
+ vtkFloatingPointType theSource)
{
static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
- if(fabs(theTarget[0] - theSource[0]) + fabs(theTarget[1] - theSource[1]) < TOL)
+ if(fabs(theTarget - theSource) < TOL)
return true;
return false;
-}
+ }
+
+ bool
+ CheckIsSameRange(vtkFloatingPointType* theTarget,
+ vtkFloatingPointType* theSource)
+ {
+ return CheckIsSameValue(theTarget[0], theSource[0]) &&
+ CheckIsSameValue(theTarget[1], theSource[1]);
+ }
void
CopyMapper(vtkMapper* theTarget,
- vtkMapper* theSource)
+ vtkMapper* theSource,
+ bool theIsCopyInput)
{
// To customize vtkMapper::ShallowCopy ...
- theTarget->SetLookupTable(theSource->GetLookupTable());
theTarget->SetScalarVisibility(theSource->GetScalarVisibility());
- if(!CheckIsSameRange(theTarget->GetScalarRange(), theSource->GetScalarRange()))
- theTarget->SetScalarRange(theSource->GetScalarRange());
+ if(theIsCopyInput){
+ vtkFloatingPointType* aScalarRange = theSource->GetScalarRange();
+ if(!CheckIsSameRange(theTarget->GetScalarRange(), aScalarRange))
+ theTarget->SetScalarRange(aScalarRange);
+ }
theTarget->SetColorMode(theSource->GetColorMode());
theTarget->SetScalarMode(theSource->GetScalarMode());
theTarget->SetImmediateModeRendering(theSource->GetImmediateModeRendering());
theTarget->SetClippingPlanes(theSource->GetClippingPlanes());
}
+ void
+ CopyDataSetMapper(vtkDataSetMapper* theTarget,
+ vtkDataSetMapper* theSource,
+ bool theIsCopyInput)
+ {
+ // To customize vtkDataSetMapper::ShallowCopy ...
+ //theTarget->SetInput(theSource->GetInput());
+ CopyMapper(theTarget, theSource, theIsCopyInput);
+ }
+
void
CopyPolyDataMapper(vtkPolyDataMapper* theTarget,
- vtkPolyDataMapper* theSource)
+ vtkPolyDataMapper* theSource,
+ bool theIsCopyInput)
{
// To customize vtkPolyDataMapper::ShallowCopy ...
- //aTargetMapper->SetInput(aMapper->GetInput());
+ //theTarget->SetInput(theSource->GetInput());
theTarget->SetGhostLevel(theSource->GetGhostLevel());
theTarget->SetNumberOfPieces(theSource->GetNumberOfPieces());
theTarget->SetNumberOfSubPieces(theSource->GetNumberOfSubPieces());
- CopyMapper(theTarget, theSource);
+ CopyMapper(theTarget, theSource, theIsCopyInput);
}
void
CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget,
- VISU_OpenGLPointSpriteMapper* theSource)
+ VISU_OpenGLPointSpriteMapper* theSource,
+ bool theIsCopyInput)
{
// To customize VISU_OpenGLPointSpriteMapper::ShallowCopy ...
theTarget->SetPrimitiveType( theSource->GetPrimitiveType() );
theTarget->SetImageData( theSource->GetImageData() );
theTarget->SetPointSpriteAlphaThreshold( theSource->GetPointSpriteAlphaThreshold() );
- CopyPolyDataMapper(theTarget, theSource);
+ CopyPolyDataMapper(theTarget, theSource, theIsCopyInput);
}
}
theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
}
+ //! Checks whether the float values are the same or not
+ bool
+ CheckIsSameValue(vtkFloatingPointType theTarget,
+ vtkFloatingPointType theSource);
+
//! Checks whether the scalar range is the same or not
bool
CheckIsSameRange(vtkFloatingPointType* theTarget,
vtkFloatingPointType* theSource);
- //! Customizes vtkMapper::ShallowCopy
+ //! Customizes vtkDataSetMapper::ShallowCopy
void
- CopyMapper(vtkMapper* theTarget, vtkMapper* theSource);
+ CopyDataSetMapper(vtkDataSetMapper* theTarget,
+ vtkDataSetMapper* theSource,
+ bool theIsCopyInput);
//! Customizes vtkPolyDataMapper::ShallowCopy
void
CopyPolyDataMapper(vtkPolyDataMapper* theTarget,
- vtkPolyDataMapper* theSource);
+ vtkPolyDataMapper* theSource,
+ bool theIsCopyInput);
//! Customizes VISU_OpenGLPointSpriteMapper::ShallowCopy
void
CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget,
- VISU_OpenGLPointSpriteMapper* theSource);
+ VISU_OpenGLPointSpriteMapper* theSource,
+ bool theIsCopyInput);
}
#endif
void
VISU_Plot3DPL::
-DoShallowCopy(VISU_PipeLine *thePipeLine)
+DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
SetOrientation (aPipeLine->GetPlaneOrientation(),
SetContourPrs( aPipeLine->GetIsContourPrs() );
SetNumberOfContours( aPipeLine->GetNumberOfContours() );
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
VISU_CutPlanesPL::PlaneOrientation
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
vtkFloatingPointType myAngle[3];
bool myIsRelative, myIsContour;
*/
void
VISU_ScalarMapOnDeformedShapePL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine)){
SetScale(aPipeLine->GetScale());
aPipeLine->GetSourceRange(aRange);
SetScalarRange(aRange);
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
/*!
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
vtkFloatingPointType myScaleFactor;
vtkWarpVector *myDeformVectors;
//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
- SetScalarRange(aPipeLine->GetScalarRange());
+ if(theIsCopyInput)
+ SetScalarRange(aPipeLine->GetScalarRange());
SetScalarMode(aPipeLine->GetScalarMode());
SetNbColors(aPipeLine->GetNbColors());
SetScaling(aPipeLine->GetScaling());
SetMapScale(aPipeLine->GetMapScale());
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
}
//
myExtractor->SetScalarMode(theScalarMode);
- Modified();
}
myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
else
myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
- Modified();
}
VISU_ScalarMapPL
::SetScalarRange(vtkFloatingPointType theRange[2])
{
- //cout << "VISU_ScalarMapPL::SetScalarRange" << endl;
if(!VISU::CheckIsSameRange(GetScalarRange(), theRange)){
- //cout << "( " << theRange[0] << " : " << theRange[1] << " )"<< endl;
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
}
{
myMapperTable->SetNumberOfColors(theNbColors);
myBarTable->SetNumberOfColors(theNbColors);
- Modified();
}
int
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
VISU_LookupTable* myMapperTable;
VISU_LookupTable* myBarTable;
void
VISU_StreamLinesPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
SetParams(aPipeLine->GetIntegrationStep(),
aPipeLine->GetUsedPoints(),
aPipeLine->GetDirection());
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
protected:
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
static
size_t
void
VISU_VectorsPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine)
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_VectorsPL *aPipeLine = dynamic_cast<VISU_VectorsPL*>(thePipeLine)){
SetGlyphType(aPipeLine->GetGlyphType());
SetGlyphPos(aPipeLine->GetGlyphPos());
}
- Superclass::DoShallowCopy(thePipeLine);
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine);
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
GlyphType myTypeGlyph;
GlyphPos myPosGlyph;
// We create a new PipeLine instance in order to provide
// different representations for different actors (basic and segmented)
VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
- aPipeLine->SetGaussPtsIDMapper(myGaussPointsPL->GetGaussPtsIDMapper());
- aPipeLine->ShallowCopy(GetPipeLine());
- aPipeLine->Update();
+ aPipeLine->ShallowCopy(GetPipeLine(), true);
return aPipeLine;
}
::GetActorPipeLine()
{
VISU_PipeLine* aPipeLine = VISU_VectorsPL::New();
- aPipeLine->SetIDMapper(GetPipeLine()->GetIDMapper());
- aPipeLine->ShallowCopy(GetPipeLine());
- aPipeLine->Update();
+ aPipeLine->ShallowCopy(GetPipeLine(), true);
return aPipeLine;
}
TSuperClass::UpdateActor(anActor);
anActor->GetProperty()->SetLineWidth(GetLineWidth());
if(VISU_VectorsPL* aVectorsPL = dynamic_cast<VISU_VectorsPL*>(anActor->GetPipeLine())){
- aVectorsPL->ShallowCopy(GetPipeLine());
+ aVectorsPL->ShallowCopy(GetPipeLine(), true);
aVectorsPL->Update();
aVectorsPL->SetMapScale(myVectorsPL->GetMapScale());
}