Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / OBJECT / VISU_DataSetActor.cxx
1 //  VISU OBJECT : 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   : 
25 //  Author : 
26 //  Module : VISU
27
28 #include "VISU_DataSetActor.h"
29 #include "VISU_UnstructuredGridPL.hxx"
30 #include "VISU_PipeLineUtils.hxx"
31
32 #include <vtkDataSetMapper.h>
33 #include <vtkObjectFactory.h>
34
35 #include <boost/bind.hpp>
36
37 using namespace std;
38
39 #ifdef _DEBUG_
40 static int MYDEBUG = 0;
41 #else
42 static int MYDEBUG = 0;
43 #endif
44
45 //----------------------------------------------------------------------------
46 vtkStandardNewMacro(VISU_DataSetActor);
47
48 //----------------------------------------------------------------------------
49 VISU_DataSetActor
50 ::VISU_DataSetActor():
51   myMapper(vtkDataSetMapper::New())
52 {
53   if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<<this);
54
55   myMapper->Delete();
56 }
57
58 //----------------------------------------------------------------------------
59 VISU_DataSetActor
60 ::~VISU_DataSetActor()
61 {
62   if(MYDEBUG) MESSAGE("~VISU_DataSetActor() - this = "<<this);
63 }
64
65 //----------------------------------------------------------------------------
66 void
67 VISU_DataSetActor
68 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
69 {
70   Superclass::ShallowCopyPL(thePipeLine);
71
72   if(VISU_UnstructuredGridPL* aPipeLine = dynamic_cast<VISU_UnstructuredGridPL*>(thePipeLine)){
73     vtkDataSetMapper* aTarget = GetDataSetMapper();
74     vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper();
75     VISU::CopyDataSetMapper(aTarget, aSource, true);
76     aTarget->SetLookupTable(aSource->GetLookupTable());
77   }
78 }
79
80 //----------------------------------------------------------------------------
81 void
82 VISU_DataSetActor
83 ::SetMapperInput(vtkDataSet* theDataSet) 
84 {
85   myMapper->SetInput(theDataSet);
86   SetMapper(myMapper.GetPointer());
87 }
88
89 //----------------------------------------------------------------------------
90 vtkDataSetMapper* 
91 VISU_DataSetActor
92 ::GetDataSetMapper()
93 {
94   return myMapper.GetPointer();
95 }