Commit f0740870 authored by Alfakhori's avatar Alfakhori
Browse files

GPS_LOCALIZATION

parent a38c00b7
Pipeline #12495 passed with stage
in 24 seconds
......@@ -15,7 +15,7 @@ The current settings are in `public/ar_geolocation.js`:
| `maximumWaitMs` | 18 s | Maximum acquisition time before using a fallback or reporting failure |
| `maximumAgeMs` | 1.5 s | Browser cache age requested for each watch reading |
Each accepted sample retains its coordinates, accuracy, and browser timestamp during selection. The chosen `geoLocation` includes rounded latitude/longitude plus accuracy, newest sample timestamp, sample count, spread, source (`stable cluster` or `timeout fallback`), and status (`STABLE` or `APPROXIMATE`). The existing five-decimal origin precision and coordinate conversion functions are unchanged.
Each accepted sample retains its coordinates, accuracy, and browser timestamp during selection. The chosen `geoLocation` keeps the full calculated floating-point latitude/longitude precision internally and includes accuracy, newest sample timestamp, sample count, spread, source (`stable cluster` or `timeout fallback`), and status (`STABLE` or `APPROXIMATE`). The existing coordinate conversion functions are unchanged. Diagnostics format coordinates to seven decimal places for display only; that formatting does not change the internal origin or increase GPS accuracy.
At timeout, the app uses the best available in-range cluster (or the best usable fix) and labels it approximate. With no usable fix, the app leaves the scene unloaded, reports the failure, and offers **Erneut versuchen**. Once a location is selected, the watch is cleared. Later GPS updates never move models or change the map origin; movement is then owned by WebXR local tracking.
......
......@@ -34,6 +34,7 @@ const state = {
};
let panel = null;
let toggleButton = null;
let refreshTimer = null;
let frameCount = 0;
let fpsWindowStarted = 0;
......@@ -132,18 +133,43 @@ function getSessionStorage() {
export function initializeXRDiagnostics() {
if (!XR_DIAGNOSTICS_ENABLED) return;
toggleButton = document.createElement("button");
toggleButton.id = "xr-diagnostics-toggle";
toggleButton.type = "button";
toggleButton.textContent = "XR";
toggleButton.setAttribute("aria-label", "Toggle XR diagnostics");
toggleButton.setAttribute("aria-controls", "xr-diagnostic-panel");
toggleButton.setAttribute("aria-expanded", "false");
toggleButton.style.cssText = [
"position:fixed",
"top:10px",
"right:10px",
"z-index:10001",
"min-width:48px",
"min-height:48px",
"padding:8px 12px",
"border:1px solid rgba(0,255,0,.65)",
"border-radius:6px",
"background:rgba(0,0,0,.88)",
"color:#00ff00",
"font:bold 14px monospace",
"cursor:pointer",
"pointer-events:auto",
"touch-action:manipulation",
].join(";");
panel = document.createElement("pre");
panel.id = "xr-diagnostic-panel";
panel.setAttribute("role", "status");
panel.setAttribute("aria-live", "polite");
panel.style.cssText = [
"position:fixed",
"top:38px",
"top:64px",
"left:8px",
"z-index:9997",
"z-index:10000",
"box-sizing:border-box",
"width:min(360px, calc(100vw - 16px))",
"max-height:45vh",
"max-height:calc(100vh - 76px)",
"overflow:auto",
"margin:0",
"padding:8px",
......@@ -153,9 +179,18 @@ export function initializeXRDiagnostics() {
"color:#00ff00",
"font:11px/1.35 monospace",
"white-space:pre-wrap",
"pointer-events:none",
"pointer-events:auto",
"touch-action:pan-y",
"display:none",
].join(";");
toggleButton.addEventListener("click", () => {
const isOpen = panel.style.display !== "none";
panel.style.display = isOpen ? "none" : "block";
toggleButton.setAttribute("aria-expanded", String(!isOpen));
});
document.body.appendChild(toggleButton);
document.body.appendChild(panel);
cameraWorldPosition = new THREE.Vector3();
......@@ -247,7 +282,7 @@ export function reportGeolocationReady(location) {
if (!XR_DIAGNOSTICS_ENABLED) return;
state.gpsStatus = location.status || "READY";
state.geolocation =
location.latitude.toFixed(5) + ", " + location.longitude.toFixed(5);
location.latitude.toFixed(7) + ", " + location.longitude.toFixed(7);
state.gpsBase = state.geolocation;
state.gpsAccuracy = Number.isFinite(location.accuracy)
? location.accuracy
......@@ -273,7 +308,7 @@ export function reportGeolocationStatus(status, location = null) {
state.gpsStatus = status;
if (location) {
state.gpsBase =
location.latitude.toFixed(5) + ", " + location.longitude.toFixed(5);
location.latitude.toFixed(7) + ", " + location.longitude.toFixed(7);
state.gpsAccuracy = Number.isFinite(location.accuracy)
? location.accuracy
: null;
......
......@@ -90,9 +90,8 @@ function makeLocation(samples, cluster, source) {
);
return {
// Keep the existing five-decimal origin precision used by the app.
latitude: Number(estimate.latitude.toFixed(5)),
longitude: Number(estimate.longitude.toFixed(5)),
latitude: estimate.latitude,
longitude: estimate.longitude,
accuracy: estimate.accuracy,
timestamp: newestSample.timestamp,
sampleCount: selectedSamples.length,
......
......@@ -314,7 +314,7 @@
============================================================ -->
<div id="app-version">
v0.3.2
v0.3.3
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment