Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

636 - Take url out of ngeoWfsPermalinkOptions #4379

Merged
merged 2 commits into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contribs/gmf/examples/wfspermalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ exports.module = angular.module('gmfapp', [

exports.module.value('ngeoWfsPermalinkOptions',
/** @type {ngeox.WfsPermalinkOptions} */ ({
url: appURL.MAPSERVER_PROXY,
wfsTypes: [
{featureType: 'fuel', label: 'display_name'},
{featureType: 'osm_scale', label: 'display_name'}
Expand All @@ -42,6 +41,7 @@ exports.module.value('ngeoWfsPermalinkOptions',
defaultFeaturePrefix: 'feature'
}));

exports.module.constant('ngeoPermalinkOgcserverUrl', appURL.MAPSERVER_PROXY);
exports.module.constant('defaultTheme', 'Demo');
exports.module.constant('angularLocaleScript', '../build/angular-locale_{{locale}}.js');

Expand Down
8 changes: 0 additions & 8 deletions options/ngeox.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,6 @@ ngeox.WfsType.prototype.featurePrefix;
/**
* The options for the WFS query service (permalink).
* @typedef {{
* url: (string),
* wfsTypes: (!Array.<ngeox.WfsType>),
* pointRecenterZoom: (number|undefined),
* defaultFeatureNS: (string),
Expand All @@ -895,13 +894,6 @@ ngeox.WfsType.prototype.featurePrefix;
ngeox.WfsPermalinkOptions;


/**
* URL to the WFS server.
* @type {string}
*/
ngeox.WfsPermalinkOptions.prototype.url;


/**
* The queryable WFS types.
* @type {!Array.<ngeox.WfsType>}
Expand Down
13 changes: 11 additions & 2 deletions src/statemanager/WfsPermalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,25 @@ import olFormatWFS from 'ol/format/WFS.js';
* @constructor
* @struct
* @param {angular.$http} $http Angular $http service.
* @param {string} ngeoPermalinkOgcserverUrl Url to the WFS server
* @param {ngeox.QueryResult} ngeoQueryResult The ngeo query result service.
* @param {ngeox.WfsPermalinkOptions} ngeoWfsPermalinkOptions The options to
* configure the ngeo wfs permalink service with.
* @ngdoc service
* @ngname ngeoWfsPermalink
* @ngInject
*/
const WfsPermalinkService = function($http, ngeoQueryResult, ngeoWfsPermalinkOptions) {
const WfsPermalinkService = function(
$http, ngeoPermalinkOgcserverUrl, ngeoQueryResult, ngeoWfsPermalinkOptions
) {

const options = ngeoWfsPermalinkOptions;

/**
* @type {string}
* @private
*/
this.url_ = options.url;
this.url_ = ngeoPermalinkOgcserverUrl;

/**
* @type {number}
Expand Down Expand Up @@ -304,6 +307,12 @@ WfsPermalinkService.module = angular.module('ngeoWfsPermalink', [
]);


/**
* Set this value to enable WFS permalink.
*/
WfsPermalinkService.module.value('ngeoPermalinkOgcserverUrl', '');


/**
* Value that is supposed to be set in applications to enable the WFS
* permalink functionality.
Expand Down
5 changes: 4 additions & 1 deletion test/spec/services/wfspermalink.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ describe('ngeo.statemanager.WfsPermalink', () => {

beforeEach(() => {
angular.mock.module('ngeo', ($provide) => {
$provide.value(
'ngeoPermalinkOgcserverUrl',
'https://geomapfish-demo-dc.camptocamp.com/2.4/mapserv_proxy'
);
$provide.value('ngeoWfsPermalinkOptions', {
url: 'https://geomapfish-demo-dc.camptocamp.com/2.4/mapserv_proxy',
wfsTypes: [{featureType: 'fuel'}, {featureType: 'highway'}],
defaultFeatureNS: 'http://mapserver.gis.umn.edu/mapserver',
defaultFeaturePrefix: 'ms'
Expand Down