Skip to content
Snippets Groups Projects
Commit c1a7e251 authored by ext.sopra.ncastejon's avatar ext.sopra.ncastejon
Browse files

Set the 3d layer url in config.json file. Enable the feature in the map only...

Set the 3d layer url in config.json file. Enable the feature in the map only if this url is informed.
parent eba36540
Branches
Tags
1 merge request!73Development
......@@ -17,6 +17,9 @@ export class AppConfig {
proxyQuery: string;
seo: string;
};
layer3d: {
url: string;
};
theFunctionalitiesInterruptor: {
credits: boolean;
reuses: boolean;
......
......@@ -2,6 +2,7 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import * as mapboxgl from 'mapbox-gl';
import { Subscription } from 'rxjs';
import { geosource } from '../../../i18n/traductions';
import { APP_CONFIG } from '../../core/services/app-config.service';
import { linkFormats } from '../../shared/models';
import { MapOptions } from '../models/map-options';
import { GeocoderService } from '../services/geocoder.service';
......@@ -211,6 +212,8 @@ export class MapComponent implements OnInit, OnDestroy {
this._mapService.addLayers();
});
// Manage the 3d layer button only if config contains the url 3d layer
if (APP_CONFIG.layer3d) {
this.map.on('zoomend', () => {
if (this.map.getZoom() < 14) {
this.displayButton3d = false;
......@@ -229,6 +232,7 @@ export class MapComponent implements OnInit, OnDestroy {
});
}
}
}
switchLayer(baseLayer) {
this.selectedBaseLayer = baseLayer;
......
......@@ -118,13 +118,13 @@ export class MapService {
this.addWMSLayer();
// Add the 3d source. Constructed with MVT tiles from the 'fpc_fond_plan_communaut.fpctoit' dataset
const domain = this.mapOptions.vectorService.url.split('wfs')[1];
const url = `${this.mapOptions.mvtUrl}${domain}?LAYERS=
fpc_fond_plan_communaut.fpctoit&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}&mode=tile`;
if (APP_CONFIG.layer3d) {
const url = APP_CONFIG.layer3d.url;
this._map.addSource('3d-source', {
type: 'vector',
tiles: [url],
});
}
// Add the data layer only if it comes from the Lyon Metropole
if (this.mapOptions.rasterService.url.includes(`${APP_CONFIG.backendUrls.proxyQuery}/map/wms`)) {
......@@ -519,7 +519,7 @@ fpc_fond_plan_communaut.fpctoit&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}
}
switch3DLayer() {
if (!this._map.getLayer('3d-layer')) {
if (!this._map.getLayer('3d-layer') && this._map.getSource('3d-source')) {
this._map.addLayer(
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment