[Mapbender-commits] r8872 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri May 16 00:42:30 PDT 2014
Author: hwbllmnn
Date: 2014-05-16 00:42:29 -0700 (Fri, 16 May 2014)
New Revision: 8872
Modified:
trunk/mapbender/http/plugins/kmlTree.js
Log:
added preview to kmltree properly
Modified: trunk/mapbender/http/plugins/kmlTree.js
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.js 2014-05-15 15:02:51 UTC (rev 8871)
+++ trunk/mapbender/http/plugins/kmlTree.js 2014-05-16 07:42:29 UTC (rev 8872)
@@ -69,25 +69,11 @@
$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();
- g.importGeoJSON(jsonFeatureCollection,false);
+ $kmlEntry.find("a").bind("click",(function(url){return function(){
+ $('#mapframe1').data('kml').zoomToLayer(url);
+ };
+ })(obj.url));
- var bbox = g.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();
-
- };
- })(obj.data));
-
$featureList = $("<ul />");
$kmlEntry.append($featureList);
for(var i = 0;i < obj.data.features.length;i++){
@@ -99,34 +85,16 @@
title = obj.data.features[i].properties.name;
abbrevTitle = title.length < 20 ? title : title.substr(0,17) + "...";
var displ = obj.data.features[i].display === true || obj.data.features[i].display === undefined;
- $feature = $('<li idx="' + i + '" title="'+ title +'"><button class="digitize-menu-arrow"></button>' + toggle + '<input type="checkbox" ' + (displ ? 'checked="checked"' : '') + '/><a href="#" >'+ abbrevTitle + '</a></li>');
+ $feature = $('<li idx="' + i + '" title="'+ title +'"><button class="digitize-menu-arrow"></button>' + toggle + '<input type="checkbox" ' + (displ ? 'checked="checked"' : '') + '/><div class="style-preview" style="width: 20px; height: 20px; display: inline;"></div><a href="#" >'+ abbrevTitle + '</a></li>');
$featureList.append($feature);
+
+ var preview = $feature.find('.style-preview').get(0);
+ $('#mapframe1').data('kml').renderPreview(obj.data.features[i], preview, 20);
+
title = obj.data.features[i].properties.name;
$feature.bind('click', function() {
$(this).addClass('kmltree-selected').siblings().removeClass('kmltree-selected');
});
- // $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 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();
-
- // };
- // })(obj.data.features[i]));
-
$feature.bind('mouseout',(function(jsonFeature){return function(){
var map = o.$target.mapbender();
var g = new GeometryArray();
More information about the Mapbender_commits
mailing list