コード例 #1
0
 def on_touch_down(self, touch):
     global xList
     global yList
     m1 = MapMarker(lat=67, lon=42)
     self.add_marker(m1)
     print(xList)
     print(yList)
     for i in range(len(xList)):
         m = MapMarker(lat=xList[i], lon=yList[i])
         self.add_marker(m)
コード例 #2
0
 def build(self):
     self.title = "Eaglesoft Map"
     print(MapSource.providers.keys())
     box_layout = BoxLayout()
     map_view = MapView(lat=30.005630, lon=73.257950, zoom=8)
     map_view.map_source = "osm"
     map_marker = MapMarker()
     map_marker.lat = 30.005630
     map_marker.lon = 73.257950
     map_marker.source = "map-marker.png"
     map_view.add_widget(map_marker)
     box_layout.add_widget(map_view)
     return box_layout
コード例 #3
0
 def create_marker(feature):
     global count
     geometry = feature["geometry"]
     if geometry["type"] != "Point":
         return
     lon, lat = geometry["coordinates"]
     marker = MapMarker(lon=lon, lat=lat)
     view.add_marker(marker)
     count += 1
コード例 #4
0
    def add_vehicle(self, mapa, marcador):

        if marcador[0] is not -1 and marcador[0] not in self.lista_anadidos:
            marker = MapMarker(lat=marcador[1], lon=marcador[2])
            sound = SoundLoader.load('assets/notification.wav')
            mapa.add_widget(marker)
            if sound and App.get_running_app().config.get(
                    "general", "sound_notifications") == "1":
                sound.play()
            mapa.lista_marker.append(marker)
            mapa.lista_anadidos.append(marcador[0])
            print("anadido")
コード例 #5
0
 def get_location(self):
     self.clear_map_from_markers()
     gps.start()
     time.sleep(3)
     if self.lat and self.lon:
         marker = MapMarker(source=os.path.join(ASSETS_FOLDER, 'map_marker64x64.png'), lat=self.lat, lon=self.lon)
         self.map.add_marker(marker)
         time.sleep(0.5)
         self.map.center_on(self.lat, self.lon)
         time.sleep(0.25)
         if self.map.zoom < 10:
             self.map.zoom = 10
     else:
         Snackbar(text='Something went wrong, try again...').show()
コード例 #6
0
ファイル: main.py プロジェクト: guysoft/recycle_app_israel
    def build(self):
        layer = ClusteredMarkerLayer()
        
        a = MapMarker()
        # self.mapview.add_marker(, cls=MapMarker)
        layer.add_marker(lon=32.092, lat=34.807, cls=MapMarker)
        
        self.mapview = MapView(zoom=15, lat=32.092, lon=34.807)
        self.mapview.map_source.min_zoom = 14
        # self.mapview.add_widget(layer)
        
        data = get_geo_data()
        
        places = data["places"]

        for place in places:
            if place["categories"][0]["id"] == "45":
                pin_color = "data/pin-red.png"
                
            else:
                pin_color = "data/pin-blue.png"
            marker = MapMarker(lat=float(place["location"]["lat"]), lon=float(place["location"]["lng"]),source=pin_color)
            # layer.add_marker(marker)
            self.mapview.add_marker(marker)
            
        
        if platform == "android":
            print("gps.py: Android detected. Requesting permissions")
            request_android_permissions()

        
        try:
            print(self.getLocation())
        except NotImplementedError:
            print("location not NotImplemented")

        return self.mapview
コード例 #7
0
ファイル: main.py プロジェクト: ADutta007/KIVY
    def show_points(self):
        global marker_coord
        self.marker = []
        self.comp_logo = []
        self.marker_image = []
        # self.random_points()
        # print(marker_coord)
        for i in range(len(marker_coord)):
            # print("muji")
            self.marker.append(i)
            self.marker_image.append(i)
            self.marker[i] = MapMarker(lat=float(marker_coord[i][0]),
                                       lon=float(marker_coord[i][1]),
                                       source="gps_logo.png")
            self.add_widget(self.marker[i])

            self.marker_image[i] = picture[random.randint(1, 3)]
コード例 #8
0
    def load_markers(self, antal, lokation):
        link = link_constructer(
            antal, self.ADA, self.UNISEX,
            lokation)  #Bruger link_constructor fra data_toiley.py
        data = data_constructer(
            link)  #Bruger data_constructer fra data_toilet.py

        for address in range(
                len(data[0])
        ):  #Laver en løkke som går fra n til længden af data[0] for at finde hvor mange markers der skal laves
            self.mark_coords = findkoordinater(
                data[0][address], 0
            )  #Sætter mark_coords til at være findkordinater af [0][n] for at få koordinater
            if self.mark_coords != None:  #Er self.mark_coords None?
                newMarker = MapMarker(
                    lat=self.mark_coords[0],
                    lon=self.mark_coords[1],
                    source="marker1.png"
                )  #laver en MapMarker med data fra self.mark_coords og bliver gemt i newMarker
                self.newMap.add_widget(
                    newMarker)  #tilføjer newMarker som widget til newMap
                self.markerList.append(
                    newMarker
                )  #tilføjer newMarker til klasse variablen markerList
