1 // Copyright (C) 2007-2010 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
28 #include "VISU_IDMapper.hxx"
30 #include <vtkUnstructuredGrid.h>
31 #include <vtkPolyData.h>
32 #include <vtkDataSet.h>
36 //---------------------------------------------------------------
40 myData[0] = myData[1] = myData[2] = -1;
45 ::operator [] ( size_t theId )
47 return myData[ theId ];
52 ::operator [] ( size_t theId ) const
54 return myData[ theId ];
59 ::operator == ( const TStructuredId& theId ) const
62 theId[0] == myData[0] &&
63 theId[1] == myData[1] &&
64 theId[2] == myData[2];
67 //---------------------------------------------------------------
70 ::CopyStructure(PStructured theStructured)
72 myIsPolarType = theStructured->myIsPolarType;
73 myIsStructured = theStructured->myIsStructured;
74 myGrilleStructure = theStructured->myGrilleStructure;
75 myObj2StructuredId = theStructured->myObj2StructuredId;
80 ::IsStructured() const
82 return myIsStructured;
89 return myGrilleStructure;
97 vtkIdType( myGrilleStructure[0] >= 0) +
98 vtkIdType( myGrilleStructure[1] >= 0) +
99 vtkIdType( myGrilleStructure[2] >= 0);
104 ::GetIndexesOfNode(vtkIdType theNodeId)
106 if ( IsStructured() ) {
107 TObj2StructuredId::const_iterator aIter = myObj2StructuredId.find( theNodeId );
108 if ( aIter != myObj2StructuredId.end() )
109 return aIter->second;
112 return TStructuredId();
117 ::GetObjectIDByIndexes(TStructuredId theVec)
119 TObj2StructuredId::const_iterator aIter = myObj2StructuredId.begin();
120 for (; aIter != myObj2StructuredId.end(); aIter++ ) {
121 if ( theVec == aIter->second )
129 //---------------------------------------------------------------
130 vtkFloatingPointType*
132 ::GetNodeCoord(vtkIdType theObjID)
134 vtkIdType aVTKID = GetNodeVTKID(theObjID);
135 return GetOutput()->GetPoint(aVTKID);
140 ::GetNodeVTKID(vtkIdType theID) const
147 ::GetNodeObjID(vtkIdType theID) const
154 ::GetElemCell(vtkIdType theObjID)
156 vtkIdType aVtkID = GetElemVTKID(theObjID);
157 return GetOutput()->GetCell(aVtkID);
162 ::GetElemVTKID(vtkIdType theID) const
169 ::GetElemObjID(vtkIdType theID) const
173 //---------------------------------------------------------------
177 TUnstructuredGridIDMapper
180 return GetUnstructuredGridOutput();
182 //---------------------------------------------------------------
189 return GetPolyDataOutput();
193 //---------------------------------------------------------------