Package org.mapfish.print.processor.map
Class CreateMapProcessor
java.lang.Object
org.mapfish.print.processor.AbstractProcessor<CreateMapProcessor.Input,CreateMapProcessor.Output>
org.mapfish.print.processor.map.CreateMapProcessor
- All Implemented Interfaces:
ConfigurationObject,Processor<CreateMapProcessor.Input,CreateMapProcessor.Output>
public final class CreateMapProcessor
extends AbstractProcessor<CreateMapProcessor.Input,CreateMapProcessor.Output>
A processor to render a map that can be embedded as a sub-report into a JasperReports template.
See also: !map attribute [[examples=verboseExample]]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Input object for processor.static final recordOutput for the processor.Nested classes/interfaces inherited from class org.mapfish.print.processor.AbstractProcessor
AbstractProcessor.ContextNested classes/interfaces inherited from interface org.mapfish.print.processor.Processor
Processor.ExecutionContext -
Field Summary
Fields inherited from interface org.mapfish.print.processor.Processor
MDC_APPLICATION_ID_KEY, MDC_JOB_ID_KEY -
Method Summary
Modifier and TypeMethodDescriptionstatic MapBoundsadjustBoundsToScaleAndMapSize(GenericMapAttribute.GenericMapAttributeValues mapValues, Rectangle paintArea, MapBounds bounds, double dpi) If requested, adjust the bounds to the nearest scale and the map size.Returns a new/clean instance of a parameter object.static MapfishMapContextcreateMapContext(MapAttribute.MapAttributeValues mapValues) static org.apache.batik.svggen.SVGGraphics2DcreateSvgGraphics(Dimension size) Create an SVG graphic with the give dimensions.execute(CreateMapProcessor.Input param, Processor.ExecutionContext context) Perform the process on the input attributes.protected voidextraValidation(List<Throwable> validationErrors, Configuration configuration) Perform any extra validation a subclass may need to perform.static voidsaveSvgFile(org.apache.batik.svggen.SVGGraphics2D graphics2d, File path) Save an SVG graphic to the given path.Methods inherited from class org.mapfish.print.processor.AbstractProcessor
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, toString, validate
-
Method Details
-
createMapContext
- Parameters:
mapValues- The map parameters.- Returns:
- The map context.
-
adjustBoundsToScaleAndMapSize
public static MapBounds adjustBoundsToScaleAndMapSize(GenericMapAttribute.GenericMapAttributeValues mapValues, Rectangle paintArea, MapBounds bounds, double dpi) If requested, adjust the bounds to the nearest scale and the map size.- Parameters:
mapValues- Map parameters.paintArea- The size of the painting area.bounds- The map bounds.dpi- the DPI.
-
createSvgGraphics
public static org.apache.batik.svggen.SVGGraphics2D createSvgGraphics(Dimension size) throws ParserConfigurationException Create an SVG graphic with the give dimensions.- Parameters:
size- The size of the SVG graphic.- Throws:
ParserConfigurationException
-
saveSvgFile
public static void saveSvgFile(org.apache.batik.svggen.SVGGraphics2D graphics2d, File path) throws IOException Save an SVG graphic to the given path.- Parameters:
graphics2d- The SVG graphic to save.path- The file.- Throws:
IOException
-
createInputParameter
Description copied from interface:ProcessorReturns a new/clean instance of a parameter object. This instance's will be inspected using reflection to find its public fields and the properties will be set from theValuesobject.The way the properties will be looked up is to
- take the bean property name
- map it using the input mapper, (if the input mapper does not have a mapping for the property then the unmapped property name is used)
- Look up the property value in the
Valuesobject using the mapped property name - set the value on the instance created by this method. If the value is null an exception
will be thrown UNLESS the
HasDefaultValueannotation is on the field for the property.
It is important to realize that super classes will also be analyzed, so care must be had with inheritance.
-
execute
public CreateMapProcessor.Output execute(CreateMapProcessor.Input param, Processor.ExecutionContext context) throws IOException, ParserConfigurationException, net.sf.jasperreports.engine.JRException Description copied from interface:ProcessorPerform the process on the input attributes.- Parameters:
param- A Java object whose public fields are populated from theValuesobject (which is used for transferring properties between processors).context- The execution context for a print task.- Returns:
- A Java object whose public fields will be put into the
Valuesobject. The key in theValuesobject is the name of the field or if there is a mapping in theProcessor.getOutputMapperBiMap()map, the mapped name. The key is determined in a similar way as for the input object. - Throws:
IOExceptionParserConfigurationExceptionnet.sf.jasperreports.engine.JRException
-
extraValidation
Description copied from class:AbstractProcessorPerform any extra validation a subclass may need to perform.- Specified by:
extraValidationin classAbstractProcessor<CreateMapProcessor.Input,CreateMapProcessor.Output> - Parameters:
validationErrors- a list to add errors to so that all validation errors are reported as one.configuration- the containing configuration
-