[fusion-commits] r2045 - sandbox/jxlib-3.0/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Jan 28 14:13:22 EST 2010
Author: madair
Date: 2010-01-28 14:13:21 -0500 (Thu, 28 Jan 2010)
New Revision: 2045
Modified:
sandbox/jxlib-3.0/widgets/Select.js
sandbox/jxlib-3.0/widgets/SelectAttribute.js
sandbox/jxlib-3.0/widgets/SelectPolygon.js
sandbox/jxlib-3.0/widgets/SelectRadius.js
Log:
selection widgets look for active layer; adjust drawing of Select by attribute
Modified: sandbox/jxlib-3.0/widgets/Select.js
===================================================================
--- sandbox/jxlib-3.0/widgets/Select.js 2010-01-26 20:35:43 UTC (rev 2044)
+++ sandbox/jxlib-3.0/widgets/Select.js 2010-01-28 19:13:21 UTC (rev 2045)
@@ -35,7 +35,7 @@
isExclusive: true,
uiClass: Jx.Button,
selectionType: 'INTERSECTS',
- nTolerance : 3, //default pixel tolerance for a point click
+ nTolerance: 3, //default pixel tolerance for a point click
bActiveOnly: false, //only select feature(s) on the active layer?
maxFeatures: 0, //default of 0 selects all features (i.e. no maximum)
pointClickSingleSelect: true, //default of true causes a point click always to select only a single feature
Modified: sandbox/jxlib-3.0/widgets/SelectAttribute.js
===================================================================
--- sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-01-26 20:35:43 UTC (rev 2044)
+++ sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-01-28 19:13:21 UTC (rev 2045)
@@ -34,6 +34,7 @@
Fusion.Widget.SelectAttribute = OpenLayers.Class(Fusion.Widget, {
isExclusive: true,
uiClass: Jx.Button,
+ drawn: false,
initializeWidget: function(widgetTag) {
var json = widgetTag.extension;
@@ -42,7 +43,6 @@
this.container = $(json.Container[0]);
}
this.workArea = document.createElement('div');
- this.workArea.style.display = 'none';
this.container.appendChild(this.workArea);
//eventually there will be multiple rows for AND/OR ops on attributes
@@ -51,6 +51,7 @@
this.workArea.appendChild(this.attrRow);
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.listLayers, this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, OpenLayers.Function.bind(this.setActiveLayer, this));
},
/**
@@ -89,6 +90,15 @@
},
+ setActiveLayer: function(event, layer) {
+ for (var i=0; i<this.layerList.options.length; ++i) {
+ if (this.layerList.options[i].value == layer.layerName) {
+ this.layerList.selectedIndex = i;
+ break;
+ }
+ }
+ },
+
setAttributes: function(xhr) {
if (xhr.status < 400) {
eval('this.attrs='+xhr.responseText);
@@ -103,6 +113,13 @@
for (var i=0; i<attrs.length; ++i) {
this.propsList.add(new Option(attrs[i],props[i]),null);
}
+ var map = this.getMap();
+ for (var i=0; i<map.aMaps[0].aLayers.length; ++i) {
+ if (map.aMaps[0].aLayers[i].layerName == layer) {
+ map.setActiveLayer(map.aMaps[0].aLayers[i]);
+ break;
+ }
+ }
},
/**
@@ -111,32 +128,34 @@
* as a widget in the map
*/
activate: function() {
- this.workArea.style.display = 'block';
- this.attrRow.innerHTML = "";
+ this.container.style.display = 'block';
- this.propsList = document.createElement('select');
- this.propsList.className = 'propsSelector';
- this.attrRow.appendChild(this.propsList);
-
- this.operatorList = document.createElement('select');
- this.operatorList.className = 'operatorSelector';
- this.operatorList.add(new Option("=","eq",true),null);
- this.operatorList.add(new Option("like","like"),null);
- this.operatorList.add(new Option(">","gt"),null);
- this.operatorList.add(new Option("<","lt"),null);
- this.operatorList.add(new Option("<=","le"),null);
- this.operatorList.add(new Option(">=","ge"),null);
- this.operatorList.add(new Option("!=","ne"),null);
- this.attrRow.appendChild(this.operatorList);
-
- this.attrValue = document.createElement('input');
- this.attrValue.className = 'propsValue';
- this.attrRow.appendChild(this.attrValue);
-
- new Jx.Button({
- label: 'Query',
- onClick: OpenLayers.Function.bind(this.execute, this)
- }).addTo(this.attrRow);
+ if (!this.drawn) {
+ this.drawn = true;
+ this.propsList = document.createElement('select');
+ this.propsList.className = 'propsSelector';
+ this.attrRow.appendChild(this.propsList);
+
+ this.operatorList = document.createElement('select');
+ this.operatorList.className = 'operatorSelector';
+ this.operatorList.add(new Option("=","eq",true),null);
+ this.operatorList.add(new Option("like","like"),null);
+ this.operatorList.add(new Option(">","gt"),null);
+ this.operatorList.add(new Option("<","lt"),null);
+ this.operatorList.add(new Option("<=","le"),null);
+ this.operatorList.add(new Option(">=","ge"),null);
+ this.operatorList.add(new Option("!=","ne"),null);
+ this.attrRow.appendChild(this.operatorList);
+
+ this.attrValue = document.createElement('input');
+ this.attrValue.className = 'propsValue';
+ this.attrRow.appendChild(this.attrValue);
+
+ new Jx.Button({
+ label: 'Query',
+ onClick: OpenLayers.Function.bind(this.execute, this)
+ }).addTo(this.attrRow);
+ }
},
/**
@@ -145,7 +164,8 @@
* as a widget in the map
**/
deactivate: function() {
- this.workArea.style.display = 'none';
+ this.container.style.display = 'none';
+ //this.workArea.style.display = 'none';
},
/**
Modified: sandbox/jxlib-3.0/widgets/SelectPolygon.js
===================================================================
--- sandbox/jxlib-3.0/widgets/SelectPolygon.js 2010-01-26 20:35:43 UTC (rev 2044)
+++ sandbox/jxlib-3.0/widgets/SelectPolygon.js 2010-01-28 19:13:21 UTC (rev 2045)
@@ -33,6 +33,7 @@
Fusion.Widget.SelectPolygon = OpenLayers.Class(Fusion.Widget, {
isExclusive: true,
uiClass: Jx.Button,
+ bActiveOnly: false, //only select feature(s) on the active layer?
selectionType: 'INTERSECTS',
nTolerance: 3, //default pixel tolernace for a point click
@@ -45,6 +46,11 @@
if (json.Tolerance && (parseInt(json.Tolerance[0]) > 0)) {
nTolerance = parseInt(json.Tolerance[0]);
}
+
+ this.bActiveOnly = (json.QueryActiveLayer &&
+ (json.QueryActiveLayer[0] == 'true' ||
+ json.QueryActiveLayer[0] == '1')) ? true : false;
+
this.bComputeMetadata = (json.ComputeMetadata &&
(json.ComputeMetadata[0] == 'true' ||
json.ComputeMetadata[0] == '1')) ? true : false;
Modified: sandbox/jxlib-3.0/widgets/SelectRadius.js
===================================================================
--- sandbox/jxlib-3.0/widgets/SelectRadius.js 2010-01-26 20:35:43 UTC (rev 2044)
+++ sandbox/jxlib-3.0/widgets/SelectRadius.js 2010-01-28 19:13:21 UTC (rev 2045)
@@ -35,6 +35,7 @@
isExclusive: true,
uiClass: Jx.Button,
selectionType: 'INTERSECTS',
+ bActiveOnly: false, //only select feature(s) on the active layer?
nTolerance: 3, //default pixel tolernace for a point click
defaultRadius: 20, //this is now in pixels
@@ -53,6 +54,9 @@
(json.ComputeMetadata[0] == 'true' ||
json.ComputeMetadata[0] == '1')) ? true : false;
+ this.bActiveOnly = (json.QueryActiveLayer &&
+ (json.QueryActiveLayer[0] == 'true' ||
+ json.QueryActiveLayer[0] == '1')) ? true : false;
var container = json.RadiusTooltipContainer ? json.RadiusTooltipContainer[0] : '';
if (container != '') {
More information about the fusion-commits
mailing list