コード例 #9
0
    def __init__(self, **kwargs):

        super().__init__(**kwargs)

        self.current_time = datetime.now()

        #test variable
        self.test = ""
        self.type = ""
        self.status = ""

        #image
        self.image_bool = True

        #gps config and start, get lat and lon values
        self.address = ""
        self.lat = 0
        self.lon = 0

        main_layout = BoxLayout(orientation="vertical")

        actual_forecast = GridLayout(cols=2,
                                     size_hint=(1, 0.3))  #size_hint= (1, 1))
        Clock.schedule_interval(self.update_image, 300)
        self.img = Image(source="./umbrella.png",
                         size_hint=(0.4, 1),
                         pos_hint={
                             "center_x": 0.5,
                             "center_y": 0.5
                         })
        info = BoxLayout(orientation="vertical")
        Clock.schedule_interval(self.update_clock, 1)
        self.time_label = Label(text=self.current_time.strftime("%H:%M:%S"))
        info.add_widget(self.time_label)
        self.pos_label = Label(text=f"{self.address} + {self.test}",
                               text_size=(info.width * 3, None))
        info.add_widget(self.pos_label)

        actual_forecast.add_widget(self.img)
        actual_forecast.add_widget(info)

        main_layout.add_widget(actual_forecast)

        # if platform == "android":
        #     Clock.schedule_interval(self.gps_run, 10)

        self.next_forecast = BoxLayout(orientation="vertical")
        next = Label(text="Prévisions à venir",
                     size_hint=(1, 0.2),
                     text_size=(Window.width * 0.9, None))
        self.next_forecast.add_widget(next)

        self.map = MapView(zoom=11, lat=float(self.lat), lon=float(self.lon))
        self.current_loc = MapMarker(lat=float(self.lat),
                                     lon=float(self.lon),
                                     source="./marker.png")
        self.current_loc.bind(on_press=self.marker_popup)
        self.map.add_marker(self.current_loc)
        self.next_forecast.add_widget(self.map)
        main_layout.add_widget(self.next_forecast)

        button = Button(text="Agenda", size_hint=(1, 0.2))
        button.bind(on_press=self.get_dairy)
        main_layout.add_widget(button)

        self.add_widget(main_layout)
コード例 #10
0
class Forecast(Screen):
    def __init__(self, **kwargs):

        super().__init__(**kwargs)

        self.current_time = datetime.now()

        #test variable
        self.test = ""
        self.type = ""
        self.status = ""

        #image
        self.image_bool = True

        #gps config and start, get lat and lon values
        self.address = ""
        self.lat = 0
        self.lon = 0

        main_layout = BoxLayout(orientation="vertical")

        actual_forecast = GridLayout(cols=2,
                                     size_hint=(1, 0.3))  #size_hint= (1, 1))
        Clock.schedule_interval(self.update_image, 300)
        self.img = Image(source="./umbrella.png",
                         size_hint=(0.4, 1),
                         pos_hint={
                             "center_x": 0.5,
                             "center_y": 0.5
                         })
        info = BoxLayout(orientation="vertical")
        Clock.schedule_interval(self.update_clock, 1)
        self.time_label = Label(text=self.current_time.strftime("%H:%M:%S"))
        info.add_widget(self.time_label)
        self.pos_label = Label(text=f"{self.address} + {self.test}",
                               text_size=(info.width * 3, None))
        info.add_widget(self.pos_label)

        actual_forecast.add_widget(self.img)
        actual_forecast.add_widget(info)

        main_layout.add_widget(actual_forecast)

        # if platform == "android":
        #     Clock.schedule_interval(self.gps_run, 10)

        self.next_forecast = BoxLayout(orientation="vertical")
        next = Label(text="Prévisions à venir",
                     size_hint=(1, 0.2),
                     text_size=(Window.width * 0.9, None))
        self.next_forecast.add_widget(next)

        self.map = MapView(zoom=11, lat=float(self.lat), lon=float(self.lon))
        self.current_loc = MapMarker(lat=float(self.lat),
                                     lon=float(self.lon),
                                     source="./marker.png")
        self.current_loc.bind(on_press=self.marker_popup)
        self.map.add_marker(self.current_loc)
        self.next_forecast.add_widget(self.map)
        main_layout.add_widget(self.next_forecast)

        button = Button(text="Agenda", size_hint=(1, 0.2))
        button.bind(on_press=self.get_dairy)
        main_layout.add_widget(button)

        self.add_widget(main_layout)

    def marker_popup(self, *args):
        box = BoxLayout(orientation="vertical")
        text = "Vous êtes au: \n" + self.address
        label = Label(text=text, text_size=(Window.width * 0.9, None))
        ok_button = Button(text="OK", size_hint=(1, 0.2))
        ok_button.bind(on_press=self.marker_popup_dismiss)
        box.add_widget(label)
        box.add_widget(ok_button)
        self.mark_popup = Popup(title="Informations:", content=box)
        self.mark_popup.open()

    def marker_popup_dismiss(self, *args):
        self.mark_popup.dismiss()

    def get_dairy(self, *arg):
        my_app.sm.current = "Agenda"

    def update_clock(self, *args):
        self.time_label.text = main_time().strftime("%H:%M:%S")

        self.pos_label.text = f"{self.address} + {self.test} \n {self.lat}, {self.lon}"  #Une phrase super gavée longue pour tester ce que je veux faire
        self.current_loc.lat = float(self.lat)
        self.current_loc.lon = float(self.lon)

        if self.image_bool and self.lat != 0 and self.lon != 0:
            if get_current_weather(self.lat, self.lon) < 0.1:
                self.img.source = "./sun.png"
            else:
                self.img.source = "./umbrella.png"
            self.image_bool = False

    def update_image(self, *args):
        if get_current_weather(self.lat, self.lon) < 0.1:
            self.img.source = "./sun.png"
        else:
            self.img.source = "./umbrella.png"
コード例 #11
0
 def create_marker(self, dt):
     self.marker = MapMarker(lat=self.lat, lon=self.lon)
     self.mapview.add_widget(self.marker)