-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-//
-//
+
+// VISU OBJECT : interactive object for VISU entities implementation
// File: VISU_PipeLine.cxx
// Author: Alexey PETROV
// Module : VISU
-
-
+//
#include "VISU_PipeLine.hxx"
#include "VISU_MapperHolder.hxx"
#include <float.h>
#include <algorithm>
+#include <climits>
+#include <limits>
#ifdef _DEBUG_
static int MYDEBUG = 0;
//----------------------------------------------------------------------------
VISU_PipeLine
::VISU_PipeLine():
- myIsShrinkable(true)
+ myIsShrinkable(true),
+ myIsFeatureEdgesAllowed(true)
{
if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
+
+ vtkMath::UninitializeBounds(myVisibleBounds);
}
void
VISU_PipeLine
::ShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
+ bool theIsCopyInput)
{
SetImplicitFunction(thePipeLine->GetImplicitFunction());
DoShallowCopy(thePipeLine, theIsCopyInput);
void
VISU_PipeLine
::DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
+ bool theIsCopyInput)
{
GetMapperHolder()->ShallowCopy(thePipeLine->GetMapperHolder(),
- theIsCopyInput);
+ theIsCopyInput);
+ for( int i =0 ; i < 6 ; i++)
+ myVisibleBounds[i] = thePipeLine->myVisibleBounds[i];
+
+ myVisibleComputeTime = thePipeLine->myVisibleComputeTime;
}
VISU_PipeLine
::IsPlanarInput()
{
- vtkFloatingPointType aBounds[6];
+ double 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 ||
}
//----------------------------------------------------------------------------
-vtkFloatingPointType*
+double*
VISU_PipeLine
-::GetNodeCoord(int theObjID)
+::GetNodeCoord(vtkIdType theObjID)
{
return GetMapperHolder()->GetNodeCoord(theObjID);
}
}
+//----------------------------------------------------------------------------
+bool
+VISU_PipeLine
+::IsFeatureEdgesAllowed()
+{
+ return myIsFeatureEdgesAllowed;
+}
+
+void
+VISU_PipeLine
+::SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+ if(myIsFeatureEdgesAllowed == theIsFeatureEdgesAllowed)
+ return;
+
+ myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+ Modified();
+}
+
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
return GetMapperHolder()->GetClippingPlane(theID);
}
+//----------------------------------------------------------------------------
+void VISU_PipeLine::RemoveClippingPlane(vtkIdType theID)
+{
+ return GetMapperHolder()->RemoveClippingPlane(theID);
+}
+
//----------------------------------------------------------------------------
vtkDataSet*
VISU_PipeLine
return GetMapperHolder()->GetClippedInput();
}
+//----------------------------------------------------------------------------
+vtkAlgorithmOutput*
+VISU_PipeLine
+::GetClippedInputPort()
+{
+ return GetMapperHolder()->GetClippedInputPort();
+}
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::SetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType theDist,
- vtkPlane* thePlane)
+::SetPlaneParam(double theDir[3],
+ double theDist,
+ vtkPlane* thePlane)
{
thePlane->SetNormal(theDir);
- vtkFloatingPointType anOrigin[3];
- VISU::DistanceToPosition(GetInput(),
- theDir,
- theDist,
- anOrigin);
+ double anOrigin[3];
+
+ //Make sure that bounds are calculated
+ ComputeVisibleBounds();
+ VISU::DistanceToPosition(myVisibleBounds,
+ theDir,
+ theDist,
+ anOrigin);
thePlane->SetOrigin(anOrigin);
}
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::GetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType& theDist,
- vtkPlane* thePlane)
+::GetPlaneParam(double theDir[3],
+ double& theDist,
+ vtkPlane* thePlane)
{
thePlane->GetNormal(theDir);
-
- vtkFloatingPointType anOrigin[3];
+
+ double anOrigin[3];
thePlane->GetOrigin(anOrigin);
-
- VISU::PositionToDistance(GetInput(),
- theDir,
- anOrigin,
- theDist);
+
+ //Make sure that bounds are calculated
+ ComputeVisibleBounds();
+ VISU::PositionToDistance(myVisibleBounds,
+ theDir,
+ anOrigin,
+ theDist);
}
try{
size_t aSize = size_t(theSize);
if(char *aCheck = new char[aSize]){
- delete [] aCheck;
- return aSize;
+ delete [] aCheck;
+ return aSize;
}
}catch(std::bad_alloc& exc){
}catch(...){
//----------------------------------------------------------------------------
size_t
VISU_PipeLine
-::GetAvailableMemory(size_t theSize,
- size_t theMinSize)
+::GetAvailableMemory(double theSize,
+ double theMinSize)
{
// Finds acceptable memory size by half-deflection methods
static double EPSILON = 2 * 1024;
}
+//----------------------------------------------------------------------------
+// Re-compute visible bounds if need
+void VISU_PipeLine::ComputeVisibleBounds() {
+ if(GetMTime() > myVisibleComputeTime) {
+ VISU::ComputeVisibleBounds(GetMapperHolder()->GetOutput(), myVisibleBounds);
+ myVisibleComputeTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+void VISU_PipeLine::GetVisibleBounds(double theBounds[6]) {
+ // Compute or get cached bounds
+ ComputeVisibleBounds();
+ for (int i=0; i<6; i++) {
+ theBounds[i] = myVisibleBounds[i];
+ }
+}
+
//----------------------------------------------------------------------------