From 3779502c82dff6c175b4416ebc01d6e759e1fb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Mon, 6 Jun 2022 15:26:47 -0400 Subject: [PATCH] Print fixes (#1068) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(print): wms/wfs layer with workspace show blue features on printing output * fix(print): remove scale control on getlegend when printing Co-authored-by: Pierre-Étienne Lord --- .../geo/src/lib/print/shared/print.service.ts | 2 +- .../shared/edition-workspace.service.ts | 22 +++++++++++++++- .../workspace/shared/wms-workspace.service.ts | 25 ++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/geo/src/lib/print/shared/print.service.ts b/packages/geo/src/lib/print/shared/print.service.ts index 50bd1fd914..a7e0fe681f 100644 --- a/packages/geo/src/lib/print/shared/print.service.ts +++ b/packages/geo/src/lib/print/shared/print.service.ts @@ -153,7 +153,7 @@ export class PrintService { resolution: map.viewController.getResolution(), extent: map.viewController.getExtent(), projection: map.viewController.getOlProjection().getCode(), - scale: map.viewController.getScale(resolution), + // scale: map.viewController.getScale(resolution), size: map.ol.getSize() } as LegendMapViewOptions ); diff --git a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts index c3c53aae3d..b9cfbb598e 100644 --- a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts +++ b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts @@ -28,6 +28,7 @@ import { import { OgcFilterableDataSourceOptions } from '../../filter/shared/ogc-filter.interface'; import { ImageLayer, LayerService, LayersLinkProperties, LinkedProperties, VectorLayer } from '../../layer'; +import { StyleService } from '../../layer/shared/style.service'; import { GeoWorkspaceOptions } from '../../layer/shared/layers/layer.interface'; import { IgoMap } from '../../map'; import { QueryableDataSourceOptions } from '../../query/shared/query.interfaces'; @@ -61,6 +62,7 @@ export class EditionWorkspaceService { private languageService: LanguageService, private http: HttpClient, private dialog: MatDialog, + private styleService: StyleService, public authInterceptor?: AuthInterceptor) { } createWorkspace(layer: ImageLayer, map: IgoMap): EditionWorkspace { @@ -138,7 +140,25 @@ export class EditionWorkspaceService { title: layer.title, minResolution: layer.options.workspace?.minResolution || layer.minResolution || 0, maxResolution: layer.options.workspace?.maxResolution || layer.maxResolution || Infinity, - sourceOptions: { + style: this.styleService.createStyle( + { + fill: { + "color": "rgba(255, 255, 255, 0.01)" + }, + stroke: { + "color": "rgba(255, 255, 255, 0.01)" + }, + circle: { + fill: { + color: "rgba(255, 255, 255, 0.01)" + }, + stroke: { + color: "rgba(255, 255, 255, 0.01)" + }, + radius: 5 + } + }), + sourceOptions: { download: dataSource.options.download, type: 'wfs', url: dataSource.options.urlWfs || dataSource.options.url, diff --git a/packages/geo/src/lib/workspace/shared/wms-workspace.service.ts b/packages/geo/src/lib/workspace/shared/wms-workspace.service.ts index e3e65148ba..1f2a2a74e7 100644 --- a/packages/geo/src/lib/workspace/shared/wms-workspace.service.ts +++ b/packages/geo/src/lib/workspace/shared/wms-workspace.service.ts @@ -24,6 +24,7 @@ import { import { OgcFilterableDataSourceOptions } from '../../filter/shared/ogc-filter.interface'; import { ImageLayer, LayerService, LayersLinkProperties, LinkedProperties, VectorLayer } from '../../layer'; +import { StyleService } from '../../layer/shared/style.service'; import { GeoWorkspaceOptions } from '../../layer/shared/layers/layer.interface'; import { IgoMap } from '../../map'; import { QueryableDataSourceOptions } from '../../query/shared/query.interfaces'; @@ -44,7 +45,11 @@ export class WmsWorkspaceService { public ws$ = new BehaviorSubject(undefined); - constructor(private layerService: LayerService, private storageService: StorageService, private configService: ConfigService) { } + constructor( + private layerService: LayerService, + private storageService: StorageService, + private styleService: StyleService, + private configService: ConfigService) { } createWorkspace(layer: ImageLayer, map: IgoMap): WfsWorkspace { if ( @@ -116,6 +121,24 @@ export class WmsWorkspaceService { title: layer.title, minResolution: layer.options.workspace?.minResolution || layer.minResolution || 0, maxResolution: layer.options.workspace?.maxResolution || layer.maxResolution || Infinity, + style: this.styleService.createStyle( + { + fill: { + "color": "rgba(255, 255, 255, 0.01)" + }, + stroke: { + "color": "rgba(255, 255, 255, 0.01)" + }, + circle: { + fill: { + color: "rgba(255, 255, 255, 0.01)" + }, + stroke: { + color: "rgba(255, 255, 255, 0.01)" + }, + radius: 5 + } + }), sourceOptions: { download: dataSource.options.download, type: 'wfs',