Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
recordFrames(mapViewApp, 40, true).then(() => {
// Clear the stats, and render the the last frame again and then gather
// results.
PerformanceStatistics.instance.clearFrames();
recordFrames(mapViewApp, 20).then(frameResults => {
if (frameResults !== undefined) {
const appValues = frameResults.lastFrameStats!.appResults;
for (const decoderValue of DECODER_VALUES) {
frameResults.lastFrameStats!.frames.delete(decoderValue);
appValues.set(decoderValue, decodingStatistics[decoderValue]);
}
const lastFrameStats = addStatistics(frameResults.lastFrameStats!);
resolve(lastFrameStats);
} else {
resolve(undefined);
}
});
});
mapView.lookAt(new GeoCoordinates(52.518611, 13.376111), 8000, 0, 0);
const mapControls = MapControls.create(mapView);
mapView.resize(window.innerWidth, window.innerHeight);
window.addEventListener("resize", () => {
if ((mapView.canvas.parentNode! as HTMLDivElement).style.position !== "absolute") {
mapView.resize(window.innerWidth, window.innerHeight);
}
});
const glInfo = getVendorFomContext(mapView.renderer.context);
PerformanceStatistics.instance.configs.set("gl.vendor", glInfo.vendor);
PerformanceStatistics.instance.configs.set("gl.renderer", glInfo.renderer);
return {
mapView,
mapControls,
omvDataSourceConnected: false,
mainDataSource: undefined
};
}
.then(() => {
PerformanceStatistics.instance.appResults.set("startTime", appStartTime);
PerformanceStatistics.instance.appResults.set("initTime", appInitTime);
resolve(mapViewApp);
})
.catch(err => {
const renderCallback = (event: RenderEvent) => {
mapView.removeEventListener(MapViewEventNames.AfterRender, renderCallback);
const renderedFrames = mapView.frameNumber - currentFrame;
let lastFrameStats: SimpleFrameStatistics | undefined;
if (returnLastFrameStats !== StatisticsMode.None) {
lastFrameStats = PerformanceStatistics.instance.getAsSimpleFrameStatistics(
returnLastFrameStats === StatisticsMode.LastFrame
);
}
resolve({ renderedFrames, lastFrameStats });
};