/** * @private * @hidden */ export class PrintController { /** * @param {JQuery} $element Element. * @param {angular.IScope} $rootScope Angular root scope. * @param {angular.IScope} $scope Angular scope. * @param {angular.ITimeoutService} $timeout Angular timeout service. * @param {angular.IQService} $q The Angular $q service. * @param {angular.gettext.gettextCatalog} gettextCatalog Gettext catalog. * @param {import('ngeo/map/LayerHelper').LayerHelper} ngeoLayerHelper The ngeo Layer Helper service. * @param {import('ngeo/print/Utils').PrintUtils} ngeoPrintUtils The ngeo PrintUtils service. * @param {import('ngeo/print/Service').CreatePrint} ngeoCreatePrint The ngeo Create Print function. * @param {string} gmfPrintUrl The MapFishPrint URL. * @param {import('ngeo/query/MapQuerent').QueryResult} ngeoQueryResult ngeo query result. * @param {angular.IFilterService} $filter Angular $filter service. * @param {PrintState} gmfPrintState GMF print state. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf Themes service. * @param {import('gmf/datasource/ExternalDataSourcesManager').ExternalDatSourcesManager} gmfExternalDataSourcesManager The manager of external datasources. * @param {import('gmf/options').gmfPrintOptions} gmfPrintOptions The options. * @param {string} cacheVersion The cache version * @ngdoc controller * @ngname GmfPrintController */ constructor($element: JQuery, $rootScope: angular.IScope, $scope: angular.IScope, $timeout: angular.ITimeoutService, $q: angular.IQService, gettextCatalog: angular.gettext.gettextCatalog, ngeoLayerHelper: import("ngeo/map/LayerHelper").LayerHelper, ngeoPrintUtils: import("ngeo/print/Utils").PrintUtils, ngeoCreatePrint: import("ngeo/print/Service").CreatePrint, gmfPrintUrl: string, ngeoQueryResult: import("ngeo/query/MapQuerent").QueryResult, $filter: angular.IFilterService, gmfPrintState: PrintState, gmfThemes: import("gmf/theme/Themes").ThemesService, gmfExternalDataSourcesManager: import("gmf/datasource/ExternalDataSourcesManager").ExternalDatSourcesManager, gmfPrintOptions: import("gmf/options").gmfPrintOptions, cacheVersion: string); options: import("gmf/options").gmfPrintOptions; /** * @type {PrintState} * @private */ private gmfPrintState_; /** * @type {function(string): string} * @private */ private translate_; /** * @type {?import('ol/Map').default} */ map: import("ol/Map").default | null; /** * @private */ private maskLayer_; /** * @type {boolean} */ active: boolean; /** * @type {import('ngeo/print/mapfish-print-v3').MapFishPrintCapabilitiesLayoutAttribute[]} */ attributesOut: import("ngeo/print/mapfish-print-v3").MapFishPrintCapabilitiesLayoutAttribute[]; /** * @type {angular.IScope} * @private */ private $rootScope_; /** * @type {angular.IScope} * @private */ private $scope_; /** * @type {angular.ITimeoutService} * @private */ private $timeout_; /** * @type {angular.IQService} * @private */ private $q_; /** * @type {angular.gettext.gettextCatalog} * @private */ private gettextCatalog_; /** * @type {import('ngeo/map/LayerHelper').LayerHelper} * @private */ private ngeoLayerHelper_; /** * @type {import('ol/layer/Vector').default>} * @private */ private featureOverlayLayer_; /** * @type {import('ngeo/print/Utils').PrintUtils} * @private */ private ngeoPrintUtils_; /** * @type {import('ngeo/print/Service').PrintService} * @private */ private ngeoPrint_; /** * @type {import('ngeo/query/MapQuerent').QueryResult} * @private */ private ngeoQueryResult_; /** * @type {import('gmf/theme/Themes').ThemesService} * @private */ private gmfThemes_; /** * @type {import('gmf/datasource/ExternalDataSourcesManager').ExternalDatSourcesManager} * @private */ private gmfExternalDataSourcesManager_; /** * @type {?import("gmf/print/LegendMapFishPrintV3").default} */ legendMapFishPrintV3_: import("gmf/print/LegendMapFishPrintV3").default | null; cacheVersion_: string; /** * @type {?angular.IDeferred} * @private */ private requestCanceler_; /** * @type {?angular.IPromise} * @private */ private statusTimeoutPromise_; /** * @type {?number[]} * @private */ private onDragPreviousMousePosition_; /** * @type {?angular.IPromise} * @private */ private rotationTimeoutPromise_; /** * @type {?import('ol/events').EventsKey} * @private */ private pointerDragListenerKey_; /** * @type {?import('ol/events').EventsKey} * @private */ private mapViewResolutionChangeKey_; /** * Current report reference id. * * @type {string} * @private */ private curRef_; /** * Formats availables in capabilities. * * @type {string[]} * @private */ private formats_; /** * An array of attributes objects from capabilities. * * @type {import('ngeo/print/mapfish-print-v3').MapFishPrintCapabilitiesLayout[]} * @private */ private layouts_; /** * An attributes object from capabilities. * * @type {?import('ngeo/print/mapfish-print-v3').MapFishPrintCapabilitiesLayout} * @private */ private layout_; /** * @type {import('ol/size').Size} * @private */ private paperSize_; /** * @type {PrintLayoutInfo} */ layoutInfo: PrintLayoutInfo; /** * @type {number} */ rotation: number; /** * The email of the user to which send the file. Obtained from the * authentication service. * * @type {?string} */ smtpEmail: string | null; /** * Whether to send the printed file by email or not. * * @type {boolean} */ smtpEnabled: boolean; /** * Flag that determines whether to show a message notifying the * user about his upcomping file or not. * * @type {boolean} */ smtpMessage: boolean; /** * Whether sending file by email is supported or not. Obtained * from the print capabilities. * * @type {boolean} */ smtpSupported: boolean; /** * @type {boolean} * @private */ private scaleManuallySelected_; /** * @type {JQuery} */ rotationInput_: JQuery; /** * @type {function((Event|import('ol/events/Event').default)): (void|boolean)} */ postcomposeListener_: (arg0: (Event | import("ol/events/Event").default)) => (void | boolean); /** * @type {?angular.IHttpPromise} * @private */ private capabilities_; /** * @type {?import('gmf/themes').GmfOgcServers} * @private */ private ogcServers_; /** * @type {import('gmf/themes').GmfTheme[]} * @private */ private currentThemes_; /** * Init the controller */ $onInit(): void; /** * @param {import('ol/Map').FrameState} frameState Frame state. * @returns {number} Scale of the map to print. */ getScaleFn(frameState: import("ol/Map").FrameState): number; /** * @param {boolean} active True to listen events related to the print and get * capabilities. False to stop listen them and set rotation to 0. * @private */ private togglePrintPanel_; /** * Gets the print capabilities. * * @param {string} roleId The roles ids. * @private */ private getCapabilities_; /** * Create the list of layouts, get the formats, get the first layout in * gmf print v3 capabilities and then update the print panel layout information. * * @param {angular.IHttpResponse} resp * Response. * @private */ private parseCapabilities_; /** * Update layout information with the user values if there are always available in the * current layout otherwise use the defaults values of the layout. * If a field doesn't exist in the current layout, set it to undefined so the * view can hide it. Update also the paper size. * custom print templates). * * @private */ private updateFields_; /** * Update simple attributes information with Customfield to be able to generate a form * from a custom GMF print v3 configuration. * * @private */ private updateCustomFields_; /** * Return a capabilities 'attribute' object corresponding to the given name. * * @param {string} name Name of the attribute to get. * @returns {?import('ngeo/print/mapfish-print-v3').MapFishPrintCapabilitiesLayoutAttribute} corresponding attribute or null. * @private */ private isAttributeInCurrentLayout_; /** * Set the current rotation value. * Updating the rotation will redraw the mask or rotate the map (depending on the configuration). * * @param {number} rotation The optional new rotation value in degrees. */ setRotation(rotation: number): void; /** * Set the current rotation value. * * @param {number} rotation The optional new rotation value in degrees. */ updateRotation_(rotation: number): void; /** * Calculate the angle and the sense of rotation between two lines. One from the * center of the map and the point of the last call to this function and one * from the same center and the point of the current call. * * @param {Event|import('ol/events/Event').default} e An ol map browser pointer event. * @private */ private onPointerDrag_; /** * Create a print report based on the values of the 'layoutInfo' values. * * @param {string} format An output format corresponding to one format in the * capabilities document ('pdf', 'png', etc). */ print(format: string): void; /** * Cancel the current print and reset its state. */ cancel(): void; /** * @param {PrintStateEnum} [opt_printState] the print state. * @private */ private resetPrintStates_; /** * Get datasource object for print report * * @private * @returns {import('ngeo/print/mapfish-print-v3').DataSourcePrintReportObject[]} the data * source object for the print report */ private getDataSource_; /** * Get the optimal scale to display the print mask. Return the lowest scale if * no scale matches. * * @param {import('ol/size').Size|undefined} mapSize Size of the map on the screen (px). * @param {number|undefined} viewResolution Resolution of the map on the screen. * @returns {number} The best scale. * @private */ private getOptimalScale_; /** * @param {angular.IHttpResponse} resp * Response. * @private */ private handleCreateReportSuccess_; /** * @param {string} ref Ref. * @private */ private getStatus_; /** * @param {string} ref Ref. * @param {angular.IHttpResponse} resp * Response. * @private */ private handleGetStatusSuccess_; /** * @private */ private handleCreateReportError_; /** * Set the current layout and update all layout information with this new layout parameters. * * @param {string} layoutName A layout name as existing in the list of * existing layouts. */ setLayout(layoutName: string): void; /** * Get or set the print scale value and adapt the zoom to match with this new scale. * * @param {number} [opt_scale] A scale value as existing in the scales list field. * @returns {number|undefined} New scale. */ getSetScale(opt_scale?: number): number | undefined; /** * Set the print dpi value. * * @param {number} dpi A dpi value as existing in the dpis list field. */ setDpi(dpi: number): void; /** * Check the current state of the print. * * @param {string} stateEnumKey An enum key from import('gmf/print/component').default.PrintStateEnum. * @returns {boolean} True if the given state matches with the current print * state. False otherwise. */ isState(stateEnumKey: string): boolean; /** * Close the SMTP message */ closeSmtpMessage(): void; } export namespace PrintController { let $inject: string[]; } export default myModule; /** * Fields that can come from a print v3 server and can be used in the partial * of the gmf print panel. */ export type PrintLayoutInfo = { /** * Custom print layoutInfo. */ simpleAttributes?: import("ngeo/print/mapfish-print-v3").MapFishPrintCapabilitiesLayoutAttribute[]; /** * The list of all the attributes name. */ attributes?: string[]; /** * The selected 'dpi'. */ dpi?: number; /** * The list of 'dpis'. */ dpis?: number[]; /** * The list of active 'formats' (png, pdf, ...). */ formats?: { [x: string]: boolean; }; /** * The selected 'layout'. */ layout?: string; /** * The list of 'layouts'. */ layouts?: string[]; /** * The legend checkbox. */ legend?: boolean; /** * The selected 'scale'. */ scale?: number; /** * The list of 'scales' */ scales?: number[]; }; export type PrintState = { state: PrintStateEnum; }; import angular from 'angular'; /** * Fields that can come from a print v3 server and can be used in the partial * of the gmf print panel. * * @typedef {Object} PrintLayoutInfo * @property {import('ngeo/print/mapfish-print-v3').MapFishPrintCapabilitiesLayoutAttribute[]} [simpleAttributes] * Custom print layoutInfo. * @property {string[]} [attributes] The list of all the attributes name. * @property {number} [dpi] The selected 'dpi'. * @property {number[]} [dpis] The list of 'dpis'. * @property {Object} [formats] The list of active 'formats' (png, pdf, ...). * @property {string} [layout] The selected 'layout'. * @property {string[]} [layouts] The list of 'layouts'. * @property {boolean} [legend] The legend checkbox. * @property {number} [scale] The selected 'scale'. * @property {number[]} [scales] The list of 'scales' */ /** * @type {angular.IModule} * @hidden */ declare const myModule: angular.IModule; /** * * */ type PrintStateEnum = string; declare namespace PrintStateEnum { let NOT_IN_USE: string; let PRINTING: string; let ERROR_ON_REPORT: string; let CAPABILITIES_NOT_LOADED: string; let ERROR_ON_GETCAPABILITIES: string; }