Skip to content

Commit fbe3218

Browse files
committed
Added LayersControl, SearchControl, Measuring tool
1 parent 29753ce commit fbe3218

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/lib/add-marker.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import Feature from "ol/Feature";
2-
import { Point } from "ol/geom";
3-
import VectorLayer from "ol/layer/Vector";
4-
import { fromLonLat } from "ol/proj";
5-
import VectorSource from "ol/source/Vector";
6-
import Icon from "ol/style/Icon";
7-
import Style from "ol/style/Style";
8-
import { getMarkerImage } from "./Marker";
1+
import Feature from 'ol/Feature';
2+
import { Point } from 'ol/geom';
3+
import VectorLayer from 'ol/layer/Vector';
4+
import { fromLonLat } from 'ol/proj';
5+
import VectorSource from 'ol/source/Vector';
6+
import Icon from 'ol/style/Icon';
7+
import Style from 'ol/style/Style';
8+
import { getMarkerImage } from './Marker';
99

1010
export function addMarker(map, lonLat, color='red', char='') {
1111
let markerLayer = map.getLayers().getArray()

src/lib/controls/SearchControl.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import './SearchControl.css';
77
import { addMarker } from '../add-marker';
88
import { fromLonLat } from 'ol/proj';
99

10-
declare var google: any;
10+
declare let google: any;
1111

1212
class SearchControl extends Control {
1313

@@ -26,11 +26,11 @@ class SearchControl extends Control {
2626
.addEventListener('click', this.onToggleBtnClick.bind(this));
2727

2828
const inputEl = element.querySelector('input#search');
29-
var autocomplete = new google.maps.places.Autocomplete(inputEl);
30-
autocomplete.addListener("place_changed", () => {
29+
const autocomplete = new google.maps.places.Autocomplete(inputEl);
30+
autocomplete.addListener('place_changed', () => {
3131
const place = autocomplete.getPlace();
32-
var latitude = place.geometry.location.lat();
33-
var longitude = place.geometry.location.lng();
32+
const latitude = place.geometry.location.lat();
33+
const longitude = place.geometry.location.lng();
3434
const map = this.getMap();
3535
addMarker(map, [longitude, latitude], 'blue');
3636
map.getView().setCenter(fromLonLat([longitude, latitude]));

src/lib/interactions/SelectInteraction.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ const defaultStyle = function (feature) {
7474
})
7575
);
7676
}
77-
} catch {} // getArea(geometry) may fail
77+
} catch(e) { // getArea(geometry) may fail
78+
console.error(e);
79+
}
7880
}
7981
return style;
8082
}

0 commit comments

Comments
 (0)