Commit b7d824d8 authored by Nico Mack's avatar Nico Mack

Minor improvement

parent a70c44b5
......@@ -13,14 +13,10 @@
*/
package lu.list.itis.dkd.tui.utility.scales;
import lu.list.itis.dkd.tui.widget.corona.ShapeFactory;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.Rectangle2D;
......@@ -53,9 +49,6 @@ public class ColourScaleRenderer {
private static final int DEFAULT_GAP = 5;
private static final Shape DEFAULT_SHAPE = ShapeFactory.buildCircle(15);
private static final Font DEFAULT_FONT = new Font("Arial", Font.PLAIN, 13);
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
......@@ -134,14 +127,14 @@ public class ColourScaleRenderer {
List<ColourMapping<T>> mappings = scale.getColourMappings();
double offset = (double) required.height / ((this.renderTitle) ? mappings.size() + 1 : mappings.size());
double fontBaseLineOffset = metrics.getAscent() / 2;
int fontBaseLineOffset = metrics.getAscent() / 2;
offscreen.translate(-shapeBounds.getX(), (offset / 2));
offscreen.setFont(scale.getTitleFont());
if (this.renderTitle) {
offscreen.setPaint(scale.getTitleColour());
offscreen.drawString(scale.getTitle(), (int) (shapeBounds.getX() + shapeBounds.getWidth() + horizontalGap), (int) fontBaseLineOffset);
offscreen.drawString(scale.getTitle(), (int) (shapeBounds.getX() + shapeBounds.getWidth() + horizontalGap), fontBaseLineOffset);
offscreen.translate(0, offset);
}
......@@ -151,7 +144,7 @@ public class ColourScaleRenderer {
offscreen.setPaint(mapping.getColour());
offscreen.fill(scale.getMappingShape());
offscreen.setPaint(scale.getLabelColour());
offscreen.drawString(scale.getLabelFor(mapping), (int) (shapeBounds.getX() + shapeBounds.getWidth() + horizontalGap), (int) fontBaseLineOffset);
offscreen.drawString(scale.getLabelFor(mapping), (int) (shapeBounds.getX() + shapeBounds.getWidth() + horizontalGap), fontBaseLineOffset);
offscreen.translate(0, offset);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment