@terrestris/mapfish-print-manager
    Preparing search index...

    Class MapFishPrintV2Manager

    Hierarchy

    • BaseMapFishPrintManager
      • MapFishPrintV2Manager
    Index

    Constructors

    Properties

    _dpi?: number

    The currently selected dpi.

    _dpis: number[] = []

    The supported DPIs by the print service.

    _extentFeature?: Feature<Polygon>

    Feature representing the page extent.

    _initiated: boolean = false

    Whether this manger has been initiated or not.

    _layout?: Layout

    The currently selected layout.

    _layouts: Layout[] = []

    The supported layouts by the print service.

    _outputFormat?: string

    The currently selected output format.

    _outputFormats: string[] = []

    The supported output formats by the print service.

    _printMapSize?: PrintMapSize

    The currently set map size defined with its width and height.

    _scale?: number

    The currently selected scale.

    _scales: number[] = []

    The supported scales by the print service.

    capabilities?: any
    credentialsMode: RequestCredentials
    customParams?: any
    customPrintScales?: number[]
    events: Record<string, ObservableEvent> = {}

    The registered events.

    extentLayer?: VectorLayer<VectorSource<Feature<Geometry>>, Feature<Geometry>>
    headers?: Record<string, string>
    layerFilter: (layer: Layer) => boolean
    legendFilter: (layer: Layer) => boolean
    map: Map
    maskColor: string
    method: "GET" | "POST"
    serializers: BaseSerializer[] = []
    timeout: number
    transformOpts?: OlInteractionTransformOpts
    url?: string
    CUSTOM_PRINT_SERIALIZER_OPTS_KEY: string = 'customPrintSerializerOpts'

    The key in the layer properties to lookup for custom serializer options.

    EXTENT_LAYER_NAME: string = 'PrintManager Vector Layer'

    The name of the vector layer configured and created by the print manager.

    INFO_JSON_ENDPOINT: string = 'info.json'

    The capabilities endpoint of the print service.

    TRANSFORM_INTERACTION_NAME: string = 'PrintManager Transform Interaction'

    The name of the transform interaction configured and created by the print manager.

    Methods

    • Calculates the extent based on a scale.

      Parameters

      • Optionalscale: number

        The scale to calculate the extent for. If not given, the current scale of the provider will be used.

      Returns undefined | number[]

      The extent.

    • Calculates the current rotation of the print extent feature.

      Returns undefined | number

    • Dispatches the given event with the provided data.

      Parameters

      • name: string

        The name of the event to dispatch.

      • data: any

        The data to apply to the event callback.

      Returns void

    • Opens the given URL in a new browser tab to download the given response (if header are set correctly).

      Parameters

      • url: string

        The url to open.

      Returns void

    • Checks if a given layer should be printed.

      Parameters

      • layer: Layer

        The layer to check.

      Returns boolean

      Whether the layer should be printed or not.

    • Checks if the legend of a given legend should be printed.

      Parameters

      • layer: Layer

        The layer to check.

      Returns boolean

      Whether the legend of the layer should be printed or not.

    • Returns the closest scale to current print feature's extent.

      Returns undefined | number

    • Returns the closest scale to fit the print feature's extent into the current extent of the map.

      Returns number

    • Returns an individual custom param.

      Parameters

      • key: string

        The custom param to get.

      Returns any

      The custom param

    • Returns the currently selected dpi.

      Returns undefined | number

      The currently selected dpi.

    • Returns the extent layer.

      Returns undefined | VectorLayer<VectorSource<Feature<Geometry>>, Feature<Geometry>>

      The extent layer.

    • Returns the currently selected layout.

      Returns undefined | Layout

      The currently selected layout.

    • Returns all supported layouts.

      Returns Layout[]

      The supported layouts.

    • Returns the currently selected output format.

      Returns undefined | string

      The currently selected output format.

    • Returns all supported output formats.

      Returns string[]

      The supported output formats.

    • Computes size of print extent in pixel depending on dimensions of print map and print scale.

      Parameters

      • printMapSize: PrintMapSize

        Print map size containing its width and height.

      • printScale: number

        Print scale.

      Returns PrintMapSize

      Print extent size.

    • Returns print map size for chosen layout.

      Returns undefined | PrintMapSize

      The map size.

    • Returns the currently selected scale.

      Returns undefined | number

      The currently selected scale.

    • Initializes the manager instance. Typically called by subclasses via init().

      Parameters

      • capabilities: any

        The capabilities to set.

      Returns void

    • Initializes the print extent feature.

      Returns undefined | Feature<Polygon>

      The extent feature.

    • Initializes the transform interaction.

      Returns void

    • Whether this manager has been initiated or not.

      Returns boolean

      Whether this manager has been initiated or not.

    • Registers an event.

      Parameters

      • name: string

        The name of the event to register.

      • callback: (data: any) => void

        The callback function to register.

      Returns void

    • Called on the extentLayer's postrender event.

      Parameters

      • olEvt: RenderEvent

        The ol render event.

      Returns void

    • Called on the extentLayer's prerender event.

      Parameters

      • olEvt: RenderEvent

        The ol render event.

      Returns void

    • Called on translate interaction's scaling event.

      Returns void

    • Calls the print servlet to create an output file in the requested format and forces a download of the created output.

      Note: The manager has to be initialized prior this method's usage.

      Parameters

      • OptionalforceDownload: boolean

        Whether to force a direct download of the print result or to return the download url.

      Returns Promise<undefined | string>

      If forceDownload is set to false, the download url of the print result will be returned in a Promise.

    • Serializes/encodes the given layer.

      Parameters

      • layer: Layer

        The layer to serialize/encode.

      Returns any

      The serialized/encoded layer.

    • Serializes/encodes the legend payload for the given layer.

      Parameters

      • layer: Layer

        The layer to serialize/encode the legend for.

      Returns any

      The serialized/encoded legend.

    • Sets an individual custom param.

      Parameters

      • key: string

        The key of the param.

      • value: any

        The value of the param.

      Returns void

    • Sets the custom params.

      Parameters

      • params: any

        The params to set.

      Returns void

    • Sets the dpi to use.

      Parameters

      • value: number

        The value of the dpi to use.

      Returns void

    • Sets the layout to use. Updates the print extent accordingly.

      Parameters

      • name: string

        The name of the layout to use.

      Returns void

    • Setter for legend filter

      Parameters

      • filterFn: (layer: Layer) => boolean

        The new legend filter function

      Returns void

    • Sets the output format to use.

      Parameters

      • name: string

        The name of the output format to use.

      Returns void

    • Sets the map size to use while printing.

      Parameters

      • printMapSize: PrintMapSize

        The object containing width and height of printed map.

      Returns void

    • Rotates the print extent by the amount of the given rotation.

      Parameters

      • rotation: number

        The amount to rotate.

      Returns void

    • Sets the scale to use. Updates the print extent accordingly.

      Parameters

      • value: number

        The value of the scale to use.

      Returns void

    • Unregisters an event.

      Parameters

      • name: string

        The name of the event to unregister.

      • callback: (data: any) => void

        The callback function to unregister.

      Returns void

    • Updates the geometry of the print extent feature to match the current scale.

      Returns void

    • Validates the given HTTP fetch response.

      Parameters

      • response: Response

        The response to validate.

      Returns void