Changeset 1594

Show
Ignore:
Timestamp:
07/06/07 16:53:43 (1 year ago)
Author:
wrobe..@pld-linux.org
Message:

- display only major cities

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gmeye/trunk/gmeye/items.py

    r1577 r1594  
    33 
    44class BItem(Item): 
    5     def __init__(self, id, x, y, data): 
     5    def __init__(self, id, x, y, data=None): 
    66        super(BItem, self).__init__() 
    77        self.id = id 
     
    7070 
    7171    def addPoint(self, id, x, y): 
    72         self._data[id] = Point(id, x, y) 
     72        self._data[id] = self.icls(id, x, y) 
     73        return self._data[id] 
    7374 
    7475 
  • gmeye/trunk/gmeye/loader.py

    r1577 r1594  
    3434            line = [(x - x0, -y + y0) for x, y in line] 
    3535            clayer.addLine(ii, x0 - clayer.x0, -y0 + clayer.y1, line) 
     36        elif g.GetGeometryType() == ogr.wkbPoint: 
     37            id_name = f.GetFieldIndex('FULLNAME')  
     38            name = f.GetField(id_name) 
     39            print id_name, name 
     40            x0, y0 = g.GetX(0), g.GetY(0) 
     41            pp = clayer.addPoint(ii, x0 - clayer.x0, -y0 + clayer.y1) 
     42            pp.name = name 
    3643        else: 
    3744            raise Exception, 'unknown type %d' % g.GetGeometryType() 
  • gmeye/trunk/gmeye_demo

    r1577 r1594  
    99import gtk 
    1010from gaphas import Canvas, GtkView 
     11from gaphas.util import text_align, text_set_font 
    1112 
    1213import gmeye.loader 
     
    1415from gmeye.tool import DefaultTool 
    1516 
    16 class City(item.Line): 
     17class City(item.Point): 
    1718    def draw(self, context): 
    18         context.cairo.set_source_rgb(0, 0, 1) 
    1919        super(City, self).draw(context) 
     20        cr = context.cairo 
     21 
     22        cr.save() 
     23        if context.selected: 
     24            cr.set_source_rgb(0, 0, 0) 
     25            text_set_font(cr, 'sans bold 0.2') 
     26        elif context.hovered: 
     27            cr.set_source_rgba(0, 0, 1, 0.4) 
     28            text_set_font(cr, 'sans 0.2') 
     29        else: 
     30            cr.set_source_rgba(0, 0, 1) 
     31            text_set_font(cr, 'sans 0.2') 
     32        cr.move_to(0, 0) 
     33        cr.show_text(self.name) 
     34        cr.stroke() 
     35        cr.restore() 
     36         
    2037 
    2138class RailRoad(item.Line): 
     
    6279    desc = [ 
    6380        ('borders', item.Background, None), 
    64         ('roads', item.Layer, RailRoad), 
     81#        ('roads', item.Layer, RailRoad), 
    6582#        ('rail', item.Layer, RailRoad), 
    66         ('pcities', item.Layer, City), 
     83#        ('pcities', item.Layer, RailRoad), 
     84        ('mcities', item.Layer, City), 
    6785    ] 
    6886    layers = gmeye.loader.get_layers(sys.argv[1], desc)