::VISU_CutPlanesPL():
VISU_OptionalDeformationPL()
{
+ if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::VISU_CutPlanesPL() - "<<this);
+
SetIsShrinkable(false);
myAppendPolyData = vtkAppendPolyData::New();
VISU_CutPlanesPL
::~VISU_CutPlanesPL()
{
+ if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::~VISU_CutPlanesPL() - "<<this);
myAppendPolyData->Delete();
myAppendPolyData = NULL;
}
vtkFloatingPointType aBounds[6];
- GetMergeFilterOutput()->GetBounds(aBounds);
+ vtkDataSet* aFilterOutput = GetMergeFilterOutput();
+
+ aFilterOutput->GetBounds(aBounds);
CutWithPlanes(myAppendPolyData,
- GetMergeFilterOutput(),
+ aFilterOutput,
myNbParts,
aDir,
aBounds,
//----------------------------------------------------------------------------
-
void
VISU_CutPlanesPL::SetVectorialField(VISU::PUnstructuredGridIDMapper theMapper)
{
Modified();
}
+//----------------------------------------------------------------------------
VISU::PUnstructuredGridIDMapper VISU_CutPlanesPL::
getVectorialField()
{
return myVectorialField;
}
+
+//----------------------------------------------------------------------------
+void VISU_CutPlanesPL::SetMapScale(vtkFloatingPointType theMapScale){
+ Superclass::SetMapScale(theMapScale);
+ if(IsDeformed())
+ VISU_OptionalDeformationPL::SetMapScale(theMapScale);
+}
virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper);
VISU::PUnstructuredGridIDMapper getVectorialField();
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+
protected:
VISU_CutPlanesPL();
//Salome includes
#include "VISU_DeformationPL.hxx"
#include "VISU_MergeFilter.hxx"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PipeLineUtils.hxx"
//VTK includes
#include <vtkDataSet.h>
#include <vtkWarpVector.h>
#include <vtkCellDataToPointData.h>
#include <vtkUnstructuredGrid.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
//----------------------------------------------------------------------------
-VISU_DeformationPL::VISU_DeformationPL()
+VISU_DeformationPL::VISU_DeformationPL():
+ myScaleFactor(1.0),
+ myMapScaleFactor(1.0)
{
+ if(MYDEBUG) MESSAGE("VISU_DeformationPL()::VISU_DeformationPL() - "<<this);
myWarpVector = vtkWarpVector::New();
- myWarpVector->SetScaleFactor(0.0);
+ myWarpVector->SetScaleFactor(myScaleFactor);
myVectorMergeFilter = VISU_MergeFilter::New();
myVectorMergeFilter->SetMergingInputs(true);
//----------------------------------------------------------------------------
VISU_DeformationPL::~VISU_DeformationPL()
{
+ if(MYDEBUG) MESSAGE("VISU_DeformationPL()::~VISU_DeformationPL() - "<<this);
myWarpVector->Delete();
myVectorMergeFilter->Delete();
myInputPassFilter->Delete();
//----------------------------------------------------------------------------
void VISU_DeformationPL::SetScale(vtkFloatingPointType theScaleFactor)
{
- myWarpVector->SetScaleFactor(theScaleFactor);
+ if(myScaleFactor == theScaleFactor)
+ return;
+ myScaleFactor = theScaleFactor;
+ myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor);
}
+void VISU_DeformationPL::SetMapScale(vtkFloatingPointType theMapScaleFactor)
+{
+ if(myMapScaleFactor == theMapScaleFactor)
+ return;
+ myMapScaleFactor = theMapScaleFactor;
+
+ myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor);
+}
+
+
vtkFloatingPointType VISU_DeformationPL::GetScale()
{
- return myWarpVector->GetScaleFactor();
+ return myScaleFactor;
}
//----------------------------------------------------------------------------
static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
if(fabs(aSourceRange[1]) > EPS){
vtkDataSet* aDataSet = thePipeLine->GetMergeFilterOutput();
- vtkFloatingPointType aScaleFactor = VISU_DeformationPL::ComputeScaleFactor(aDataSet);
+ vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor(aDataSet);
return aScaleFactor / aSourceRange[1];
}
return 0.0;
}
-//----------------------------------------------------------------------------
-vtkFloatingPointType VISU_DeformationPL::ComputeScaleFactor(vtkDataSet* theDataSet)
-{
- if(!theDataSet)
- return 0.0;
-
- theDataSet->Update();
-
- int aNbCells = theDataSet->GetNumberOfCells();
- int aNbPoints = theDataSet->GetNumberOfPoints();
- int aNbElem = aNbCells? aNbCells: aNbPoints;
-
- vtkFloatingPointType* aBounds = theDataSet->GetBounds();
- vtkFloatingPointType aVolume = 1, aVol, idim = 0;
- for(int i = 0; i < 6; i += 2){
- aVol = fabs(aBounds[i+1] - aBounds[i]);
- if(aVol > 0) {
- idim++;
- aVolume *= aVol;
- }
- }
- aVolume /= aNbElem;
- return pow(aVolume, vtkFloatingPointType(1.0/idim));
-}
//-----------------------------------------------------------
virtual void SetScale(vtkFloatingPointType theScaleFactor);
+ virtual void SetMapScale(vtkFloatingPointType theMapScaleFactor);
virtual vtkFloatingPointType GetScale();
//-----------------------------------------------------------
GetMTime();
static vtkFloatingPointType GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine);
- static vtkFloatingPointType ComputeScaleFactor(vtkDataSet* theDataSet);
void SetWarpVectorInput(vtkDataSet *theInput);
vtkDataSet* GetWarpVectorOutput();
vtkPassThroughFilter *myOutputPassFiler;
vtkCellDataToPointData *myCellDataToPointData;
+private:
+ vtkFloatingPointType myScaleFactor;
+ vtkFloatingPointType myMapScaleFactor;
+
};
#endif
#include <vtkPassThroughFilter.h>
#include <vtkWarpVector.h>
#include <vtkCellDataToPointData.h>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
//----------------------------------------------------------------------------
VISU_OptionalDeformationPL::VISU_OptionalDeformationPL():
VISU_DeformationPL(),
myIsDeformed(true)
-{}
+{
+ if(MYDEBUG) MESSAGE("VISU_OptionalDeformationPL()::VISU_OptionalDeformationPL() - "<<this);
+}
//----------------------------------------------------------------------------
-VISU_OptionalDeformationPL::~VISU_OptionalDeformationPL(){
-
+VISU_OptionalDeformationPL::~VISU_OptionalDeformationPL()
+{
+ if(MYDEBUG) MESSAGE("VISU_OptionalDeformationPL()::~VISU_OptionalDeformationPL() - "<<this);
}
//----------------------------------------------------------------------------
TSuperClass::SameAs(theOrigin);
OptionalDeformation_i::SameAsDeformation(dynamic_cast<const Deformation_i*>(theOrigin));
}
-
-void VISU::CutPlanes_i::SetVectorialField(Entity theEntity, const char* theFieldName){
- if(MYDEBUG) MESSAGE("CutPlanes_i::SetVectorialField()");
-
- bool anIsModified = false;
- if(!anIsModified)
- anIsModified |= GetVectorialFieldEntity() != theEntity;
-
- if(!anIsModified)
- anIsModified |= GetVectorialFieldName() != theFieldName;
-
- if(!anIsModified)
- return;
-
- int aTimeStampNumber = GetTimeStampNumber();
-
- VISU::TEntity aEntity = VISU::TEntity(theEntity);
- VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
- theEntity,
- theFieldName,
- aTimeStampNumber);
-
- PField aVectorialField = anInput->GetField(GetCMeshName(), aEntity, theFieldName);
-
- VISU::PUnstructuredGridIDMapper anIDMapper =
- anInput->GetTimeStampOnMesh(GetCMeshName(),
- aEntity,
- theFieldName,
- aTimeStampNumber);
-
- SetVField(theEntity,
- theFieldName,
- anIDMapper,
- aVectorialField);
-
-};
{
return myCutPlanesPL;
}
-
- virtual void SetVectorialField(Entity theEntity, const char* theFieldName);
protected:
//! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
#endif
//---------------------------------------------------------------
-VISU::Deformation_i::Deformation_i(VISU::Prs3d_i *theModifiedEngine):
- myModifiedEngine(theModifiedEngine)
+VISU::Deformation_i::Deformation_i(VISU::ColoredPrs3d_i *thePrs3d):
+ myColoredPrs3d(thePrs3d)
{
if(MYDEBUG) MESSAGE("Deformation_i::Deformation_i()");
}
{
if(MYDEBUG) MESSAGE("Deformation_i::SetScale()");
- VISU::TSetModified aModified(GetModifiedEngine());
+ VISU::TSetModified aModified(GetColoredPrs3d());
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, vtkFloatingPointType>
(GetSpecificDeformedPL(), &VISU_DeformationPL::SetScale, theScale));
return GetSpecificDeformedPL()->GetScale();
}
-//---------------------------------------------------------------
-void VISU::
-Deformation_i::SetVField(VISU::Entity theEntity,
- const char* theFieldName,
- VISU::PUnstructuredGridIDMapper anIDMapper,
- PField theVectorialField)
-{
-
- if(MYDEBUG) MESSAGE("Deformation_i::SetVField()");
-
-
- VISU::TSetModified aModified(GetModifiedEngine());
- myVectorialField = theVectorialField;
- if(GetSpecificDeformedPL() && anIDMapper)
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, VISU::PUnstructuredGridIDMapper>
- (GetSpecificDeformedPL(), &VISU_DeformationPL::SetVectorialField, anIDMapper));
-
- myVectorialEntity = theEntity;
- myVectorialFieldName = theFieldName;
-}
-
-
//---------------------------------------------------------------
VISU::Entity VISU::Deformation_i::GetVectorialFieldEntity(){
return myVectorialEntity;
//---------------------------------------------------------------
void
VISU::Deformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap)
+ const Storable::TRestoringMap& theMap)
{
SetScale(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble());
VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap, "myVectorialEntiry").toInt());
this->SetScale(anOrigin->GetScale());
}
}
+
+void VISU::Deformation_i::SetVectorialField(Entity theEntity, const char* theFieldName){
+ if(MYDEBUG) MESSAGE("CutPlanes_i::SetVectorialField()");
+
+ bool anIsModified = false;
+ if(!anIsModified)
+ anIsModified |= GetVectorialFieldEntity() != theEntity;
+
+ if(!anIsModified)
+ anIsModified |= GetVectorialFieldName() != theFieldName;
+
+ if(!anIsModified)
+ return;
+
+ ColoredPrs3d_i *aColoredPrs = GetColoredPrs3d();
+ int aTimeStampNumber = aColoredPrs->GetTimeStampNumber();
+
+ VISU::TEntity aEntity = VISU::TEntity(theEntity);
+
+ VISU::Result_i::PInput anInput = aColoredPrs->GetCResult()->GetInput(aColoredPrs->GetCMeshName(),
+ theEntity,
+ theFieldName,
+ aTimeStampNumber);
+
+ PField aVectorialField = anInput->GetField(aColoredPrs->GetCMeshName(), aEntity, theFieldName);
+
+ VISU::PUnstructuredGridIDMapper anIDMapper =
+ anInput->GetTimeStampOnMesh(aColoredPrs->GetCMeshName(),
+ aEntity,
+ theFieldName,
+ aTimeStampNumber);
+ if(GetSpecificDeformedPL() && anIDMapper) {
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformationPL, VISU::PUnstructuredGridIDMapper>
+ (GetSpecificDeformedPL(), &VISU_DeformationPL::SetVectorialField, anIDMapper));
+
+ VISU::TSetModified aModified(GetColoredPrs3d());
+
+ myVectorialEntity = theEntity;
+ myVectorialFieldName = theFieldName;
+ myVectorialField = anIDMapper;
+ }
+};
#define VISU_Deformation_i_HeaderFile
#include "VISU_I.hxx"
-#include "VISU_Prs3d_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
#include "VISU_DeformationPL.hxx"
public:
typedef VISU::Deformation TInterface;
- Deformation_i(Prs3d_i* theModifiedEngine);
+ Deformation_i(VISU::ColoredPrs3d_i* theColoredPrs3d);
virtual ~Deformation_i();
virtual
char*
GetVectorialFieldName();
+ virtual void SetVectorialField(Entity theEntity, const char* theFieldName);
+
protected:
virtual
void
return myDeformationPL;
}
- void SetVField(VISU::Entity theEntity,
- const char* theFieldName,
- PUnstructuredGridIDMapper,
- PField theVectorialField);
-
- Prs3d_i* GetModifiedEngine(){
- return myModifiedEngine;
+ ColoredPrs3d_i* GetColoredPrs3d(){
+ return myColoredPrs3d;
}
PField myVectorialField;
VISU::Entity myVectorialEntity;
std::string myVectorialFieldName;
- Prs3d_i *myModifiedEngine;
+ ColoredPrs3d_i *myColoredPrs3d;
};
}
#endif
//---------------------------------------------------------------
-VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::Prs3d_i *theModifiedEngine):
- Deformation_i(theModifiedEngine)
+VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d):
+ Deformation_i(theColoredPrs3d)
{
if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()");
}
void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){
if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()");
- VISU::TSetModified aModified(GetModifiedEngine());
+ VISU::TSetModified aModified(GetColoredPrs3d());
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_OptionalDeformationPL, bool>
(GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag));
typedef VISU::OptionalDeformation TInterface;
typedef Deformation_i TSuperClass;
- OptionalDeformation_i(Prs3d_i* theModifiedEngine);
+ OptionalDeformation_i(VISU::ColoredPrs3d_i* theModifiedEngine);
virtual ~OptionalDeformation_i();
virtual void UseDeformation(CORBA::Boolean theFlag);