<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Cyclomedia ArcGIS JavaScript API (Bèta) Example</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.29/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.29/"></script>
<style>
html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; }
#menu { padding: 1em; }
</style>
<script>
require([
"esri/WebScene",
"esri/views/SceneView",
"esri/layers/IntegratedMeshLayer",
"esri/config",
"esri/request" ],
(WebScene, SceneView, IntegratedMeshLayer, esriConfig, esriRequest) => {
const webscene = new WebScene();
const params = new URLSearchParams(window.location.search);
var t = params.get("t")
const baseUrl = `https://atlasapi.cyclomedia.com/i3s/arcgis/rest/services/3dnl/SceneServer`;
esriConfig.request.interceptors.push({
urls: new RegExp(baseUrl, "i"), // Match your server URL
before: function(params) {
// Add authorization header
params.requestOptions.headers = params.requestOptions.headers || {};
params.requestOptions.headers.Authorization = 'Basic <Base64-encoded Cyclomedia's username and password, separated by a colon>';
}
});
fetch(baseUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic '
}
}
) .then((response) => { return response.json(); })
.then((json) => {
var count = 0;
json.layers.forEach((layer) => {
const l = new IntegratedMeshLayer({
url: `${baseUrl}/layers/${count++}`,
copyright: "Cyclomedia",
title: layer.name
});
webscene.add(l);
});
});
const view = new SceneView({
container: "viewDiv",
map: webscene,
qualityProfile: "high",
zoom: 1
});
});
</script>
</head>
<body> <div id="viewDiv"> </div>
</body>
</html>