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
27 #include "VISU_IDMapper.hxx"
29 #include <vtkUnstructuredGrid.h>
30 #include <vtkPolyData.h>
31 #include <vtkDataSet.h>
35 //---------------------------------------------------------------
39 myData[0] = myData[1] = myData[2] = -1;
44 ::operator [] ( size_t theId )
46 return myData[ theId ];
51 ::operator [] ( size_t theId ) const
53 return myData[ theId ];
58 ::operator == ( const TStructuredId& theId ) const
61 theId[0] == myData[0] &&
62 theId[1] == myData[1] &&
63 theId[2] == myData[2];
66 //---------------------------------------------------------------
69 ::CopyStructure(PStructured theStructured)
71 myIsPolarType = theStructured->myIsPolarType;
72 myIsStructured = theStructured->myIsStructured;
73 myGrilleStructure = theStructured->myGrilleStructure;
74 myObj2StructuredId = theStructured->myObj2StructuredId;
79 ::IsStructured() const
81 return myIsStructured;
88 return myGrilleStructure;
96 vtkIdType( myGrilleStructure[0] >= 0) +
97 vtkIdType( myGrilleStructure[1] >= 0) +
98 vtkIdType( myGrilleStructure[2] >= 0);
103 ::GetIndexesOfNode(vtkIdType theNodeId)
105 if ( IsStructured() ) {
106 TObj2StructuredId::const_iterator aIter = myObj2StructuredId.find( theNodeId );
107 if ( aIter != myObj2StructuredId.end() )
108 return aIter->second;
111 return TStructuredId();
116 ::GetObjectIDByIndexes(TStructuredId theVec)
118 TObj2StructuredId::const_iterator aIter = myObj2StructuredId.begin();
119 for (; aIter != myObj2StructuredId.end(); aIter++ ) {
120 if ( theVec == aIter->second )
128 //---------------------------------------------------------------
129 vtkFloatingPointType*
131 ::GetNodeCoord(vtkIdType theObjID)
133 vtkIdType aVTKID = GetNodeVTKID(theObjID);
134 return GetOutput()->GetPoint(aVTKID);
139 ::GetNodeVTKID(vtkIdType theID) const
146 ::GetNodeObjID(vtkIdType theID) const
153 ::GetElemCell(vtkIdType theObjID)
155 vtkIdType aVtkID = GetElemVTKID(theObjID);
156 return GetOutput()->GetCell(aVtkID);
161 ::GetElemVTKID(vtkIdType theID) const
168 ::GetElemObjID(vtkIdType theID) const
172 //---------------------------------------------------------------
176 TUnstructuredGridIDMapper
179 return GetUnstructuredGridOutput();
181 //---------------------------------------------------------------
188 return GetPolyDataOutput();
192 //---------------------------------------------------------------