Skip to content

Commit

Permalink
fixes for geojson and cache_dir not working with geojson (implementat…
Browse files Browse the repository at this point in the history
…ion is not great :/)
  • Loading branch information
tito committed Feb 9, 2017
1 parent 227fc73 commit 5fe95b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions mapview/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from kivy.utils import get_color_from_hex
from kivy.metrics import dp
from kivy.utils import get_color_from_hex
from mapview import CACHE_DIR
from mapview.view import MapLayer
from mapview.downloader import Downloader

Expand Down Expand Up @@ -190,15 +191,14 @@ class GeoJsonMapLayer(MapLayer):

source = StringProperty()
geojson = ObjectProperty()
initial_zoom = None
first_time = True
cache_dir = StringProperty(CACHE_DIR)

def __init__(self, **kwargs):
self.first_time = True
self.initial_zoom = None
super(GeoJsonMapLayer, self).__init__(**kwargs)
self.cache_dir = kwargs.get('cache_dir', None)
with self.canvas:
self.canvas_polygon = Canvas()
self.canvas_line = Canvas()
with self.canvas_polygon.before:
PushMatrix()
self.g_matrix = MatrixInstruction()
Expand Down Expand Up @@ -243,7 +243,7 @@ def traverse_feature(self, func, part=None):
for feature in part["features"]:
func(feature)
elif tp == "Feature":
func(feature)
func(part)

@property
def bounds(self):
Expand Down
2 changes: 1 addition & 1 deletion mapview/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class MapView(Widget):
delta_x = NumericProperty(0)
delta_y = NumericProperty(0)
background_color = ListProperty([181 / 255., 208 / 255., 208 / 255., 1])
cache_dir = StringProperty(CACHE_DIR)
_zoom = NumericProperty(0)
_pause = BooleanProperty(False)
_scale = 1.
Expand Down Expand Up @@ -518,7 +519,6 @@ def __init__(self, **kwargs):
self._scale_target_anim = False
self._scale_target = 1.
self._touch_count = 0
self.cache_dir = kwargs.get('cache_dir', CACHE_DIR)
self.map_source.cache_dir = self.cache_dir
Clock.schedule_interval(self._animate_color, 1 / 60.)
self.lat = kwargs.get("lat", self.lat)
Expand Down

0 comments on commit 5fe95b0

Please sign in to comment.