[Mapbender-commits] r5613 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Feb 24 03:55:39 EST 2010
Author: astrid_emde
Date: 2010-02-24 03:55:37 -0500 (Wed, 24 Feb 2010)
New Revision: 5613
Added:
trunk/mapbender/http/plugins/mb_resultList_setVendorspecific.js
Log:
new module to configure vendor specifics from result list
http://trac.osgeo.org/mapbender/ticket/611
Added: trunk/mapbender/http/plugins/mb_resultList_setVendorspecific.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_setVendorspecific.js (rev 0)
+++ trunk/mapbender/http/plugins/mb_resultList_setVendorspecific.js 2010-02-24 08:55:37 UTC (rev 5613)
@@ -0,0 +1,76 @@
+//[ { featureTypeId: 24, fields: [ "hausnummer", "schlüssel" ] }, ...]
+
+var API = function(options){
+ var parameters = [];
+ var currentFeatureTypeId = null;
+
+ this.getParamater = function(wms){
+ var layer = null;
+ var resultString = "";
+ var i = 0;
+ for(i in wms.objLayer){
+ layer = wms.objLayer[i];
+ if(currentFeatureTypeId == layer.gui_layer_wfs_featuretype){
+ // currentFeatureType is valid for this WMS
+ var j = 0;
+ for(j in parameters){
+ resultString += encodeURIComponent(parameters[j].key) + "=" +encodeURIComponent(parameters[j].value) + "&";
+ }
+ return resultString;
+ }
+ }
+ return "";
+ };
+
+ Mapbender.modules[options.target[0]].rowclick.register(function(row){
+ var me = Mapbender.modules[options.target[0]];
+ var modelIndex = $(row).data("modelindex");
+
+ // check if the currentFeatureTypeId is configured in the options
+ // and if so, get the values
+ var key ="";
+ var value="";
+ var i = 0;
+ for(i in options.config){
+ parameters = [];
+ if(options.config[i].ftId == currentFeatureTypeId){
+
+ var j = 0;
+ for(j in options.config[i].fields){
+ key = options.config[i].fields[j];
+ value = me.model.getFeatureProperty(modelIndex, key);
+ parameters.push({ key: key, value: value});
+ }
+
+ }
+ }
+
+ var feature = me.model.getFeature(modelIndex);
+ var bbox = feature.getBBox();
+ var bufferFloat = parseFloat(me.WFSConf.g_buffer);
+ var buffer = new Point(bufferFloat,bufferFloat);
+ bbox[0] = bbox[0].minus(buffer);
+ bbox[1] = bbox[1].plus(buffer);
+ var map = Mapbender.modules[me.options.target[0]];
+ map.calculateExtent( new Mapbender.Extent(bbox[0], bbox[1]));
+ map.setMapRequest();
+
+ });
+
+
+ Mapbender.modules[options.target[1]].events.onWfsConfSelect.register(function(data){
+ console.log("NEW FTid");
+ currentFeatureTypeId = data.wfsConfId;
+ });
+
+ Mapbender.modules[options.target[1]].events.onFormReset.register(function(){
+ currentFeatureTypeId = null;
+ });
+
+};
+
+Mapbender.events.afterInit.register(function(){
+ Mapbender.modules[options.id] = $.extend(new API(options), Mapbender.modules[options.id]);
+ mb_registerVendorSpecific("Mapbender.modules." +options.id + ".getParamater(currentWms, functionName)");
+});
+
More information about the Mapbender_commits
mailing list