[Mapbender-commits] r8815 - in trunk/mapbender: http/classes http/javascripts http/plugins lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 7 01:42:53 PDT 2014
Author: hwbllmnn
Date: 2014-05-07 01:42:53 -0700 (Wed, 07 May 2014)
New Revision: 8815
Modified:
trunk/mapbender/http/classes/class_map.php
trunk/mapbender/http/classes/class_wmcToXml.php
trunk/mapbender/http/javascripts/mod_savewmc.js
trunk/mapbender/http/plugins/kmlTree.js
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
added drag & drop, display order for kml files
Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php 2014-05-07 07:39:59 UTC (rev 8814)
+++ trunk/mapbender/http/classes/class_map.php 2014-05-07 08:42:53 UTC (rev 8815)
@@ -17,6 +17,7 @@
private $wmsArray = array();
private $kmls;
private $originalKmls;
+ private $kmlOrder;
/**
* @destructor
@@ -231,6 +232,14 @@
$this->originalKmls = $originalKmls;
}
+ public function getKmlOrder() {
+ return $this->kmlOrder;
+ }
+
+ public function setKmlOrder($kmlOrder) {
+ $this->kmlOrder = $kmlOrder;
+ }
+
/**
*
* @return
@@ -512,6 +521,9 @@
if(property_exists($jsMapObject, 'originalKmls')) {
$this->originalKmls = $jsMapObject->originalKmls;
}
+ if(property_exists($jsMapObject, 'kmlOrder')) {
+ $this->kmlOrder = $jsMapObject->kmlOrder;
+ }
if (isset($jsMapObject->isOverview) && $jsMapObject->isOverview == "1") {
$this->isOverview = true;
Modified: trunk/mapbender/http/classes/class_wmcToXml.php
===================================================================
--- trunk/mapbender/http/classes/class_wmcToXml.php 2014-05-07 07:39:59 UTC (rev 8814)
+++ trunk/mapbender/http/classes/class_wmcToXml.php 2014-05-07 08:42:53 UTC (rev 8815)
@@ -149,6 +149,9 @@
if($this->wmc->mainMap->getOriginalKmls()) {
$extensionData['originalKmls'] = base64_encode(serialize($this->wmc->mainMap->getOriginalKmls()));
}
+ if($this->wmc->mainMap->getKmlOrder()) {
+ $extensionData['kmlOrder'] = json_encode($this->wmc->mainMap->getKmlOrder());
+ }
// store epsg and bbox of root layer of 0th WMS
$firstWms = $this->wmc->mainMap->getWms(0);
Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js 2014-05-07 07:39:59 UTC (rev 8814)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js 2014-05-07 08:42:53 UTC (rev 8815)
@@ -170,6 +170,7 @@
if(kml) {
mb_mapObj[0].kmls = kml._kmls;
mb_mapObj[0].originalKmls = kml.originalKmls;
+ mb_mapObj[0].kmlOrder = kml.kmlOrder;
}
var mapObjectToSend = $.toJSON(mb_mapObj);
Modified: trunk/mapbender/http/plugins/kmlTree.js
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.js 2014-05-07 07:39:59 UTC (rev 8814)
+++ trunk/mapbender/http/plugins/kmlTree.js 2014-05-07 08:42:53 UTC (rev 8815)
@@ -157,7 +157,18 @@
};
})(obj.data.features[i]));
+ $('#kmlTree > li > ul').sortable({
+ update: function() {
+ var kml = $('#mapframe1').data('kml');
+ var urls = [];
+ $(this).children('li[title]').each(function(k, v) {
+ urls.push($(this).attr('title'));
+ });
+ kml.setOrder(urls);
+ }
+ });
+
}
$("*:checkbox",$kmlEntry).bind('click', function(){
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-07 07:39:59 UTC (rev 8814)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-07 08:42:53 UTC (rev 8815)
@@ -35,6 +35,7 @@
autoDisplay: true
},
_kmls: {},
+ kmlOrder: [],
_popup : null,
_create: function(){
var self = this, o = this.options;
@@ -52,7 +53,7 @@
var g,h,nodes = null;
$("*",self._popup).remove();
var $tabs = $("<ul></ul>");
- for (var i in self._kmls){
+ for (var i in self.kmlOrder){
feed = self._kmls[i] ;
if(!feed.display){ continue; }
requestGeometries = [];
@@ -201,6 +202,7 @@
self.originalKmls = {};
}
self.originalKmls[o.url] = data;
+ self.kmlOrder.push(o.url);
}
});
@@ -236,6 +238,10 @@
if(kmls) {
this.originalKmls = kmls;
}
+ kmls = mb_getWmcExtensionData('KMLORDER');
+ if(kmls) {
+ this.kmlOrder = JSON.parse(kmls);
+ }
},
reload: function() {
@@ -243,7 +249,9 @@
var epsg = $(self.element).mapbender().epsg;
epsg = epsg.split(":")[1];
- $.each(self._kmls, function(url, o) {
+ $.each(self.kmlOrder, function(k, url) {
+ var o = self._kmls[url];
+ if(!o) return;
$('li[title="' + url + '"] > button[name="remove"]').click();
$.ajax({ url: self._endpointURL,
data: {url: o.url, targetEPSG: epsg},
@@ -267,6 +275,11 @@
});
},
+ setOrder: function(order) {
+ this.kmlOrder = order;
+ this.reload();
+ },
+
show : function(url){
this._kmls[url].display = true;
var $map = $(this.element).mapbender();
@@ -299,7 +312,7 @@
_display : function(mapitem){
var self = this, o = this.options;
// getting the mapitem from the events bre
- var mapitem = self._kmls[mapitem.url];
+ mapitem = self._kmls[mapitem.url];
var geojson = mapitem.data;
if(typeof(Mapbender) != "undefined"){
var $map = $(self.element).mapbender();
More information about the Mapbender_commits
mailing list