[Commits] r2630 - sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets
commits at geoext.org
commits at geoext.org
Tue Mar 22 16:33:32 CET 2011
Author: adube
Date: 2011-03-22 16:33:32 +0100 (Tue, 22 Mar 2011)
New Revision: 2630
Modified:
sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
Log:
WFSTFeatureEditing - WMS layer sibling detection, select controls (doing nothing for now)...
Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js 2011-03-22 14:35:18 UTC (rev 2629)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js 2011-03-22 15:33:32 UTC (rev 2630)
@@ -54,7 +54,9 @@
actionGroup: null,
+ useFilter: false,
+
/* PRIVATE*/
mainPanel: null,
@@ -136,7 +138,10 @@
var layers = [];
Ext.each(records, function(record, index) {
var layer = record.getLayer().clone();
- layer.wfstFeatureEditing = {"manager": this};
+ layer.wfstFeatureEditing = {
+ "manager": this,
+ "wmsLayerSibling": this.getWMSLayerSibling(layer)
+ };
// todo : create SaveStrategy in WFSCapabilitiesReader
// find the save strategy and keep a reference to it
@@ -298,10 +303,105 @@
layer.wfstFeatureEditing.drawAction = drawAction;
layer.wfstFeatureEditing.drawControl = drawControl;
+
+
+ // =======================
+ // GetFeature (filtering)
+ // =======================
+ if (this.useFilter) {
+ var getFeatureControl;
+ // do stuff...
+ }
+
+ // ================================================
+ // SelectFeature (hovering and main point of entry)
+ // ================================================
+ var selectControl = new OpenLayers.Control.SelectFeature(layer, {
+ clickout: false
+ });
+ layer.wfstFeatureEditing.selectControl = selectControl;
+
+ // =========================
+ // SelectFeature (selecting)
+ // =========================
+ var highlightControl = new OpenLayers.Control.SelectFeature(layer, {
+ hover: true,
+ highlightOnly: true,
+ renderIntent: "temporary"
+ });
+ highlightControl.events.on({
+ "activate": function() {
+ this.setVisibility(true);
+ this.wfstFeatureEditing.selectControl.activate();
+ },
+ "deactivate": function() {
+ this.setVisibility(false);
+ this.wfstFeatureEditing.selectControl.deactivate();
+
+ // todo
+ // if control is deactivated while editing, no choice but to
+ // cancel the current modifications...
+ ///this.cancelEditing();
+ },
+ "beforefeaturehighlighted": function(e) {
+ // if hovered feature is already selected, do nothing
+ return (this.selectedFeatures.indexOf(e.feature) == -1);
+ },
+ "featurehighlighted": function(e) {
+ var feature = e.feature;
+ },
+ "featureunhighlighted": function(e) {
+ var feature = e.feature;
+ },
+ scope: layer
+ });
+ layer.wfstFeatureEditing.highlightControl = highlightControl;
+
+ // =============================
+ // EditAction and control adding
+ // =============================
+
+ this.map.addControl(selectControl);
+ this.useFilter && this.map.addControl(highlightControl);
+
+ var editAction = new GeoExt.Action({
+ text: layer.name,
+ hidden: true,
+ control: (this.useFilter) ? getFeatureControl : highlightControl,
+ map: map,
+ disabled: !layer.inRange,
+ // button options
+ toggleGroup: this.actionGroup || this.DEFAULT_ACTION_GROUP,
+ allowDepress: false,
+ // check item options
+ group: this.actionGroup || this.DEFAULT_ACTION_GROUP
+ });
+ this.toolbar.addItem(editAction);
+ this.editMenuButton.menu.addItem(new Ext.menu.CheckItem(editAction));
+ editMenuItem = this.editMenuButton.menu.items.items[
+ this.editMenuButton.menu.items.getCount() - 1
+ ];
+ editMenuItem.show();
+ editMenuItem.on("click", function() {
+ this.isDrawing = false;
+ }, this);
+
+ layer.wfstFeatureEditing.editAction = editAction;
},
resetAll: function() {
this.layers = [];
this.queries = 0;
+ },
+
+ getWMSLayerSibling: function(layer) {
+ var wmsLayerSibling;
+ Ext.each(this.map.getLayersByName(layer.name), function(layerSibling) {
+ if (layerSibling instanceof OpenLayers.Layer.WMS) {
+ wmsLayerSibling = layerSibling;
+ return false;
+ }
+ }, this);
+ return wmsLayerSibling;
}
});
More information about the Commits
mailing list