Merge branch 'YukariChiba-master'

This commit is contained in:
gym487 2022-04-15 15:34:00 +08:00
commit a70a50961f
3 changed files with 100 additions and 1 deletions

6
.gitignore vendored
View File

@ -40,6 +40,7 @@ gps-sdr-sim-lut
*.swp
*~
<<<<<<< HEAD
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@ -185,3 +186,8 @@ nbproject/*
# Last used USER_MOTION_SIZE variable
.user-motion-size
=======
# Python bytecodes
*.pyc
>>>>>>> 33aa99cdff44ab8f8ced315ff0b7ea047ef92403

View File

@ -39,7 +39,9 @@ python mapper.py
Then visit http://127.0.0.1:8080/static/baidumap.html to use the Online map.
You can write an map which can POST data to http://127.0.0.1:8080/post like this
Or visit http://127.0.0.1:8080/static/googlemap.html to use the google Online map.
You can also write an map which can POST data to http://127.0.0.1:8080/post like this
```
lon=116&lat=39&hgt=10

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Choose Your Location</title>
<script
type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key="
></script>
<script>
// hack Google Maps to bypass API v3 key (needed since 22 June 2016 http://googlegeodevelopers.blogspot.com.es/2016/06/building-for-scale-updates-to-google.html)
var target = document.head;
var observer = new MutationObserver(function(mutations) {
for (var i = 0; mutations[i]; ++i) {
// notify when script to hack is added in HTML head
if (
mutations[i].addedNodes[0].nodeName == "SCRIPT" &&
mutations[i].addedNodes[0].src.match(
/\/AuthenticationService.Authenticate?/g
)
) {
var str = mutations[i].addedNodes[0].src.match(
/[?&]callback=.*[&$]/g
);
if (str) {
if (str[0][str[0].length - 1] == "&") {
str = str[0].substring(10, str[0].length - 1);
} else {
str = str[0].substring(10);
}
var split = str.split(".");
var object = split[0];
var method = split[1];
window[object][method] = null; // remove censorship message function _xdc_._jmzdv6 (AJAX callback name "_jmzdv6" differs depending on URL)
//window[object] = {}; // when we removed the complete object _xdc_, Google Maps tiles did not load when we moved the map with the mouse (no problem with OpenStreetMap)
}
observer.disconnect();
}
}
});
var config = { attributes: true, childList: true, characterData: true };
observer.observe(target, config);
</script>
<script src="https://unpkg.com/location-picker/dist/location-picker.min.js"></script>
<script src="./jquery.js"></script>
<script src="./jqueryui.js"></script>
<style type="text/css">
#map {
width: 100%;
height: 600px;
}
</style>
</head>
<body>
<div id="map"></div>
<br />
<button id="confirmPosition">Confirm Position</button>
<br />
<p>Cursor position: <span id="onIdlePositionView"></span></p>
<p>Confirmed position: <span id="onClickPositionView"></span></p>
<script>
var confirmBtn = document.getElementById("confirmPosition");
var onClickPositionView = document.getElementById("onClickPositionView");
var onIdlePositionView = document.getElementById("onIdlePositionView");
var map = document.getElementById("map");
var lp = new locationPicker(
map,
{
setCurrentPosition: true,
lat: 39.9077,
lng: 116.3974
},
{
zoom: 15
}
);
confirmBtn.onclick = function() {
var location = lp.getMarkerPosition();
onClickPositionView.innerHTML =
"The chosen location is " + location.lat + "," + location.lng;
$.post("/post", { lon: location.lng, lat: location.lat, hgt: 100 });
};
google.maps.event.addListener(lp.map, "idle", function(event) {
var location = lp.getMarkerPosition();
onIdlePositionView.innerHTML =
"The chosen location is " + location.lat + "," + location.lng;
});
</script>
</body>
</html>