[fusion-commits] r2040 - in sandbox/jxlib-3.0: lib widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jan 20 14:13:08 EST 2010
Author: madair
Date: 2010-01-20 14:13:08 -0500 (Wed, 20 Jan 2010)
New Revision: 2040
Modified:
sandbox/jxlib-3.0/lib/Map.js
sandbox/jxlib-3.0/widgets/LayerManager.js
Log:
update of LayerManager, add WMS_LAYER_ADDED event to the MapWidget for the GetFeatureInfo widget to listen to
Modified: sandbox/jxlib-3.0/lib/Map.js
===================================================================
--- sandbox/jxlib-3.0/lib/Map.js 2010-01-15 20:41:28 UTC (rev 2039)
+++ sandbox/jxlib-3.0/lib/Map.js 2010-01-20 19:13:08 UTC (rev 2040)
@@ -41,8 +41,8 @@
Fusion.Event.MAP_RELOADED = Fusion.Event.lastEventId++;
Fusion.Event.MAP_SESSION_CREATED = Fusion.Event.lastEventId++;
Fusion.Event.MAP_MAPTIP_REQ_FINISHED = Fusion.Event.lastEventId++;
+Fusion.Event.WMS_LAYER_ADDED = Fusion.Event.lastEventId++;
-
Fusion.Constant.LAYER_POINT_TYPE = 0;
Fusion.Constant.LAYER_LINE_TYPE = 1;
Fusion.Constant.LAYER_POLYGON_TYPE = 2;
@@ -168,6 +168,7 @@
this.registerEventID(Fusion.Event.MAP_SELECTION_ON);
this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);
this.registerEventID(Fusion.Event.MAP_MAPTIP_REQ_FINISHED);
+ this.registerEventID(Fusion.Event.WMS_LAYER_ADDED);
this.registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapLoaded,this));
Modified: sandbox/jxlib-3.0/widgets/LayerManager.js
===================================================================
--- sandbox/jxlib-3.0/widgets/LayerManager.js 2010-01-15 20:41:28 UTC (rev 2039)
+++ sandbox/jxlib-3.0/widgets/LayerManager.js 2010-01-20 19:13:08 UTC (rev 2040)
@@ -54,8 +54,8 @@
currentNode: null,
bIsDrawn: false,
map: null,
- bLayerChanged:false,
initializeWidget: function(widgetTag) {
+ //console.log("initializeWidget");
var json = widgetTag.extension;
this.delIconSrc = json.DeleteIcon ? json.DeleteIcon[0] : 'images/icons/select-delete.png';
@@ -71,22 +71,18 @@
mapLoaded: function() {
this.draw();
- this.bLayerChanged = true;
},
-
layerChanged: function() {
- this.bLayerChanged = true;
- this.draw();
this.updateSessionMapFile();
},
- mapReLoaded: function(){
- this.bLayerChanged = false;
+ mapReLoaded: function(){
this.draw();
},
/**
* remove the dom objects representing the legend layers and groups
*/
clear: function(node) {
+ //console.log("clear");
while (node.childNodes.length > 0) {
this.clear(node.childNodes[0]);
node.destroy(node.childNodes[0]);
@@ -99,6 +95,7 @@
* @param r Object the reponse xhr object
*/
draw: function(r) {
+ //console.log("draw");
if (this.mapList) {
this.clear(this.mapList);
this.mapList.destroy();
@@ -113,7 +110,6 @@
//this processes the OL layers
var map = this.getMap();
-
for (var i=0; i<map.aMaps.length; ++i) {
var mapBlock = document.createElement('li');
mapBlock.className = 'jxLmanMap';
@@ -139,19 +135,15 @@
},
processMapBlock: function(blockDom, map) {
+ //console.log("processMapBlock");
var mapBlockList = document.createElement('ul');
mapBlockList.className = 'jxLmanSet';
mapBlockList.id = 'fusionLayerManager_'+map.getMapName();
blockDom.appendChild(mapBlockList);
map.layerPrefix = 'layer_'; //TODO make this unique for each block
- mapBlockList.bLayerChanged = this.bLayerChanged;
//this process all layers within an OL layer
var processArray = map.aLayers;
-
- if (map.bLayersReversed && this.bLayerChanged === false ) {
- processArray.reverse();
- }
-
+
for (var i=0; i<processArray.length; ++i) {
var blockItem = document.createElement('li');
blockItem.className = 'jxLmanLayer';
@@ -235,6 +227,7 @@
},
updateLayer: function(map, ul) {
+ //console.log("updateLayer");
//reorder the layers in the client as well as the session
var aLayerIndex = [];
var aIds = [];
@@ -242,9 +235,6 @@
for (var i=0; i<nLayers; ++i) {
aIds[i] = this.childNodes[i].id.split('_');
var index = parseInt(aIds[i].pop());
- if (map.bLayersReversed && ul.bLayerChanged === false) {
- index = nLayers - (index+1);
- }
aLayerIndex.push(index);
this.childNodes[i].id = '';
}
@@ -257,9 +247,6 @@
node.childNodes[1].checked = node.layer.isVisible()
}
- if (map.bLayersReversed && ul.bLayerChanged === false) {
- aLayerIndex.reverse();
- }
map.reorderLayers(aLayerIndex);
},
@@ -268,6 +255,7 @@
},
deleteLayer: function(layer, ev) {
+ // console.log("deleteLayer");
var targetLI = (new Event(ev)).target.parentNode;
var ul = targetLI.parentNode;
$(targetLI).dispose();
@@ -284,6 +272,7 @@
}
},
updateSessionMapFile: function(){
+ // console.log("updateSessionMapFile");
// get map
var map = this.getMap();
var aMaps = map.getAllMaps();
More information about the fusion-commits
mailing list