@@ -4,7 +4,12 @@ import { Component } from '@angular/core';
44 selector : 'app-root' ,
55 template : `
66 <aol-map [width]="'100%'" [height]="'100%'">
7- <aol-view [zoom]="zoom" (onChangeZoom)="onChangeZoom($event)">
7+ <aol-view
8+ [zoom]="zoom"
9+ (onChangeResolution)="onChangeResolution($event)"
10+ (onChangeZoom)="onChangeZoom($event)"
11+ (onChangeCenter)="onChangeCenter($event)"
12+ >
813 <aol-coordinate [x]="5" [y]="45" [srid]="'EPSG:4326'"></aol-coordinate>
914 </aol-view>
1015 <aol-layer-tile [opacity]="opacity"> <aol-source-osm></aol-source-osm> </aol-layer-tile>
@@ -44,6 +49,8 @@ import { Component } from '@angular/core';
4449 <span>opacity:</span><button (click)="increaseOpacity()">+</button><button (click)="decreaseOpacity()">-</button
4550 ><br />
4651 <span>zoom:</span><button (click)="increaseZoom()">+</button><button (click)="decreaseZoom()">-</button><br />
52+ <span>latitude:</span><button (click)="increaseLat()">+</button><button (click)="decreaseLat()">-</button><br />
53+ <span>longitude:</span><button (click)="increaseLon()">+</button><button (click)="decreaseLon()">-</button><br />
4754 </div>
4855 ` ,
4956 styles : [
@@ -67,6 +74,8 @@ export class BasicComponent {
6774 public zoom = 15 ;
6875 public opacity = 1.0 ;
6976 public width = 5 ;
77+ public lon = 5 ;
78+ public lat = 45 ;
7079
7180 increaseZoom ( ) {
7281 this . zoom = Math . min ( this . zoom + 1 , 18 ) ;
@@ -78,6 +87,26 @@ export class BasicComponent {
7887 console . log ( 'zoom: ' , this . zoom ) ;
7988 }
8089
90+ increaseLat ( ) {
91+ this . lat = Math . max ( - 90 , Math . min ( 90 , this . lat + 1 ) ) ;
92+ console . log ( 'lat: ' , this . lat ) ;
93+ }
94+
95+ decreaseLat ( ) {
96+ this . lat = Math . max ( - 90 , Math . min ( 90 , this . lat - 1 ) ) ;
97+ console . log ( 'lat: ' , this . lat ) ;
98+ }
99+
100+ increaseLon ( ) {
101+ this . lon = Math . max ( - 180 , Math . min ( 180 , this . lat + 1 ) ) ;
102+ console . log ( 'lon: ' , this . lon ) ;
103+ }
104+
105+ decreaseLon ( ) {
106+ this . lon = Math . max ( - 180 , Math . min ( 180 , this . lat - 1 ) ) ;
107+ console . log ( 'lon: ' , this . lon ) ;
108+ }
109+
81110 increaseOpacity ( ) {
82111 this . opacity = Math . min ( this . opacity + 0.1 , 1 ) ;
83112 console . log ( 'opacity: ' , this . opacity ) ;
@@ -88,6 +117,14 @@ export class BasicComponent {
88117 console . log ( 'opacity: ' , this . opacity ) ;
89118 }
90119
120+ onChangeResolution ( evt ) {
121+ console . log ( 'Resolution changed:' , evt ) ;
122+ }
123+
124+ onChangeCenter ( evt ) {
125+ console . log ( 'Center changed:' , evt ) ;
126+ }
127+
91128 onChangeZoom ( evt ) {
92129 console . log ( 'Zoom changed:' , evt ) ;
93130 }
0 commit comments