[Commits] r1861 - sandbox/redlining/ux/FeatureEditing/ux/widgets
commits at geoext.org
commits at geoext.org
Tue Feb 2 21:05:17 CET 2010
Author: adube
Date: 2010-02-02 21:05:17 +0100 (Tue, 02 Feb 2010)
New Revision: 1861
Modified:
sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
Log:
import and export as options and actions
Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js 2010-02-02 19:25:51 UTC (rev 1860)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js 2010-02-02 20:05:17 UTC (rev 1861)
@@ -154,7 +154,7 @@
*/
layerOptions: {},
- /** private: property[cosmetic]
+ /** api: property[cosmetic]
* ``Boolean``
* If set to true, a blank OpenLayers.Layer.Vector object will be created
* and added to this controler.
@@ -182,6 +182,18 @@
*/
defaultOpacity: 1,
+ /** api: property[import]
+ * ``Boolean``
+ * If set to true, automatically creates and add Import(s) pluggins.
+ */
+ import: true,
+
+ /** api: property[export]
+ * ``Boolean``
+ * If set to true, automatically creates and add Import(s) pluggins.
+ */
+ export: true,
+
/** private: method[constructor]
* Private constructor override.
*/
@@ -278,6 +290,9 @@
this.initFeatureControl(layer);
this.initDeleteAllAction();
+ // 3rd, create import/export pluggins
+ this.initImport();
+ this.initExport();
},
/** private: method[initMap]
@@ -487,6 +502,52 @@
this);
},
+ initImport: function(layer) {
+ if(this.import === true) {
+ var actionOptions = {
+ handler: this.importFeatures,
+ scope: this,
+ tooltip: OpenLayers.i18n('Import KML')
+ };
+
+ if(this.useIcons === true) {
+ actionOptions.iconCls = "gx-featureediting-import";
+ } else {
+ actionOptions.text = OpenLayers.i18n("Import");
+ }
+
+ var action = new Ext.Action(actionOptions);
+ this.actions.push(action);
+ }
+ },
+
+ importFeatures: function() {
+ GeoExt.ux.data.Import.KMLImport(this.map, this.activeLayer);
+ },
+
+ initExport: function() {
+ if(this.export === true) {
+ var actionOptions = {
+ handler: this.exportFeatures,
+ scope: this,
+ tooltip: OpenLayers.i18n('Export KML')
+ };
+
+ if(this.useIcons === true) {
+ actionOptions.iconCls = "gx-featureediting-export";
+ } else {
+ actionOptions.text = OpenLayers.i18n("Export");
+ }
+
+ var action = new Ext.Action(actionOptions);
+ this.actions.push(action);
+ }
+ },
+
+ exportFeatures: function() {
+ GeoExt.ux.data.Export.KMLExport(this.map, this.layers, null, this.downloadService);
+ },
+
/** private: method[getSelectControl]
* :return: ``OpenLayers.Control.Select``
* Convenience method to return the SelectFeature control from
@@ -588,9 +649,12 @@
features: [feature],
controler: this,
useIcons: this.useIcons,
- plugins: [new GeoExt.ux.ExportFeature(), new GeoExt.ux.CloseFeatureDialog()]
+ };
- };
+ if(this.export === true) {
+ options['plugins'] = [new GeoExt.ux.ExportFeature(), new GeoExt.ux.CloseFeatureDialog()];
+ }
+
this.featurePanel = new GeoExt.ux.form.FeaturePanel(options);
// display the popup
More information about the Commits
mailing list