<div id="map"></div>
+
+<div id="divModal" role="dialog">
+ <div class="modal-dialog modal-sm">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" (click)="closeModal()">×</button>
+ <h4 class="modal-title">Add new</h4>
+ </div>
+ <div class="modal-body">
+ <p>Do you want to add new a facility?</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" (click)="addUnit()">Yes</button>
+ </div>
+ </div>
+ </div>
+</div>
+<div id="expandModal" role="dialog">
+ <div class="modal-dialog modal-sm">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type class="close" (click)="closeExpandModal()" )>×</button>
+ </div>
+ <div class="modal-body">
+ <button (click)="seeDetails()">See details</button>
+ <button (click)="drillDown()">Drill down</button>
+ <button (click)="drillUp()">Drill up</button>
+ </div>
+ </div>
+ </div>
+</div>
export class Map {
+ hideModal: any;
+ expandModal:any;
map:Object;
http:Http;
LEVEL:number;
this.currentPos = null;
this.uprunned = false;
// this.COLORS = {'red','brown',',yellow','green',',pink','purple','gray','black'};
+ this.hideModal = document.getElementById("divModal").style.visibility = "hidden";
+ this.expandModal = document.getElementById("expandModal").style.visibility = "hidden";
+
+ }
+
+ showModal(){
+ return this.hideModal = document.getElementById("divModal").style.visibility = "visible";
+ }
+
+ closeModal(){
+ console.log("hei");
+ return this.hideModal = document.getElementById("divModal").style.visibility = "hidden";
+
+ }
+
+ showExpandModal(){
+ return this.hideModal = document.getElementById("expandModal").style.visibility = "visible";
+ }
+
+ closeExpandModal(){
+ return this.hideModal = document.getElementById("expandModal").style.visibility = "hidden";
}
map.setCenter(pos, 0);
map.setZoom(7);
-
-
}
logError(error) {
};
}
- console.log("her er iden: " +unit.properties.id);
+
this.map.data.addGeoJson(unit);
this.map.data.setStyle(function(feature) {
let color = 'gray';
if (instance.runned == false && instance.LEVEL < 4) {
instance.setRunned(true);
- let infowindow = new google.maps.InfoWindow({
- //TODO: Style this
- content: '<div> <button >DrillUP</button>' +
- ' <button ">DrillDOWN</button>' +
- '<button ">SEEINFO</button></div>'
- });
-
- infowindow.setPosition(event.latlng);
- // infowindow.open(instance.map);
+ instance.showExpandModal();
let id = event.feature.O.id;
instance.setParent(id);
-
instance.map.data.forEach(function (feature) {
if (!(feature.O.id == id && instance.LEVEL == 3)) {
instance.map.data.remove(feature);
instance.getData('/' + id + '/children', instance);
} else if (instance.runned == false && instance.LEVEL >= 4) {
instance.setRunned(true);
- let infowindowNew = new google.maps.InfoWindow({
- //TODO: Style this
- content: '<div>Du you want to add a new OrgUnit here ? <button onclick="addUnit()">Yes</button></div>'
- });
+
instance.setcurrentPos(event.latLng);
var marker = new google.maps.Marker({
});
marker.setMap(instance.map);
-
- infowindowNew.open(instance.map, marker);
-
- infowindowNew.addListener('closeclick', function (e) {
- instance.setRunned(false);
- marker.setMap(null);
- });
+ instance.showModal();
instance.addUnit();