Package org.mapfish.print.attribute.map
Class GenericMapAttribute.GenericMapAttributeValues
- java.lang.Object
-
- org.mapfish.print.attribute.map.GenericMapAttribute.GenericMapAttributeValues
-
- Direct Known Subclasses:
MapAttribute.MapAttributeValues
,OverviewMapAttribute.OverviewMapAttributeValues
- Enclosing class:
- GenericMapAttribute
public abstract class GenericMapAttribute.GenericMapAttributeValues extends java.lang.Object
The value ofGenericMapAttribute
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
DEFAULT_PROJECTION
The default projection.boolean
dpiSensitiveStyle
Should the vector style definitions be adapted to the target DPI resolution? (Default: true)java.lang.Integer
height
The height of the map.java.lang.Boolean
longitudeFirst
By default the normal axis order as specified in EPSG code will be used when parsing projections.java.lang.Boolean
pdfA
Whether to merge all layers into one.java.lang.String
projection
The projection of the map.java.lang.Double
rotation
The rotation of the map.java.lang.Boolean
useAdjustBounds
Indicates if the map should adjust its bounds.java.lang.Boolean
useNearestScale
Indicates if the map should adjust its scale/zoom level to be equal to one of those defined in the configuration file.java.lang.Integer
width
The width of the map.
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericMapAttributeValues(Template template)
Constructor.protected
GenericMapAttributeValues(Template template, java.lang.Integer width, java.lang.Integer height)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Double
getDpi()
Return the DPI value for the map.double[]
getDpiSuggestions()
java.lang.Integer
getHeight()
java.util.List<MapLayer>
getLayers()
java.awt.Dimension
getMapSize()
java.lang.String
getProjection()
abstract PArray
getRawLayers()
Return the JSON layer definition.java.lang.Double
getRotation()
Gets the rotation.Template
getTemplate()
protected <T> T
getValueOr(T value, T defaultValue)
java.lang.Integer
getWidth()
ZoomLevels
getZoomLevels()
ZoomLevelSnapStrategy
getZoomLevelSnapStrategy()
java.lang.Boolean
getZoomSnapGeodetic()
java.lang.Double
getZoomSnapTolerance()
boolean
isDpiSensitiveStyle()
java.lang.Boolean
isUseAdjustBounds()
Return true if requestData has useNearestScale and configuration has some zoom levels defined.java.lang.Boolean
isUseNearestScale()
Return true if requestData has useNearestScale and configuration has some zoom levels defined.protected org.geotools.api.referencing.crs.CoordinateReferenceSystem
parseProjection()
Parse the projection from a string.void
postConstruct()
Validate the values provided by the request data and construct MapBounds and parse the layers.void
replaceLayer(int pos, MapLayer layer)
Replace a layer with another.abstract void
setRawLayers(PArray layers)
Set the JSON layer definition.
-
-
-
Field Detail
-
DEFAULT_PROJECTION
protected static final java.lang.String DEFAULT_PROJECTION
The default projection.- See Also:
- Constant Field Values
-
width
public java.lang.Integer width
The width of the map.
-
height
public java.lang.Integer height
The height of the map.
-
projection
public java.lang.String projection
The projection of the map.
-
rotation
public java.lang.Double rotation
The rotation of the map.
-
useNearestScale
public java.lang.Boolean useNearestScale
Indicates if the map should adjust its scale/zoom level to be equal to one of those defined in the configuration file.- See Also:
isUseNearestScale()
-
useAdjustBounds
public java.lang.Boolean useAdjustBounds
Indicates if the map should adjust its bounds.- See Also:
isUseAdjustBounds()
-
longitudeFirst
public java.lang.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.
-
dpiSensitiveStyle
public boolean dpiSensitiveStyle
Should the vector style definitions be adapted to the target DPI resolution? (Default: true)The style definitions are often optimized for a use with OpenLayers (which uses a DPI value of 72). When these styles are used to print with a higher DPI value, lines often look too thin, label are too small, etc.
If this property is set to `true`, the style definitions will be scaled to the target DPI value.
-
pdfA
public java.lang.Boolean pdfA
Whether to merge all layers into one. This is great to reduce pdf size but needs layers having an imagebufferscaling of 1. Also see the pdfA option of the print config.
-
-
Constructor Detail
-
GenericMapAttributeValues
protected GenericMapAttributeValues(Template template)
Constructor.- Parameters:
template
- the template this map is part of.
-
GenericMapAttributeValues
protected GenericMapAttributeValues(Template template, java.lang.Integer width, java.lang.Integer height)
Constructor.- Parameters:
template
- the template this map is part of.width
- the width of the map.height
- the height of the map.
-
-
Method Detail
-
postConstruct
public void postConstruct() throws org.geotools.api.referencing.FactoryException
Validate the values provided by the request data and construct MapBounds and parse the layers.- Throws:
org.geotools.api.referencing.FactoryException
-
parseProjection
protected final org.geotools.api.referencing.crs.CoordinateReferenceSystem parseProjection()
Parse the projection from a string.- Returns:
- the crs
-
getDpi
public abstract java.lang.Double getDpi()
Return the DPI value for the map. This method is abstract because the dpi value is optional for the overview map, but must be given for the normal map. So, in the overview map the field is defined with a @HasDefaultValue annotation.
-
getRawLayers
public abstract PArray getRawLayers()
Return the JSON layer definition. This method is abstract for the same reasons asgetDpi()
.
-
setRawLayers
public abstract void setRawLayers(PArray layers)
Set the JSON layer definition. This method is abstract for the same reasons asgetDpi()
.- Parameters:
layers
- the new layers
-
getLayers
public java.util.List<MapLayer> getLayers()
-
replaceLayer
public void replaceLayer(int pos, MapLayer layer)
Replace a layer with another.- Parameters:
pos
- The position of the layer to replacelayer
- The new layer
-
getTemplate
public final Template getTemplate()
-
getMapSize
public final java.awt.Dimension getMapSize()
-
getWidth
public final java.lang.Integer getWidth()
-
getHeight
public final java.lang.Integer getHeight()
-
getRotation
public java.lang.Double getRotation()
Gets the rotation.- Returns:
- the rotation
-
getProjection
public java.lang.String getProjection()
-
isUseNearestScale
public java.lang.Boolean isUseNearestScale()
Return true if requestData has useNearestScale and configuration has some zoom levels defined.
-
isUseAdjustBounds
public java.lang.Boolean isUseAdjustBounds()
Return true if requestData has useNearestScale and configuration has some zoom levels defined.
-
isDpiSensitiveStyle
public final boolean isDpiSensitiveStyle()
-
getZoomLevels
public ZoomLevels getZoomLevels()
-
getZoomSnapTolerance
public java.lang.Double getZoomSnapTolerance()
-
getZoomLevelSnapStrategy
public ZoomLevelSnapStrategy getZoomLevelSnapStrategy()
-
getZoomSnapGeodetic
public java.lang.Boolean getZoomSnapGeodetic()
-
getDpiSuggestions
public double[] getDpiSuggestions()
-
getValueOr
protected final <T> T getValueOr(T value, T defaultValue)
- Type Parameters:
T
- A type.- Parameters:
value
- The value or null.defaultValue
- The default value.
-
-