Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-girard committed Oct 8, 2018
1 parent 6540c92 commit be1b5c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/draw-polygon/draw-polygon.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import Draw from 'ol/interaction/Draw';
import { createBox, Draw } from 'ol/interaction/Draw';
import { Feature } from 'ol';
import Projection from 'ol/proj/Projection';
import { Polygon } from 'ol/geom';
import { fromExtent, Polygon } from 'ol/geom/Polygon';

@Component({
selector: 'app-draw-polygon',
Expand Down Expand Up @@ -67,7 +67,7 @@ export class DrawPolygonComponent implements OnInit {
constructor() {}

isDrawing = false;
drawBoxGeometryFunction = Draw.createBox();
drawBoxGeometryFunction = createBox();
feature;

ngOnInit() {}
Expand All @@ -77,7 +77,7 @@ export class DrawPolygonComponent implements OnInit {
}

endDraw(feature: Feature) {
const olGeomPolygon = Polygon.fromExtent(feature.getGeometry().getExtent());
const olGeomPolygon = fromExtent(feature.getGeometry().getExtent());
olGeomPolygon.transform(new Projection({ code: 'EPSG:3857' }), new Projection({ code: 'EPSG:4326' }));
this.feature = {
type: 'Feature',
Expand Down
4 changes: 2 additions & 2 deletions src/app/overlay/overlay.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { GeoJSON } from 'ol/format';
import { Feature as OlFeature } from 'ol';
import { Polygon } from 'ol/geom';
import { fromExtent, Polygon } from 'ol/geom/Polygon';

@Component({
selector: 'app-display-overlay',
Expand Down Expand Up @@ -93,7 +93,7 @@ export class OverlayComponent implements OnInit {

ngOnInit() {
const olFeature: OlFeature = this.geoJsonFormat.readFeature(this.feature);
const olGeomPolygon = Polygon.fromExtent(olFeature.getGeometry().getExtent());
const olGeomPolygon = fromExtent(olFeature.getGeometry().getExtent());
[, this.tooltip.lat, this.tooltip.lon] = olGeomPolygon.getExtent();
}
}

0 comments on commit be1b5c7

Please sign in to comment.