]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_IDMapper.cxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / CONVERTOR / VISU_IDMapper.cxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //  File:
24 //  Author:
25 //  Module : VISU
26
27 #include "VISU_IDMapper.hxx"
28
29 #include <vtkUnstructuredGrid.h>
30 #include <vtkPolyData.h>
31 #include <vtkDataSet.h>
32
33 namespace VISU
34 {
35   //---------------------------------------------------------------
36   //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
37   bool
38   TStructured
39   ::IsStructured() const
40   {
41     return myIsStructured;
42   }
43   
44   TIdTypeVector
45   TStructured
46   ::GetStructure()
47   {
48     return myGrilleStructure;
49   }
50
51   TIdTypeVector
52   TStructured
53   ::GetIndexesOfNode(vtkIdType theNodeId)
54   {
55     TIdTypeVector aNullVec;
56     if(!IsStructured())
57       return aNullVec;
58     TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.find(theNodeId);
59     if(aIter!=myObjID2StructureID.end())
60       return aIter->second;
61     else
62       return aNullVec;
63   }
64   
65   vtkIdType
66   TStructured
67   ::GetObjectIDByIndexes(TIdTypeVector theVec)
68   {
69     TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.begin();
70     for(;aIter!=myObjID2StructureID.end();aIter++){
71       if(theVec == aIter->second)
72         return aIter->first;
73     }
74     return -1;
75   }
76   //ENK: 23.11.2006
77
78   //---------------------------------------------------------------
79   vtkFloatingPointType*  
80   TIDMapper
81   ::GetNodeCoord(vtkIdType theObjID)
82   {
83     vtkIdType aVTKID = GetNodeVTKID(theObjID);
84     return GetOutput()->GetPoint(aVTKID);
85   }
86
87   vtkIdType
88   TIDMapper
89   ::GetNodeVTKID(vtkIdType theID) const
90   {
91     return theID;
92   }
93
94   vtkIdType
95   TIDMapper
96   ::GetNodeObjID(vtkIdType theID) const
97   {
98     return theID;
99   }
100
101   vtkCell* 
102   TIDMapper
103   ::GetElemCell(int theObjID)
104   {
105     vtkIdType aVtkID = GetElemVTKID(theObjID);
106     return GetOutput()->GetCell(aVtkID);
107   }
108
109   vtkIdType
110   TIDMapper
111   ::GetElemVTKID(vtkIdType theID) const
112   {
113     return theID;
114   }
115
116   vtkIdType
117   TIDMapper
118   ::GetElemObjID(vtkIdType theID) const
119   {
120     return theID;
121   }  
122   //---------------------------------------------------------------
123
124
125   vtkDataSet* 
126   TUnstructuredGridIDMapper
127   ::GetOutput()
128   {
129     return GetUnstructuredGridOutput();
130   }
131   //---------------------------------------------------------------
132
133
134   vtkDataSet* 
135   TPolyDataIDMapper
136   ::GetOutput()
137   {
138     return GetPolyDataOutput();
139   }
140
141
142   //---------------------------------------------------------------
143 }