ça c'est bien
This commit is contained in:
parent
f77cdd6281
commit
f417552c1d
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>U Planet Infinity project 0.01° x 0.01°</title>
|
<title>U Planet Infinity project 0.01° x 0.01° / Astroport / Common Distributed Information System </title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
<link rel="stylesheet" href="jquery-ui.min.css">
|
<link rel="stylesheet" href="jquery-ui.min.css">
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
<option value="simple">Simple earth</option>
|
<option value="simple">Simple earth</option>
|
||||||
<option value="simple_tilted">Simple tilted earth</option>
|
<option value="simple_tilted">Simple tilted earth</option>
|
||||||
-->
|
-->
|
||||||
<option value="simple_mars">UPlanet</option>
|
<option value="simple_mars">New</option>
|
||||||
<!--
|
<!--
|
||||||
<option value="flights">Earth with locations and flights</option>
|
<option value="flights">Earth with locations and flights</option>
|
||||||
-->
|
-->
|
||||||
|
@ -147,7 +147,9 @@
|
||||||
<input type="text" id="address" size=30 required>
|
<input type="text" id="address" size=30 required>
|
||||||
<button type="button" onclick="getCoordinates()">Go There</button>
|
<button type="button" onclick="getCoordinates()">Go There</button>
|
||||||
</form>
|
</form>
|
||||||
<p id="result"><a href="mailto:support@qo-op.com">Contact us</a> to add your own UPlanet</p>
|
|
||||||
|
<br>
|
||||||
|
<p id="result">- <a href="mailto:support@qo-op.com">Contact</a> -</p>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<div class="code">
|
<div class="code">
|
||||||
|
|
|
@ -264,7 +264,6 @@ document.getElementById('map-container').addEventListener('click', (event) => {
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
async function loadGridNumbers(myURL) {
|
async function loadGridNumbers(myURL) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await fetchAstroport(myURL);
|
const data = await fetchAstroport(myURL);
|
||||||
return data.gridNumbers || [];
|
return data.gridNumbers || [];
|
||||||
|
@ -292,28 +291,11 @@ function overlayGridNumbers(rectangle, number) {
|
||||||
document.getElementById('map-container').appendChild(numberElement);
|
document.getElementById('map-container').appendChild(numberElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const zquery = 'zone='+NSize+'&ulat='+southWestLat+'&ulon='+southWestLon; // Replace with your actual query parameters
|
const zquery = 'zone='+NSize+'&ulat='+southWestLat+'&ulon='+southWestLon; // Replace with your actual query parameters
|
||||||
const zoneURL = station+'/?' + zquery;
|
const zoneURL = station+'/?' + zquery;
|
||||||
|
|
||||||
console.log('ZONE URL:', zoneURL);
|
console.log('ZONE URL:', zoneURL);
|
||||||
|
|
||||||
// Load grid numbers and overlay them on the map
|
|
||||||
loadGridNumbers(zoneURL).then(gridNumbers => {
|
|
||||||
gridNumbers.forEach(({ lat, lon, number }) => {
|
|
||||||
const latLng = L.latLng(lat, lon);
|
|
||||||
|
|
||||||
// Find the corresponding rectangle
|
|
||||||
const matchingRectangle = rectangles.find(rectangle =>
|
|
||||||
rectangle.getBounds().contains(latLng)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingRectangle) {
|
|
||||||
overlayGridNumbers(matchingRectangle, number);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a clickable rectangle for each grid cell
|
// Create a clickable rectangle for each grid cell
|
||||||
const rectangles = [];
|
const rectangles = [];
|
||||||
for (let latIndex = 0; latIndex < gridSize; latIndex++) {
|
for (let latIndex = 0; latIndex < gridSize; latIndex++) {
|
||||||
|
@ -343,6 +325,58 @@ for (let latIndex = 0; latIndex < gridSize; latIndex++) {
|
||||||
rectangles.push(rectangle);
|
rectangles.push(rectangle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load grid numbers and overlay them on the map
|
||||||
|
loadGridNumbers(zoneURL).then(gridNumbers => {
|
||||||
|
gridNumbers.forEach(({ lat, lon, number, ipns }) => {
|
||||||
|
// Calculate the center of the rectangle based on lat + NSize and lon + NSize
|
||||||
|
const latCenter = lat + (lat < 0 ? -NSize / 2 : NSize / 2);
|
||||||
|
const lonCenter = lon + (lon < 0 ? -NSize / 2 : NSize / 2);
|
||||||
|
|
||||||
|
const latLng = L.latLng(latCenter, lonCenter);
|
||||||
|
|
||||||
|
// Find the corresponding rectangle
|
||||||
|
const matchingRectangle = rectangles.find(rectangle =>
|
||||||
|
rectangle.getBounds().contains(latLng)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchingRectangle) {
|
||||||
|
overlayGridNumbers(matchingRectangle, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ipns !== '') {
|
||||||
|
const buttonContainer = document.createElement('div');
|
||||||
|
buttonContainer.id = 'button-container'
|
||||||
|
buttonContainer.style.position = 'absolute';
|
||||||
|
buttonContainer.style.bottom = '10px';
|
||||||
|
buttonContainer.style.left = '10px';
|
||||||
|
buttonContainer.style.width = '200px';
|
||||||
|
buttonContainer.style.height = '150px';
|
||||||
|
buttonContainer.style.zIndex = '1001';
|
||||||
|
buttonContainer.style.display = 'flex';
|
||||||
|
buttonContainer.style.flexDirection = 'column';
|
||||||
|
buttonContainer.style.alignItems = 'center';
|
||||||
|
buttonContainer.style.justifyContent = 'center';
|
||||||
|
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.innerText = 'EXPLORE';
|
||||||
|
button.className = 'button';
|
||||||
|
|
||||||
|
// Add an event listener to the button
|
||||||
|
button.addEventListener('click', function() {
|
||||||
|
window.open( ipns , "AstroTab");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Append the button to the button container
|
||||||
|
buttonContainer.appendChild(button);
|
||||||
|
document.body.appendChild(buttonContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue