Version: 6.3.1

src/PIPELINE/VISU_PipeLineUtils.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  VISU OBJECT : interactive object for VISU entities implementation
00024 // File:    VISU_PipeLine.hxx
00025 // Author:  Alexey PETROV
00026 // Module : VISU
00027 //
00028 #ifndef VISU_PipeLineUtils_HeaderFile
00029 #define VISU_PipeLineUtils_HeaderFile
00030 
00031 #include "VISUPipeline.hxx"
00032 #include "VISU_ConvertorUtils.hxx"
00033 #include "VISU_CellDataToPointData.hxx"
00034 
00035 #include <vtkProperty.h>
00036 #include <vtkObjectFactory.h>
00037 #include <vtkDataSetMapper.h>
00038 #include <vtkUnstructuredGrid.h>
00039 
00040 #include <vtkPointData.h>
00041 #include <vtkCellData.h>
00042 #include <vtkPolyData.h>
00043 
00044 #include <vtkMath.h>
00045 
00046 #ifndef MESSAGE
00047 #define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
00048 
00049 #undef EXCEPT
00050 #define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
00051 
00052 #undef EXCEPTION
00053 #define EXCEPTION(msg) EXCEPT(msg).latin1()
00054 
00055 #endif
00056 
00057 class VISU_OpenGLPointSpriteMapper;
00058 
00059 namespace VISU
00060 {
00061   //----------------------------------------------------------------------------
00062   void
00063   Mul(const vtkFloatingPointType A[3], 
00064       vtkFloatingPointType b, 
00065       vtkFloatingPointType C[3]); // C = A * b
00066   
00067 
00068   //----------------------------------------------------------------------------
00069   void
00070   Sub(const vtkFloatingPointType A[3], 
00071       const vtkFloatingPointType B[3], 
00072       vtkFloatingPointType C[3]); // C = A - B
00073 
00074 
00075   //----------------------------------------------------------------------------
00076   template<class TOutputFilter> 
00077   void
00078   CellDataToPoint(TOutputFilter* theOutputFilter, 
00079                   VISU_CellDataToPointData *theCellDataToPointData,
00080                   vtkDataSet* theDataSet)
00081 
00082   {
00083     if(VISU::IsDataOnCells(theDataSet)){
00084       theCellDataToPointData->SetInput(theDataSet);
00085       theCellDataToPointData->PassCellDataOn();
00086       theOutputFilter->SetInput(theCellDataToPointData->GetUnstructuredGridOutput());
00087     }else
00088       theOutputFilter->SetInput(theDataSet);
00089   }
00090 
00091   //----------------------------------------------------------------------------
00093   bool VISU_PIPELINE_EXPORT
00094   CheckIsSameValue(vtkFloatingPointType theTarget,
00095                    vtkFloatingPointType theSource);
00096 
00098   bool VISU_PIPELINE_EXPORT
00099   CheckIsSameRange(vtkFloatingPointType* theTarget,
00100                    vtkFloatingPointType* theSource);
00101 
00103   void VISU_PIPELINE_EXPORT
00104   CopyMapper(vtkMapper* theTarget, 
00105              vtkMapper* theSource,
00106              bool theIsCopyInput);
00107 
00109   void VISU_PIPELINE_EXPORT
00110   CopyDataSetMapper(vtkDataSetMapper* theTarget, 
00111                     vtkDataSetMapper* theSource,
00112                     bool theIsCopyInput);
00113 
00115   void VISU_PIPELINE_EXPORT
00116   CopyPolyDataMapper(vtkPolyDataMapper* theTarget, 
00117                      vtkPolyDataMapper* theSource,
00118                      bool theIsCopyInput);
00119 
00121   void VISU_PIPELINE_EXPORT
00122   CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget, 
00123                             VISU_OpenGLPointSpriteMapper* theSource,
00124                             bool theIsCopyInput);
00125 
00126 
00127   //----------------------------------------------------------------------------
00128   void VISU_PIPELINE_EXPORT
00129   ComputeBoundsParam(vtkFloatingPointType theBounds[6],
00130                      vtkFloatingPointType theDirection[3], 
00131                      vtkFloatingPointType theMinPnt[3],
00132                      vtkFloatingPointType& theMaxBoundPrj, 
00133                      vtkFloatingPointType& theMinBoundPrj);
00134 
00135 
00136   //----------------------------------------------------------------------------
00137   void VISU_PIPELINE_EXPORT
00138   DistanceToPosition(vtkFloatingPointType theBounds[6],
00139                      vtkFloatingPointType theDirection[3], 
00140                      vtkFloatingPointType theDist, 
00141                      vtkFloatingPointType thePos[3]);
00142 
00143 
00144   //----------------------------------------------------------------------------
00145   void VISU_PIPELINE_EXPORT
00146   PositionToDistance(vtkFloatingPointType theBounds[6],
00147                      vtkFloatingPointType theDirection[3], 
00148                      vtkFloatingPointType thePos[3], 
00149                      vtkFloatingPointType& theDist);
00150 
00151 
00152   //----------------------------------------------------------------------------
00153   bool VISU_PIPELINE_EXPORT
00154   IsQuadraticData(vtkDataSet* theDataSet);
00155 
00156   //----------------------------------------------------------------------------
00157   void VISU_PIPELINE_EXPORT
00158   ComputeVisibleBounds(vtkDataSet* theDataSet,
00159                        vtkFloatingPointType theBounds[6]);
00160 
00161   //----------------------------------------------------------------------------
00162   void VISU_PIPELINE_EXPORT
00163   ComputeBoxCenter(vtkFloatingPointType theBounds[6], vtkFloatingPointType theCenter[3]);
00164 
00165   //----------------------------------------------------------------------------
00166   double VISU_PIPELINE_EXPORT
00167   ComputeBoxDiagonal(vtkFloatingPointType theBounds[6]);
00168 
00169 }
00170 
00171 #endif
00172   
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS