/[escript]/trunk/pyvisi/py_src/carpet.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/carpet.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1207 by jongui, Mon Jul 2 02:02:26 2007 UTC revision 1208 by jongui, Mon Jul 2 04:46:10 2007 UTC
# Line 119  class Carpet(DataSetMapper, Actor3D, War Line 119  class Carpet(DataSetMapper, Actor3D, War
119              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
120    
121          self._setupPlane(self._getTransform())          self._setupPlane(self._getTransform())
122    """
123          # Get the bounds of the object in the form of          # Get the bounds of the object in the form of
124          # (xmin, xmax, ymin, ymax, zmin, zmax).          # (xmin, xmax, ymin, ymax, zmin, zmax).
125          bounds = self.__data_collector._getDataCollectorOutput().GetBounds()          bounds = self.__data_collector._getDataCollectorOutput().GetBounds()
126            print "bounds: ", bounds
127          # Length of the z-axis (max - min). Assumption is made that if the          # Length of the z-axis (max - min). Assumption is made that if the
128          # length of the z-axis is equal to zero, the the data set is 2D.          # length of the z-axis is equal to zero, the the data set is 2D.
129          # Otherwise, the data set is 3D. However, there are exceptions to this          # Otherwise, the data set is 3D. However, there are exceptions to this
# Line 141  class Carpet(DataSetMapper, Actor3D, War Line 142  class Carpet(DataSetMapper, Actor3D, War
142                  self._setupWarp(c2p._getCellToPointOutput())                  self._setupWarp(c2p._getCellToPointOutput())
143          elif(self.__cell_to_point == False): # No conversion happens.            elif(self.__cell_to_point == False): # No conversion happens.  
144              if(z_axis_length != 0): # A cutter is used for 3D data.              if(z_axis_length != 0): # A cutter is used for 3D data.
145                    print "if"
146                  self._setupCutter(\                  self._setupCutter(\
147                          self.__data_collector._getDataCollectorOutput(), \                          self.__data_collector._getDataCollectorOutput(), \
148                          self._getPlane())                            self._getPlane())  
149                  self._setupWarp(self._getCutterOutput())                  self._setupWarp(self._getCutterOutput())
150              elif(z_axis_length == 0): # A cutter is not used for 2D data.              elif(z_axis_length == 0): # A cutter is not used for 2D data.
151                    print "else"
152                  self._setupWarp(                  self._setupWarp(
153                          self.__data_collector._getDataCollectorOutput())                          self.__data_collector._getDataCollectorOutput())
154    
# Line 154  class Carpet(DataSetMapper, Actor3D, War Line 157  class Carpet(DataSetMapper, Actor3D, War
157    
158          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
159          scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
160    """
161      def _isModified(self):        def _isModified(self):  
162          """          """
163          Return whether the Carpet or DataCollector has been modified.          Return whether the Carpet or DataCollector has been modified.
# Line 173  class Carpet(DataSetMapper, Actor3D, War Line 176  class Carpet(DataSetMapper, Actor3D, War
176          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
177          """          """
178    
179            if(self.__modified):
180                # Get the bounds of the object in the form of
181                # (xmin, xmax, ymin, ymax, zmin, zmax).
182                bounds = self.__data_collector._getDataCollectorOutput().GetBounds()
183                print "bounds: ", bounds
184                # Length of the z-axis (max - min). Assumption is made that if the
185                # length of the z-axis is equal to zero, the the data set is 2D.
186                # Otherwise, the data set is 3D. However, there are exceptions to this
187                # rule as some 2D data sets may have a z-axis length of non-zero, but
188                # such exceptions are not taken into account here.
189                z_axis_length = bounds[5] - bounds[4]
190    
191                if(self.__cell_to_point == True): # Converts cell data to point data.
192                    c2p = CellDataToPointData(\
193                            self.__data_collector._getDataCollectorOutput())
194                    if(z_axis_length != 0): # A cutter is used for 3D data.
195                        self._setupCutter(c2p._getCellToPointOutput(), \
196                                self._getPlane())  
197                        self._setupWarp(self._getCutterOutput())
198                    elif(z_axis_length == 0): # A cutter is not used for 2D data.
199                        self._setupWarp(c2p._getCellToPointOutput())
200                elif(self.__cell_to_point == False): # No conversion happens.  
201                    if(z_axis_length != 0): # A cutter is used for 3D data.
202                        print "if"
203                        self._setupCutter(\
204                                self.__data_collector._getDataCollectorOutput(), \
205                                self._getPlane())  
206                        self._setupWarp(self._getCutterOutput())
207                    elif(z_axis_length == 0): # A cutter is not used for 2D data.
208                        print "else"
209                        self._setupWarp(
210                                self.__data_collector._getDataCollectorOutput())
211    
212                self._setupDataSetMapper(self._getWarpOutput(),
213                        lookup_table._getLookupTable())
214    
215                self._setupActor3D(self._getDataSetMapper())
216                scene._addActor3D(self.__viewport, self._getActor3D())
217    
218    
219    
220    
221    
222    
223    
224    
225          if (self._isModified() == True):          if (self._isModified() == True):
226              if(self.__data_collector._isScalarSet() == True):              if(self.__data_collector._isScalarSet() == True):
227                  self.__data_collector._setActiveScalar()                  self.__data_collector._setActiveScalar()
# Line 184  class Carpet(DataSetMapper, Actor3D, War Line 233  class Carpet(DataSetMapper, Actor3D, War
233                  self._setScalarRange(self.__data_collector._getScalarRange())                  self._setScalarRange(self.__data_collector._getScalarRange())
234              self.__modified = False              self.__modified = False
235    
236            bounds = self.__data_collector._getDataCollectorOutput().GetBounds()
237            print "bounds2: ", bounds
238    
239    

Legend:
Removed from v.1207  
changed lines
  Added in v.1208

  ViewVC Help
Powered by ViewVC 1.1.26