Skip to content

Commit

Permalink
Merge pull request #9563 from martin-bom/wms-getfeatureurl
Browse files Browse the repository at this point in the history
Feature request for #9545
  • Loading branch information
lilleyse committed Dec 13, 2021
2 parents f53e5b2 + 2dca43f commit 2995ac2
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

##### Additions :tada:

- Added a `pointSize` field to custom vertex shaders for more control over
shading point clouds. [#9960](https://github.com/CesiumGS/cesium/pull/9960)
- Added a `pointSize` field to custom vertex shaders for more control over shading point clouds. [#9960](https://github.com/CesiumGS/cesium/pull/9960)
- Added `lambertDiffuseMultiplier` property to Globe object to enhance terrain lighting. [#9878](https://github.com/CesiumGS/cesium/pull/9878)
- Added `getFeatureInfoUrl` option to `WebMapServiceImageryProvider` which reads the getFeatureInfo request URL for WMS service if it differs with the getCapabilities URL. [#9563](https://github.com/CesiumGS/cesium/pull/9563)

##### Fixes :wrench:

Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Robin Danielsson](https://github.com/robdan7)
- [Oskar Havo](https://github.com/OskarHavo)
- [Mark Williams](https://github.com/markw65)
- [Mark Williams](https://github.com/markw65)
- [Rain Liang](https://github.com/rainliang000)
- [Mark Williams](https://github.com/markw65)
- [lyqh-ctx](https://github.com/lyqh-ctx)
- [David Tryse](https://github.com/dtryse)
- [Martin Chan](https://github.com/martin-bom)
21 changes: 19 additions & 2 deletions Source/Scene/WebMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var excludesReverseAxis = [
* an array, each element in the array is a subdomain.
* @property {Clock} [clock] A Clock instance that is used when determining the value for the time dimension. Required when `times` is specified.
* @property {TimeIntervalCollection} [times] TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values.
* @property {Resource|String} [getFeatureInfoUrl] The getFeatureInfo URL of the WMS service. If the property is not defined then we use the property value of url.
*/

/**
Expand Down Expand Up @@ -203,9 +204,13 @@ function WebMapServiceImageryProvider(options) {
*/
this.defaultMagnificationFilter = undefined;

var resource = Resource.createIfNeeded(options.url);
this._getFeatureInfoUrl = defaultValue(
options.getFeatureInfoUrl,
options.url
);

var pickFeatureResource = resource.clone();
var resource = Resource.createIfNeeded(options.url);
var pickFeatureResource = Resource.createIfNeeded(this._getFeatureInfoUrl);

resource.setQueryParameters(
WebMapServiceImageryProvider.DefaultParameters,
Expand Down Expand Up @@ -611,6 +616,18 @@ Object.defineProperties(WebMapServiceImageryProvider.prototype, {
this._timeDynamicImagery.times = value;
},
},

/**
* Gets the getFeatureInfo URL of the WMS server.
* @memberof WebMapServiceImageryProvider.prototype
* @type {Resource|String}
* @readonly
*/
getFeatureInfoUrl: {
get: function () {
return this._getFeatureInfoUrl;
},
},
});

/**
Expand Down
31 changes: 31 additions & 0 deletions Specs/Scene/WebMapServiceImageryProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2037,4 +2037,35 @@ describe("Scene/WebMapServiceImageryProvider", function () {
});
});
});

it("uses getFeatureInfoUrl in options for getting the getFeatureInfo URL", function () {
var featureUrl = "made/up/wms/feature/server";
var provider = new WebMapServiceImageryProvider({
url: "made/up/wms/server",
layers: "someLayer",
getFeatureInfoUrl: featureUrl,
});

return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider._pickFeaturesResource.url).toContain(featureUrl);
});
});

it("uses url in options if getFeatureInfoUrl is absent for pickResources", function () {
var featureUrl = "made/up/wms/feature/server";
var getCapabilitiesUrl = "made/up/wms/server";
var provider = new WebMapServiceImageryProvider({
url: getCapabilitiesUrl,
layers: "someLayer",
});

return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider._pickFeaturesResource.url).not.toContain(featureUrl);
expect(provider._pickFeaturesResource.url).toContain(getCapabilitiesUrl);
});
});
});

0 comments on commit 2995ac2

Please sign in to comment.