def build_csv_url(self): # See HSL Live 1.6 documentation. # http://developer.reittiopas.fi/pages/en/other-apis.php bbox = self.osm.get_bbox() lat = osmgpsmap.point_new_radians(bbox[0], bbox[2]).get_degrees() lon = osmgpsmap.point_new_radians(bbox[1], bbox[3]).get_degrees() return ("http://83.145.232.209:10001/?type=vehicles" "&lng1=%.6f&lat1=%.6f&lng2=%.6f&lat2=%.6f" % (min(lon), min(lat), max(lon), max(lat)))
def addTrace(self, trace): filename = trace.get_full_path() if filename not in self._tracks: gpstracks = [] for track in trace.get_points(): for segment in track: gpstrack = osmgpsmap.GpsMapTrack() gpstrack.props.alpha = ALPHA_UNSELECTED for rlat,rlon in segment: gpstrack.add_point(osmgpsmap.point_new_radians(rlat, rlon)) gpstracks.append(gpstrack) self._tracks[filename] = (trace, gpstracks) self.model.append( (trace.get_display_name(), filename) ) self.emit("track-added", trace, gpstracks)
def addTrace(self, trace): filename = trace.getFullPath() if filename not in self._files.keys(): newtracks = [] for track in trace.getTracks(): # Rotate colors color = self._lastColor + 1 if color >= len(TRACK_COLORS): color = 0 self._lastColor = color gpstracks = [] for segment in track: gpstrack = osmgpsmap.GpsMapTrack() gpstrack.props.color = gtk.gdk.Color(TRACK_COLORS[color]) gpstrack.props.alpha = ALPHA_UNSELECTED for point in segment: gpstrack.add_point(osmgpsmap.point_new_radians(point.getRadLat(), point.getRadLon())) gpstracks.append(gpstrack) # Append list of OsmGpsMapTracks to the GPX track object track.osmTracks = gpstracks newtracks.extend(gpstracks) self._files[filename] = trace # Build menù tree filenode = self.model.append( None, (trace.getDisplayName(), trace) ) i = 0 for track in trace.getTracks(): self.model.append( filenode, ('track ' + str(i), track) ) i += 1 i = 0 for wpt in trace.getWaypoints(): self.model.append( filenode, (wpt.name if wpt.name else 'wpt ' + str(i), wpt) ) i += 1 # Signal event self.emit("track-added", trace, newtracks)
def addTrack(self,points): track = osmgpsmap.GpsMapTrack() for rlat,rlon in points: track.add_point(osmgpsmap.point_new_radians(rlat, rlon)) self.map.track_add(track)