[Commits] r1896 - in sandbox/styler/ux/Styler: examples ux ux/widgets
commits at geoext.org
commits at geoext.org
Fri Feb 12 22:21:39 CET 2010
Author: juliensam
Date: 2010-02-12 22:21:39 +0100 (Fri, 12 Feb 2010)
New Revision: 1896
Modified:
sandbox/styler/ux/Styler/examples/feature-style-selector.js
sandbox/styler/ux/Styler/ux/LayerStyleManager.js
sandbox/styler/ux/Styler/ux/widgets/StyleSelectorComboBox.js
Log:
Add some comments and originalStyle methods.
Modified: sandbox/styler/ux/Styler/examples/feature-style-selector.js
===================================================================
--- sandbox/styler/ux/Styler/examples/feature-style-selector.js 2010-02-12 20:36:25 UTC (rev 1895)
+++ sandbox/styler/ux/Styler/examples/feature-style-selector.js 2010-02-12 21:21:39 UTC (rev 1896)
@@ -6,7 +6,7 @@
* of the license.
*/
-/** api: example[zoom-chooser]
+/** api: example[feature-style-selector]
* Style Selector
* --------------
* Use a ComboBox to select the style of a feature
@@ -16,9 +16,6 @@
Ext.onReady(function() {
-
- // if true a google layer is used, if false
- // the bluemarble WMS layer is used
var options, layer;
var extent = new OpenLayers.Bounds(-5, 35, 15, 55);
Modified: sandbox/styler/ux/Styler/ux/LayerStyleManager.js
===================================================================
--- sandbox/styler/ux/Styler/ux/LayerStyleManager.js 2010-02-12 20:36:25 UTC (rev 1895)
+++ sandbox/styler/ux/Styler/ux/LayerStyleManager.js 2010-02-12 21:21:39 UTC (rev 1896)
@@ -15,7 +15,11 @@
GeoExt.ux.LayerStyleManager = Ext.extend(Ext.util.Observable, {
currentLayer: null,
+
currentFeature: null,
+
+ originalFeatureStyle: null,
+
styler: null,
constructor: function(styler, config) {
@@ -75,6 +79,11 @@
this.currentLayer.redraw();
this.fireEvent("styleupdated", this.currentFeature);
}
+ else if(!this.currentFeature && this.currentLayer &&
+ this.currentLayer.style != style) {
+ // TODO
+ // Need to support StyleMap as well
+ }
}, this);
}
@@ -101,12 +110,40 @@
if(feature && feature != this.currentFeature)
{
this.currentFeature = feature;
+ this.originalFeatureStyle = feature.style;
this.fireEvent("featurechanged", this.currentFeature);
this.setCurrentLayer(feature.layer);
}
return this.currentFeature;
+ },
+
+ /**
+ * Method: resetStyle
+ */
+ resetStyle: function() {
+ if(this.currentFeature)
+ {
+ this.currentFeature.style = this.originalFeatureStyle;
+ this.currentLayer.redraw();
+ }
+
+ return;
+ },
+
+ /**
+ * Method: setOriginalStyle
+ */
+ setOriginalStyle: function(style, useCurrentStyle = false) {
+ if(useCurrentStyle) {
+ this.originalFeatureStyle = this.currentFeature.style;
+ }
+ else {
+ this.originalFeatureStyle = style;
+ }
+
+ return;
}
Modified: sandbox/styler/ux/Styler/ux/widgets/StyleSelectorComboBox.js
===================================================================
--- sandbox/styler/ux/Styler/ux/widgets/StyleSelectorComboBox.js 2010-02-12 20:36:25 UTC (rev 1895)
+++ sandbox/styler/ux/Styler/ux/widgets/StyleSelectorComboBox.js 2010-02-12 21:21:39 UTC (rev 1896)
@@ -50,12 +50,18 @@
GeoExt.ux.StyleSelectorComboBox.superclass.initComponent.call(this);
},
+
+ /** public: method[createLayout]
+ * This function returns a GeoExt object (Panel, Window, etc)
+ * If a generic Styler class is created, then this class would be an
+ * Observable that create and return a Panel in this function.
+ */
createLayout: function(config) {
return this;
},
- /** private: method[initForm]
- * Create field options and link them to the controler controls and actions
+ /** private: method[initComoboBox]
+ * Create the GeoExt ComboBox from the styleStore.
*/
initComboBox: function() {
var oItems= Array();
More information about the Commits
mailing list