[Mapbender-commits] r8851 - in trunk/mapbender: http/plugins lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue May 13 02:01:49 PDT 2014
Author: hwbllmnn
Date: 2014-05-13 02:01:49 -0700 (Tue, 13 May 2014)
New Revision: 8851
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
removed info on click for kml objects, added editing of attributes
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 14:31:00 UTC (rev 8850)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-13 09:01:49 UTC (rev 8851)
@@ -82,13 +82,13 @@
var editHtml = '<div title="Edit feature">' +
'<div class="digitize-image digitize-polygon"></div>' +
- '<span>my polygon</span>' +
+ '<span>my polygon</span><br></br>' +
'<div class="digitize-image digitize-style"></div>' +
'<div class="digitize-image digitize-attributes"></div>' +
'<div class="digitize-image digitize-add"></div>' +
'<div class="digitize-image digitize-export"></div><br></br>' +
'<div class="digitize-image digitize-pencil"></div>' +
- '<fieldset class="fieldset-auto-width">' +
+ '<fieldset class="fieldset-auto-width digitize-hidden">' +
'<div class="digitize-image digitize-move"></div>' +
'<div class="digitize-image digitize-add-vertex"></div>' +
'<div class="digitize-image digitize-move-vertex"></div>' +
@@ -220,10 +220,34 @@
});
menu.children('li:has(.digitize-pencil)').bind('click', function() {
$link.addClass('kmltree-selected').siblings().removeClass('kmltree-selected');
+ var idx = $link.attr('idx');
+ var kml = $('#mapframe1').data('kml');
+ var url = $link.parent().parent().attr('title');
+ var feature = kml._kmls[url].data.features[idx];
+ editDialog.find('span').text(feature.properties.title);
editDialog.dialog('open');
editDialog.find('.digitize-attributes').bind('click', function() {
attributesDialog.dialog('open');
+ var rows = '';
+ $.each(feature.properties, function(k, v) {
+ if(k.match(/Mapbender:/)) return;
+ rows += '<tr><td>' + k + '</td><td><input type="text" name="' + k + '" value="' + v + '"></input></td></tr>';
+ });
+ attributesDialog.find('table').html(rows);
+ attributesDialog.find('.digitize-save').bind('click', function() {
+ attributesDialog.find('table input').each(function() {
+ var k = $(this).attr('name');
+ var v = $(this).val();
+ feature.properties[k] = v;
+ });
+ attributesDialog.dialog('close');
+ editDialog.dialog('close');
+ kml.refresh(url);
+ });
});
+ editDialog.find('.digitize-pencil').bind('click', function() {
+ $(this).next().toggleClass('digitize-hidden');
+ });
menu.menu('destroy').remove();
});
menu.children('li:has(.digitize-remove)').bind('click', function() {
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-12 14:31:00 UTC (rev 8850)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-13 09:01:49 UTC (rev 8851)
@@ -39,7 +39,7 @@
_popup : null,
_create: function(){
var self = this, o = this.options;
- this.element.bind('click', function(e){
+/* this.element.bind('click', function(e){
var map = self.element.mapbender();
var pos = map.getMousePosition(e);
var clickPoint = map.convertPixelToReal(new Point(pos.x,pos.y));
@@ -166,7 +166,7 @@
requestGeometries = [];
pointGeometries = {};
}
- });
+ });*/
self.element.bind('kml:loaded',function(event,obj){
if(o.autoOpen){
self._display(obj);
@@ -279,6 +279,14 @@
$map.setMapRequest();
},
+ refresh: function(url) {
+ var $map = $(this.element).mapbender();
+ var itm = this._kmls[url];
+ this._convertFromJson(itm);
+ this.element.trigger('kml:loaded',{type:"geojson",data:itm.data,url:itm.url,display: itm.display, refreshing: true});
+ $map.setMapRequest();
+ },
+
_load : function(url){
var self = this, o = this.options;
var epsg = $(self.element).mapbender().epsg;
@@ -426,12 +434,17 @@
bbox[0] = bbox[0].minus(buffer);
bbox[1] = bbox[1].plus(buffer);
//
- for(var i =0; i < mapitem.geomArray.count(); i++){
- var h = new Highlight([self.element.attr('id')], "mapframe1_" + parseInt(Math.random()*100000,10),{
+ for(i =0; i < mapitem.geomArray.count(); i++){
+ var elemid = "mapframe1_" + parseInt(Math.random()*100000, 10);
+ var h = new Highlight([self.element.attr('id')], elemid,{
"position":"absolute",
"top": "0px",
"left": "0px",
"z-index": "80" },1);
+
+ $('#mapframe1').children('*[id*="' + elemid + '"]').attr('data-idx', i)
+ .attr('data-url', mapitem.url);
+
g = mapitem.geomArray.get(i);
icon = g.e.getElementValueByName("Mapbender:icon");
//title = g.e.getElementValueByName("title");
@@ -462,6 +475,7 @@
mapitem.highlightArray[j].hide();
}
}
+
self.element.mapbender().events.afterMapRequest.register(function () {
if(mapitem.display){
for(var i in mapitem.highlightArray){
More information about the Mapbender_commits
mailing list