Permalink
Browse files

fixed lint warnings

  • Loading branch information...
1 parent 9a1707d commit 4a64d87c26f73da01e4dc27c42a2e06221d57c3b @trey0 trey0 committed Aug 28, 2012
Showing with 48 additions and 39 deletions.
  1. +1 −0 geocamTrack/filter.py
  2. +0 −1 geocamTrack/models.py
  3. +43 −37 geocamTrack/static/geocamTrack/js/geocamTrack.js
  4. +4 −1 geocamTrack/views.py
@@ -9,6 +9,7 @@
PAST_POSITION_MODEL = getModelByName(settings.GEOCAM_TRACK_PAST_POSITION_MODEL)
+
class PositionFilter(object):
def __init__(self, distanceMeters, callback=lambda pos: pos.save()):
self.distanceMeters = distanceMeters
@@ -5,7 +5,6 @@
# __END_LICENSE__
import sys
-import time
import calendar
import datetime
@@ -8,59 +8,65 @@ var geocamTrack = {
markersById: {},
markerCount: 0,
- nullOrUndefined: function (x) {
+ nullOrUndefined: function(x) {
return (x === null) || (x === undefined);
},
- handleResourcePositionsResponse: function (response) {
+ initFeature: function(feature) {
+ var pos = new google.maps.LatLng(feature.geometry.coordinates[1],
+ feature.geometry.coordinates[0]);
+ var marker = geocamTrack.markersById[feature.id];
+ if (marker === undefined) {
+ var icon;
+ if (geocamTrack.markerCount < 26) {
+ var letter = String.fromCharCode(65 + geocamTrack.markerCount);
+ icon = ('http://maps.google.com/mapfiles/marker' +
+ letter + '.png');
+ } else {
+ icon = 'http://maps.google.com/mapfiles/marker.png';
+ }
+ var title;
+ if (geocamTrack.nullOrUndefined(feature.properties.displayName)) {
+ title = feature.properties.userName;
+ } else {
+ title = feature.properties.displayName;
+ }
+
+ marker = new google.maps.Marker({
+ position: pos,
+ title: title,
+ icon: icon
+ });
+ marker.setMap(geocamCore.mapG.gmap);
+ geocamTrack.markersById[feature.id] = marker;
+ geocamTrack.markerCount++;
+ }
+ if (!pos.equals(marker.position)) {
+ marker.setPosition(pos);
+ }
+ },
+
+ handleResourcePositionsResponse: function(response) {
if (!geocamTrack.nullOrUndefined(response.result)) {
$.each(response.result.features,
- function (i, feature) {
- var pos = new google.maps.LatLng(feature.geometry.coordinates[1],
- feature.geometry.coordinates[0]);
- var marker = geocamTrack.markersById[feature.id];
- if (marker === undefined) {
- var icon;
- if (geocamTrack.markerCount < 26) {
- var letter = String.fromCharCode(65 + geocamTrack.markerCount);
- icon = 'http://maps.google.com/mapfiles/marker' + letter + '.png';
- } else {
- icon = 'http://maps.google.com/mapfiles/marker.png';
- }
- var title;
- if (geocamTrack.nullOrUndefined(feature.properties.displayName)) {
- title = feature.properties.userName;
- } else {
- title = feature.properties.displayName;
- }
-
- marker = new google.maps.Marker({
- position: pos,
- title: title,
- icon: icon
- });
- marker.setMap(geocamCore.mapG.gmap);
- geocamTrack.markersById[feature.id] = marker;
- geocamTrack.markerCount++;
- }
- if (!pos.equals(marker.position)) {
- marker.setPosition(pos);
- }
+ function(i, feature) {
+ geocamTrack.initFeature(feature);
});
}
},
- updateResourcePositions: function () {
- $.getJSON(geocamCore.settings.SCRIPT_NAME + "tracking/resources.json",
+ updateResourcePositions: function() {
+ $.getJSON(geocamCore.settings.SCRIPT_NAME +
+ 'tracking/resources.json',
geocamTrack.handleResourcePositionsResponse);
},
- updateResourcePositionsLoop: function () {
+ updateResourcePositionsLoop: function() {
geocamTrack.updateResourcePositions();
setTimeout(geocamTrack.updateResourcePositionsLoop, 5000);
},
- startTracking: function () {
+ startTracking: function() {
geocamTrack.updateResourcePositionsLoop();
}
};
@@ -212,7 +212,7 @@ def writeTrackNetworkLink(out, name,
elif caching == 'cached':
urlName = 'geocamTrack_cachedTracks'
url = reverse(urlName)
-
+
params = {}
if trackName:
params['track'] = trackName
@@ -381,14 +381,17 @@ def getTrackIndexKml(request):
def getCurrentPosKml(request):
return getTracksKml(request)
+
@cache_page(0.9 * settings.GEOCAM_TRACK_RECENT_TRACK_REFRESH_TIME_SECONDS)
def getRecentTracksKml(request):
return getTracksKml(request)
+
@cache_page(0.9 * settings.GEOCAM_TRACK_OLD_TRACK_REFRESH_TIME_SECONDS)
def getCachedTracksKml(request):
return getTracksKml(request)
+
def getTracksKml(request, recent=True):
geocamTrack.models.latestRequestG = request

0 comments on commit 4a64d87

Please sign in to comment.