Skip to content

Commit

Permalink
refactor(add-data): Consistent naming of useTiles prop
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipLeitner committed Oct 15, 2024
1 parent 773c702 commit a61770c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
<div class="capabilities_input d-flex flex-column">
@if (type === 'wms') {
<label class="capabilities_label control-label"> <input type="checkbox" class="me-1 checkbox-lg" name="useTiles"
[(ngModel)]="data.use_tiles" />
[(ngModel)]="data.useTiles" />
{{'ADDLAYERS.useTiles' | translateHs }}
</label>
}
</div>
</div>
@if (type === 'wms' || type === 'arcgis') {
<p class="col-sm-12 alert alert-warning" [hidden]="data.use_tiles">
<p class="col-sm-12 alert alert-warning" [hidden]="data.useTiles">
{{'ADDLAYERS.considerUsingTiles' | translateHs }}
</p>
}
Expand Down
2 changes: 1 addition & 1 deletion projects/hslayers/services/add-data/url/arcgis.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class HsUrlArcGisService implements HsUrlTypeServiceModel {
map_projection: '',
tile_size: 512,
use_resampling: false,
use_tiles: true,
useTiles: true,
table: {
trackBy: 'id',
nameProperty: 'name',
Expand Down
13 changes: 6 additions & 7 deletions projects/hslayers/services/add-data/url/wms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class HsUrlWmsService implements HsUrlTypeServiceModel {
map_projection: '',
tile_size: 512,
use_resampling: false,
use_tiles: true,
useTiles: true,
visible: true,
table: {
trackBy: 'Name',
Expand Down Expand Up @@ -475,10 +475,9 @@ export class HsUrlWmsService implements HsUrlTypeServiceModel {
},
crossOrigin: 'anonymous',
};
const USE_TILES = options.useTiles ?? this.data.use_tiles;
const source: ImageWMS | TileWMS = !USE_TILES
? new ImageWMS(sourceOptions)
: new TileWMS(sourceOptions);
const source: ImageWMS | TileWMS = this.data.useTiles
? new TileWMS(sourceOptions)
: new ImageWMS(sourceOptions);
const metadata =
this.hsWmsGetCapabilitiesService.getMetadataObjectWithUrls(layer);
const view = this.hsMapService.getMap().getView();
Expand Down Expand Up @@ -518,10 +517,10 @@ export class HsUrlWmsService implements HsUrlTypeServiceModel {
*/
layerOptions['capsExtentSet'] = !!layerOptions.extent;

const new_layer = USE_TILES
const new_layer = this.data.useTiles
? new Tile(layerOptions as TileOptions<TileSource>)
: new ImageLayer(layerOptions as ImageOptions<ImageSource>);
this.hsMapService.proxifyLayerLoader(new_layer, USE_TILES);
this.hsMapService.proxifyLayerLoader(new_layer, this.data.useTiles);
return new_layer;
}

Expand Down
2 changes: 1 addition & 1 deletion projects/hslayers/types/add-data/data-object.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type UrlDataObject = {
tile_size?: number;
title?: string;
use_resampling?: boolean;
use_tiles?: boolean;
useTiles?: boolean;
version?: string;
visible?: boolean;
table: {
Expand Down

0 comments on commit a61770c

Please sign in to comment.