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

#6933: Enhance IconSymbolizer and Contrast enhancement #1

Merged
merged 2 commits into from
Aug 19, 2021

Conversation

dsuren1
Copy link

@dsuren1 dsuren1 commented Jun 11, 2021

Description

This PR extends the IconSymbolizer and ContrastEnhancement interface with new properties

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Enhancement

##Issue

What is the current behavior?
#6933 & #1453

What is the new behavior?

  • Allows us to pass format value to Icon symbolizer for the image provided
  • Allows us to pass vendor option to Contrast enhancement (Normalize Contrast Enhancement)

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

@dsuren1 dsuren1 changed the title #6933 & #1453: New props for IconSymbolizer and Contrast enhancement #6933 & #1453: Enhance IconSymbolizer and Contrast enhancement Jun 11, 2021
@dsuren1 dsuren1 changed the title #6933 & #1453: Enhance IconSymbolizer and Contrast enhancement #6933: Enhance IconSymbolizer and Contrast enhancement Jun 14, 2021
@tdipisa tdipisa requested a review from allyoucanmap July 28, 2021 10:20
style.ts Outdated
Comment on lines 559 to 563
export interface VendorOption {
algorithm?: 'StretchToMinimumMaximum' | 'ClipToMinimumMaximum' | 'ClipToZero';
minValue?: number;
maxValue?: number;
}

Choose a reason for hiding this comment

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

VendorOption seems a generic name but in this case is used only for ContrastEnhancement and it has a specific structure that match what the GeoServer expect.

Probably we should make this more specific:

export interface ContrastEnhancementVendorOption {
  algorithm?: 'StretchToMinimumMaximum' | 'ClipToMinimumMaximum' | 'ClipToZero';
  minValue?: number;
  maxValue?: number;
}
export interface ContrastEnhancementAlgorithm {
  name?: 'StretchToMinimumMaximum' | 'ClipToMinimumMaximum' | 'ClipToZero';
  minValue?: number;
  maxValue?: number;
}

export interface ContrastEnhancement {
  enhancementType?: 'normalize' | 'histogram';
  gammaValue?: number;
  algorithm?: ContrastEnhancementAlgorithm;
}

or more generic to be used in other context

export interface VendorProperty {
  name?: string;
  options?: any;
}

From the previous code it seems they prefer specific naming. My suggestions were more about the meaning of VendorOption itself that in this context seems to generic

Choose a reason for hiding this comment

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

We agreed to change only the name of VendorOption to ContrastEnhancementVendorOption

style.ts Outdated
* A VendorOption defines the algorithm to apply for Normalize contrast enhancement.
*/
export interface VendorOption {
algorithm?: 'StretchToMinimumMaximum' | 'ClipToMinimumMaximum' | 'ClipToZero';
Copy link

Choose a reason for hiding this comment

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

I see that you are using nullable types for all the properties. If any of this is required I would remove the question mark.

Copy link

Choose a reason for hiding this comment

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

For example, it is strange to see a sum type (alghoritm) as nullable, I would add a 'None' type if no alghoritm is possible, and remove the nullable

Copy link
Author

Choose a reason for hiding this comment

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

I think the algorithm property alone is required. So I will update the property accordingly

style.ts Outdated
Comment on lines 559 to 563
export interface VendorOption {
algorithm?: 'StretchToMinimumMaximum' | 'ClipToMinimumMaximum' | 'ClipToZero';
minValue?: number;
maxValue?: number;
}

Choose a reason for hiding this comment

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

We agreed to change only the name of VendorOption to ContrastEnhancementVendorOption

@dsuren1 dsuren1 requested a review from allyoucanmap August 9, 2021 10:22
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.

3 participants