Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// options.right = box.max.x;
// options.top = box.max.y;
// options.bottom = box.min.y;
// options.near = box.min.z;
// options.far = box.max.z;
// console.log(box);
if (shadowMapViewerCreated === false) {
shadowMapViewerCreated = true;
const lightShadowMapViewer = new ShadowMapViewer(light) as any;
lightShadowMapViewer.position.x = 10;
lightShadowMapViewer.position.y = 10;
lightShadowMapViewer.size.width = 4096 / 16;
lightShadowMapViewer.size.height = 4096 / 16;
lightShadowMapViewer.update();
map.addEventListener(MapViewEventNames.AfterRender, () => {
lightShadowMapViewer.render(map.renderer);
});
}
Object.assign(light.shadow.camera, options);
light.shadow.camera.updateProjectionMatrix();
};
function initMapView(
id: string,
gridPositionX: number,
gridPositionY: number,
theme: string,
decoderUrl: string
): ViewControlPair {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const mapView = new MapView({
canvas,
theme,
decoderUrl
});
CopyrightElementHandler.install("copyrightNotice", mapView);
// instantiate the default map controls, allowing the user to pan around freely.
const mapControls = new MapControls(mapView);
// Add an UI.
if (gridPositionX === 1) {
const ui = new MapControlsUI(mapControls);
canvas.parentElement!.appendChild(ui.domElement);
}
// center the camera somewhere around Berlin geo locations
function initializeBaseMap(id: string): MapView {
// snippet:geojson_property_styling1.ts
const canvas = document.getElementById(id) as HTMLCanvasElement;
const mapView = new MapView({
canvas,
theme: "resources/reducedNight.json"
});
CopyrightElementHandler.install("copyrightNotice")
.attach(mapView)
.setDefaults([
{
id: "openstreetmap.org",
label: "OpenStreetMap contributors",
link: "https://www.openstreetmap.org/copyright"
}
]);
mapView.camera.position.set(2000000, 3500000, 6000000); // Europe.
mapView.geoCenter = new GeoCoordinates(16, -4, 0);
function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const sampleMapView = new MapView({
canvas,
theme: "resources/reducedNight.json"
});
CopyrightElementHandler.install("copyrightNotice")
.attach(sampleMapView)
.setDefaults([
{
id: "openstreetmap.org",
label: "OpenStreetMap contributors",
link: "https://www.openstreetmap.org/copyright"
}
]);
sampleMapView.camera.position.set(2000000, 3500000, 6000000); // Europe.
sampleMapView.geoCenter = new GeoCoordinates(16, -4, 0);
export function initMapView(
id: string,
gridPositionX: number,
gridPositionY: number,
theme?: string,
decoderUrl?: string
): ViewControlPair {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const sampleMapView = new MapView({
canvas,
theme: theme !== undefined ? theme : defaultTheme,
decoderUrl
});
sampleMapView.camera.position.set(0, 0, 800);
// instantiate the default map controls, allowing the user to pan around freely.
const mapControls = new MapControls(sampleMapView);
//Set the cameras height according to the given zoom level.
sampleMapView.camera.position.setZ(
MapViewUtils.calculateDistanceToGroundFromZoomLevel(sampleMapView, defaultZoomLevel)
);
// center the camera somewhere around Berlin geo locations
sampleMapView.geoCenter = new GeoCoordinates(52.518611, 13.376111, 0);
function initializeMapView(id: string): MapView {
// snippet:vislib_hello_onethread_example_0.ts
const canvas = document.getElementById(id) as HTMLCanvasElement;
// end:vislib_hello_onethread_example_0.ts
// snippet:vislib_hello_onethread_example_1.ts
const sampleMapView = new MapView({
canvas,
theme: "resources/day.json"
});
// end:vislib_hello_onethread_example_1.ts
CopyrightElementHandler.install("copyrightNotice")
.attach(sampleMapView)
.setDefaults([
{
id: "openstreetmap.org",
label: "OpenStreetMap contributors",
link: "https://www.openstreetmap.org/copyright"
}
]);
// snippet:vislib_hello_onethread_example_2.ts
export function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const sampleMapView = new MapView({
canvas,
theme: "./resources/day.json"
});
CopyrightElementHandler.install("copyrightNotice")
.attach(sampleMapView)
.setDefaults([
{
id: "openstreetmap.org",
label: "OpenStreetMap contributors",
link: "https://www.openstreetmap.org/copyright"
}
]);
// let the camera float over the map, looking straight down
sampleMapView.camera.position.set(0, 0, 800);
function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const map = new MapView({
canvas,
theme: "resources/berlin_tilezen_base.json"
});
CopyrightElementHandler.install("copyrightNotice", map);
// Center the camera on Manhattan, New York City.
map.setCameraGeolocationAndZoom(new GeoCoordinates(40.6935, -74.009), 16.9, 6.3, 50);
// Instantiate the default map controls, allowing the user to pan around freely.
const mapControls = new MapControls(map);
mapControls.maxTiltAngle = 50;
// Add an UI.
const ui = new MapControlsUI(mapControls);
canvas.parentElement!.appendChild(ui.domElement);
// Resize the mapView to maximum.
map.resize(window.innerWidth, window.innerHeight);
// React on resize events.
export function initializeMapView(id: string): MapView {
const canvas = document.getElementById(id) as HTMLCanvasElement;
const map = new MapView({
canvas,
theme: "resources/berlin_tilezen_base_globe.json"
});
// instantiate the default map controls, allowing the user to pan around freely.
const controls = new MapControls(map);
// Add an UI.
const ui = new MapControlsUI(controls, { zoomLevel: "input", projectionSwitch: true });
canvas.parentElement!.appendChild(ui.domElement);
CopyrightElementHandler.install("copyrightNotice", map);
// resize the mapView to maximum
map.resize(window.innerWidth, window.innerHeight);
// react on resize events
window.addEventListener("resize", () => {
map.resize(window.innerWidth, window.innerHeight);
});
return map;
}
function initializeMapView(id: string): MapView {
// snippet:vislib_hello_onethread_example_0.ts
const canvas = document.getElementById(id) as HTMLCanvasElement;
// end:vislib_hello_onethread_example_0.ts
// snippet:vislib_hello_onethread_example_1.ts
const sampleMapView = new MapView({
canvas,
theme: "resources/day.json"
});
// end:vislib_hello_onethread_example_1.ts
CopyrightElementHandler.install("copyrightNotice")
.attach(sampleMapView)
.setDefaults([
{
id: "openstreetmap.org",
label: "OpenStreetMap contributors",
link: "https://www.openstreetmap.org/copyright"
}
]);
// snippet:vislib_hello_onethread_example_2.ts
// let the camera float over the map, looking straight down
sampleMapView.camera.position.set(0, 0, 800);
// center the camera somewhere around Berlin geo locations
sampleMapView.geoCenter = new GeoCoordinates(52.518611, 13.376111, 0);
// instantiate the default map controls, allowing the user to pan around freely.