Controller.prototype.getResolutionStyle = function(gmfLayer) { if (!this.map) { throw new Error('Missing map'); } const resolution = this.map.getView().getResolution(); if (!resolution) { throw new Error('Missing resolution'); } const minResolution = getNodeMinResolution(gmfLayer); if (minResolution !== undefined && resolution < minResolution) { return 'out-of-resolution'; } const maxResolution = getNodeMaxResolution(gmfLayer); if (maxResolution !== undefined && resolution > maxResolution) { return 'out-of-resolution'; } return undefined; };
Controller.prototype.zoomToResolution = function(treeCtrl) { if (!this.map) { throw new Error('Missing map'); } const gmfLayer = /** @type {import('gmf/themes.js').GmfLayerWMS} */ (treeCtrl.node); const view = this.map.getView(); const resolution = view.getResolution(); if (!resolution) { throw new Error('Missing resolution'); } const minResolution = getNodeMinResolution(gmfLayer); if (minResolution !== undefined && resolution < minResolution) { view.setResolution(view.constrainResolution(minResolution, 0, 1)); } else { const maxResolution = getNodeMaxResolution(gmfLayer); if (maxResolution !== undefined && resolution > maxResolution) { view.setResolution(view.constrainResolution(maxResolution, 0, -1)); } } };
EditingSnappingService.prototype.registerTreeCtrl_ = function(treeCtrl) { // Skip any Layertree controller that has a node that is not a leaf let node = /** @type {import('gmf/themes.js').GmfGroup|import('gmf/themes.js').GmfLayer} */ (treeCtrl.node); const groupNode = /** @type import('gmf/themes.js').GmfGroup */ (node); if (groupNode.children) { return; } // If treeCtrl is snappable and supports WFS, listen to its state change. // When it becomes visible, it's added to the list of snappable tree ctrls. node = /** @type {import('gmf/themes.js').GmfLayer} */ (treeCtrl.node); const snappingConfig = getSnappingConfig(node); if (snappingConfig) { const wfsConfig = this.getWFSConfig_(treeCtrl); if (wfsConfig) { const uid = olUtilGetUid(treeCtrl); const stateWatcherUnregister = this.rootScope_.$watch( () => treeCtrl.getState(), this.handleTreeCtrlStateChange_.bind(this, treeCtrl) ); const ogcServer = this.getOGCServer_(treeCtrl); if (!ogcServer) { throw new Error('Missing ogcServer'); } this.cache_[uid] = { active: false, featureNS: ogcServer.wfsFeatureNS, featurePrefix: 'feature', features: new olCollection(), geometryName: ogcServer.geometryName, interaction: null, maxFeatures: 50, requestDeferred: null, snappingConfig: snappingConfig, treeCtrl: treeCtrl, wfsConfig: wfsConfig, stateWatcherUnregister: stateWatcherUnregister }; // This extra call is to initialize the treeCtrl with its current state this.handleTreeCtrlStateChange_(treeCtrl, treeCtrl.getState()); } } };
this.gmfThemes_.getThemesObject().then((themes) => { const theme = findThemeByName(themes, actionData); if (theme) { this.gmfTreeManager_.addFirstLevelGroups(theme.children); } });