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

minor fix for duplicate legend entries for color ramp rasters #229

Merged
merged 1 commit into from May 28, 2017

Conversation

Projects
None yet
2 participants
@egouge
Contributor

egouge commented May 17, 2017

Fix for legend issue shown in attached image.
legendfix

Signed-off-by: egouge egouge@refractions.net

minor fix for duplicate legend entries for color ramp rasters with di…
…fferent font sizes

Signed-off-by: egouge <egouge@refractions.net>

@fgdrf fgdrf added this to the uDig-2.0.0 milestone May 19, 2017

@@ -205,7 +205,7 @@ public ImageData getImageData() {
String l1 = entry.getLabel();
String l2 = prevEntry.getLabel();
if (i <= entries.length - 3){
if (i < entries.length - 1){

This comment has been minimized.

@fgdrf

fgdrf May 22, 2017

Contributor

@egouge I'm not sure what this if-Statement is for because in the else-block the first inner statement (l2 == null) looks pretty identical to the inner statement of that if.

Question : What's the reason/use-case that String[] text can have length of 1 or the length of two? I thought that a LegendEntry represents one line in the Legend with ImageDescriptor and text element. My understanding is that every entry should have a LegentEntry representation after iterations. The if-Statement looks like only for the last one merge the text of the previous and the current and make a new Entry out of it. Why has the last Entry an array lenght for text of two while all others have a lenght of one. What I did not understand?

This comment has been minimized.

@egouge

egouge May 24, 2017

Contributor

Q: What's the reason/use-case that String[] text can have length of 1 or the length of two?
A: From what I remember - it was the only way I could "easily" get "gradient" styles to appear in the correctly without substantially rewriting other parts of the Legend Graphic.
In the case shown above there are four labels (0, 3, 6, 8) but in terms of the colors (and legend entries) there are only three: white to light green [0-3]; light green to medium green [3-6]; and medium green to dark green [6,8]. So in order to get all the labels to show up one of those three legend entries needed to have two labels.
I am sure there were other ways of doing this, but this is what I came up with at the time.

@fgdrf fgdrf self-requested a review May 22, 2017

@fgdrf

@egouge I'm not sure what this if-Statement is for because in the else-block the first inner statement (l2 == null) looks pretty identical to the inner statement of that if.

Question : What's the reason/use-case that String[] text can have length of 1 or the length of two? I thought that a LegendEntry represents one line in the Legend with ImageDescriptor and text element. My understanding is that every entry should have a LegentEntry representation after iterations. The if-Statement looks like only for the last one merge the text of the previous and the current and make a new Entry out of it. Why has the last Entry an array lenght for text of two while all others have a lenght of one. What I did not understand?

@fgdrf fgdrf dismissed their stale review May 24, 2017

tested the review process and was trying to comment then requesting changes

@fgdrf fgdrf merged commit 17e3952 into locationtech:master May 28, 2017

1 check passed

ip-validation
Details
@fgdrf

This comment has been minimized.

Contributor

fgdrf commented May 28, 2017

@egouge Thank you very much for the fix and the continuous support! Much appreciated

@fgdrf fgdrf added the bug label Sep 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment