Class GridParam

java.lang.Object
org.mapfish.print.map.AbstractLayerParams
org.mapfish.print.map.geotools.grid.GridParam

public final class GridParam extends AbstractLayerParams
Parameters relevant to creating Grid layers.
  • Field Details

    • DEFAULT_UNIT_FORMAT

      public static final String 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

      public static final String DEFAULT_HALO_COLOR
      See Also:
    • DEFAULT_LABEL_COLOR

      public static final String DEFAULT_LABEL_COLOR
      See Also:
    • DEFAULT_GRID_COLOR

      public static final String DEFAULT_GRID_COLOR
      See Also:
    • gridType

      public GridType gridType
      The type of grid to render.

      Can be LINES or POINTS. Default is LINES.

    • spacing

      public double[] spacing
      The x,y spacing between grid lines.

      Either spacing or numberOfLines

      If spacing is defined then origin must also be defined

    • origin

      public double[] origin
      The x,y point of grid origin.

      This is required if spacing is defined.

    • numberOfLines

      public int[] numberOfLines
      The x,y number of grid lines.

      The x is the number of lines that run vertically along the page.

    • style

      public String 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 and haloColor and haloRadius. If gridType is GridType.POINTS then the style will be crosses with a haloRadius sized halo around the cross. If GridType.LINES then the style will be a dashed line with no halo.

    • renderAsSvg

      public Boolean renderAsSvg
      Indicates if the layer is rendered as SVG.

      (will default to Configuration.defaultToSvg).

    • pointsInLine

      public int pointsInLine
      The 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 haloRadius
      The size of the halo around the Grid Labels. The default is 1.
    • haloColor

      public String 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

      public String labelColor
      The color of the grid label text. Default is dark gray ("#444")
    • gridColor

      public String gridColor
      The color of the grid points or lines. Default is gray ("gray")
    • font

      public GridFontParam font
      Configuration for the font of the grid labels. The default is the default system font.
    • indent

      public int indent
      The number of pixels to indent the grid labels from the end of the map. The default is 5.
    • labelProjection

      public String labelProjection
      The projection code to use for the labels. The value should be the string authority:code form identifying the projection. By default it will be the same projection as the map.
    • labelFormat

      public String 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. If labelFormat is set, valueFormat, unitFormat and custom separator characters will be ignored.
    • valueFormat

      public String valueFormat
      The formatting string used to format the decimal part of a label (for example "###,###"). This parameter is ignored if labelFormat is set. For the format syntax, see DecimalFormat.
    • unitFormat

      public String unitFormat
      The formatting string used to format the unit part of a label (for example " %s"). This parameter is ignored if labelFormat is set. valueFormat must be set to use this parameter. For the format syntax, see java.util.Formatter.
    • formatDecimalSeparator

      public String formatDecimalSeparator
      The character used to separate the decimal part (for example ","). This parameter is only used if valueFormat is used. The default is the character of the default locale.
    • formatGroupingSeparator

      public String formatGroupingSeparator
      The character used for the thousands separator (for example "'"). This parameter is only used if valueFormat is used. The default is the character of the default locale.
    • longitudeFirst

      public Boolean 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 rotateLabels
      If 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 verticalXOffset
      Apply an X offset to the vertical grid line labels, relative to the vertical grid lines. Defaults to 0.
    • horizontalYOffset

      public double horizontalYOffset
      Apply 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

      public String calculateLabelUnit(org.geotools.api.referencing.crs.CoordinateReferenceSystem mapCrs)
      Determine which unit to use when creating grid labels.
      Parameters:
      mapCrs - the crs of the map, used if the labelProjection 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 the labelProjection is not defined.
    • getGridLabelFormat

      public GridLabelFormat getGridLabelFormat()