Skip to content

Commit

Permalink
Better name display on map
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfett committed Jul 20, 2010
1 parent a2f57eb commit f7b3a61
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions files/advancedcaching/simplegui.py
Expand Up @@ -1388,7 +1388,8 @@ class GeocacheLayer(MapLayer):
TOO_MANY_POINTS = 30
CACHES_ZOOM_LOWER_BOUND = 9
CACHE_DRAW_SIZE = 10
CACHE_DRAW_FONT = pango.FontDescription("Sans 4")
CACHE_DRAW_FONT = pango.FontDescription("Sans 10")
CACHE_DRAW_FONT_COLOR = gtk.gdk.color_parse('black')
MAX_NUM_RESULTS_SHOW = 100

# map markers colors
Expand Down Expand Up @@ -1503,15 +1504,6 @@ def draw(self):
continue


# print the name?
if self.show_name:
layout = self.map.create_pango_layout(SimpleGui.shorten_name(c.title, 20))
layout.set_font_description(self.CACHE_DRAW_FONT)

cr.move_to(p[0] + 3 + radius, p[1] - 3 - radius)
#cr.set_line_width(1)
cr.set_source_color(color)
cr.show_layout(layout)


# if we have a description for this cache...
Expand All @@ -1525,7 +1517,7 @@ def draw(self):
dist = 3
count = 3
pos_x = p[0] + radius + 3 + 1
pos_y = p[1] + radius - (dist * count)
pos_y = p[1] + radius - (dist * count) + dist
cr.set_line_width(1)
for i in xrange(count):
cr.move_to(pos_x, pos_y + dist * i)
Expand All @@ -1538,19 +1530,30 @@ def draw(self):
cr.set_line_width(1)
cr.set_source_color(self.COLOR_CURRENT_CACHE)
#radius = 7
radius += 3
cr.rectangle(p[0] - radius, p[1] - radius, radius * 2, radius * 2)
radius_outline = radius + 3
cr.rectangle(p[0] - radius_outline, p[1] - radius_outline, radius_outline * 2, radius_outline * 2)
cr.stroke()

# if this cache is disabled
if c.status == geocaching.GeocacheCoordinate.STATUS_DISABLED:
cr.set_line_width(3)
cr.set_source_color(self.COLOR_CURRENT_CACHE)
radius = 7
cr.move_to(p[0]-radius, p[1]-radius)
cr.line_to(p[0] + radius, p[1] + radius)
radius_disabled = 7
cr.move_to(p[0]-radius_disabled, p[1]-radius_disabled)
cr.line_to(p[0] + radius_disabled, p[1] + radius_disabled)
cr.stroke()


# print the name?
if self.show_name:
layout = self.map.create_pango_layout(SimpleGui.shorten_name(c.title, 20))
layout.set_font_description(self.CACHE_DRAW_FONT)
width, height = layout.get_pixel_size()
cr.move_to(p[0] + 4 + radius, p[1] - height + 2)
#cr.set_line_width(1)
cr.set_source_color(self.CACHE_DRAW_FONT_COLOR)
cr.show_layout(layout)

cr.set_source_color(self.COLOR_CACHE_CENTER)
cr.set_line_width(1)
cr.move_to(p[0], p[1] - 3)
Expand Down

0 comments on commit f7b3a61

Please sign in to comment.