source: subversion/applications/routing/pyroute/sketch.py

Last change on this file was 5830, checked in by ojw, 12 years ago

Load and display GPX tracklogs

File size: 1.5 KB
Line 
1#!/usr/bin/python
2#-----------------------------------------------------------------------------
3# Sketch-on-map module for pyroute
4#
5# Usage:
6#
7#-----------------------------------------------------------------------------
8# Copyright 2007, Oliver White
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22#-----------------------------------------------------------------------------
23from base import pyrouteModule
24import os
25import cairo
26from lib_gpx import lib_gpx
27
28class sketching(pyrouteModule, lib_gpx):
29  """  """
30  def __init__(self, modules):
31    lib_gpx.__init__(self)
32    pyrouteModule.__init__(self, modules)
33   
34  def startStroke(self,x,y):
35    lat,lon = self.m['projection'].xy2ll(x,y)
36    self.latest = [(lat,lon)]
37    self.lines.append(self.latest)
38   
39  def moveTo(self,x,y):
40    lat,lon = self.m['projection'].xy2ll(x,y)
41    self.latest.append((lat,lon))
42    self.set("needRedraw", 1)
43
44  def save(self):
45      self.saveAs("data/sketches/latest.gpx")
46     
Note: See TracBrowser for help on using the repository browser.