/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/classgen.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/classgen.py

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

revision 1361 by jonathan, Wed Jul 2 12:59:20 2003 UTC revision 1425 by jonathan, Wed Jul 16 13:21:59 2003 UTC
# Line 396  class CustomRamp: Line 396  class CustomRamp:
396    
397          newProps = ClassGroupProperties()          newProps = ClassGroupProperties()
398    
399          color1 = self.prop1.GetLineColor()          self.__SetProperty(self.prop1.GetLineColor(),
400          color2 = self.prop2.GetLineColor()                             self.prop2.GetLineColor(),
401                               index, newProps.SetLineColor)
402          self.__SetProperty(color1, color2, index, newProps.SetLineColor)          self.__SetProperty(self.prop1.GetFill(), self.prop2.GetFill(),
403          self.__SetProperty(color1, color2, index, newProps.SetFill)                             index, newProps.SetFill)
404    
405          w = (self.prop2.GetLineWidth() - self.prop1.GetLineWidth()) \          w = (self.prop2.GetLineWidth() - self.prop1.GetLineWidth()) \
406              * index \              * index \
407              + self.prop1.GetLineWidth()              + self.prop1.GetLineWidth()
   
408          newProps.SetLineWidth(int(round(w)))          newProps.SetLineWidth(int(round(w)))
409    
410          return newProps          return newProps
# Line 446  GreyRamp       = MonochromaticRamp(Color Line 445  GreyRamp       = MonochromaticRamp(Color
445  RedRamp        = MonochromaticRamp(Color(1, 1, 1),  Color(.8, 0, 0))  RedRamp        = MonochromaticRamp(Color(1, 1, 1),  Color(.8, 0, 0))
446  GreenRamp      = MonochromaticRamp(Color(1, 1, 1),  Color(0, .8, 0))  GreenRamp      = MonochromaticRamp(Color(1, 1, 1),  Color(0, .8, 0))
447  BlueRamp       = MonochromaticRamp(Color(1, 1, 1),  Color(0, 0, .8))  BlueRamp       = MonochromaticRamp(Color(1, 1, 1),  Color(0, 0, .8))
448  GreenToRedRamp = MonochromaticRamp(Color(1, .8, 1), Color(1, 0, 0))  GreenToRedRamp = MonochromaticRamp(Color(0, .8, 0), Color(1, 0, 0))
449    
450  class HotToColdRamp:  class HotToColdRamp:
451    
# Line 481  class HotToColdRamp: Line 480  class HotToColdRamp:
480    
481          return prop          return prop
482    
483    class FixedRamp:
484        """FixedRamp allows particular properties of a ramp to be
485        held constant over the ramp.
486        """
487    
488        def __init__(self, ramp, fixes):
489            """
490            ramp -- a source ramp to get the default properties
491    
492            fixes -- a tuple (lineColor, lineWidth, fillColor) such that
493                 if any item is not None, the appropriate property will
494                 be fixed to that item value.
495            """
496    
497            self.fixes = fixes
498            self.ramp = ramp
499    
500        def GetRamp(self):
501            return self
502    
503        def GetProperties(self, index):
504            props = self.ramp.GetProperties(index)
505            if self.fixes[0] is not None: props.SetLineColor(self.fixes[0])
506            if self.fixes[1] is not None: props.SetLineWidth(self.fixes[1])
507            if self.fixes[2] is not None: props.SetFill(self.fixes[2])
508    
509            return props

Legend:
Removed from v.1361  
changed lines
  Added in v.1425

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26