static int MYDEBUG = 0;
#endif
-VISU_PipeLine::VISU_PipeLine()
+VISU_PipeLine
+::VISU_PipeLine():
+ myMapper(vtkDataSetMapper::New()),
+ myExtractGeometry(SALOME_ExtractGeometry::New())
{
- if(MYDEBUG) MESSAGE("VISU_PipeLine - "<<this);
+ if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
SetDebug(MYVTKDEBUG);
+ myMapper->Delete();
+
// Clipping planes
- myExtractGeometry = SALOME_ExtractGeometry::New();
myExtractGeometry->Delete();
- //myExtractGeometry->DebugOn();
myExtractGeometry->SetExtractInside(0);
//myExtractGeometry->SetReleaseDataFlag(true);
anImplicitBoolean->SetOperationTypeToIntersection();
anImplicitBoolean->Delete();
- // Mapper
- myMapper = vtkDataSetMapper::New();
- myInput = NULL;
-
myIsShrinkable = false;
}
-VISU_PipeLine::~VISU_PipeLine()
+VISU_PipeLine
+::~VISU_PipeLine()
{
- if(MYDEBUG) MESSAGE("~VISU_PipeLine - "<<this);
- myMapper->Delete();
+ if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<<this);
+}
+
+// Turn debugging output on.
+void
+VISU_PipeLine
+::DebugOn()
+{
+ myExtractGeometry->DebugOn();
+ Superclass::DebugOn();
+}
+
+// Turn debugging output off.
+void
+VISU_PipeLine
+::DebugOff()
+{
+ myExtractGeometry->DebugOff();
+ Superclass::DebugOff();
}
void
void VISU_PipeLine::SameAs(VISU_PipeLine *thePipeLine){
ShallowCopy(thePipeLine);
- vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
- SetImplicitFunction(anImplicitBoolean);
- anImplicitBoolean->Delete();
+ SetImplicitFunction(vtkImplicitBoolean::New());
+ GetImplicitFunction()->Delete();
}
-TInput* VISU_PipeLine::GetInput() const
+TInput*
+VISU_PipeLine
+::GetInput() const
{
- return myInput;
+ return myInput.GetPointer();
}
-TInput* VISU_PipeLine::GetInput2() const
+TInput*
+VISU_PipeLine
+::GetInput2() const
{
vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
aDataSet->Update();
return aDataSet;
}
-void VISU_PipeLine::SetInput(TInput* theInput)
+void
+VISU_PipeLine
+::SetInput(TInput* theInput)
{
+ if(theInput)
+ theInput->Update();
+
myExtractGeometry->SetInput(theInput);
- if((myInput = theInput))
- myInput->Update();
+ myInput = theInput;
Modified();
}
-VISU_PipeLine::TMapper* VISU_PipeLine::GetMapper()
+VISU_PipeLine::TMapper*
+VISU_PipeLine
+::GetMapper()
{
if(GetInput()){
if(!myMapper->GetInput()){
}
myMapper->Update();
}
- return myMapper;
+ return myMapper.GetPointer();
}
-void VISU_PipeLine::Update()
+void
+VISU_PipeLine
+::Update()
{
myMapper->Update();
}
-int VISU_PipeLine::CheckAvailableMemory(const float& theSize)
+int
+VISU_PipeLine
+::CheckAvailableMemory(const float& theSize)
{
try{
if(theSize > ULONG_MAX) return 0;
return 0;
}
-float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize)
+float
+VISU_PipeLine
+::GetAvailableMemory(float theSize,
+ float theMinSize)
{
while(!CheckAvailableMemory(theSize))
if(theSize > theMinSize)
}
//------------------------ Clipping planes -----------------------------------
-
-bool VISU_PipeLine::AddClippingPlane(vtkPlane* thePlane)
+bool
+VISU_PipeLine
+::AddClippingPlane(vtkPlane* thePlane)
{
if (thePlane) {
if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
return true;
}
-vtkPlane* VISU_PipeLine::GetClippingPlane(vtkIdType theID) const
+vtkPlane*
+VISU_PipeLine
+::GetClippingPlane(vtkIdType theID) const
{
vtkPlane* aPlane = NULL;
if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
return aPlane;
}
-void VISU_PipeLine::RemoveAllClippingPlanes()
+void
+VISU_PipeLine
+::RemoveAllClippingPlanes()
{
if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
}
}
-vtkIdType VISU_PipeLine::GetNumberOfClippingPlanes() const
+vtkIdType
+VISU_PipeLine
+::GetNumberOfClippingPlanes() const
{
if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
return 0;
}
-static void ComputeBoundsParam (vtkDataSet* theDataSet,
- float theDirection[3], float theMinPnt[3],
- float& theMaxBoundPrj, float& theMinBoundPrj)
+static
+void
+ComputeBoundsParam (vtkDataSet* theDataSet,
+ float theDirection[3],
+ float theMinPnt[3],
+ float& theMaxBoundPrj,
+ float& theMinBoundPrj)
{
float aBounds[6];
theDataSet->GetBounds(aBounds);
theMinPnt[2] = aMinPnt[2];
}
-static void DistanceToPosition (vtkDataSet* theDataSet,
- float theDirection[3], float theDist, float thePos[3])
+static
+void
+DistanceToPosition(vtkDataSet* theDataSet,
+ float theDirection[3],
+ float theDist,
+ float thePos[3])
{
float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
}
-static void PositionToDistance (vtkDataSet* theDataSet,
- float theDirection[3], float thePos[3], float& theDist)
+static
+void
+PositionToDistance (vtkDataSet* theDataSet,
+ float theDirection[3],
+ float thePos[3],
+ float& theDist)
{
float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
}
-void VISU_PipeLine::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane)
+void
+VISU_PipeLine
+::SetPlaneParam(float theDir[3],
+ float theDist,
+ vtkPlane* thePlane)
{
thePlane->SetNormal(theDir);
float anOrigin[3];
thePlane->SetOrigin(anOrigin);
}
-void VISU_PipeLine::GetPlaneParam (float theDir[3], float& theDist, vtkPlane* thePlane)
+void
+VISU_PipeLine
+::GetPlaneParam(float theDir[3],
+ float& theDist,
+ vtkPlane* thePlane)
{
thePlane->GetNormal(theDir);
//function : IsPlanarInput
//purpose :
//=======================================================================
-bool VISU_PipeLine::IsPlanarInput() const
+bool
+VISU_PipeLine
+::IsPlanarInput() const
{
float aBounds[6];
GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
class VISU_PipeLine : public vtkObject{
public:
vtkTypeMacro(VISU_PipeLine,vtkObject);
- virtual ~VISU_PipeLine();
+ virtual
+ ~VISU_PipeLine();
+
+ virtual
+ void
+ DebugOn();
+
+ virtual
+ void
+ DebugOff();
+
+ virtual
+ void
+ ShallowCopy(VISU_PipeLine *thePipeLine);
- virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
- virtual void SameAs(VISU_PipeLine *thePipeLine);
+ virtual
+ void
+ SameAs(VISU_PipeLine *thePipeLine);
public:
- virtual void SetInput(TInput* theInput);
- virtual TInput* GetInput() const;
+ virtual
+ void
+ SetInput(TInput* theInput);
- bool IsPlanarInput() const;
+ virtual
+ TInput*
+ GetInput() const;
+
+ bool
+ IsPlanarInput() const;
typedef vtkMapper TMapper;
- virtual TMapper* GetMapper();
- virtual void Init() = 0;
- virtual void Update();
+ virtual
+ TMapper*
+ GetMapper();
+
+ virtual
+ void
+ Init() = 0;
- static int CheckAvailableMemory(const float& theSize);
- static float GetAvailableMemory(float theSize = 16*1024*1024.0,
- float theMinSize = 1024*1024.0);
+ virtual
+ void
+ Update();
+
+ static
+ int
+ CheckAvailableMemory(const float& theSize);
+
+ static
+ float
+ GetAvailableMemory(float theSize = 16*1024*1024.0,
+ float theMinSize = 1024*1024.0);
// Clipping planes
- void RemoveAllClippingPlanes();
- vtkIdType GetNumberOfClippingPlanes() const;
- bool AddClippingPlane(vtkPlane* thePlane);
- vtkPlane* GetClippingPlane(vtkIdType theID) const;
+ void
+ RemoveAllClippingPlanes();
+
+ vtkIdType
+ GetNumberOfClippingPlanes() const;
+
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
- void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
- void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID) const;
- bool IsShrinkable() { return myIsShrinkable; }
+ void
+ SetPlaneParam(float theDir[3],
+ float theDist,
+ vtkPlane* thePlane);
+
+ void
+ GetPlaneParam(float theDir[3],
+ float& theDist,
+ vtkPlane* thePlane);
+
+ bool
+ IsShrinkable() { return myIsShrinkable; }
virtual
vtkIdType
const VISU::PIDMapper&
GetIDMapper()const;
- void SetImplicitFunction(vtkImplicitFunction *theFunction);
- vtkImplicitFunction* GetImplicitFunction();
- void SetExtractInside (int);
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
+ void
+ SetExtractInside(int);
protected:
VISU_PipeLine();
VISU_PipeLine(const VISU_PipeLine&);
- virtual TInput* GetInput2() const;
- virtual void Build() = 0;
+ virtual
+ TInput*
+ GetInput2() const;
+
+ virtual
+ void
+ Build() = 0;
bool myIsShrinkable;
- TInput *myInput;
+ TVTKSmartPtr<TInput> myInput;
VISU::PIDMapper myIDMapper;
- vtkDataSetMapper *myMapper;
+ TVTKSmartPtr<vtkDataSetMapper> myMapper;
// Clipping planes
TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;