public class ScalebarGenerator
extends java.lang.Object
| Constructor and Description |
|---|
ScalebarGenerator()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.image.BufferedImage |
getImage(java.lang.Double scale,
double width,
double dpi)
Generate the image of the scalebar.
|
byte[] |
getImageAsByte(java.lang.Double scale,
double width,
double dpi) |
java.lang.String |
getImageAsFileLocation(java.lang.Double scale,
double width,
double dpi)
Generate the image of the scalebar, stores it in a temporary location and returns the file
location.
|
java.lang.String |
getImageAsFileLocation(java.lang.Double scale,
double width,
double dpi,
java.lang.String fileNameWithoutExtension) |
void |
setColorBorderSegment(java.awt.Color colorBorderSegment)
A color for the border of the segment.
|
void |
setColorSegmentEven(java.awt.Color colorSegmentEven)
Set color for the even segments.
|
void |
setColorSegmentUneven(java.awt.Color colorSegmentUneven)
Set color for the uneven segments.
|
void |
setColorText(java.awt.Color colorText)
Sets color for the texts used.
|
void |
setDrawScaleText(boolean drawScaleText)
Controls whether the scale is displayed on top of the scale bar or not
|
void |
setHeight(int height)
Sets the height of the entire image.
|
void |
setLrbMargin(int lrbMargin)
Sets the margin for the left, right and bottom of the control.
|
void |
setNumberOfSegments(int numberOfSegments)
Sets the number of segments to be displayed in the scalebar.
|
void |
setTextFont(java.awt.Font textFont)
Sets the font of the texts used.
|
void |
setTopMargin(int topMargin)
Sets the size of the margin above the scale bar.
|
public void setColorBorderSegment(java.awt.Color colorBorderSegment)
colorBorderSegment - public void setColorSegmentEven(java.awt.Color colorSegmentEven)
colorSegmentEven - public void setColorSegmentUneven(java.awt.Color colorSegmentUneven)
colorSegmentUneven - public void setColorText(java.awt.Color colorText)
colorText - public void setDrawScaleText(boolean drawScaleText)
drawScaleText - If false, the scale text will not be displayed.public void setHeight(int height)
height - public void setLrbMargin(int lrbMargin)
margin - The size of the margin to set around the left, right and bottom of the scalebar
image.public void setTopMargin(int topMargin)
topMargin - The size of the margin above the scale bar.public void setNumberOfSegments(int numberOfSegments)
numberOfSegments - public void setTextFont(java.awt.Font textFont)
textFont - public java.awt.image.BufferedImage getImage(java.lang.Double scale,
double width,
double dpi)
scale - The scale for which to generate the imagewidth - The initial width of the scalebar in points. There are approx 2.83 points per
mm. The real width will change to round the measurement of the segments.dpi - DPI used on the display device. e.g. for a standard printout, 72 is suitable. For
screen display, 96 is better.public java.lang.String getImageAsFileLocation(java.lang.Double scale,
double width,
double dpi)
throws java.io.IOException
scale - The scale for which to generate the imagewidth - The width of the scalebar. The real width will change to round the measurement
of the segments.dpi - DPI usedjava.io.IOExceptionpublic java.lang.String getImageAsFileLocation(java.lang.Double scale,
double width,
double dpi,
java.lang.String fileNameWithoutExtension)
throws java.io.IOException
java.io.IOExceptionpublic byte[] getImageAsByte(java.lang.Double scale,
double width,
double dpi)
throws java.io.IOException
java.io.IOException