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_MapperHolder.cxx
25 // Author: Alexey PETROV
28 #include "VISU_MapperHolder.hxx"
29 #include "VISU_PipeLine.hxx"
31 #include "VISU_PipeLineUtils.hxx"
33 #include <vtkDataSet.h>
36 static int MYDEBUG = 0;
38 static int MYDEBUG = 0;
42 //----------------------------------------------------------------------------
44 ::VISU_MapperHolder():
48 MESSAGE("VISU_MapperHolder::VISU_MapperHolder - "<<this);
52 //----------------------------------------------------------------------------
54 ::~VISU_MapperHolder()
57 MESSAGE("VISU_MapperHolder::~VISU_MapperHolder - "<<this);
61 //----------------------------------------------------------------------------
64 ::ShallowCopy(VISU_MapperHolder *theMapperHolder,
68 SetIDMapper(theMapperHolder->GetIDMapper());
70 VISU::CopyMapper(GetMapper(),
71 theMapperHolder->GetMapper(),
76 //----------------------------------------------------------------------------
81 unsigned long int aSize = 0;
83 if(myMapper.GetPointer())
84 if(vtkDataSet* aDataSet = myMapper->GetInput())
85 aSize = aDataSet->GetActualMemorySize() * 1024;
88 aSize += myIDMapper->GetMemorySize();
94 //----------------------------------------------------------------------------
99 unsigned long int aTime = Superclass::GetMTime();
102 if(vtkDataSet* aDataSet = myIDMapper->GetOutput())
103 aTime = std::max(aTime, aDataSet->GetMTime());
105 if(myMapper.GetPointer())
106 aTime = std::max(aTime, myMapper->GetMTime());
112 //----------------------------------------------------------------------------
115 ::SetPipeLine(VISU_PipeLine* thePipeLine)
117 myPipeLine = thePipeLine;
121 //----------------------------------------------------------------------------
124 ::SetIDMapper(const VISU::PIDMapper& theIDMapper)
126 if(myIDMapper == theIDMapper)
129 myIDMapper = theIDMapper;
131 if(myPipeLine && GetInput())
132 if(!GetMapper()->GetInput()){
135 myPipeLine->Update();
142 //----------------------------------------------------------------------------
143 const VISU::PIDMapper&
151 //----------------------------------------------------------------------------
157 return myIDMapper->GetOutput();
163 //----------------------------------------------------------------------------
168 if(!myMapper.GetPointer())
171 return myMapper.GetPointer();
175 //----------------------------------------------------------------------------
180 if(myMapper.GetPointer())
181 return myMapper->GetInput();
187 //----------------------------------------------------------------------------
192 if(myMapper.GetPointer())
193 return myMapper->Update();
197 //----------------------------------------------------------------------------
200 ::SetMapper(vtkMapper* theMapper)
202 myMapper = theMapper;
206 //----------------------------------------------------------------------------
209 ::GetNodeObjID(vtkIdType theID)
211 return myIDMapper->GetNodeObjID(theID);
214 //----------------------------------------------------------------------------
217 ::GetNodeVTKID(vtkIdType theID)
219 return myIDMapper->GetNodeVTKID(theID);
222 //----------------------------------------------------------------------------
223 vtkFloatingPointType*
225 ::GetNodeCoord(vtkIdType theObjID)
227 return myIDMapper->GetNodeCoord(theObjID);
231 //----------------------------------------------------------------------------
234 ::GetElemObjID(vtkIdType theID)
236 return myIDMapper->GetElemObjID(theID);
239 //----------------------------------------------------------------------------
242 ::GetElemVTKID(vtkIdType theID)
244 return myIDMapper->GetElemVTKID(theID);
247 //----------------------------------------------------------------------------
250 ::GetElemCell(vtkIdType theObjID)
252 return myIDMapper->GetElemCell(theObjID);
256 //----------------------------------------------------------------------------