maps wms settings refactoring (#20371) (#21383)

This commit is contained in:
Peter Pisljar 2018-07-30 10:15:05 +02:00 committed by GitHub
parent 38978a07ae
commit f6200a42c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 20 deletions

View file

@ -79,8 +79,7 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps
text: 'top right',
}],
colorSchemas: Object.keys(truncatedColorMaps),
vectorLayers: vectorLayers,
baseLayers: []
vectorLayers: vectorLayers
},
schemas: new Schemas([
{

View file

@ -121,7 +121,7 @@ export function BaseMapsVisualizationProvider(serviceSettings) {
_baseLayerConfigured() {
const mapParams = this._getMapsParams();
return mapParams.wms.baseLayersAreLoaded || mapParams.wms.selectedTmsLayer;
return mapParams.wms.selectedTmsLayer;
}
async _updateBaseLayer() {
@ -166,9 +166,7 @@ export function BaseMapsVisualizationProvider(serviceSettings) {
...mapParams.wms.options
}
});
} else {
await mapParams.wms.baseLayersAreLoaded;
} else if (mapParams.wms.selectedTmsLayer) {
const selectedTmsLayer = mapParams.wms.selectedTmsLayer;
this._setTmsLayer(selectedTmsLayer);

View file

@ -76,4 +76,4 @@
</div>
</div>
<wms-options options="editorState.params.wms"></wms-options>
<wms-options options="editorState.params.wms" collections="vis.type.editorConfig.collections"></wms-options>

View file

@ -18,7 +18,7 @@
id="tmsLayers"
class="kuiSelect kuiSideBarSelect"
ng-model="options.selectedTmsLayer"
ng-options="layer.id for layer in options.tmsLayers track by layer.id"
ng-options="layer.id for layer in collections.tmsLayers track by layer.id"
></select>
</div>
</div>

View file

@ -27,21 +27,17 @@ module.directive('wmsOptions', function (serviceSettings) {
template: wmsOptionsTemplate,
replace: true,
scope: {
options: '='
options: '=',
collections: '=',
},
link: function ($scope) {
$scope.options.baseLayersAreLoaded = new Promise((resolve, reject) => {
new Promise((resolve, reject) => {
serviceSettings
.getTMSServices()
.then((allTMSServices) => {
if (!$scope.options.tmsLayers) {
$scope.options.tmsLayers = [];
}
const newBaseLayers = $scope.options.tmsLayers.slice();
const newBaseLayers = $scope.collections.tmsLayers.slice();
for (let i = 0; i < allTMSServices.length; i += 1) {
const layerFromService = allTMSServices[i];
const alreadyAdded = newBaseLayers.some((layer) => layerFromService.id === layer.id);
@ -49,10 +45,10 @@ module.directive('wmsOptions', function (serviceSettings) {
newBaseLayers.push(layerFromService);
}
}
$scope.options.tmsLayers = newBaseLayers;
$scope.collections.tmsLayers = newBaseLayers;
if (!$scope.options.selectedTmsLayer) {
$scope.options.selectedTmsLayer = $scope.options.tmsLayers[0];
if (!$scope.options.selectedTmsLayer && $scope.collections.tmsLayers.length) {
$scope.options.selectedTmsLayer = $scope.collections.tmsLayers[0];
}
resolve(true);

View file

@ -80,7 +80,7 @@ VisTypesRegistryProvider.register(function TileMapVisType(Private, getAppState,
'Shaded Geohash Grid',
'Heatmap'
],
baseLayers: []
tmsLayers: [],
},
optionsTemplate: '<tile-map-vis-params></tile-map-vis-params>',
schemas: new Schemas([