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

Add support for OlSourceImageWMS to getLegendGraphicUrl method (for ol4) #16

Merged
merged 1 commit into from
Sep 4, 2018

Conversation

KaiVolland
Copy link
Member

@KaiVolland KaiVolland commented Sep 4, 2018

This adds support for OlSourceImageWMS layers to the getLegendGraphicUrl method.

Copy link
Member

@marcjansen marcjansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One optimization wrt readability and potential extension. Take it or ignore it. This is good to go IMO.

@@ -304,11 +304,14 @@ export class MapUtil {
Logger.error('Invalid input parameter for MapUtil.getLegendGraphicUrl.');
return;
}
const isTiledWMS = layer.getSource() instanceof OlSourceTileWMS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better

const src = layer.getSource();
if(!src) {
  return undefined;
}
const isTiledWMS = src instanceof OlSourceTileWMS;
const isImageWMS = !isTiledWMS && src instanceof OlSourceImageWMS;

then the if below gets trivial and more cases can easily be added IMO

expect(legendUrl).toContain(requestParam);
expect(legendUrl).toContain(formatParam);
describe('returns a getLegendGraphicUrl from a given layer', () => {
it('… for a tiled Layer', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ …

@KaiVolland KaiVolland changed the title Add support for OlSourceImageWMS to getLegendGraphicUrl method Add support for OlSourceImageWMS to getLegendGraphicUrl method (for ol4) Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants