From 08ebb3e54f0f3c3391e45bbe0c0c8fe4d2dad49a Mon Sep 17 00:00:00 2001 From: geodan Date: Wed, 2 Apr 2014 14:23:22 +0200 Subject: [PATCH 1/5] Preparing for geofort release --- config/geofort.js | 82 ++++++++++++++++++++++++++++++++++------------- index.html | 7 +++- lib/cow | 2 +- src/factories.js | 3 +- 4 files changed, 69 insertions(+), 25 deletions(-) diff --git a/config/geofort.js b/config/geofort.js index 5f538fb..214683b 100644 --- a/config/geofort.js +++ b/config/geofort.js @@ -10,36 +10,74 @@ var icmconfig = { [ {id:'situatie', title: 'Situatie', isedit: false, zeker: true} ]} ,{ beeld: 'populatie', title: 'Populatie', timestamp: 0, beeldonderdeel: - [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true}, - {title:'Gebiedsoverzicht',id:'gebied', isedit: false, zeker: true}, - {title:'Besluitsvorming',id:'besluitsvorming', isedit: false, zeker: true}, - {title:'Knelpunten',id:'knelpunten', isedit: false, zeker: true}, - {title:'Acties/maatregelen',id:'maatregelen', isedit: false, zeker: true}, - {title:'Prognose (verwachting)',id:'prognose', isedit: false, zeker: true} + [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true} ]} ,{ beeld: 'evacuatie', title: 'Evacutatie', timestamp: 0, beeldonderdeel: - [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true}, - {title:'Routeoverzicht',id:'routes', isedit: false, zeker: true}, - {title:'Besluitsvorming',id:'besluitsvorming', isedit: false, zeker: true}, - {title:'Knelpunten',id:'knelpunten', isedit: false, zeker: true}, - {title:'Acties/maatregelen',id:'maatregelen', isedit: false, zeker: true}, - {title:'Prognose (verwachting)',id:'prognose', isedit: false, zeker: true} + [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true} ]} ,{ beeld: 'opvang', title: 'Opvang', timestamp: 0, beeldonderdeel: - [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true}, - {title:'Locatie overzicht',id:'locaties', isedit: false, zeker: true}, - {title:'Besluitsvorming',id:'besluitsvorming', isedit: false, zeker: true}, - {title:'Knelpunten',id:'knelpunten', isedit: false, zeker: true}, - {title:'Acties/maatregelen',id:'maatregelen', isedit: false, zeker: true}, - {title:'Prognose (verwachting)',id:'prognose', isedit: false, zeker: true} + [ {title:'Samenvatting',id:'samenvatting', isedit: false, zeker: true} ]} ,{ beeld: 'comms', title: 'Communicatie', timestamp: 0, beeldonderdeel: - [ {title:'Kernboodschap',id:'kernboodschap', isedit: false, zeker: true}, - {title:'Omgevingsbeeld',id:'omgevingsbeeld', isedit: false, zeker: true}, - {title:'Communicatie extern',id:'extern', isedit: false, zeker: true}, - {title:'Communicatie intern',id:'intern', isedit: false, zeker: true} + [ {title:'Samenvatting',id:'kernboodschap', isedit: false, zeker: true} ]} ], + drawstyles:{ + linestyles: [ + {stroke: '#000'}, + {stroke: '#f57900'}, + {stroke: '#204a87'}, + {stroke: '#cc0000'}, + {stroke: '#5c3566'}, + {stroke: '#4e9a06'}], + polygonstyles: [ + {stroke: '#000' ,fill: '#000' }, + {stroke: '#f57900',fill: '#f57900'}, + {stroke: '#204a87',fill: '#204a87'}, + {stroke: '#cc0000',fill: '#cc0000'}, + {stroke: '#5c3566',fill: '#5c3566'}, + {stroke: '#4e9a06',fill: '#4e9a06'}], + icontypes:[ + {"cat":"none", "text":"ZW", "url":"mapicons/direction_downleft.png"} + ,{"cat":"none", "text":"Z","url":"mapicons/direction_down.png"} + ,{"cat":"none", "text":"ZO","url":"mapicons/direction_downright.png"} + ,{"cat":"none", "text":"O","url":"mapicons/direction_left.png"} + ,{"cat":"none", "text":"W","url":"mapicons/direction_right.png"} + ,{"cat":"none", "text":"NW","url":"mapicons/direction_upleft.png"} + ,{"cat":"none", "text":"N","url":"mapicons/direction_up.png"} + ,{"cat":"none", "text":"NO","url":"mapicons/direction_upright.png"} + ,{"cat":"none", "text":"Afgesloten","url":"mapicons/accesdenied.png"} + ,{"cat":"none", "text":"Let op!","url":"mapicons/caution.png"} + ,{"cat":"none", "text":"Groepsvervoer","url":"mapicons/bus.png"} + ,{"cat":"none", "text":"Parkeerplaats","url":"mapicons/parkinggarage.png"} + ,{"cat":"none", "text":"EHBO","url":"mapicons/firstaid.png"} + ,{"cat":"none", "text":"Noodtelefoon","url":"mapicons/emergencyphone.png"} + ,{"cat":"none", "text":"Ambulancepost","url":"mapicons/ambulance.png"} + ,{"cat":"none", "text":"Ziekenhuis","url":"mapicons/hospital-building.png"} + ,{"cat":"none", "text":"Apotheek","url":"mapicons/medicine.png"} + ,{"cat":"none", "text":"School","url":"mapicons/school.png"} + ,{"cat":"none", "text":"Zaal","url":"mapicons/communitycentre.png"} + ,{"cat":"none", "text":"Verzorgingstehuis","url":"mapicons/seniorsite.png"} + ,{"cat":"none", "text":"none","url":"mapicons/family.png"} + ,{"cat":"none", "text":"Kinderopvang","url":"mapicons/daycare.png"} + ,{"cat":"none", "text":"Calamiteit","url":"mapicons/blast.png"} + ,{"cat":"none", "text":"Dodelijke slachtoffers","url":"mapicons/skull.png"} + ,{"cat":"none", "text":"Schade aan huis","url":"mapicons/earthquake-3.png"} + ,{"cat":"none", "text":"Stroomuitval","url":"mapicons/poweroutage.png"} + ,{"cat":"none", "text":"Brand","url":"mapicons/fire.png"} + ,{"cat":"none", "text":"Overstroming","url":"mapicons/flood.png"} + ,{"cat":"none", "text":"Radio zender","url":"mapicons/radio-station-2.png"} + ,{"cat":"none", "text":"Verzamelpunt","url":"mapicons/regroup.png"} + ,{"cat":"none", "text":"Netwerk","url":"mapicons/wifi.png"} + ,{"cat":"none", "text":"Groep mensen","url":"mapicons/group-2.png"} + ,{"cat":"none", "text":"Brandweer","url":"mapicons/firemen.png"} + ,{"cat":"none", "text":"Politie","url":"mapicons/police.png"} + ,{"cat":"none", "text":"Camera","url":"mapicons/cctv.png"} + ,{"cat":"none", "text":"Gemeentehuis","url":"mapicons/moderntower.png"} + ,{"cat":"none", "text":"Commentaar","url":"mapicons/comment-map-icon.png"} + ,{"cat":"none", "text":"Happy","url":"mapicons/smiley_happy.png"} + ] + }, "definedlayers":{ osm: { name: "Openstreetmap", diff --git a/index.html b/index.html index 18913fc..6a28b7a 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,9 @@ + + @@ -26,7 +28,10 @@ + + @@ -90,7 +95,7 @@ - + diff --git a/lib/cow b/lib/cow index 5e8d33f..15f8bf6 160000 --- a/lib/cow +++ b/lib/cow @@ -1 +1 @@ -Subproject commit 5e8d33ff4ace5c4bccd8ae0dbdfa6f7f95f5d092 +Subproject commit 15f8bf6f425685880a28035d03d833ce18a86db1 diff --git a/src/factories.js b/src/factories.js index ed78249..338fc77 100644 --- a/src/factories.js +++ b/src/factories.js @@ -17,7 +17,8 @@ icm.factory('Beelden', ['$rootScope', function( $rootScope ) { /*TT: Cow temporarily moved to a global because signalR breaks from within a factory */ var cow = new Cow.core({ - wsUrl: '/Cow/signalr' + //wsUrl: '/Cow/signalr' + wsUrl: 'wss://websocket.geodan.nl:443/' }); cow.userStore().loaded.then(function(){ //if (!cow.users('1')){ From 93c9f502d3b80b363df5bd8f4376bd4b14e54343 Mon Sep 17 00:00:00 2001 From: geodan Date: Thu, 3 Apr 2014 12:10:59 +0200 Subject: [PATCH 2/5] Working on geofort version --- config/geofort.js | 108 +++++++++++++++++++++++++++++++++ src/controllers/leafletCtrl.js | 3 + 2 files changed, 111 insertions(+) diff --git a/config/geofort.js b/config/geofort.js index 214683b..55d3893 100644 --- a/config/geofort.js +++ b/config/geofort.js @@ -90,3 +90,111 @@ var icmconfig = { "ahn1": {"type": "overlay", "category": "Terrein", "layer": {"type":"betterwms","visible":true,"name":"Hoogtekaart","url":"http://t3.edugis.nl/tiles/tilecache.py?map=maps/edugis/cache/hoogte.map","layerOptions":{"layers":"hoogtes","format":"image/png","transparent":true,"opacity":0.8}}} } }; + + +var addGeofortLayers = function(LeafletService,map){ + /* Floodlayer */ + var data = []; + var floodlayer = new L.geoJson(data, { + style: function (feature) { + var style = {}; + if (feature.properties.tijdstip == 'na 4 uur'){ + style.opacity = 0.2; + } + else if (feature.properties.tijdstip == 'na 8 uur'){ + style.opacity = 0.4; + } + else if (feature.properties.tijdstip == 'na 12 uur'){ + style.opacity = 0.6; + } + else if (feature.properties.tijdstip == 'na 16 uur'){ + style.opacity = 0.8; + } + //style.fillOpacity = 0; + style.fillColor = "None"; + return style; + }, + onEachFeature: function (feature, layer) { + layer.bindPopup(feature.properties.tijdstip); + } + }).addTo(map); + floodlayer.name = 'Model uitvoer'; + floodlayer.buttonclass = true; + LeafletService.layers.icmlayers.floodlayer = floodlayer; + //self.layercontrol.addOverlay(floodlayer,"Inundatie"); + d3.json('./data/flood_merged.geojson',function(data){ + var collection = {"type":"FeatureCollection","features":[]}; + collection.features = data.features; + floodlayer.addData(collection); + }); + /*Kwetsbare objecten*/ + var geojsonMarkerOptions = { + radius: 8, + fillColor: "#ff7800", + color: "#000", + weight: 1, + opacity: 1, + fillOpacity: 0.8 + }; + + var kwetsbareobjectenlayer = new L.geoJson(data, { + pointToLayer: function(feature, latlng){ + return L.circleMarker(latlng, geojsonMarkerOptions); + }, + style: function (feature) { + if (feature.properties.PRIORITEIT == 1){ + return {fillColor: 'red'}; + } + else if (feature.properties.PRIORITEIT == 2){ + return {fillColor: 'orange'}; + } + else if (feature.properties.PRIORITEIT == 3){ + return {fillColor: 'yellow'}; + } + else if (feature.properties.PRIORITEIT == 4){ + return {fillColor: 'blue'}; + } + else{ + return {fillColor: 'blue'}; + } + }, + onEachFeature: function (feature, layer) { + layer.bindLabel(feature.properties.ROT_NAAM + "
" + (feature.properties.OMSCHRI5 || ''),{ noHide: false }); + layer.bindPopup(feature.properties.ROT_NAAM + "
" + (feature.properties.OMSCHRI5 || '')); + } + }); + kwetsbareobjectenlayer.buttonclass = false; + kwetsbareobjectenlayer.name = 'Kwetsbare objecten'; + LeafletService.layers.icmlayers.kwetsbareobjectenlayer = kwetsbareobjectenlayer; + //self.layercontrol.addOverlay(kwetsbareobjectenlayer,"Kwetsbare objecten"); + d3.json('./data/kwetsbareobjecten.geojson',function(data){ + var collection = {"type":"FeatureCollection","features":[]}; + collection.features = data.features; + kwetsbareobjectenlayer.addData(collection); + }); + + /* Opvanglocaties */ + var opvanglocatieslayer = new L.geoJson(data, { + pointToLayer: function(feature, latlng){ + return L.circleMarker(latlng, geojsonMarkerOptions); + }, + style: function (feature) { + return {color: 'red',weight: 1}; + }, + onEachFeature: function (feature, layer) { + layer.bindLabel(feature.properties.naam,{ noHide: false }); + layer.bindPopup(feature.properties.omschrijvi); + } + }); + opvanglocatieslayer.name = 'Opvanglocaties'; + opvanglocatieslayer.buttonclass = false; + LeafletService.layers.icmlayers.opvanglocatieslayer = opvanglocatieslayer; + //self.layercontrol.addOverlay(opvanglocatieslayer,"Openbare functies"); + //d3.json('./data/publieke_functie.geojson',function(data){ + d3.json('./data/opvanglocaties.geojson',function(data){ + var collection = {"type":"FeatureCollection","features":[]}; + collection.features = data.features; + opvanglocatieslayer.addData(collection); + }); +}; + diff --git a/src/controllers/leafletCtrl.js b/src/controllers/leafletCtrl.js index f20ee56..0cf9caa 100644 --- a/src/controllers/leafletCtrl.js +++ b/src/controllers/leafletCtrl.js @@ -623,6 +623,9 @@ icm.controller('LeafletController', [ '$scope','$http','$timeout','Core', 'Utils map.addLayer(extentLayer); map.addLayer(featureLayer); + /** Add geofort layers **/ + addGeofortLayers(LeafletService,map); + /** SETUP DRAWING FUNCTIONALITY **/ // Use a geoJson object for the drawnItems instead of featureGroup var drawnItems = new L.geoJson(); From 110faf89378d3f83e60f872cde1a282d4ec9014e Mon Sep 17 00:00:00 2001 From: geodan Date: Tue, 8 Apr 2014 09:38:09 +0200 Subject: [PATCH 3/5] Deleted obsolete files --- src/obs.d3layer_utils.js | 454 ------------------------ src/obs.icm.js | 11 - src/obs.ng-leaflet-geojson-directive.js | 95 ----- 3 files changed, 560 deletions(-) delete mode 100644 src/obs.d3layer_utils.js delete mode 100644 src/obs.icm.js delete mode 100644 src/obs.ng-leaflet-geojson-directive.js diff --git a/src/obs.d3layer_utils.js b/src/obs.d3layer_utils.js deleted file mode 100644 index afa9e51..0000000 --- a/src/obs.d3layer_utils.js +++ /dev/null @@ -1,454 +0,0 @@ -//Replacing editpopup: -var cow = {}; -cow.textbox = function(feature,obj){ - var _this = this; - var self = this.map; - //d3.selectAll('.popup').remove(); //Remove any old menu's - d3.select(obj).on('mouseout', function(d){ - d3.selectAll('.textbox').remove(); - }); - var loc = d3.mouse(obj); //Wrong on firefox - var divloc = [d3.event.screenX ,d3.event.screenY ]; - var item = self.core.itemstore().getItemById(feature.properties.key); - var name = feature.properties.name || ""; - var desc = feature.properties.desc || ""; - var ownername = feature.properties.owner || "Anoniem"; - //var mygroups = self.core.project.myGroups(); - var editgroups = item.permissions('edit')[0].groups; - var groupnames = ""; - $.each(editgroups,function(i,d){ - var name = self.core.project.getGroupById(d).name; - if (name != 'public') //Keep public out of here - groupnames = groupnames + name; - }); - - var allgroups = self.core.project.groups(); - var grouparr = []; - $.each(allgroups, function(i,d){ - grouparr.push(d._id); - }); - - var div = d3.select('body').append('div') - .style('left',divloc[0] + 25 + 'px') - .style('top',divloc[1] + -100 + 'px') - .classed("textbox popup share ui-draggable", true); - var sheader = div.append('div') - .classed('sheader', true) - .attr('title','Dit object is gemaakt door'); - sheader.append('span') - .classed('group ' + groupnames,true); //TODO add own groups here - sheader.append('span').html(groupnames + " (" + ownername + ")"); - var scontent = div.append('div') - .classed('scontent', true); - desc = desc.replace(/\r\n?|\n/g, '
'); - scontent.append('div').classed('ssubheader', true).html(desc); - sfooter = div.append('div') - .classed('sfooter',true) - .attr('id','permissionlist') - .html("Gedeeld met:");//TODO dont use ids; - var itemgroups = item.permissions('view')[0].groups; - var blokje = d3.select('#permissionlist').selectAll('.permission').data(itemgroups); - blokje.enter() - .append('span') - .attr('class',function(d){ - var groupname = self.core.project.getGroupById(d).name - return 'group ' + groupname; - }); - -} - -cow.menu = function(feature,obj){ - var _this = this; - var self = this.map; - d3.selectAll('.popup').remove(); //Remove any old menu's - var loc = d3.mouse(obj); //Wrong on firefox - var divloc = [d3.event.screenX ,d3.event.screenY ]; - var item = self.core.itemstore().getItemById(feature.properties.key); - var groups = self.core.project.groups(); - $.each(groups, function(i,d){ - d.children = [{name: 'Vw'},{name: 'Ed'},{name: 'Sh'}] - }); - var data = { - "name": "root", - "children": [ - //{ - // "name": "P", - // value: 5, - // "children": groups - //}, - { - "name": "E", - icon: './css/img/pencil_icon.png', - label: 'Bewerken', - value: 1 - },{ - "name": "D", - icon: './css/img/clipboard_cut_icon.png', - label: 'Verwijderen', - value: 1 - },{ - "name": "T", - icon: './css/img/text_letter_t_icon.png', - label: "Tekst", - size: 1 - },{ - "name": "S", - icon: './css/img/share_2_icon.png', - label: "Delen", - size: 1 - }] - }; - if (feature.geometry.type == 'Polygon' && self.core.project.myGroups().indexOf(2) > -1){ - data.children.push({ - "name": "Pop", - icon: './css/img/users_icon.png', - label: "Populatie", - size: 1 - }) - } - - var width = 150; - var height = 150; - var radius = Math.min(width, height) / 2; - var partition = d3.layout.partition() - .sort(null) - .size([2 * Math.PI, radius * radius]) - .value(function(d) { return d.value || 1; }); - var arc = d3.svg.arc() - .startAngle(function(d) { return d.x; }) - .endAngle(function(d) { return d.x + d.dx; }) - .innerRadius(function(d) { return Math.sqrt(d.y * 0.7); }) - .outerRadius(function(d) { - return Math.sqrt((d.y + d.dy)*1.5); - }); - - var color = d3.scale.category10(); - var entity = _this.g.append('g'); - - if (entity.attr('selected') == 'true'){ - entity.select('.popup').remove(); - entity.attr('selected','false'); - } - else { - entity.attr('selected','true'); - - var chart = entity.append('g') - .classed('pie popup',true) - .attr('width',width) - .attr('height',height) - .append('g') - .attr('class','zoomable') - .attr("transform", function(z){ - var x = loc[0]; - var y = loc[1]; - return "translate(" + x + "," + y + ")" - }); - - //var g = chart.selectAll('.arc1') - var g = chart.datum(data).selectAll("arc1") - .data(partition.nodes) - .enter().append("g") - .attr("class", "arc1") - .on('dblclick',function(d){ - d3.event.stopPropagation();//Prevent the map from firing click event as well - var name = d.name; - if (name == 'D'){//Delete feature without asking - entity.remove(); - self.deletefeature(self,feature); - } - }) - .on('click', function(d){ - d3.event.stopPropagation();//Prevent the map from firing click event as well - var name = d.name; - if (name == 'Pop'){ - window.callback = function(d){ - entity.remove(); - var population = "Populatie: \n" ; - var wonen= werken= onderwijs= zorg = 0; - $.each(d.results,function(i,d){ - if (d.doel == 'onderwijsfunctie'){ - onderwijs = onderwijs + (d.count * 200); - } - else if (d.doel == 'kantoorfunctie' || d.doel == 'industriefunctie' || d.doel == 'winkelfunctie'){ - werken = werken + (d.count * 10); - } - else if (d.doel == 'gezondheidszorgfunctie'){ - zorg = zorg + (d.count * 50); - } - else if (d.doel == 'woonfunctie'){ - wonen = wonen + Math.round(d.count * 2.3); - } - }); - population = 'Populatie: \n WONEN: ' + wonen + ' pers.\n' - + ' WERKEN: ' + werken + ' pers. \n' - + ' ZORG: ' + zorg + ' pers. \n' - + ' ONDERWIJS: ' + onderwijs + ' pers. \n'; - - - //Doing the same as for text edit - var name = feature.properties.name || ""; - //var desc = (feature.properties.desc || "") + population; - var desc = population; //Replace original text - var innerHtml = '' - //+ translator.translate('Label') + ':
' - + 'Description:

' - //+ '' - + ''; - var div = d3.select('body').append('div') - .style('left',divloc[0] + 0 + 'px') - .style('top',divloc[1] + 0 + 'px') - .classed("popup share ui-draggable", true); - var sheader = div.append('div') - .classed('sheader', true) - .attr('title','Dit object is gemaakt door'); - sheader.append('span') - .classed('group populatie',true); //TODO add own groups here - sheader.append('span').html(groupnames); - var scontent = div.append('div') - .classed('scontent', true); - desc = desc.replace(/\r\n?|\n/g, '
'); - scontent.append('div').classed('ssubheader', true).html(innerHtml); - scontent.append('div') - .html('Opslaan') - .classed('popupbutton', true) - .on('click',function(z){ - self.changeFeature(self, feature); - div.remove(); - }); - sfooter = div.append('div') - .classed('sfooter',true) - .attr('id','permissionlist');//TODO dont use ids; - var itemgroups = item.permissions('view')[0].groups; - var blokje = d3.select('#permissionlist').selectAll('.permission').data(itemgroups); - blokje.enter() - .append('span') - .attr('class',function(d){ - var groupname = self.core.project.getGroupById(d).name - return 'group ' + groupname; - }); - } - //Will generate a callback to 'callback' - var geom = JSON.stringify(feature.geometry); - d3.jsonp('http://model.geodan.nl/cgi-bin/populator/populator.py?geom=' + geom,function(){console.log(arguments)}); - } - if (name == 'E'){ //edit geometry - entity.remove(); - self.editLayer.addData(feature); - self.editfeature(self,feature); - - } - else if (name == 'T'){ //edit tekst - entity.remove(); - var name = feature.properties.name || ""; - var desc = feature.properties.desc || ""; - var innerHtml = '' - //+ translator.translate('Label') + ':
' - + 'Description:

' - //+ '' - + ''; - - var div = d3.select('body').append('div') - .style('left',divloc[0] + 0 + 'px') - .style('top',divloc[1] + 0 + 'px') - .classed("popup share ui-draggable", true); - var sheader = div.append('div') - .classed('sheader', true) - .attr('title','Dit object is gemaakt door'); - sheader.append('span') - .classed('group populatie',true); //TODO add own groups here - sheader.append('span').html(groupnames); - var scontent = div.append('div') - .classed('scontent', true); - desc = desc.replace(/\r\n?|\n/g, '
'); - scontent.append('div').classed('ssubheader', true).html(innerHtml); - scontent.append('div') - .html('Opslaan') - .classed('popupbutton', true) - .on('click',function(z){ - self.changeFeature(self, feature); - div.remove(); - }); - sfooter = div.append('div') - .classed('sfooter',true) - .attr('id','permissionlist');//TODO dont use ids; - var itemgroups = item.permissions('view')[0].groups; - var blokje = d3.select('#permissionlist').selectAll('.permission').data(itemgroups); - blokje.enter() - .append('span') - .attr('class',function(d){ - var groupname = self.core.project.getGroupById(d).name - return 'group ' + groupname; - }); - /* - var div = d3.select('body').append('div') - .attr("height", 500) - .style('left',divloc[0] -100 + 'px') - .style('top',divloc[1] + 0 + 'px') - .style('background-color','white') - .style('opacity',0.7) - .style('position','absolute'); - - div.append('div').attr("width", 480) - .html(innerHtml); - - div.append('div') - .html('Opslaan') - .classed('popupbutton', true) - .on('click',function(z){ - self.changeFeature(self, feature); - div.remove(); - }); - */ - } - else if (name == 'S'){//Share permissions - entity.remove(); - - var mygroups = self.core.project.myGroups(); - var groupnames = ""; - $.each(mygroups,function(i,d){ - groupnames = groupnames + self.core.project.getGroupById(d).name; - }); - - var allgroups = self.core.project.groups(); - var grouparr = []; - $.each(allgroups, function(i,d){ - - grouparr.push(d._id); - }); - var div = d3.select('body').append('div') - .style('left',divloc[0] -100 + 'px') - .style('top',divloc[1] + 0 + 'px') - .classed("popup share ui-draggable", true); - var sheader = div.append('div') - .classed('sheader', true) - .attr('title','Dit object is gemaakt door'); - sheader.append('span') - .classed('group populatie',true); //TODO add own groups here - sheader.append('span').html(groupnames); - var scontent = div.append('div') - .classed('scontent', true); - scontent.append('div').classed('ssubheader', true).html('deel dit object met:'); - scontent.append('div').classed('iedereen',true).append('div') - .attr('class','permission share-cop unselected') - .on('click',function(d){ - //Only adding permissions here, removing goes 1 by 1 - item.permissions('view',grouparr); - core.itemstore().items('feature',{data:item.flatten()},'user'); - d3.selectAll('.permission').attr('class','selected'); - console.log('Permissions for all groups added'); - }) - .html('Iedereen'); - - var formbox = scontent.append('div').classed('individueel',true).attr('id','permlist'); - var permissions = d3.select('#permlist').selectAll('.permission').data(allgroups); - //Add on/off button for every group - var pdiv = permissions.enter().append('div') - .attr('class',function(d){ - if (item.permissionHasGroup('view',[d._id])) return 'permission selected'; - else return 'permission unselected'; - }) - .on('click',function(d){ - if (d3.select(this).classed('unselected')){ - d3.select(this).classed('selected',true).classed('unselected',false); - item.permissions('view',d._id); - core.itemstore().items('feature',{data:item.flatten()},'user'); - console.log('Permission added'); - } - else { - d3.select(this).classed('unselected',true).classed('selected',false); - item.removePermission('view',[d._id]); - core.itemstore().items('feature',{data:item.flatten()},'user'); - console.log('Permission removed'); - } - }); - pdiv.append('span').attr('class',function(d){ - return 'group ' + d.name; - }); - pdiv.append('span') - .html(function(d){return d.name}); - scontent.append('div') - .html('Sluiten') - .classed('popupbutton', true) - .on('click',function(z){ - //Close share window, - div.remove(); - }); - //formbox.html(form); - - } - else if (name == 'D'){//Delete feature - if (confirm('Verwijderen?')) { - entity.remove(); - self.deletefeature(self,feature); - } else { - // Do nothing! - } - - - } - }) - .on('mouseover', function(d){ //Mouseover menulabel - d3.select(this) - .append("text") - .classed('menu_shadow',true) - //.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) - .attr("dy", 0) - .attr("dx", 0) - .text(function(d) { - return d.label; - }); - d3.select(this) - .append("text") - .classed('menu',true) - //.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) - .attr("dy", 0) - .attr("dx", 0) - .text(function(d) { - return d.label; - }); - - }) - .on('mouseout', function(d){ - d3.select(this) - .style('opacity',1) - .selectAll('text').remove(); - }); - - g.append("path") - .attr("d", function(d){ - return arc(d); - }) - .style("stroke", "#fff") - .style("fill", function(d) { - if (d.name == 'root') - return 'none'; - else if (d.parent && d.parent.name == 'P') - return 'none'; - else if (d.parent && d.parent.name == 'root') - return color(d.name); - else - return color(d.name); - }) - - - g.append("svg:image") - .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) - .attr('x',-9) - .attr('y',-12) - .attr('width', 20) - .attr('height', 24) - .attr("xlink:href",function(d){ - return d.icon; - }) - //g.append("text") - // .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) - // .attr("dy", ".35em") - // .style("text-anchor", "middle") - // .text(function(d) { - // return d.name; - // }); - } - - - - } diff --git a/src/obs.icm.js b/src/obs.icm.js deleted file mode 100644 index 4776dc2..0000000 --- a/src/obs.icm.js +++ /dev/null @@ -1,11 +0,0 @@ -var core; - -core = new Cow.core({ - wsUrl: 'wss://websocket.geodan.nl:443/new' -}); - - -core.userStore().loaded.then(function(){ - core.users({_id:'1'}).data('name','Anonymous').sync(); - core.user('1'); -}); diff --git a/src/obs.ng-leaflet-geojson-directive.js b/src/obs.ng-leaflet-geojson-directive.js deleted file mode 100644 index 4ba3971..0000000 --- a/src/obs.ng-leaflet-geojson-directive.js +++ /dev/null @@ -1,95 +0,0 @@ -var noopDirective = function() { return function () {}; }; -// Disable ngPaste directive -angular.module('leaflet-directive') - .factory('geojson', noopDirective); - -angular.module("leaflet-directive").directive('geojson', function ($log, $rootScope, leafletData, leafletHelpers) { - return { - restrict: "A", - scope: false, - replace: false, - require: 'leaflet', - - link: function(scope, element, attrs, controller) { - var safeApply = leafletHelpers.safeApply, - isDefined = leafletHelpers.isDefined, - leafletScope = controller.getLeafletScope(), - leafletGeoJSON = {}; - - controller.getMap().then(function(map) { - leafletScope.$watch("geojson", function(geojson) { - if (isDefined(leafletGeoJSON) && map.hasLayer(leafletGeoJSON)) { - map.removeLayer(leafletGeoJSON); - } - - if (!(isDefined(geojson) && isDefined(geojson.data))) { - return; - } - - var resetStyleOnMouseout = geojson.resetStyleOnMouseout, - onEachFeature = geojson.onEachFeature; - - if (!onEachFeature) { - onEachFeature = function(feature, layer) { - - if (leafletHelpers.LabelPlugin.isLoaded() && isDefined(geojson.label)) { - layer.bindLabel(feature.properties.desc); - } - - layer.on({ - mouseover: function(e) { - safeApply(leafletScope, function() { - geojson.selected = feature; - $rootScope.$broadcast('leafletDirectiveMap.geojsonMouseover', e); - }); - }, - mouseout: function(e) { - if (resetStyleOnMouseout) { - leafletGeoJSON.resetStyle(e.target); - } - safeApply(leafletScope, function() { - geojson.selected = undefined; - $rootScope.$broadcast('leafletDirectiveMap.geojsonMouseout', e); - }); - }, - click: function(e) { - console.log('Click!'); - safeApply(leafletScope, function() { - geojson.selected = feature; - $rootScope.$broadcast('leafletDirectiveMap.geojsonClick', geojson.selected, e); - }); - } - }); - }; - } - - geojson.options = { - style: geojson.style, - onEachFeature: onEachFeature - }; - - //leafletGeoJSON = L.geoJson(geojson.data, geojson.options); - leafletGeoJSON = new L.GeoJSON.d3(geojson.data, { - core: core, //TODO - labels: true, - labelconfig: { - field: "name", - style: { - stroke: "#000033" - //stroke: "steelBlue" - } - }, - style: { - fill: "none", - stroke: "steelBlue", - 'stroke-width': 2, - opacity: 0.5 - } - }); - leafletData.setGeoJSON(leafletGeoJSON); - leafletGeoJSON.addTo(map); - }); - }); - } - }; -}); From cbc5fe51589d1785cad4c8adeb4255b416da3a90 Mon Sep 17 00:00:00 2001 From: geodan Date: Tue, 8 Apr 2014 09:49:09 +0200 Subject: [PATCH 4/5] Increased stroke width --- config/geofort.js | 7 ++++++- src/controllers/leafletCtrl.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/geofort.js b/config/geofort.js index 55d3893..a0626a1 100644 --- a/config/geofort.js +++ b/config/geofort.js @@ -83,7 +83,12 @@ var icmconfig = { name: "Openstreetmap", url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', type: 'xyz' - } + }, + osm_grey: { + name: 'OSM grey', + url: 'http://a.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', + type: 'xyz' + } }, "layers": { diff --git a/src/controllers/leafletCtrl.js b/src/controllers/leafletCtrl.js index 0cf9caa..54956c2 100644 --- a/src/controllers/leafletCtrl.js +++ b/src/controllers/leafletCtrl.js @@ -683,7 +683,7 @@ icm.controller('LeafletController', [ '$scope','$http','$timeout','Core', 'Utils feature.properties.stroke = $scope.currentstyle.line.stroke; } feature.properties.fill = $scope.currentstyle.polygon.fill; - feature.properties['stroke-width'] = 3; + feature.properties['stroke-width'] = 6; var id = core.peerid() + "_" + timestamp; var mygroups = core.project().myGroups(); From 050220412f3ce733d8fae2de966bddbacd39f43c Mon Sep 17 00:00:00 2001 From: geodan Date: Tue, 8 Apr 2014 17:10:57 +0200 Subject: [PATCH 5/5] something... --- src/controllers/leafletCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/leafletCtrl.js b/src/controllers/leafletCtrl.js index 54956c2..cfbc0eb 100644 --- a/src/controllers/leafletCtrl.js +++ b/src/controllers/leafletCtrl.js @@ -370,7 +370,7 @@ icm.controller('LeafletController', [ '$scope','$http','$timeout','Core', 'Utils labelconfig: { field: "name", style: { - 'stroke-width': 0.2, + 'stroke-width': 1, stroke: "#000033" } },