diff --git a/flockompass.kv b/flockompass.kv index 7b7aa26..67690c7 100644 --- a/flockompass.kv +++ b/flockompass.kv @@ -9,34 +9,43 @@ : - BoxLayout: - orientation: 'vertical' - ActionBar: - pos_hint: {'top':1} - ActionView: - use_separator: True - ActionPrevious: - title: 'Social Cycling' - with_previous: False - ActionButton: - important: False - text: 'go to current loc' - on_press: app.center_map_on_gps() - ActionButton: - important: True - text: 'we ride together' - on_press: root.manager.current = 'compass'; app.set_destination() + FloatLayout: MapView: + id: mapview zoom: 16 - on_map_relocated: centermark.lat = mapview.lat; centermark.lon = mapview.lon + on_map_relocated: + centermark.lat = mapview.lat + centermark.lon = mapview.lon + selfmark.lat = app.gps_data.get('lat', 0) + selfmark.lon = app.gps_data.get('lon', 0) + + MapMarker: + source: 'marker_self.png' + id: selfmark + anchor_x: 0.5 + anchor_y: 0 MapMarker: source: 'marker.png' id: centermark - #anchor_x: 0.2 - #anchor_y: 0.3 + anchor_x: 0.5 + anchor_y: 0 + TextInput: + pos_hint: {"x":0.05, "top":0.97} + size_hint: 0.9, 0.07 + multiline: False + Button: + pos_hint: {"x":0.35, "top":0.9} + size_hint: 0.6, 0.07 + text: 'go to current loc' + on_press: app.center_map_on_gps() + Button: + pos_hint: {"x":.35, "top":0.83} + size_hint: 0.6, 0.07 + text: 'we ride together' + on_press: root.manager.current = 'compass'; app.set_destination() @@ -91,3 +100,5 @@ origin: self.center canvas.after: PopMatrix + Image: + source: 'pivot.png' \ No newline at end of file diff --git a/main.py b/main.py index 91ae13e..cf079f0 100644 --- a/main.py +++ b/main.py @@ -30,7 +30,7 @@ class FlockompassApp(App): needle_angle = NumericProperty(0) fbearing = NumericProperty(0) - dest_distance = StringProperty("") + dest_distance = StringProperty("") def dump(self, dt): print(dt, self.gps_data, self.session_data) @@ -65,7 +65,7 @@ class FlockompassApp(App): def on_location(self, **kwargs): self.gps_data = kwargs self.dump(1) - + if ('dest_lat' not in self.session_data and 'dest_lon' not in self.session_data): @@ -78,7 +78,7 @@ class FlockompassApp(App): self.dest_distance = "D: %0.1f km" % geodesic( (self.gps_data['lat'], self.gps_data['lon']), (self.session_data['dest_lat'], self.session_data['dest_lon'])).kilometers - + def center_map_on_gps(self): self.ms.ids.mapview.center_on(self.gps_data['lat'], self.gps_data['lon']) @@ -92,13 +92,13 @@ class FlockompassApp(App): needle_angle = 0 if self.cs.facade.field != (None, None, None): x, y, z = self.cs.facade.field - - smoothingFactor = 0.88 + + smoothingFactor = 0.676 angle = atan2(y, x) self.last_angle = smoothingFactor * self.last_angle + (1 - smoothingFactor) * angle needle_angle = degrees(self.last_angle) - 90 - + # fix animation transition around the unit circle if (self.needle_angle % 360) - needle_angle > 180: needle_angle += 360 @@ -124,13 +124,13 @@ class FlockompassApp(App): cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon2-lon1)) fbearing = self.needle_angle - degrees(fbearing) - - fbearing = (fbearing + 360) % 360 - + + #fbearing = (fbearing + 360) % 360 + self.cs._anim &= Animation(fbearing=fbearing, d=0.1, t='out_quad') - + self.cs._anim.start(self) def compass_enable(self): @@ -175,13 +175,13 @@ class FlockompassApp(App): self.cs = CompassScreen(name='compass') self.cs._anim = None - self.cs._anim1 = None + self.cs._anim1 = None screen_manager.add_widget(self.cs) # smoothing vars for compass self.last_angle = 0 - + #Clock.schedule_interval(self.dump, 2.0) return screen_manager diff --git a/marker_self.png b/marker_self.png new file mode 100644 index 0000000..0652a0f Binary files /dev/null and b/marker_self.png differ diff --git a/marker_self.svg b/marker_self.svg new file mode 100644 index 0000000..3667d01 --- /dev/null +++ b/marker_self.svg @@ -0,0 +1,135 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/needle.png b/needle.png index 4952e90..3e225f0 100644 Binary files a/needle.png and b/needle.png differ diff --git a/needle_to_dest.png b/needle_to_dest.png index b625552..b3fed6d 100644 Binary files a/needle_to_dest.png and b/needle_to_dest.png differ diff --git a/pivot.png b/pivot.png new file mode 100644 index 0000000..5f2d529 Binary files /dev/null and b/pivot.png differ diff --git a/presplash.png b/presplash.png index 1d2d2d3..9991353 100644 Binary files a/presplash.png and b/presplash.png differ