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

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

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

revision 848 by jongui, Mon Sep 11 07:40:09 2006 UTC revision 849 by jongui, Fri Sep 15 07:11:55 2006 UTC
# Line 1  Line 1 
1  """  """
 @var RED: Constant representing red  
 @type RED: RGB color  
 @var GREEN: Constant representing green  
 @type GREEN: RGB color  
 @var BLUE: Constant representing blue  
 @type BLUE: RGB color  
 @var BLACK: Constant representing black  
 @type BLACK: RBG color  
 @var WHITE: Constant representing white  
 @type WHITE: RGB color  
 @var YELLOW: Constant representing yellow  
 @type YELLOW: RGB color  
 @var PINK: Constant represnting pink  
 @type PINK: RGB color  
 @var ORANGE: Constant representing orange  
 @type ORANGE: RGB color  
 @var PURPLE: Constant representing purple  
 @type PURPLE: RGB color  
 @var GREY: Constant representing grey  
 @type GREY: RGB color  
 @var BROWN: Constant representing brown  
 @type BROWN: RGB color  
   
2  @author: John Ngui  @author: John Ngui
3  @author: Lutz Gross  @author: Lutz Gross
4  """  """
# Line 38  class ColorMap: Line 15  class ColorMap:
15          """          """
16    
17          self.color_name = color_name          self.color_name = color_name
18          self.colorMap = {}          self.color_map = {}
19          self.buildColorMap()          self.buildColorMap()
20    
21      def buildColorMap(self):      def buildColorMap(self):
# Line 46  class ColorMap: Line 23  class ColorMap:
23          Build a hash that defines mapping of colors.          Build a hash that defines mapping of colors.
24          """          """
25    
26          self.colorMap["Red"] = [255, 0, 0]          self.color_map["Red"] = [1, 0, 0]
27          self.colorMap["Green"]= [0, 255, 0]          self.color_map["Green"]= [0, 1, 0]
28          self.colorMap["Blue"] = [0, 0, 255]          self.color_map["Blue"] = [0, 0, 1]
29          self.colorMap["Black"] = [0, 0, 0]          self.color_map["Black"] = [0, 0, 0]
30          self.colorMap["White"] = [255, 255, 255]          self.color_map["White"] = [1, 1, 1]
31          self.colorMap["Yellow"] = [255, 255, 0]          self.color_map["Yellow"] = [1,1,0]
32          self.colorMap["Pink"] = [255, 20, 147]          self.color_map["Pink"] = [1, 0.0784, 0.4588]
33          self.colorMap["Orange"] = [255, 69, 0]          self.color_map["Orange"] = [1, 0.2706, 0]
34          self.colorMap["Purple"] = [138, 43, 226]          self.color_map["Purple"] = [0.5412, 0.1680, 0.8828]
35          self.colorMap["Grey"] = [169, 169, 169]          self.color_map["Grey"] = [0.6602, 0.6602, 0.6602]
36          self.colorMap["Brown"] = [139, 69, 19]          self.color_map["Brown"] = [0.5430, 0.2700, 0.0742]
37    
38      def getR(self):      def getR(self):
39          """          """
# Line 66  class ColorMap: Line 43  class ColorMap:
43          @return: Red(R) value from the RGB          @return: Red(R) value from the RGB
44          """          """
45    
46          return self.colorMap[self.color_name][0]          return self.color_map[self.color_name][0]
47    
48      def getG(self):      def getG(self):
49          """          """
50          Return the green(G) value from the RGB.          Return the green(G) value from the RGB.
51    
52          @rtype: Number          @rtype: Number
53          @return: Green(R) value from the RGB          @return: Green(G) value from the RGB
54          """          """
55    
56          return self.colorMap[self.color_name][1]          return self.color_map[self.color_name][1]
57    
58      def getB(self):      def getB(self):
59          """          """
# Line 86  class ColorMap: Line 63  class ColorMap:
63          @return: Blue(B) value from the RGB          @return: Blue(B) value from the RGB
64          """          """
65    
66          return self.colorMap[self.color_name][2]          return self.color_map[self.color_name][2]
67    
68      def getColor(self):      def getColor(self):
69          """          """
# Line 97  class ColorMap: Line 74  class ColorMap:
74          """          """
75    
76          return self.color_name          return self.color_name
   
 # Constants  
 RED = ColorMap("Red")  
 GREEN = ColorMap("Green")  
 BLUE = ColorMap("Blue")  
 BLACK = ColorMap("Black")  
 WHITE = ColorMap("White")  
 YELLOW = ColorMap("Yellow")  
 PINK = ColorMap("Pink")  
 ORANGE = ColorMap("Orange")  
 PURPLE = ColorMap("Purple")  
 GREY = ColorMap("Grey")  
 BROWN = ColorMap("Brown")  
77            
78  import vtk    import vtk  
79    

Legend:
Removed from v.848  
changed lines
  Added in v.849

  ViewVC Help
Powered by ViewVC 1.1.26