Esempio n. 1
0
File: map.py Progetto: marcb1387/MAD
    def get_prioroute(self):
        routeexport = []

        routemanager_names = self._mapping_manager.get_all_routemanager_names()

        for routemanager in routemanager_names:
            mode = self._mapping_manager.routemanager_get_mode(routemanager)
            name = self._mapping_manager.routemanager_get_name(routemanager)
            route: Optional[List[
                Location]] = self._mapping_manager.routemanager_get_current_prioroute(
                    routemanager)

            if route is None:
                continue
            route_serialized = []

            for location in route:
                route_serialized.append({
                    "timestamp":
                    location[0],
                    "latitude":
                    get_coord_float(location[1].lat),
                    "longitude":
                    get_coord_float(location[1].lng)
                })

            routeexport.append({
                "name": name,
                "mode": mode,
                "coordinates": route_serialized
            })

        return jsonify(routeexport)
Esempio n. 2
0
File: map.py Progetto: marcb1387/MAD
def get_routepool_coords(coord_list, mode):
    route_serialized = []
    prepared_coords = coord_list
    if isinstance(coord_list, RoutePoolEntry):
        prepared_coords = coord_list.subroute
    for location in prepared_coords:
        route_serialized.append(
            [get_coord_float(location.lat),
             get_coord_float(location.lng)])
    return (route_serialized)
Esempio n. 3
0
File: map.py Progetto: marcb1387/MAD
    def get_workers(self):
        positions = []
        devicemappings = self._mapping_manager.get_all_devicemappings()
        for name, values in devicemappings.items():
            lat = values.get("settings").get("last_location",
                                             Location(0.0, 0.0)).lat
            lon = values.get("settings").get("last_location",
                                             Location(0.0, 0.0)).lng

            worker = {
                "name": str(name),
                "lat": get_coord_float(lat),
                "lon": get_coord_float(lon)
            }
            positions.append(worker)

        return jsonify(positions)