import { Directive } from '@angular/core' ; import { BaseMapDirective } from './base-map-directive' ; import { NguiMapComponent } from '../components/ngui-map.component' ; const INPUTS = [ 'controlPosition' , 'controls' , 'drawingMode' , 'featureFactory' , 'style' , 'geoJson' , 'geoJsonUrl' ] ; const OUTPUTS = [ 'addfeature' , 'click' , 'dblclick' , 'mousedown' , 'mouseout' , 'mouseover' , 'mouseup' , 'removefeature' , 'removeproperty' , 'rightclick' , 'setgeometry' , 'setproperty' ] ; @ Directive ( { selector : 'ngui-map > data-layer' , inputs : INPUTS , outputs : OUTPUTS , } ) export class DataLayer extends BaseMapDirective { constructor ( nguiMapComponent ) { super ( nguiMapComponent , 'Data' , INPUTS , OUTPUTS ) ; } initialize ( ) { if ( this [ 'geoJson' ] ) { console . log ( 'this.geoJson' , this [ 'geoJson' ] ) ; this . nguiMapComponent . map . data . addGeoJson ( this [ 'geoJson' ] ) ; } else if ( this [ 'geoJsonUrl' ] ) { console . log ( 'this.geoJsonUrl' , this [ 'geoJsonUrl' ] ) ; this . nguiMapComponent . map . data . loadGeoJson ( this [ 'geoJsonUrl' ] ) ; } else { this . objectOptions = this . optionBuilder . googlizeAllInputs ( this . inputs , this ) ; console . log ( this . mapObjectName , 'initialization objectOptions' , this . objectOptions ) ; this . nguiMapComponent . map . data . add ( this . objectOptions ) ; } this . mapObject = this . nguiMapComponent . map . data ; this . nguiMap . setObjectEvents ( this . outputs , this , 'mapObject' ) ; this . nguiMapComponent . addToMapObjectGroup ( this . mapObjectName , this . mapObject ) ; this . initialized$ . emit ( this . mapObject ) ; } }