Skip to content

Commit

Permalink
Fixed absoluteMargins default and improved documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto committed Nov 11, 2016
1 parent 4d9178e commit 2fcf4e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -142,7 +142,7 @@ The producer for the raster legend will make use of this elements in order to bu
- the height of each row is set to the maximum height of the single elements
- the width of each row is set to the sum of the width of the various elements plus the various paddings
- **dx,dy** the spaces between elements and rows are set to the 15% of the requested width and height. Notice that **dy** is ignored for the colormaps of type **ramp** since they must create a continuous color strip.
- **absoluteMargins** true/false, if true dx is considered as a fixed number of pixels, instead of a percentage of the width.
- **absoluteMargins** true/false, used to change the uom of **dx** from percentage (when false) to a fixed number of pixels (when true).
- **mx,my** the margins from the border of the legends are set to the 1.5% of the total size of the legend

Just to jump right to the conclusions (which is a bad practice I know, but no one is perfect ), here below I am adding an image of a sample legend with all the various options at work. The request that generated it is the following::
Expand Down
Expand Up @@ -161,7 +161,7 @@ public static class Builder {

private double hMarginPercentage = LegendUtils.marginFactor;

private boolean absoluteMargins = false;
private boolean absoluteMargins = true;

private boolean border = false;

Expand Down
Expand Up @@ -1054,10 +1054,10 @@ public void testAbsoluteMargins() throws Exception {
this.legendProducer.buildLegendGraphic(req);

BufferedImage image = this.legendProducer.buildLegendGraphic(req);
int proportionalWidth = image.getWidth();
legendOptions.put("absoluteMargins", "true");
int absoluteWidth = image.getWidth();
legendOptions.put("absoluteMargins", "false");
image = this.legendProducer.buildLegendGraphic(req);
assertTrue(image.getWidth() < proportionalWidth);
assertTrue(image.getWidth() > absoluteWidth);
} finally {
RenderedImage ri = coverage.getRenderedImage();
if(coverage instanceof GridCoverage2D) {
Expand Down

0 comments on commit 2fcf4e7

Please sign in to comment.