[Mapbender-commits] r8837 - in trunk/mapbender: http/css http/plugins lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon May 12 01:42:40 PDT 2014
Author: hwbllmnn
Date: 2014-05-12 01:42:40 -0700 (Mon, 12 May 2014)
New Revision: 8837
Modified:
trunk/mapbender/http/css/digitize_new.css
trunk/mapbender/http/plugins/kmlTree.js
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
reworking the kml tree:
* don't zoom to feature on click
* left click on blue arrow also opens context menu
Modified: trunk/mapbender/http/css/digitize_new.css
===================================================================
--- trunk/mapbender/http/css/digitize_new.css 2014-05-12 08:36:17 UTC (rev 8836)
+++ trunk/mapbender/http/css/digitize_new.css 2014-05-12 08:42:40 UTC (rev 8837)
@@ -141,3 +141,9 @@
.digitize-contextmenu {
line-height: 28px;
}
+
+.digitize-menu-arrow {
+ background-image: url('../img/tree_new/menu.png');
+ background-repeat: no-repeat;
+ background-position: center;
+}
Modified: trunk/mapbender/http/plugins/kmlTree.js
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.js 2014-05-12 08:36:17 UTC (rev 8836)
+++ trunk/mapbender/http/plugins/kmlTree.js 2014-05-12 08:42:40 UTC (rev 8837)
@@ -66,8 +66,9 @@
$KMLfolder.find('ul li[title="' + title + '"]').remove();
}
abbrevTitle = title.length < 20 ? title : title.substr(0,17) + "...";
- $kmlEntry = $('<li title="'+ title +'" class="open"><button class="toggle" name="toggle" value="toggle" ></button> <input type="checkbox"'+checked +'/><button class="digitize-layer" name="digitize-layer" value="digitize-layer"></button><button class="remove" name="remove" value="remove" ></button><a href="#">'+abbrevTitle+'</a></li>');
+ $kmlEntry = $('<li title="'+ title +'" class="open"><button class="digitize-menu-arrow"></button><button class="toggle" name="toggle" value="toggle" ></button> <input type="checkbox"'+checked +'/><a href="#">'+abbrevTitle+'</a></li>');
$KMLfolder.children("ul").append($kmlEntry);
+
$kmlEntry.find("a").bind("click",(function(jsonFeatureCollection){return function(){
var map = o.$target.mapbender();
var g = new GeometryArray();
@@ -90,33 +91,32 @@
$featureList = $("<ul />");
$kmlEntry.append($featureList);
for(var i = 0;i < obj.data.features.length;i++){
-
title = obj.data.features[i].properties.name;
abbrevTitle = title.length < 20 ? title : title.substr(0,17) + "...";
- $feature = $('<li idx="' + i + '" title="'+ title +'"><a href="#" >'+ abbrevTitle + '</a></li>');
+ $feature = $('<li idx="' + i + '" title="'+ title +'"><button class="digitize-menu-arrow"></button><a href="#" >'+ abbrevTitle + '</a></li>');
$featureList.append($feature);
title = obj.data.features[i].properties.name;
- $feature.bind('click',(function(jsonFeature){return function(){
+ // $feature.bind('click',(function(jsonFeature){return function(){
- var map = o.$target.mapbender();
- var g = new GeometryArray();
- g.importGeoJSON(jsonFeature,false);
- var feature = g.get(0);
+ // var map = o.$target.mapbender();
+ // var g = new GeometryArray();
+ // g.importGeoJSON(jsonFeature,false);
+ // var feature = g.get(0);
- var bbox = feature.getBBox();
- var bufferFloat = parseFloat(o.buffer);
- var buffer = new Point(bufferFloat,bufferFloat);
- bbox[0] = bbox[0].minus(buffer);
- bbox[1] = bbox[1].plus(buffer);
+ // var bbox = feature.getBBox();
+ // var bufferFloat = parseFloat(o.buffer);
+ // var buffer = new Point(bufferFloat,bufferFloat);
+ // bbox[0] = bbox[0].minus(buffer);
+ // bbox[1] = bbox[1].plus(buffer);
- map.calculateExtent(
- new Mapbender.Extent(bbox[0], bbox[1])
- );
- map.setMapRequest();
+ // map.calculateExtent(
+ // new Mapbender.Extent(bbox[0], bbox[1])
+ // );
+ // map.setMapRequest();
- };
- })(obj.data.features[i]));
+ // };
+ // })(obj.data.features[i]));
$feature.bind('mouseout',(function(jsonFeature){return function(){
var map = o.$target.mapbender();
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 08:36:17 UTC (rev 8836)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 08:42:40 UTC (rev 8837)
@@ -1,3 +1,4 @@
+// -*- mode: js3;-*-
/**
* Package: digitize_widget
*
@@ -188,6 +189,8 @@
var url = item.url;
$('li[title="' + url + '"] > a').live('contextmenu', contextmenuLayer);
$('li[title="' + url + '"] > ul > li').live('contextmenu', contextmenuObject);
+ $('li[title="' + url + '"] > .digitize-menu-arrow').live('click', contextmenuLayer);
+ $('li[title="' + url + '"] > ul > li > .digitize-menu-arrow').live('click', contextmenuObject);
});
};
@@ -201,7 +204,9 @@
.hover(function() {$(this).addClass('ui-state-hover'); },
function() {$(this).removeClass('ui-state-hover'); });
menu.children('li:has(.digitize-zoomto)').bind('click', function() {
- $link.click();
+ var kml = $('#mapframe1').data('kml');
+ var url = $link.parent().parent().parent().attr('title');
+ kml.zoomToFeature(url, $link.parent().attr('idx'));
menu.menu('destroy').remove();
});
menu.children('li:has(.digitize-pencil)').bind('click', function() {
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-12 08:36:17 UTC (rev 8836)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-12 08:42:40 UTC (rev 8837)
@@ -207,6 +207,23 @@
}
},
+ zoomToFeature: function(url, idx) {
+ var map = $('#mapframe1').mapbender();
+ var item = this._kmls[url];
+
+ var bbox = item.geomArray.list[idx].getBBox();
+
+ var bufferFloat = 100;
+ var buffer = new Point(bufferFloat,bufferFloat);
+ bbox[0] = bbox[0].minus(buffer);
+ bbox[1] = bbox[1].plus(buffer);
+
+ map.calculateExtent(
+ new Mapbender.Extent(bbox[0], bbox[1])
+ );
+ map.setMapRequest();
+ },
+
addGeometry: function(pts) {
var $map = $(this.element).mapbender();
var self = this;
More information about the Mapbender_commits
mailing list