Skip to content

Commit

Permalink
chore: update openlayers to ~6.15.1
Browse files Browse the repository at this point in the history
BREAKING CHANGES:
- `ol` peer dep is now `~6.15.1`
- `DrawInteractionComponent` : input `type` is now of type `Type`
- `SourceImageWMSComponent` : input `serverType` is now of type `ServerType`
- `OverlayComponent` : input `positioning` is now of type `Positioning`
- `SourceTileWMSComponent` : input `projection` is now of type `ProjectionLike` and input `serverType` is now of type `ServerType`
- `SourceTileWMTSComponent` : input `requestEncoding` is now of type `RequestEncoding`
  • Loading branch information
jeremy-eychenne committed Mar 20, 2024
1 parent eb19c9d commit 096445d
Show file tree
Hide file tree
Showing 15 changed files with 1,158 additions and 1,118 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"jsdoc/newline-after-description": "off",
"@angular-eslint/component-selector": [
"error",
{
Expand All @@ -43,6 +44,14 @@
"accessibility": "explicit"
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "objectLiteralProperty",
"leadingUnderscore": "allow",
"format": ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"]
}
],
"arrow-parens": [
"off",
"always"
Expand Down
2 changes: 1 addition & 1 deletion documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ property of the source as they would otherwise appear multiple times.

```html
<aol-layer-vectortile
[renderMode]="'vector'"
[renderMode]="VectorTileRenderType.VECTOR"
[maxResolution]="312"
[style]="myStyle"
[zIndex]="20"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "^14.3.0",
"@angular/router": "^14.3.0",
"hammerjs": "^2.0.8",
"ol": "~6.13.0",
"ol": "~6.15.1",
"rxjs": "~7.5.0",
"tslib": "^2.5.0",
"zone.js": "~0.11.4"
Expand All @@ -45,10 +45,10 @@
"@types/topojson-specification": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"commit-and-tag-version": "^12.0.0",
"commit-and-tag-version": "^11.3.0",
"eslint": "^8.23.0",
"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-prefer-arrow": "latest",
"improved-yarn-audit": "^3.0.0",
"jasmine-core": "~4.3.0",
Expand All @@ -58,7 +58,7 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"ng-packagr": "^14.2.2",
"ng-packagr": "~14.2.2",
"prettier": "^2.0.3",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-openlayers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"peerDependencies": {
"@angular/common": ">=6.0.0 <=14.x.x",
"@angular/core": ">=6.0.0 <=14.x.x",
"ol": "~6.13.0"
"ol": "~6.15.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Vector } from 'ol/source';
import { Style } from 'ol/style';
import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component';
import { Type } from 'ol/geom/Geometry';

@Component({
selector: 'aol-interaction-draw',
Expand All @@ -23,7 +24,7 @@ export class DrawInteractionComponent implements OnInit, OnDestroy {
@Input()
snapTolerance?: number;
@Input()
type: string;
type: Type;
@Input()
maxPoints?: number;
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { StyleFunction } from 'ol/style/Style';
import { MapComponent } from '../map.component';
import { LayerComponent } from './layer.component';
import { LayerGroupComponent } from './layergroup.component';
import VectorTileRenderType from 'ol/layer/VectorTileRenderType';

type VectorTileRenderType = typeof VectorTileRenderType;

@Component({
selector: 'aol-layer-vectortile',
Expand All @@ -15,7 +18,7 @@ export class LayerVectorTileComponent extends LayerComponent implements OnInit,
@Input()
renderBuffer: number;
@Input()
renderMode: string;
renderMode: VectorTileRenderType;
/* not marked as optional in the typings */
@Input()
renderOrder: (feature1: Feature, feature2: Feature) => number;
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-openlayers/src/lib/overlay.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, ContentChild, Input, OnDestroy, OnInit } from '@angular/core';
import { Overlay } from 'ol';
import { PanOptions } from 'ol/Overlay';
import { PanOptions, Positioning } from 'ol/Overlay';
import { ContentComponent } from './content.component';
import { MapComponent } from './map.component';

Expand All @@ -17,7 +17,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
@Input()
offset: number[];
@Input()
positioning: string;
positioning: Positioning;
@Input()
stopEvent: boolean;
@Input()
Expand Down
9 changes: 5 additions & 4 deletions projects/ngx-openlayers/src/lib/sources/imagewms.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
Component,
EventEmitter,
forwardRef,
Host,
Input,
OnChanges,
OnInit,
forwardRef,
SimpleChanges,
Output,
EventEmitter,
SimpleChanges,
} from '@angular/core';
import { ImageWMS } from 'ol/source';
import { LayerImageComponent } from '../layers/layerimage.component';
Expand All @@ -16,6 +16,7 @@ import { ProjectionLike } from 'ol/proj';
import { AttributionLike } from 'ol/source/Source';
import { LoadFunction } from 'ol/Image';
import { ImageSourceEvent } from 'ol/source/Image';
import { ServerType } from 'ol/source/wms';

@Component({
selector: 'aol-source-imagewms',
Expand All @@ -30,7 +31,7 @@ export class SourceImageWMSComponent extends SourceComponent implements OnChange
@Input()
hidpi: boolean;
@Input()
serverType: string;
serverType: ServerType;
@Input()
imageLoadFunction?: LoadFunction;
@Input()
Expand Down
8 changes: 5 additions & 3 deletions projects/ngx-openlayers/src/lib/sources/tilewms.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Component, Host, Input, OnChanges, OnInit, SimpleChanges, forwardRef } from '@angular/core';
import { Component, forwardRef, Host, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { LoadFunction } from 'ol/Tile';
import { TileWMS } from 'ol/source';
import TileGrid from 'ol/tilegrid/TileGrid';
import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component';
import { ProjectionLike } from 'ol/proj';
import { ServerType } from 'ol/source/wms';

@Component({
selector: 'aol-source-tilewms',
Expand All @@ -22,11 +24,11 @@ export class SourceTileWMSComponent extends SourceComponent implements OnChanges
@Input()
params: { [key: string]: any };
@Input()
projection: string;
projection: ProjectionLike;
@Input()
reprojectionErrorThreshold: number;
@Input()
serverType: string;
serverType: ServerType;
@Input()
tileGrid: TileGrid;
@Input()
Expand Down
5 changes: 3 additions & 2 deletions projects/ngx-openlayers/src/lib/sources/tilewmts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
Component,
ContentChild,
EventEmitter,
forwardRef,
Host,
Input,
OnChanges,
Output,
SimpleChanges,
forwardRef,
} from '@angular/core';
import { LoadFunction } from 'ol/Tile';
import { ProjectionLike } from 'ol/proj';
Expand All @@ -18,6 +18,7 @@ import WMTSTileGrid from 'ol/tilegrid/WMTS';
import { LayerTileComponent } from '../layers/layertile.component';
import { TileGridWMTSComponent } from '../tilegridwmts.component';
import { SourceComponent } from './source.component';
import { RequestEncoding } from 'ol/source/WMTS';

@Component({
selector: 'aol-source-tilewmts',
Expand All @@ -36,7 +37,7 @@ export class SourceTileWMTSComponent extends SourceComponent implements AfterCon
@Input()
reprojectionErrorThreshold?: number;
@Input()
requestEncoding?: string;
requestEncoding?: RequestEncoding;
@Input()
layer: string;
@Input()
Expand Down
13 changes: 9 additions & 4 deletions projects/ngx-openlayers/src/lib/styles/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { Color } from 'ol/color';
import { Size } from 'ol/size';
import { Icon } from 'ol/style';
import { StyleComponent } from './style.component';
import IconAnchorUnits from 'ol/style/IconAnchorUnits';
import IconOrigin from 'ol/style/IconOrigin';

type IconAnchorUnits = typeof IconAnchorUnits;
type IconOrigin = typeof IconOrigin;

@Component({
selector: 'aol-style-icon',
Expand All @@ -12,11 +17,11 @@ export class StyleIconComponent implements OnInit, OnChanges {
@Input()
anchor: [number, number];
@Input()
anchorXUnits: string;
anchorXUnits: IconAnchorUnits;
@Input()
anchorYUnits: string;
anchorYUnits: IconAnchorUnits;
@Input()
anchorOrigin: string;
anchorOrigin: IconOrigin;
@Input()
color: Color;
@Input()
Expand All @@ -26,7 +31,7 @@ export class StyleIconComponent implements OnInit, OnChanges {
@Input()
offset: [number, number];
@Input()
offsetOrigin: string;
offsetOrigin: IconOrigin;
@Input()
opacity: number;
@Input()
Expand Down
11 changes: 8 additions & 3 deletions src/app/basic/basic.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import IconAnchorUnits from 'ol/style/IconAnchorUnits';
import IconOrigin from 'ol/style/IconOrigin';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -34,10 +36,10 @@ import { Component } from '@angular/core';
<aol-style-icon
[src]="'assets/marker.png'"
[anchor]="[0.5, 1]"
[anchorXUnits]="'fraction'"
[anchorYUnits]="'fraction'"
[anchorXUnits]="IconAnchorUnits.FRACTION"
[anchorYUnits]="IconAnchorUnits.FRACTION"
[scale]="0.1"
[anchorOrigin]="'top-left'"
[anchorOrigin]="IconOrigin.TOP_LEFT"
>
</aol-style-icon>
</aol-style>
Expand Down Expand Up @@ -78,6 +80,9 @@ export class BasicComponent {
public lon = 5;
public lat = 45;

protected readonly IconAnchorUnits = IconAnchorUnits;
protected readonly IconOrigin = IconOrigin;

increaseZoom() {
this.zoom = Math.min(this.zoom + 1, 18);
console.log('zoom: ', this.zoom);
Expand Down
14 changes: 8 additions & 6 deletions src/app/marker/marker.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';

//
import { Component } from '@angular/core';
import IconAnchorUnits from 'ol/style/IconAnchorUnits';
import IconOrigin from 'ol/style/IconOrigin';

@Component({
selector: 'app-display-marker',
Expand All @@ -25,10 +25,10 @@ import { Component, OnInit } from '@angular/core';
<aol-style-icon
[src]="'assets/marker.svg'"
[anchor]="[0.5, 1]"
[anchorXUnits]="'fraction'"
[anchorYUnits]="'fraction'"
[anchorXUnits]="IconAnchorUnits.FRACTION"
[anchorYUnits]="IconAnchorUnits.FRACTION"
[scale]="2"
[anchorOrigin]="'top-left'"
[anchorOrigin]="IconOrigin.TOP_LEFT"
>
</aol-style-icon>
</aol-style>
Expand Down Expand Up @@ -60,4 +60,6 @@ export class MarkerComponent {
lon: -2.264184,
lat: 46.996207,
};
protected readonly IconAnchorUnits = IconAnchorUnits;
protected readonly IconOrigin = IconOrigin;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import IconAnchorUnits from 'ol/style/IconAnchorUnits';
import IconOrigin from 'ol/style/IconOrigin';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -30,10 +32,10 @@ import { Component } from '@angular/core';
<aol-style-icon
[src]="'assets/marker.png'"
[anchor]="[0.5, 1]"
[anchorXUnits]="'fraction'"
[anchorYUnits]="'fraction'"
[anchorXUnits]="IconAnchorUnits.FRACTION"
[anchorYUnits]="IconAnchorUnits.FRACTION"
[scale]="0.1"
[anchorOrigin]="'top-left'"
[anchorOrigin]="IconOrigin.TOP_LEFT"
>
</aol-style-icon>
</aol-style>
Expand Down Expand Up @@ -70,6 +72,9 @@ import { Component } from '@angular/core';
export class ViewProjectionUpdateComponent {
public viewProjection = 'EPSG:3857';

protected readonly IconAnchorUnits = IconAnchorUnits;
protected readonly IconOrigin = IconOrigin;

projectionChange(evt) {
console.log(`Projection changed to ${evt.target.value}`);
this.viewProjection = evt.target.value;
Expand Down
Loading

0 comments on commit 096445d

Please sign in to comment.