Class ScalebarGraphic
- java.lang.Object
-
- org.mapfish.print.processor.map.scalebar.ScalebarGraphic
-
public class ScalebarGraphic extends java.lang.Object
Creates a scalebar graphic.
-
-
Constructor Summary
Constructors Constructor Description ScalebarGraphic()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.String
createLabelText(DistanceUnit scaleUnit, double value, DistanceUnit intervalUnit)
Format the label text.protected static int
getBarSize(ScaleBarRenderSettings settings)
Get the bar size.protected static int
getLabelDistance(ScaleBarRenderSettings settings)
Get the label distance..protected static java.awt.Dimension
getMaxLabelSize(ScaleBarRenderSettings settings)
Get the maximum width and height of the labels.protected static double
getNearestNiceValue(double value, DistanceUnit scaleUnit, boolean lockUnits)
Reduce the given value to the nearest smaller 1 significant digit number starting with 1, 2 or 5.protected static java.awt.Dimension
getSize(ScalebarAttribute.ScalebarAttributeValues scalebarParams, ScaleBarRenderSettings settings, java.awt.Dimension maxLabelSize)
Get the size of the painting area required to draw the scalebar with labels.java.net.URI
render(MapfishMapContext mapContext, ScalebarAttribute.ScalebarAttributeValues scalebarParams, java.io.File tempFolder, Template template)
Render the scalebar.
-
-
-
Method Detail
-
getSize
protected static java.awt.Dimension getSize(ScalebarAttribute.ScalebarAttributeValues scalebarParams, ScaleBarRenderSettings settings, java.awt.Dimension maxLabelSize)
Get the size of the painting area required to draw the scalebar with labels.- Parameters:
scalebarParams
- Parameters for the scalebar.settings
- Parameters for rendering the scalebar.maxLabelSize
- The max. size of the labels.
-
getMaxLabelSize
protected static java.awt.Dimension getMaxLabelSize(ScaleBarRenderSettings settings)
Get the maximum width and height of the labels.- Parameters:
settings
- Parameters for rendering the scalebar.
-
createLabelText
protected static java.lang.String createLabelText(DistanceUnit scaleUnit, double value, DistanceUnit intervalUnit)
Format the label text.- Parameters:
scaleUnit
- The unit used for the scalebar.value
- The scale value.intervalUnit
- The scaled unit for the intervals.
-
getNearestNiceValue
protected static double getNearestNiceValue(double value, DistanceUnit scaleUnit, boolean lockUnits)
Reduce the given value to the nearest smaller 1 significant digit number starting with 1, 2 or 5.- Parameters:
value
- the value to find a nice number for.scaleUnit
- the unit of the value.lockUnits
- if set, the values are not scaled to a "nicer" unit.
-
getBarSize
protected static int getBarSize(ScaleBarRenderSettings settings)
Get the bar size.- Parameters:
settings
- Parameters for rendering the scalebar.
-
getLabelDistance
protected static int getLabelDistance(ScaleBarRenderSettings settings)
Get the label distance..- Parameters:
settings
- Parameters for rendering the scalebar.
-
render
public final java.net.URI render(MapfishMapContext mapContext, ScalebarAttribute.ScalebarAttributeValues scalebarParams, java.io.File tempFolder, Template template) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException
Render the scalebar.- Parameters:
mapContext
- The context of the map for which the scalebar is created.scalebarParams
- The scalebar parameters.tempFolder
- The directory in which the graphic file is created.template
- The template that contains the scalebar processor- Throws:
java.io.IOException
javax.xml.parsers.ParserConfigurationException
-
-