source: subversion/applications/routing/pyroute/tracklog.py @ 8327

Last change on this file since 8327 was 5894, checked in by ojw, 12 years ago

save tracklogs

File size: 1.6 KB
Line 
1#!/usr/bin/python
2#-----------------------------------------------------------------------------
3#
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 tracklog(pyrouteModule, lib_gpx):
29  """  """
30  def __init__(self, modules):
31    lib_gpx.__init__(self)
32    pyrouteModule.__init__(self, modules)
33    self.active = []
34    self.lines.append(self.active)
35    self.pointsSinceSave = 0
36   
37  def addPoint(self,lat,lon):
38    self.active.append([lat,lon])
39    self.pointsSinceSave = self.pointsSinceSave + 1
40
41  def checkIfNeedsSaving(self, forceSave = False):
42    if(self.pointsSinceSave > 20 or forceSave):
43      self.save()
44     
45  def save(self):
46    self.saveAs("data/tracklogs.gpx", "tracklogs")
47    self.pointsSinceSave = 0
48   
Note: See TracBrowser for help on using the repository browser.