From: eap Date: Tue, 24 May 2005 10:39:06 +0000 (+0000) Subject: add IsPlanarInput() X-Git-Tag: V2_2_0_VISU_improvement_2005-05-27~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5cc84a290412619fc37bbdde9417e5198a957a6e;p=modules%2Fvisu.git add IsPlanarInput() --- diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index a5a36ad6..0c8223cd 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -31,7 +31,7 @@ #include "SALOME_ExtractGeometry.h" -#include +#include #include #include @@ -286,3 +286,21 @@ void VISU_PipeLine::GetPlaneParam (float theDir[3], float& theDist, vtkPlane* th thePlane->GetOrigin(anOrigin); ::PositionToDistance(GetInput(),theDir,anOrigin,theDist); } + +//======================================================================= +//function : IsPlanarInput +//purpose : +//======================================================================= + +bool VISU_PipeLine::IsPlanarInput() const +{ + float aBounds[6]; + GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax + if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN || + fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN || + fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN ) + return true; + + return false; +} + diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index 7267531e..91491e59 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -80,6 +80,8 @@ public: virtual void SetInput(TInput* theInput); virtual TInput* GetInput() const; + bool IsPlanarInput() const; + typedef vtkDataSetMapper TMapper; virtual TMapper* GetMapper();