circlemarker/circlemarker.ts
moduleId | module.id.toString() |
selector | circle-marker-element |
styleUrls | circlemarker.css |
templateUrl | circlemarker.html |
lat
|
Type:
Default value: |
Defined in circlemarker/circlemarker.ts:21
|
lon
|
Type: |
Defined in circlemarker/circlemarker.ts:22
|
mouseover
|
Type:
Default value: |
Defined in circlemarker/circlemarker.ts:23
|
onclick
|
Type:
Default value: |
Defined in circlemarker/circlemarker.ts:24
|
Options
|
Type: |
Defined in circlemarker/circlemarker.ts:25
|
constructor(mapService: MapService, groupService: GroupService, popupService: PopupService, elementText: ElementRef, LeafletElement: LeafletElement, LeafletGroup: LeafletGroup)
|
Defined in circlemarker/circlemarker.ts:26
|
ngOnInit |
ngOnInit()
|
Defined in circlemarker/circlemarker.ts:38
|
Returns:
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Defined in circlemarker/circlemarker.ts:59
|
Returns:
void
|
circle |
circle: |
Defined in circlemarker/circlemarker.ts:26
|
import { Component, Input, Injector, Optional, ElementRef } from '@angular/core';
import { LeafletElement } from '../map/map';
import { LeafletGroup } from '../group/group';
import { MapService } from '../services/map.service';
import { GroupService } from '../services/group.service';
import { PopupService } from '../services/popup.service';
import { CoordinateHandler } from '../helpers/coodinateHandler';
import { path } from '../models/path';
import { Ipath } from '../interfaces/path';
import * as L from 'leaflet';
@Component({
moduleId: module.id.toString(),
selector: 'circle-marker-element',
templateUrl: 'circlemarker.html',
styleUrls: ['circlemarker.css']
})
export class CircleMarkerElement extends CoordinateHandler {
@Input() lat: number = 52.6;
@Input() lon: number = -1.1;
@Input() mouseover: string = undefined;
@Input() onclick: string = undefined;
@Input() Options: any = new path(null);
circle: any = null;
constructor(
private mapService: MapService,
private groupService: GroupService,
private popupService: PopupService,
private elementText: ElementRef,
@Optional() private LeafletElement?: LeafletElement,
@Optional() private LeafletGroup?: LeafletGroup) {
super();
}
ngOnInit() {
super.assignCartesianPointToLeafletsLatLngSchema();
//check if any of the two optional injections exist
if (this.LeafletElement || this.LeafletGroup) {
let inheritedOptions: any = new path(this.Options);
let map = this.mapService.getMap();
let elementPosition: any = super.transformPointCoordinates(this.LeafletElement.crs);
this.circle = L.circleMarker([this.lat, this.lon], inheritedOptions);
if (this.LeafletGroup) {
this.groupService.addOLayersToGroup(this.circle, map, this.mapService, this.LeafletGroup);
} else {
this.circle.addTo(map);
}
} else {
console.warn("This circle-element will not be rendered \n the expected parent node of circle-element should be either leaf-element or leaflet-group");
}
}
ngAfterViewInit() {
var textInput = undefined;
if (this.elementText.nativeElement.childNodes.length > 0) {
var textNode = this.elementText.nativeElement.childNodes[0];
textInput = textNode.nodeValue;
}
//add popup methods on element
this.popupService.enablePopup(this.mouseover, this.onclick, this.circle, textInput);
}
}
<ng-content></ng-content>