1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File: VISU_PipeLine.hxx
25 // Author: Alexey PETROV
28 #ifndef VISU_PipeLineUtils_HeaderFile
29 #define VISU_PipeLineUtils_HeaderFile
31 #include "VISUPipeline.hxx"
32 #include "VISU_ConvertorUtils.hxx"
33 #include "VISU_CellDataToPointData.hxx"
35 #include <vtkProperty.h>
36 #include <vtkObjectFactory.h>
37 #include <vtkDataSetMapper.h>
38 #include <vtkUnstructuredGrid.h>
40 #include <vtkPointData.h>
41 #include <vtkCellData.h>
42 #include <vtkPolyData.h>
47 #define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
50 #define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
53 #define EXCEPTION(msg) EXCEPT(msg).latin1()
57 class VISU_OpenGLPointSpriteMapper;
61 //----------------------------------------------------------------------------
63 Mul(const double A[3],
65 double C[3]); // C = A * b
68 //----------------------------------------------------------------------------
70 Sub(const double A[3],
72 double C[3]); // C = A - B
75 //----------------------------------------------------------------------------
76 template<class TOutputFilter>
78 CellDataToPoint(TOutputFilter* theOutputFilter,
79 VISU_CellDataToPointData *theCellDataToPointData,
80 vtkDataSet* theDataSet,
81 vtkAlgorithmOutput* theAlgorithmOutput)
84 if(VISU::IsDataOnCells(theDataSet)){
85 theCellDataToPointData->SetInputConnection(theAlgorithmOutput);
86 theCellDataToPointData->PassCellDataOn();
87 theOutputFilter->SetInputConnection(theCellDataToPointData->GetOutputPort());
89 theOutputFilter->SetInputConnection(theAlgorithmOutput);
92 //----------------------------------------------------------------------------
93 //! Checks whether the float values are the same or not
94 bool VISU_PIPELINE_EXPORT
95 CheckIsSameValue(double theTarget,
98 //! Checks whether the scalar range is the same or not
99 bool VISU_PIPELINE_EXPORT
100 CheckIsSameRange(double* theTarget,
103 //! Customizes vtkMapper::ShallowCopy
104 void VISU_PIPELINE_EXPORT
105 CopyMapper(vtkMapper* theTarget,
106 vtkMapper* theSource,
107 bool theIsCopyInput);
109 //! Customizes vtkDataSetMapper::ShallowCopy
110 void VISU_PIPELINE_EXPORT
111 CopyDataSetMapper(vtkDataSetMapper* theTarget,
112 vtkDataSetMapper* theSource,
113 bool theIsCopyInput);
115 //! Customizes vtkPolyDataMapper::ShallowCopy
116 void VISU_PIPELINE_EXPORT
117 CopyPolyDataMapper(vtkPolyDataMapper* theTarget,
118 vtkPolyDataMapper* theSource,
119 bool theIsCopyInput);
121 //! Customizes VISU_OpenGLPointSpriteMapper::ShallowCopy
122 void VISU_PIPELINE_EXPORT
123 CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget,
124 VISU_OpenGLPointSpriteMapper* theSource,
125 bool theIsCopyInput);
128 //----------------------------------------------------------------------------
129 void VISU_PIPELINE_EXPORT
130 ComputeBoundsParam(double theBounds[6],
131 double theDirection[3],
133 double& theMaxBoundPrj,
134 double& theMinBoundPrj);
137 //----------------------------------------------------------------------------
138 void VISU_PIPELINE_EXPORT
139 DistanceToPosition(double theBounds[6],
140 double theDirection[3],
145 //----------------------------------------------------------------------------
146 void VISU_PIPELINE_EXPORT
147 PositionToDistance(double theBounds[6],
148 double theDirection[3],
153 //----------------------------------------------------------------------------
154 bool VISU_PIPELINE_EXPORT
155 IsQuadraticData(vtkDataSet* theDataSet);
157 //----------------------------------------------------------------------------
158 void VISU_PIPELINE_EXPORT
159 ComputeVisibleBounds(vtkDataSet* theDataSet,
160 double theBounds[6]);
162 //----------------------------------------------------------------------------
163 void VISU_PIPELINE_EXPORT
164 ComputeBoxCenter(double theBounds[6], double theCenter[3]);
166 //----------------------------------------------------------------------------
167 double VISU_PIPELINE_EXPORT
168 ComputeBoxDiagonal(double theBounds[6]);