Class GridParam
java.lang.Object
org.mapfish.print.map.AbstractLayerParams
org.mapfish.print.map.geotools.grid.GridParam
Parameters relevant to creating Grid layers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final int
static final int
static final String
static final int
static final String
Grid label default format pattern for the unit (if valueFormat is used).Configuration for the font of the grid labels.The character used to separate the decimal part (for example ",").The character used for the thousands separator (for example "'").The color of the grid points or lines.The type of grid to render.The color of the halo around grid label text.double
The size of the halo around the Grid Labels.double
Apply an Y offset to horizontal grid line labels, relative to the horizontal grid lines.int
The number of pixels to indent the grid labels from the end of the map.The color of the grid label text.The formatting string used to format the label (for example "%1.2f %s").The projection code to use for the labels.By default the normal axis order as specified in EPSG code will be used when parsing projections.int[]
The x,y number of grid lines.double[]
The x,y point of grid origin.int
The number of points that will be in the grid line (if the gridType is LINES).Indicates if the layer is rendered as SVG.boolean
If true (the default), the labels will be rotated to follow the lines they belong to.double[]
The x,y spacing between grid lines.The style name of a style to apply to the features during rendering.The formatting string used to format the unit part of a label (for example " %s").The formatting string used to format the decimal part of a label (for example "###,###").double
Apply an X offset to the vertical grid line labels, relative to the vertical grid lines.Fields inherited from class org.mapfish.print.map.AbstractLayerParams
failOnError, name, opacity
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.geotools.api.referencing.operation.MathTransform
calculateLabelTransform
(org.geotools.api.referencing.crs.CoordinateReferenceSystem mapCrs) Determine which math transform to use when creating the coordinate of the label.calculateLabelUnit
(org.geotools.api.referencing.crs.CoordinateReferenceSystem mapCrs) Determine which unit to use when creating grid labels.void
Initialize default values and validate that config is correct.
-
Field Details
-
DEFAULT_UNIT_FORMAT
Grid label default format pattern for the unit (if valueFormat is used).- See Also:
-
DEFAULT_POINTS_IN_GRID_LINE
public static final int DEFAULT_POINTS_IN_GRID_LINE- See Also:
-
DEFAULT_HALO_RADIUS
public static final int DEFAULT_HALO_RADIUS- See Also:
-
DEFAULT_INDENT
public static final int DEFAULT_INDENT- See Also:
-
DEFAULT_HALO_COLOR
- See Also:
-
DEFAULT_LABEL_COLOR
- See Also:
-
DEFAULT_GRID_COLOR
- See Also:
-
gridType
The type of grid to render.Can be LINES or POINTS. Default is LINES.
-
spacing
public double[] spacingThe x,y spacing between grid lines.Either
spacing
ornumberOfLines
If spacing is defined then
origin
must also be defined -
origin
public double[] originThe x,y point of grid origin.This is required if
spacing
is defined. -
numberOfLines
public int[] numberOfLinesThe x,y number of grid lines.The x is the number of lines that run vertically along the page.
-
style
The style name of a style to apply to the features during rendering. The style name must map to a style in the template or the configuration objects.If no style is defined then the default grid style will be used. The default will depend if the type is point or line and will respect
gridColor
andhaloColor
andhaloRadius
. IfgridType
isGridType.POINTS
then the style will be crosses with a haloRadius sized halo around the cross. IfGridType.LINES
then the style will be a dashed line with no halo. -
renderAsSvg
Indicates if the layer is rendered as SVG.(will default to
Configuration.defaultToSvg
). -
pointsInLine
public int pointsInLineThe number of points that will be in the grid line (if the gridType is LINES). If the line will be curved (for certain projections) then the more points the smoother the curve.The default number of points is 10000.
-
haloRadius
public double haloRadiusThe size of the halo around the Grid Labels. The default is 1. -
haloColor
The color of the halo around grid label text. The color is defined the same as colors in CSS. Default is white ("#FFF") -
labelColor
The color of the grid label text. Default is dark gray ("#444") -
gridColor
The color of the grid points or lines. Default is gray ("gray") -
font
Configuration for the font of the grid labels. The default is the default system font. -
indent
public int indentThe number of pixels to indent the grid labels from the end of the map. The default is 5. -
labelProjection
The projection code to use for the labels. The value should be the stringauthority:code
form identifying the projection. By default it will be the same projection as the map. -
labelFormat
The formatting string used to format the label (for example "%1.2f %s"). By default the label is formatted according to the unit and label value. For the format syntax, see java.util.Formatter. IflabelFormat
is set,valueFormat
,unitFormat
and custom separator characters will be ignored. -
valueFormat
The formatting string used to format the decimal part of a label (for example "###,###"). This parameter is ignored iflabelFormat
is set. For the format syntax, see DecimalFormat. -
unitFormat
The formatting string used to format the unit part of a label (for example " %s"). This parameter is ignored iflabelFormat
is set.valueFormat
must be set to use this parameter. For the format syntax, see java.util.Formatter. -
formatDecimalSeparator
The character used to separate the decimal part (for example ","). This parameter is only used ifvalueFormat
is used. The default is the character of the default locale. -
formatGroupingSeparator
The character used for the thousands separator (for example "'"). This parameter is only used ifvalueFormat
is used. The default is the character of the default locale. -
longitudeFirst
By default the normal axis order as specified in EPSG code will be used when parsing projections. However the requester can override this by explicitly declaring that longitude axis is first. -
rotateLabels
public boolean rotateLabelsIf true (the default), the labels will be rotated to follow the lines they belong to. Otherwise they are orientated west to east. -
verticalXOffset
public double verticalXOffsetApply an X offset to the vertical grid line labels, relative to the vertical grid lines. Defaults to 0. -
horizontalYOffset
public double horizontalYOffsetApply an Y offset to horizontal grid line labels, relative to the horizontal grid lines. Defaults to 0.
-
-
Constructor Details
-
GridParam
public GridParam()
-
-
Method Details
-
postConstruct
public void postConstruct()Initialize default values and validate that config is correct. -
calculateLabelUnit
Determine which unit to use when creating grid labels.- Parameters:
mapCrs
- the crs of the map, used if thelabelProjection
is not defined.
-
calculateLabelTransform
public org.geotools.api.referencing.operation.MathTransform calculateLabelTransform(org.geotools.api.referencing.crs.CoordinateReferenceSystem mapCrs) Determine which math transform to use when creating the coordinate of the label.- Parameters:
mapCrs
- the crs of the map, used if thelabelProjection
is not defined.
-
getGridLabelFormat
-