1 // Copyright (C) 2007-2008 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
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File: VISU_MapperHolder.cxx
24 // Author: Alexey PETROV
27 #include "VISU_MapperHolder.hxx"
28 #include "VISU_PipeLine.hxx"
30 #include "VISU_PipeLineUtils.hxx"
32 #include <vtkDataSet.h>
35 static int MYDEBUG = 0;
37 static int MYDEBUG = 0;
41 //----------------------------------------------------------------------------
43 ::VISU_MapperHolder():
47 MESSAGE("VISU_MapperHolder::VISU_MapperHolder - "<<this);
51 //----------------------------------------------------------------------------
53 ::~VISU_MapperHolder()
56 MESSAGE("VISU_MapperHolder::~VISU_MapperHolder - "<<this);
60 //----------------------------------------------------------------------------
63 ::ShallowCopy(VISU_MapperHolder *theMapperHolder,
67 SetIDMapper(theMapperHolder->GetIDMapper());
69 VISU::CopyMapper(GetMapper(),
70 theMapperHolder->GetMapper(),
75 //----------------------------------------------------------------------------
80 unsigned long int aSize = 0;
82 if(myMapper.GetPointer())
83 if(vtkDataSet* aDataSet = myMapper->GetInput())
84 aSize = aDataSet->GetActualMemorySize() * 1024;
87 aSize += myIDMapper->GetMemorySize();
93 //----------------------------------------------------------------------------
98 unsigned long int aTime = Superclass::GetMTime();
101 if(vtkDataSet* aDataSet = myIDMapper->GetOutput())
102 aTime = std::max(aTime, aDataSet->GetMTime());
104 if(myMapper.GetPointer())
105 aTime = std::max(aTime, myMapper->GetMTime());
111 //----------------------------------------------------------------------------
114 ::SetPipeLine(VISU_PipeLine* thePipeLine)
116 myPipeLine = thePipeLine;
120 //----------------------------------------------------------------------------
123 ::SetIDMapper(const VISU::PIDMapper& theIDMapper)
125 if(myIDMapper == theIDMapper)
128 myIDMapper = theIDMapper;
130 if(myPipeLine && GetInput())
131 if(!GetMapper()->GetInput()){
134 myPipeLine->Update();
141 //----------------------------------------------------------------------------
142 const VISU::PIDMapper&
150 //----------------------------------------------------------------------------
156 return myIDMapper->GetOutput();
162 //----------------------------------------------------------------------------
167 if(!myMapper.GetPointer())
170 return myMapper.GetPointer();
174 //----------------------------------------------------------------------------
179 if(myMapper.GetPointer())
180 return myMapper->GetInput();
186 //----------------------------------------------------------------------------
191 if(myMapper.GetPointer())
192 return myMapper->Update();
196 //----------------------------------------------------------------------------
199 ::SetMapper(vtkMapper* theMapper)
201 myMapper = theMapper;
205 //----------------------------------------------------------------------------
208 ::GetNodeObjID(vtkIdType theID)
210 return myIDMapper->GetNodeObjID(theID);
213 //----------------------------------------------------------------------------
216 ::GetNodeVTKID(vtkIdType theID)
218 return myIDMapper->GetNodeVTKID(theID);
221 //----------------------------------------------------------------------------
222 vtkFloatingPointType*
224 ::GetNodeCoord(vtkIdType theObjID)
226 return myIDMapper->GetNodeCoord(theObjID);
230 //----------------------------------------------------------------------------
233 ::GetElemObjID(vtkIdType theID)
235 return myIDMapper->GetElemObjID(theID);
238 //----------------------------------------------------------------------------
241 ::GetElemVTKID(vtkIdType theID)
243 return myIDMapper->GetElemVTKID(theID);
246 //----------------------------------------------------------------------------
249 ::GetElemCell(vtkIdType theObjID)
251 return myIDMapper->GetElemCell(theObjID);
255 //----------------------------------------------------------------------------