(gui) - added location/background (rest) - added location

This commit is contained in:
Blake J. Harnden 2018-09-19 16:32:25 -07:00
parent b6cc2ad86e
commit 28f14a9b66
13 changed files with 417 additions and 1 deletions

View file

@ -101,6 +101,38 @@ def set_session_options(session_id):
return jsonify()
@api.route("/sessions/<int:session_id>/location", methods=["PUT"])
def set_session_location(session_id):
session = core_utils.get_session(coreemu, session_id)
data = request.get_json() or {}
position = data["position"]
location = data["location"]
session.location.refxyz = (position["x"], position["y"], position["z"])
session.location.setrefgeo(location["latitude"], location["longitude"], location["altitude"])
session.location.refscale = data["scale"]
return jsonify()
@api.route("/sessions/<int:session_id>/location")
def get_session_location(session_id):
session = core_utils.get_session(coreemu, session_id)
x, y, z = session.location.refxyz
lat, lon, alt = session.location.refgeo
return jsonify({
"position": {
"x": x,
"y": y,
"z": z,
},
"location": {
"latitude": lat,
"longitude": lon,
"altitude": alt
},
"scale": session.location.refscale
})
@api.route("/sessions/<int:session_id>")
def get_session(session_id):
session = core_utils.get_session(coreemu, session_id)