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

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

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

revision 1114 by jongui, Sun Apr 22 05:16:05 2007 UTC revision 1115 by jongui, Sun Apr 22 07:18:30 2007 UTC
# Line 47  class Map(DataSetMapper, Actor3D): Line 47  class Map(DataSetMapper, Actor3D):
47          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
48          """          """
49    
50          # NOTE: Actor3D is inherited and there are two instances declared here.          self.__scene = scene
51          # As a result, when methods from Actor3D is invoked from the driver,          self.__data_collector = data_collector
52          # only the methods associated with the latest instance (which in this          self.__viewport = viewport
53          # case is the Actor3D for the  map) can be executed. Actor3D          self.__lut = lut
54          # methods associated with Outline cannot be invoked from the driver.          self.__cell_to_point = cell_to_point
55          # They can only be called within here, which is why Outline must          self.__outline = outline
56          # be place before map as there is unlikely to be any changes  
57          # made to the Outline's Actor3D.          self.__modified = True
58            scene._addModules(self)
59          # ----- Outline -----  
60        def _render(self):
61          if(outline == True):          if self.__modified == True:
62              outline = Outline(data_collector._getOutput())              # NOTE: Actor3D is inherited and there are two instances declared here.
63              DataSetMapper.__init__(self, outline._getOutput())              # As a result, when methods from Actor3D is invoked from the driver,
64                # only the methods associated with the latest instance (which in this
65                # case is the Actor3D for the  map) can be executed. Actor3D
66                # methods associated with Outline cannot be invoked from the driver.
67                # They can only be called within here, which is why Outline must
68                # be place before map as there is unlikely to be any changes
69                # made to the Outline's Actor3D.
70    
71    
72                # ----- Outline -----
73    
74                if(self.__outline == True):
75                    outline = Outline(self.__data_collector._getOutput())
76                    DataSetMapper.__init__(self, outline._getOutput())
77    
78                    Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
79                    # Default outline color is black.
80                    Actor3D.setColor(self, Color.BLACK)
81    
82                    # Default line width is 1.
83                    Actor3D._setLineWidth(self, 1)
84                    self.__scene._addActor3D(self.__viewport, Actor3D._getActor3D(self))
85    
86                # ----- Map -----
87    
88                # NOTE: Lookup table color mapping (color or grey scale) MUST be set
89                # before DataSetMapper. If it is done after DataSetMapper, no effect
90                # will take place.
91                if(self.__lut == Lut.COLOR): # Colored lookup table.
92                    lookup_table = LookupTable()
93                    lookup_table._setTableValue()
94                elif(self.__lut == Lut.GREY_SCALE): # Grey scaled lookup table.
95                    lookup_table = LookupTable()
96                    lookup_table._setLookupTableToGreyScale()
97    
98                if(self.__cell_to_point == True): # Converts cell data to point data.
99                    c2p = CellDataToPointData(self.__data_collector._getOutput())
100                    DataSetMapper.__init__(self, c2p._getOutput(),
101                            lookup_table._getLookupTable())
102                elif(self.__cell_to_point == False): # No conversion happens.
103                    DataSetMapper.__init__(self, self.__data_collector._getOutput(),
104                            lookup_table._getLookupTable())
105    
106              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              DataSetMapper._setScalarRange(self, self.__data_collector._getScalarRange())
             # Default outline color is black.  
             Actor3D.setColor(self, Color.BLACK)  
107    
108              # Default line width is 1.              self.__data_collector._paramForUpdatingMultipleSources(VizType.MAP,
109              Actor3D._setLineWidth(self, 1)                      ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))
             scene._addActor3D(viewport, Actor3D._getActor3D(self))  
   
         # ----- Map -----  
   
         # NOTE: Lookup table color mapping (color or grey scale) MUST be set  
         # before DataSetMapper. If it is done after DataSetMapper, no effect  
         # will take place.  
         if(lut == Lut.COLOR): # Colored lookup table.  
             lookup_table = LookupTable()  
             lookup_table._setTableValue()  
         elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.  
             lookup_table = LookupTable()  
             lookup_table._setLookupTableToGreyScale()  
   
         if(cell_to_point == True): # Converts cell data to point data.  
             c2p = CellDataToPointData(data_collector._getOutput())  
             DataSetMapper.__init__(self, c2p._getOutput(),  
                     lookup_table._getLookupTable())  
         elif(cell_to_point == False): # No conversion happens.  
             DataSetMapper.__init__(self, data_collector._getOutput(),  
                     lookup_table._getLookupTable())  
110    
111          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
112                self.__scene._addActor3D(self.__viewport, Actor3D._getActor3D(self))
113    
114          data_collector._paramForUpdatingMultipleSources(VizType.MAP,              self.__modified = False
                 ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self))  
115    
         Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  
116    
117  ###############################################################################  ###############################################################################
118    

Legend:
Removed from v.1114  
changed lines
  Added in v.1115

  ViewVC Help
Powered by ViewVC 1.1.26