Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / VTKViewer / VTKViewer_PassThroughFilter.cxx
1 //  SALOME FILTER : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : SALOME_PassThroughFilter.cxx
25 //  Author : Laurent CORNABE with help of Nicolas REJNERI
26 //  Module : SALOME
27
28
29 #include "VTKViewer_PassThroughFilter.h"
30
31 #include <vtkCellData.h>
32 #include <vtkDataSet.h>
33 #include <vtkObjectFactory.h>
34 #include <vtkPointData.h>
35 #include <vtkInformation.h>
36 #include <vtkInformationVector.h>
37
38 vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$");
39 vtkStandardNewMacro(VTKViewer_PassThroughFilter);
40
41 /*! \class VTKViewer_PassThroughFilter
42  * Passive filter take a dataset as input and create a dataset as output.\n
43  * The form of the input geometry is not changed in these filters, \n
44  * only the point attributes (e.g. scalars, vectors, etc.). 
45  */
46
47 /*!Execute method.Output calculation.*/
48 int VTKViewer_PassThroughFilter::RequestData(
49   vtkInformation *,
50   vtkInformationVector **inputVector,
51   vtkInformationVector *outputVector)
52 {
53   // get the info objects
54   vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
55   vtkInformation *outInfo = outputVector->GetInformationObject(0);
56
57   // get the input and ouptut
58   vtkDataSet *input = vtkDataSet::SafeDownCast(
59     inInfo->Get(vtkDataObject::DATA_OBJECT()));
60   vtkDataSet *output = vtkDataSet::SafeDownCast(
61     outInfo->Get(vtkDataObject::DATA_OBJECT()));
62
63   // This has to be here because it initialized all field datas.
64   output->CopyStructure( input );
65   
66   //! Pass all. (data object's field data is passed by the
67   //! superclass after this method)
68   output->GetPointData()->PassData( input->GetPointData() );
69   output->GetCellData()->PassData( input->GetCellData() );
70
71   return 1;
72 }
73
74 /*!Methods invoked by print to print information about the object including superclasses.\n
75  * Typically not called by the user (use Print() instead) but used in the hierarchical \n
76  * print process to combine the output of several classes. 
77  *\param os - output stream.
78  */
79 void VTKViewer_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
80 {
81   this->Superclass::PrintSelf(os,indent);
82 }