X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPIPELINE%2FVISU_PipeLineUtils.hxx;h=f65aea6b40f5582f2db70df8929aae7aaae02b3c;hb=d920ec40769170efb5b1750fd8192cb789537b70;hp=7b2523506501a1ffc50665c16906e6843b7ba61f;hpb=953451df51750a1d9910c0325f01d5ca7b6e0330;p=modules%2Fvisu.git diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index 7b252350..f65aea6b 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -1,43 +1,42 @@ -// VISU OBJECT : interactive object for VISU entities implementation +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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. // -// Copyright (C) 2003 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 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// 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 // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// VISU OBJECT : interactive object for VISU entities implementation // File: VISU_PipeLine.hxx // Author: Alexey PETROV // Module : VISU - +// #ifndef VISU_PipeLineUtils_HeaderFile #define VISU_PipeLineUtils_HeaderFile -#include "VISU_FieldTransform.hxx" -#include "VISU_LookupTable.hxx" -#include "VISU_Extractor.hxx" +#include "VISUPipeline.hxx" +#include "VISU_ConvertorUtils.hxx" +#include "VISU_CellDataToPointData.hxx" #include #include #include #include -#include -#include #include #include #include @@ -55,39 +54,118 @@ #endif -namespace VISU{ - void Mul(const float A[3], float b, float C[3]); // C = A * b - void Sub(const float A[3], const float B[3], float C[3]); // C = A - B +class VISU_OpenGLPointSpriteMapper; - template +namespace VISU +{ + //---------------------------------------------------------------------------- void - CellDataToPoint(TItem* theTItem, - vtkCellDataToPointData *theFilter, - vtkDataSet* theDataSet, - VISU_FieldTransform *theFieldTransform) - { - if(theDataSet->GetCellData()->GetNumberOfArrays()){ - theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput()); - theFilter->PassCellDataOn(); - theTItem->SetInput(theFilter->GetUnstructuredGridOutput()); - }else - theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput()); - } + Mul(const vtkFloatingPointType A[3], + vtkFloatingPointType b, + vtkFloatingPointType C[3]); // C = A * b + + + //---------------------------------------------------------------------------- + void + Sub(const vtkFloatingPointType A[3], + const vtkFloatingPointType B[3], + vtkFloatingPointType C[3]); // C = A - B + - template + //---------------------------------------------------------------------------- + template void - ToCellCenters(TItem* theTItem, - vtkCellCenters *theFilter, - vtkDataSet* theDataSet, - VISU_FieldTransform *theFieldTransform) + CellDataToPoint(TOutputFilter* theOutputFilter, + VISU_CellDataToPointData *theCellDataToPointData, + vtkDataSet* theDataSet) + { - if(theDataSet->GetCellData()->GetNumberOfArrays()){ - theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput()); - theFilter->VertexCellsOn(); - theTItem->SetInput(theFilter->GetOutput()); + if(VISU::IsDataOnCells(theDataSet)){ + theCellDataToPointData->SetInput(theDataSet); + theCellDataToPointData->PassCellDataOn(); + theOutputFilter->SetInput(theCellDataToPointData->GetUnstructuredGridOutput()); }else - theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput()); + theOutputFilter->SetInput(theDataSet); } + + //---------------------------------------------------------------------------- + //! Checks whether the float values are the same or not + bool VISU_PIPELINE_EXPORT + CheckIsSameValue(vtkFloatingPointType theTarget, + vtkFloatingPointType theSource); + + //! Checks whether the scalar range is the same or not + bool VISU_PIPELINE_EXPORT + CheckIsSameRange(vtkFloatingPointType* theTarget, + vtkFloatingPointType* theSource); + + //! Customizes vtkMapper::ShallowCopy + void VISU_PIPELINE_EXPORT + CopyMapper(vtkMapper* theTarget, + vtkMapper* theSource, + bool theIsCopyInput); + + //! Customizes vtkDataSetMapper::ShallowCopy + void VISU_PIPELINE_EXPORT + CopyDataSetMapper(vtkDataSetMapper* theTarget, + vtkDataSetMapper* theSource, + bool theIsCopyInput); + + //! Customizes vtkPolyDataMapper::ShallowCopy + void VISU_PIPELINE_EXPORT + CopyPolyDataMapper(vtkPolyDataMapper* theTarget, + vtkPolyDataMapper* theSource, + bool theIsCopyInput); + + //! Customizes VISU_OpenGLPointSpriteMapper::ShallowCopy + void VISU_PIPELINE_EXPORT + CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, + VISU_OpenGLPointSpriteMapper* theSource, + bool theIsCopyInput); + + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + ComputeBoundsParam(vtkFloatingPointType theBounds[6], + vtkFloatingPointType theDirection[3], + vtkFloatingPointType theMinPnt[3], + vtkFloatingPointType& theMaxBoundPrj, + vtkFloatingPointType& theMinBoundPrj); + + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + DistanceToPosition(vtkFloatingPointType theBounds[6], + vtkFloatingPointType theDirection[3], + vtkFloatingPointType theDist, + vtkFloatingPointType thePos[3]); + + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + PositionToDistance(vtkFloatingPointType theBounds[6], + vtkFloatingPointType theDirection[3], + vtkFloatingPointType thePos[3], + vtkFloatingPointType& theDist); + + + //---------------------------------------------------------------------------- + bool VISU_PIPELINE_EXPORT + IsQuadraticData(vtkDataSet* theDataSet); + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + ComputeVisibleBounds(vtkDataSet* theDataSet, + vtkFloatingPointType theBounds[6]); + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + ComputeBoxCenter(vtkFloatingPointType theBounds[6], vtkFloatingPointType theCenter[3]); + + //---------------------------------------------------------------------------- + double VISU_PIPELINE_EXPORT + ComputeBoxDiagonal(vtkFloatingPointType theBounds[6]); + } #endif