Skip to content

Commit 0ed47a3

Browse files
samuel-girardNeonox31
authored andcommitted
feat(openlayers): migrate to 5 version
BREAKING CHANGE: Migration from `openlayers` package to `ol`
1 parent 965cf66 commit 0ed47a3

File tree

79 files changed

+685
-597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+685
-597
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ node_modules
3131
/libpeerconnection.log
3232
npm-debug.log
3333
yarn-error.log
34+
yarn.lock
3435
testem.log
3536
/typings
3637

angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
],
4949
"styles": [
5050
"src/styles.css",
51-
"projects/ngx-openlayers/node_modules/openlayers/dist/ol.css"
51+
"node_modules/ol/ol.css"
5252
],
5353
"scripts": []
5454
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"geojson": "^0.5.0",
2828
"hammer-timejs": "^1.1.0",
2929
"hammerjs": "^2.0.8",
30+
"ol": "^5.3.1",
3031
"rxjs": "6.3.3",
3132
"zone.js": "^0.8.26"
3233
},

projects/ngx-openlayers/ng-package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../dist/ngx-openlayers",
44
"deleteDestPath": false,
5-
"whitelistedNonPeerDependencies": [
6-
"openlayers", "@types/openlayers"
7-
],
85
"lib": {
96
"entryFile": "src/public_api.ts"
107
}

projects/ngx-openlayers/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
},
1010
"peerDependencies": {
1111
"@angular/common": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0",
12-
"@angular/core": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0"
12+
"@angular/core": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0",
13+
"ol": "^5.3.1"
1314
},
14-
"dependencies": {
15-
"@types/openlayers": "4.3.x || 4.4.x",
16-
"openlayers": "4.3.x || 4.4.x"
17-
}
15+
"dependencies": {}
1816
}

projects/ngx-openlayers/src/lib/attribution.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, ElementRef, OnInit } from '@angular/core';
2-
import { Attribution } from 'openlayers';
2+
import { Attribution } from 'ol/control';
33

44
@Component({
55
selector: 'aol-attribution',

projects/ngx-openlayers/src/lib/attributions.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AfterViewInit, Component, ContentChildren, Host, QueryList } from '@angular/core';
2-
import { Attribution } from 'openlayers';
2+
import { Attribution } from 'ol/control';
33
import { SourceComponent } from './sources/source.component';
44
import { AttributionComponent } from './attribution.component';
55

projects/ngx-openlayers/src/lib/controls/attribution.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
2-
import { control } from 'openlayers';
2+
import { Attribution } from 'ol/control';
33
import { MapComponent } from '../map.component';
44

55
@Component({
@@ -8,7 +8,7 @@ import { MapComponent } from '../map.component';
88
})
99
export class ControlAttributionComponent implements OnInit, OnDestroy {
1010
public componentType = 'control';
11-
instance: control.Attribution;
11+
instance: Attribution;
1212
target: Element;
1313
@Input()
1414
collapsible: boolean;
@@ -18,7 +18,7 @@ export class ControlAttributionComponent implements OnInit, OnDestroy {
1818
ngOnInit() {
1919
this.target = this.element.nativeElement;
2020
// console.log('ol.control.Attribution init: ', this);
21-
this.instance = new control.Attribution(this);
21+
this.instance = new Attribution(this);
2222
this.map.instance.addControl(this.instance);
2323
}
2424

projects/ngx-openlayers/src/lib/controls/control.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, ContentChild, OnDestroy, OnInit } from '@angular/core';
2-
import { control } from 'openlayers';
2+
import { Control } from 'ol/control';
33
import { MapComponent } from '../map.component';
44
import { ContentComponent } from '../content.component';
55

@@ -11,7 +11,7 @@ import { ContentComponent } from '../content.component';
1111
})
1212
export class ControlComponent implements OnInit, OnDestroy {
1313
public componentType = 'control';
14-
instance: control.Control;
14+
instance: Control;
1515
element: Element;
1616
@ContentChild(ContentComponent)
1717
content: ContentComponent;
@@ -21,7 +21,7 @@ export class ControlComponent implements OnInit, OnDestroy {
2121
ngOnInit() {
2222
if (this.content) {
2323
this.element = this.content.elementRef.nativeElement;
24-
this.instance = new control.Control(this);
24+
this.instance = new Control(this);
2525
this.map.instance.addControl(this.instance);
2626
}
2727
}

projects/ngx-openlayers/src/lib/controls/default.component.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
import { Component, OnDestroy, OnInit, Input } from '@angular/core';
2-
import { control, Collection } from 'openlayers';
2+
import { Control, defaults } from 'ol/control';
3+
import { Collection } from 'ol';
4+
import { Options as AttributionOptions } from 'ol/control/Attribution';
5+
import { Options as RotateOptions } from 'ol/control/Rotate';
6+
import { Options as ZoomOptions } from 'ol/control/Zoom';
7+
38
import { MapComponent } from '../map.component';
49

510
@Component({
611
selector: 'aol-control-defaults',
712
template: '',
813
})
914
export class DefaultControlComponent implements OnInit, OnDestroy {
10-
instance: Collection<control.Control>;
15+
instance: Collection<Control>;
1116
@Input()
1217
attribution: boolean;
1318
@Input()
14-
attributionOptions: olx.control.AttributionOptions;
19+
attributionOptions: AttributionOptions;
1520
@Input()
1621
rotate: boolean;
1722
@Input()
18-
rotateOptions: olx.control.RotateOptions;
23+
rotateOptions: RotateOptions;
1924
@Input()
2025
zoom: boolean;
2126
@Input()
22-
zoomOptions: olx.control.ZoomOptions;
27+
zoomOptions: ZoomOptions;
2328

2429
constructor(private map: MapComponent) {}
2530

2631
ngOnInit() {
2732
// console.log('ol.control.defaults init: ', this);
28-
this.instance = control.defaults(this);
33+
this.instance = defaults(this);
2934
this.instance.forEach(c => this.map.instance.addControl(c));
3035
}
3136

0 commit comments

Comments
 (0)