UNPKG

ng2-bingmaps

Version:
90 lines (88 loc) 2.45 kB
/** * ng2-bingmaps - Angular 2 components for Bing Maps * @version v0.2.0 * @link https://github.com/youjustgo/ng2-bingmaps * @license MIT */ export class Marker { constructor(map, pushpin) { this.map = map; this.pushpin = pushpin; } setPosition(latLng) { this.pushpin.setLocation(new Microsoft.Maps.Location(latLng.lat, latLng.lng)); } deleteMarker() { this.pushpin.setOptions({ visible: false }); } setTitle(title) { console.log('set title'); this.pushpin.setOptions({ text: title }); } setLabel(label) { // title does not exist on the TSD. this.pushpin.setOptions({ title: label }); } setDraggable(draggable) { this.pushpin.setOptions({ draggable: draggable }); } setIcon(icon) { this.pushpin.setOptions({ icon: icon }); } getLabel() { return null; } addListener(eventType, fn) { Microsoft.Maps.Events.addHandler(this.pushpin, eventType, (e) => { fn(e); }); } } export var MapTypeId; (function (MapTypeId) { MapTypeId[MapTypeId["aerial"] = 0] = "aerial"; MapTypeId[MapTypeId["auto"] = 1] = "auto"; MapTypeId[MapTypeId["birdseye"] = 2] = "birdseye"; MapTypeId[MapTypeId["collinsBart"] = 3] = "collinsBart"; MapTypeId[MapTypeId["mercator"] = 4] = "mercator"; MapTypeId[MapTypeId["ordnanceSurvey"] = 5] = "ordnanceSurvey"; MapTypeId[MapTypeId["road"] = 6] = "road"; })(MapTypeId || (MapTypeId = {})); export class InfoWindow { constructor(map, infoBox) { this.map = map; this.infoBox = infoBox; } close() { this.infoBox.setMap(null); this.infoBox.setOptions({ visible: false }); } ; getPosition() { return { lat: this.infoBox.getLocation().latitude, lng: this.infoBox.getLocation().longitude }; } ; open() { // when using custom HTML, you have to do setMap. this.infoBox.setMap(this.map); this.infoBox.setOptions({ visible: true }); } ; setOptions(options) { this.infoBox.setOptions({ title: options.title, description: options.title }); } ; setPosition(position) { this.infoBox.setLocation(new Microsoft.Maps.Location(position.lat, position.lng)); } ; } //# sourceMappingURL=bing-maps-types.js.map