debug current zoom level
This commit is contained in:
parent
915bc99603
commit
8d1994f365
5 changed files with 14 additions and 5 deletions
BIN
assets/images/marker_fountain.png
Normal file
BIN
assets/images/marker_fountain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
|
@ -5,9 +5,11 @@
|
||||||
<ForestMapView>:
|
<ForestMapView>:
|
||||||
lat: 42.131331
|
lat: 42.131331
|
||||||
lon: 24.747571
|
lon: 24.747571
|
||||||
zoom: 15
|
zoom: 5
|
||||||
|
snap_to_zoom: False
|
||||||
on_zoom:
|
on_zoom:
|
||||||
self.zoom = 5 if self.zoom < 5 else self.zoom
|
self.zoom = 7 if self.zoom < 7 else self.zoom
|
||||||
|
self.print_current_zoom(self.zoom)
|
||||||
on_lat:
|
on_lat:
|
||||||
self.start_get_fov_trees()
|
self.start_get_fov_trees()
|
||||||
on_lon:
|
on_lon:
|
||||||
|
|
|
@ -8,6 +8,9 @@ class ForestMapView(MapView):
|
||||||
get_trees_timer = None
|
get_trees_timer = None
|
||||||
tree_names = []
|
tree_names = []
|
||||||
|
|
||||||
|
def print_current_zoom(self):
|
||||||
|
print("] Zoom level: " + zoom)
|
||||||
|
|
||||||
def start_get_fov_trees(self):
|
def start_get_fov_trees(self):
|
||||||
# After one second get the trees in field of view
|
# After one second get the trees in field of view
|
||||||
try:
|
try:
|
||||||
|
@ -28,8 +31,7 @@ class ForestMapView(MapView):
|
||||||
trees = app.cursor.fetchall()
|
trees = app.cursor.fetchall()
|
||||||
for tree in trees:
|
for tree in trees:
|
||||||
name = tree[0]
|
name = tree[0]
|
||||||
print(tree)
|
print("] Fountain detected: " + str(tree))
|
||||||
print("Tree detected")
|
|
||||||
if name in self.tree_names:
|
if name in self.tree_names:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
@ -39,7 +41,7 @@ class ForestMapView(MapView):
|
||||||
# Create TreeMarker
|
# Create TreeMarker
|
||||||
name = tree[0]
|
name = tree[0]
|
||||||
lat, lon = tree[1], tree[2]
|
lat, lon = tree[1], tree[2]
|
||||||
treemarker = TreeMarker(lat=lat, lon=lon, source='assets/images/marker.png')
|
treemarker = TreeMarker(lat=lat, lon=lon, source='assets/images/marker_tree.png')
|
||||||
treemarker.tree_data = treemarker
|
treemarker.tree_data = treemarker
|
||||||
|
|
||||||
# Add TreeMarker to the map
|
# Add TreeMarker to the map
|
||||||
|
|
5
main.py
5
main.py
|
@ -21,6 +21,10 @@ from gpshelper import GpsHelper
|
||||||
from settings import SampleBoxLayout
|
from settings import SampleBoxLayout
|
||||||
from game import GameWidget
|
from game import GameWidget
|
||||||
|
|
||||||
|
# MOTD
|
||||||
|
motd = """]
|
||||||
|
] GlobalForest 0.1 by afx"""
|
||||||
|
|
||||||
Builder.load_string("""
|
Builder.load_string("""
|
||||||
<ScreenOne>:
|
<ScreenOne>:
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
@ -59,6 +63,7 @@ class MainApp(MDApp):
|
||||||
#return SampleBoxLayout()
|
#return SampleBoxLayout()
|
||||||
|
|
||||||
def on_start(self):
|
def on_start(self):
|
||||||
|
print(motd)
|
||||||
connection = None
|
connection = None
|
||||||
cursor = None
|
cursor = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue