1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 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
24 // File: VISU_MapperHolder.cxx
25 // Author: Alexey PETROV
29 #include "VISU_MapperHolder.hxx"
30 #include "VISU_PipeLine.hxx"
32 #include "VISU_PipeLineUtils.hxx"
34 #include <vtkDataSet.h>
37 static int MYDEBUG = 0;
39 static int MYDEBUG = 0;
43 //----------------------------------------------------------------------------
45 ::VISU_MapperHolder():
49 MESSAGE("VISU_MapperHolder::VISU_MapperHolder - "<<this);
53 //----------------------------------------------------------------------------
55 ::~VISU_MapperHolder()
58 MESSAGE("VISU_MapperHolder::~VISU_MapperHolder - "<<this);
62 //----------------------------------------------------------------------------
65 ::ShallowCopy(VISU_MapperHolder *theMapperHolder,
69 SetIDMapper(theMapperHolder->GetIDMapper());
71 VISU::CopyMapper(GetMapper(),
72 theMapperHolder->GetMapper(),
77 //----------------------------------------------------------------------------
82 unsigned long int aSize = 0;
84 if(myMapper.GetPointer())
85 if(vtkDataSet* aDataSet = myMapper->GetInput())
86 aSize = aDataSet->GetActualMemorySize() * 1024;
89 aSize += myIDMapper->GetMemorySize();
95 //----------------------------------------------------------------------------
100 unsigned long int aTime = Superclass::GetMTime();
103 if(vtkDataSet* aDataSet = myIDMapper->GetOutput())
104 aTime = std::max(aTime, aDataSet->GetMTime());
106 if(myMapper.GetPointer())
107 aTime = std::max(aTime, myMapper->GetMTime());
113 //----------------------------------------------------------------------------
116 ::SetPipeLine(VISU_PipeLine* thePipeLine)
118 myPipeLine = thePipeLine;
122 //----------------------------------------------------------------------------
125 ::SetIDMapper(const VISU::PIDMapper& theIDMapper)
127 if(myIDMapper == theIDMapper)
130 myIDMapper = theIDMapper;
132 if(myPipeLine && GetInput())
133 if(!GetMapper()->GetInput()){
136 myPipeLine->Update();
143 //----------------------------------------------------------------------------
144 const VISU::PIDMapper&
152 //----------------------------------------------------------------------------
158 return myIDMapper->GetOutput();
164 //----------------------------------------------------------------------------
169 if(!myMapper.GetPointer())
172 return myMapper.GetPointer();
176 //----------------------------------------------------------------------------
181 if(myMapper.GetPointer())
182 return myMapper->GetInput();
188 //----------------------------------------------------------------------------
193 if(myMapper.GetPointer())
194 return myMapper->Update();
198 //----------------------------------------------------------------------------
201 ::SetMapper(vtkMapper* theMapper)
203 myMapper = theMapper;
207 //----------------------------------------------------------------------------
210 ::GetNodeObjID(vtkIdType theID)
212 return myIDMapper->GetNodeObjID(theID);
215 //----------------------------------------------------------------------------
218 ::GetNodeVTKID(vtkIdType theID)
220 return myIDMapper->GetNodeVTKID(theID);
223 //----------------------------------------------------------------------------
224 vtkFloatingPointType*
226 ::GetNodeCoord(vtkIdType theObjID)
228 return myIDMapper->GetNodeCoord(theObjID);
232 //----------------------------------------------------------------------------
235 ::GetElemObjID(vtkIdType theID)
237 return myIDMapper->GetElemObjID(theID);
240 //----------------------------------------------------------------------------
243 ::GetElemVTKID(vtkIdType theID)
245 return myIDMapper->GetElemVTKID(theID);
248 //----------------------------------------------------------------------------
251 ::GetElemCell(vtkIdType theObjID)
253 return myIDMapper->GetElemCell(theObjID);
257 //----------------------------------------------------------------------------