From 4ef64302e832f187f898888d794668d098595396 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Tue, 19 Dec 2017 12:04:09 +0100 Subject: [PATCH 1/6] Move files --- src/{directives/attributes.js => editing/attributescomponent.js} | 0 .../createfeature.js => editing/createfeaturecomponent.js} | 0 .../createregularpolygonfromclickcomponent.js} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/{directives/attributes.js => editing/attributescomponent.js} (100%) rename src/{directives/createfeature.js => editing/createfeaturecomponent.js} (100%) rename src/{directives/createregularpolygonfromclick.js => editing/createregularpolygonfromclickcomponent.js} (100%) diff --git a/src/directives/attributes.js b/src/editing/attributescomponent.js similarity index 100% rename from src/directives/attributes.js rename to src/editing/attributescomponent.js diff --git a/src/directives/createfeature.js b/src/editing/createfeaturecomponent.js similarity index 100% rename from src/directives/createfeature.js rename to src/editing/createfeaturecomponent.js diff --git a/src/directives/createregularpolygonfromclick.js b/src/editing/createregularpolygonfromclickcomponent.js similarity index 100% rename from src/directives/createregularpolygonfromclick.js rename to src/editing/createregularpolygonfromclickcomponent.js From a21c8ec623e6929414bdd10ce0b4b7dc95cb9d58 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Thu, 21 Dec 2017 10:25:01 +0100 Subject: [PATCH 2/6] Add module and eslintrc.yaml --- src/editing/.eslintrc.yaml | 2 ++ src/editing/module.js | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/editing/.eslintrc.yaml create mode 100644 src/editing/module.js diff --git a/src/editing/.eslintrc.yaml b/src/editing/.eslintrc.yaml new file mode 100644 index 00000000000..718b11a9fd5 --- /dev/null +++ b/src/editing/.eslintrc.yaml @@ -0,0 +1,2 @@ +extends: + - ../.eslintrc-googshift.yaml diff --git a/src/editing/module.js b/src/editing/module.js new file mode 100644 index 00000000000..9f572cb19e1 --- /dev/null +++ b/src/editing/module.js @@ -0,0 +1,8 @@ +goog.provide('ngeo.editing.module'); + + +/** + * @type {!angular.Module} + */ +ngeo.editing.module = angular.module('ngeoEditingModule', [ +]); From fa612c565e9ec7bda31c2f2487a7f684a599f9b6 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Thu, 21 Dec 2017 11:54:53 +0100 Subject: [PATCH 3/6] Refactoring --- contribs/gmf/examples/xsdattributes.js | 3 +- contribs/gmf/src/directives/editfeature.js | 4 +-- .../gmf/src/directives/objecteditingtools.js | 4 +-- examples/attributes.js | 5 +-- examples/createfeature.js | 3 +- .../partials => editing}/attributes.html | 0 src/editing/attributescomponent.js | 26 ++++++++++------ src/editing/createfeaturecomponent.js | 25 ++++++++++----- .../createregularpolygonfromclickcomponent.js | 31 +++++++++++++------ src/editing/module.js | 6 ++++ 10 files changed, 72 insertions(+), 35 deletions(-) rename src/{directives/partials => editing}/attributes.html (100%) diff --git a/contribs/gmf/examples/xsdattributes.js b/contribs/gmf/examples/xsdattributes.js index 757aa300474..3e8888bdfae 100644 --- a/contribs/gmf/examples/xsdattributes.js +++ b/contribs/gmf/examples/xsdattributes.js @@ -3,7 +3,7 @@ goog.provide('gmfapp.xsdattributes'); goog.require('gmf.theme.Themes'); goog.require('gmf.XSDAttributes'); /** @suppress {extraRequire} */ -goog.require('ngeo.attributesComponent'); +goog.require('ngeo.editing.attributesComponent'); goog.require('ol.Feature'); @@ -11,6 +11,7 @@ goog.require('ol.Feature'); gmfapp.module = angular.module('gmfapp', [ gmf.module.name, gmf.theme.Themes.module.name, + ngeo.editing.attributesComponent.name, ]); diff --git a/contribs/gmf/src/directives/editfeature.js b/contribs/gmf/src/directives/editfeature.js index a80ff9e1ac3..c020153d574 100644 --- a/contribs/gmf/src/directives/editfeature.js +++ b/contribs/gmf/src/directives/editfeature.js @@ -8,9 +8,9 @@ goog.require('gmf.Snapping'); goog.require('gmf.SyncLayertreeMap'); goog.require('gmf.XSDAttributes'); /** @suppress {extraRequire} */ -goog.require('ngeo.attributesComponent'); +goog.require('ngeo.editing.attributesComponent'); /** @suppress {extraRequire} */ -goog.require('ngeo.createfeatureDirective'); +goog.require('ngeo.editing.createfeatureComponent'); goog.require('ngeo.interaction.Rotate'); goog.require('ngeo.interaction.Translate'); goog.require('ngeo.map.LayerHelper'); diff --git a/contribs/gmf/src/directives/objecteditingtools.js b/contribs/gmf/src/directives/objecteditingtools.js index c0920d70a7d..fced5a10c34 100644 --- a/contribs/gmf/src/directives/objecteditingtools.js +++ b/contribs/gmf/src/directives/objecteditingtools.js @@ -3,9 +3,9 @@ goog.provide('gmf.objecteditingtoolsDirective'); /** @suppress {extraRequire} */ goog.require('gmf.objecteditinggetwmsfeatureDirective'); /** @suppress {extraRequire} */ -goog.require('ngeo.createfeatureDirective'); +goog.require('ngeo.editing.createfeatureComponent'); /** @suppress {extraRequire} */ -goog.require('ngeo.createregularpolygonfromclickDirective'); +goog.require('ngeo.editing.createregularpolygonfromclickComponent'); /** @suppress {extraRequire} */ goog.require('ngeo.misc.btnComponent'); /** @suppress {extraRequire} */ diff --git a/examples/attributes.js b/examples/attributes.js index 940861cc9e0..3eea5cc5a6f 100644 --- a/examples/attributes.js +++ b/examples/attributes.js @@ -2,7 +2,7 @@ goog.provide('app.attributes'); goog.require('ngeo.format.XSDAttribute'); /** @suppress {extraRequire} */ -goog.require('ngeo.attributesComponent'); +goog.require('ngeo.editing.attributesComponent'); goog.require('ol.Feature'); goog.require('ngeo.map.module'); @@ -11,7 +11,8 @@ goog.require('ngeo.map.module'); /** @type {!angular.Module} */ app.module = angular.module('app', [ ngeo.module.name, - ngeo.map.module.name + ngeo.map.module.name, + ngeo.editing.attributesComponent.name, ]); diff --git a/examples/createfeature.js b/examples/createfeature.js index 90143b54977..960ca77b33e 100644 --- a/examples/createfeature.js +++ b/examples/createfeature.js @@ -1,7 +1,7 @@ goog.provide('app.createfeature'); /** @suppress {extraRequire} */ -goog.require('ngeo.createfeatureDirective'); +goog.require('ngeo.editing.createfeatureComponent'); /** @suppress {extraRequire} */ goog.require('ngeo.misc.btnComponent'); goog.require('ngeo.misc.ToolActivate'); @@ -23,6 +23,7 @@ app.module = angular.module('app', [ ngeo.map.module.name, ngeo.misc.btnComponent.name, ngeo.misc.ToolActivateMgr.module.name, + ngeo.editing.createfeatureComponent.name, ]); diff --git a/src/directives/partials/attributes.html b/src/editing/attributes.html similarity index 100% rename from src/directives/partials/attributes.html rename to src/editing/attributes.html diff --git a/src/editing/attributescomponent.js b/src/editing/attributescomponent.js index b961f70820d..5ee3523c242 100644 --- a/src/editing/attributescomponent.js +++ b/src/editing/attributescomponent.js @@ -1,5 +1,6 @@ -goog.provide('ngeo.attributesComponent'); +goog.provide('ngeo.editing.attributesComponent'); +goog.require('ol'); goog.require('ol.events'); goog.require('ngeo'); goog.require('ngeo.misc.EventHelper'); @@ -7,6 +8,11 @@ goog.require('ngeo.misc.EventHelper'); // FIXME Dont' forget to add ngeo.misc.EventHelper to the module +ngeo.editing.attributesComponent = angular.module('ngeoAttributes', [ +]); + +ngeo.module.requires.push(ngeo.editing.attributesComponent.name); + /** * Component used to render the attributes of a feature into a form. * Example: @@ -26,7 +32,7 @@ goog.require('ngeo.misc.EventHelper'); * @ngdoc component * @ngname ngeoAttributes */ -ngeo.attributesComponent = { +ngeo.editing.attributesComponent.component_ = { controller: 'ngeoAttributesController as attrCtrl', bindings: { 'attributes': '=ngeoAttributesAttributes', @@ -36,10 +42,10 @@ ngeo.attributesComponent = { require: { 'form': '^' }, - templateUrl: () => `${ngeo.baseTemplateUrl}/attributes.html` + templateUrl: () => `${ngeo.baseModuleTemplateUrl}/editing/attributes.html` }; -ngeo.module.component('ngeoAttributes', ngeo.attributesComponent); +ngeo.editing.attributesComponent.component('ngeoAttributes', ngeo.editing.attributesComponent.component_); /** @@ -53,7 +59,7 @@ ngeo.module.component('ngeoAttributes', ngeo.attributesComponent); * @ngdoc controller * @ngname ngeoAttributesController */ -ngeo.AttributesController = function($scope, ngeoEventHelper, gettextCatalog) { +ngeo.editing.attributesComponent.Controller_ = function($scope, ngeoEventHelper, gettextCatalog) { /** * The list of attributes to create the form with. @@ -130,7 +136,7 @@ ngeo.AttributesController = function($scope, ngeoEventHelper, gettextCatalog) { /** * Initialise the component. */ -ngeo.AttributesController.prototype.$onInit = function() { +ngeo.editing.attributesComponent.Controller_.prototype.$onInit = function() { this.properties = this.feature.getProperties(); // Listen to the feature inner properties change and apply them to the form @@ -150,7 +156,7 @@ ngeo.AttributesController.prototype.$onInit = function() { * @param {string} name Attribute name * @export */ -ngeo.AttributesController.prototype.handleInputChange = function(name) { +ngeo.editing.attributesComponent.Controller_.prototype.handleInputChange = function(name) { this.updating_ = true; const value = this.properties[name]; this.feature.set(name, value); @@ -161,7 +167,7 @@ ngeo.AttributesController.prototype.handleInputChange = function(name) { /** * Cleanup event listeners. */ -ngeo.AttributesController.prototype.$onDestroy = function() { +ngeo.editing.attributesComponent.Controller_.prototype.$onDestroy = function() { const uid = ol.getUid(this); this.ngeoEventHelper_.clearListenerKey(uid); }; @@ -171,7 +177,7 @@ ngeo.AttributesController.prototype.$onDestroy = function() { * @param {ol.Object.Event} evt Event. * @private */ -ngeo.AttributesController.prototype.handleFeaturePropertyChange_ = function(evt) { +ngeo.editing.attributesComponent.Controller_.prototype.handleFeaturePropertyChange_ = function(evt) { if (this.updating_) { return; } @@ -180,4 +186,4 @@ ngeo.AttributesController.prototype.handleFeaturePropertyChange_ = function(evt) }; -ngeo.module.controller('ngeoAttributesController', ngeo.AttributesController); +ngeo.editing.attributesComponent.controller('ngeoAttributesController', ngeo.editing.attributesComponent.Controller_); diff --git a/src/editing/createfeaturecomponent.js b/src/editing/createfeaturecomponent.js index 02913db470d..2df14bcecdf 100644 --- a/src/editing/createfeaturecomponent.js +++ b/src/editing/createfeaturecomponent.js @@ -1,4 +1,4 @@ -goog.provide('ngeo.createfeatureDirective'); +goog.provide('ngeo.editing.createfeatureComponent'); goog.require('ngeo'); /** @suppress {extraRequire} */ @@ -7,6 +7,7 @@ goog.require('ngeo.interaction.MeasureArea'); goog.require('ngeo.interaction.MeasureLength'); goog.require('ngeo.misc.EventHelper'); goog.require('ngeo.utils'); +goog.require('ol'); goog.require('ol.events'); goog.require('ol.Feature'); goog.require('ol.interaction.Draw'); @@ -15,6 +16,12 @@ goog.require('ol.style.Style'); // Don't forget to add module dependencies +ngeo.editing.createfeatureComponent = angular.module('ngeoCreatefeature', [ +]); + +ngeo.module.requires.push(ngeo.editing.createfeatureComponent.name); + + /** * A directive used to draw vector features of a single geometry type using * either a 'draw' or 'measure' interaction. Once a feature is finished being @@ -53,9 +60,9 @@ goog.require('ol.style.Style'); * @ngdoc directive * @ngname ngeoCreatefeature */ -ngeo.createfeatureDirective = function() { +ngeo.editing.createfeatureComponent.directive_ = function() { return { - controller: ngeo.CreatefeatureController, + controller: 'ngeoCreatefeatureController', bindToController: true, scope: { 'active': '=ngeoCreatefeatureActive', @@ -66,7 +73,7 @@ ngeo.createfeatureDirective = function() { }; }; -ngeo.module.directive('ngeoCreatefeature', ngeo.createfeatureDirective); +ngeo.editing.createfeatureComponent.directive('ngeoCreatefeature', ngeo.editing.createfeatureComponent.directive_); /** @@ -83,7 +90,7 @@ ngeo.module.directive('ngeoCreatefeature', ngeo.createfeatureDirective); * @ngdoc controller * @ngname ngeoCreatefeatureController */ -ngeo.CreatefeatureController = function(gettextCatalog, $compile, $filter, $scope, +ngeo.editing.createfeatureComponent.Controller_ = function(gettextCatalog, $compile, $filter, $scope, $timeout, ngeoEventHelper) { /** @@ -168,7 +175,7 @@ ngeo.CreatefeatureController = function(gettextCatalog, $compile, $filter, $scop /** * Initialize the directive. */ -ngeo.CreatefeatureController.prototype.$onInit = function() { +ngeo.editing.createfeatureComponent.Controller_.prototype.$onInit = function() { this.active = this.active === true; const gettextCatalog = this.gettextCatalog_; @@ -254,7 +261,7 @@ ngeo.CreatefeatureController.prototype.$onInit = function() { * @param {ol.interaction.Draw.Event|ngeox.MeasureEvent} event Event. * @export */ -ngeo.CreatefeatureController.prototype.handleDrawEnd_ = function(event) { +ngeo.editing.createfeatureComponent.Controller_.prototype.handleDrawEnd_ = function(event) { let sketch; if (event.feature) { // ol.interaction.Draw.Event @@ -283,7 +290,7 @@ ngeo.CreatefeatureController.prototype.handleDrawEnd_ = function(event) { /** * Cleanup event listeners and remove the interaction from the map. */ -ngeo.CreatefeatureController.prototype.$onDestroy = function() { +ngeo.editing.createfeatureComponent.Controller_.prototype.$onDestroy = function() { this.timeout_(() => { const uid = ol.getUid(this); this.ngeoEventHelper_.clearListenerKey(uid); @@ -291,3 +298,5 @@ ngeo.CreatefeatureController.prototype.$onDestroy = function() { this.map.removeInteraction(this.interaction_); }, 0); }; + +ngeo.editing.createfeatureComponent.controller('ngeoCreatefeatureController', ngeo.editing.createfeatureComponent.Controller_); diff --git a/src/editing/createregularpolygonfromclickcomponent.js b/src/editing/createregularpolygonfromclickcomponent.js index 11fcd351ce9..e8afeb5b6c8 100644 --- a/src/editing/createregularpolygonfromclickcomponent.js +++ b/src/editing/createregularpolygonfromclickcomponent.js @@ -1,4 +1,4 @@ -goog.provide('ngeo.createregularpolygonfromclickDirective'); +goog.provide('ngeo.editing.createregularpolygonfromclickComponent'); goog.require('ngeo'); goog.require('ngeo.interaction.DrawRegularPolygonFromClick'); @@ -6,6 +6,12 @@ goog.require('ol.events'); goog.require('ol.Feature'); +ngeo.editing.createregularpolygonfromclickComponent = angular.module('ngeoCreateregularpolygonfromclick', [ +]); + +ngeo.module.requires.push(ngeo.editing.createregularpolygonfromclickComponent.name); + + /** * A directive used to draw vector features of a single geometry type using * either a 'draw' or 'measure' interaction. Once a feature is finished being @@ -51,9 +57,9 @@ goog.require('ol.Feature'); * @ngdoc directive * @ngname ngeoCreateregularpolygonfromclick */ -ngeo.createregularpolygonfromclickDirective = function() { +ngeo.editing.createregularpolygonfromclickComponent.directive_ = function() { return { - controller: ngeo.CreateregularpolygonfromclickController, + controller: 'ngeoCreateregularpolygonfromclickController', bindToController: true, scope: { 'active': '=ngeoCreateregularpolygonfromclickActive', @@ -66,9 +72,10 @@ ngeo.createregularpolygonfromclickDirective = function() { }; }; -ngeo.module.directive( +ngeo.editing.createregularpolygonfromclickComponent.directive( 'ngeoCreateregularpolygonfromclick', - ngeo.createregularpolygonfromclickDirective); + ngeo.editing.createregularpolygonfromclickComponent.directive_ +); /** @@ -80,7 +87,7 @@ ngeo.module.directive( * @ngdoc controller * @ngname ngeoCreateregularpolygonfromclickController */ -ngeo.CreateregularpolygonfromclickController = function($scope) { +ngeo.editing.createregularpolygonfromclickComponent.Controller_ = function($scope) { // == Scope properties == @@ -149,7 +156,7 @@ ngeo.CreateregularpolygonfromclickController = function($scope) { /** * Initialize the directive. */ -ngeo.CreateregularpolygonfromclickController.prototype.$onInit = function() { +ngeo.editing.createregularpolygonfromclickComponent.Controller_.prototype.$onInit = function() { this.interaction_ = new ngeo.interaction.DrawRegularPolygonFromClick({ angle: this.angle, @@ -175,7 +182,7 @@ ngeo.CreateregularpolygonfromclickController.prototype.$onInit = function() { * @param {ol.interaction.Draw.Event} evt Event. * @private */ -ngeo.CreateregularpolygonfromclickController.prototype.handleDrawEnd_ = function(evt) { +ngeo.editing.createregularpolygonfromclickComponent.Controller_.prototype.handleDrawEnd_ = function(evt) { const feature = new ol.Feature(evt.feature.getGeometry()); this.features.push(feature); }; @@ -185,8 +192,14 @@ ngeo.CreateregularpolygonfromclickController.prototype.handleDrawEnd_ = function * Cleanup event listeners and remove the interaction from the map. * @private */ -ngeo.CreateregularpolygonfromclickController.prototype.handleDestroy_ = function() { +ngeo.editing.createregularpolygonfromclickComponent.Controller_.prototype.handleDestroy_ = function() { ol.events.unlistenByKey(this.interactionListenerKey_); this.interaction_.setActive(false); this.map.removeInteraction(this.interaction_); }; + + +ngeo.editing.createregularpolygonfromclickComponent.controller( + 'ngeoCreateregularpolygonfromclickController', + ngeo.editing.createregularpolygonfromclickComponent.Controller_ +); diff --git a/src/editing/module.js b/src/editing/module.js index 9f572cb19e1..32ba06fc03f 100644 --- a/src/editing/module.js +++ b/src/editing/module.js @@ -1,8 +1,14 @@ goog.provide('ngeo.editing.module'); +goog.require('ngeo.editing.attributesComponent'); +goog.require('ngeo.editing.createfeatureComponent'); +goog.require('ngeo.editing.createregularpolygonfromclickComponent'); /** * @type {!angular.Module} */ ngeo.editing.module = angular.module('ngeoEditingModule', [ + ngeo.editing.attributesComponent.name, + ngeo.editing.createfeatureComponent.name, + ngeo.editing.createregularpolygonfromclickComponent.name, ]); From a2eab3763c795f0237496fd5ee3a08354ff72346 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Wed, 3 Jan 2018 12:22:23 +0100 Subject: [PATCH 4/6] Move exportfeatures component --- .../exportfeatures.js => editing/exportfeaturescomponent.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{directives/exportfeatures.js => editing/exportfeaturescomponent.js} (100%) diff --git a/src/directives/exportfeatures.js b/src/editing/exportfeaturescomponent.js similarity index 100% rename from src/directives/exportfeatures.js rename to src/editing/exportfeaturescomponent.js From 78d0ab463b94569495e274182a5d625d8dc10fcb Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Wed, 3 Jan 2018 13:44:32 +0100 Subject: [PATCH 5/6] Refactor exportfeaturescomponent, apply changes from PR feedback --- ...tributes.html => attributescomponent.html} | 0 src/editing/attributescomponent.js | 2 +- src/editing/createfeaturecomponent.js | 3 +-- src/editing/exportfeaturescomponent.js | 27 ++++++++++++------- 4 files changed, 19 insertions(+), 13 deletions(-) rename src/editing/{attributes.html => attributescomponent.html} (100%) diff --git a/src/editing/attributes.html b/src/editing/attributescomponent.html similarity index 100% rename from src/editing/attributes.html rename to src/editing/attributescomponent.html diff --git a/src/editing/attributescomponent.js b/src/editing/attributescomponent.js index 5ee3523c242..550749f6698 100644 --- a/src/editing/attributescomponent.js +++ b/src/editing/attributescomponent.js @@ -42,7 +42,7 @@ ngeo.editing.attributesComponent.component_ = { require: { 'form': '^' }, - templateUrl: () => `${ngeo.baseModuleTemplateUrl}/editing/attributes.html` + templateUrl: () => `${ngeo.baseModuleTemplateUrl}/editing/attributescomponent.html` }; ngeo.editing.attributesComponent.component('ngeoAttributes', ngeo.editing.attributesComponent.component_); diff --git a/src/editing/createfeaturecomponent.js b/src/editing/createfeaturecomponent.js index 2df14bcecdf..4099ab04a02 100644 --- a/src/editing/createfeaturecomponent.js +++ b/src/editing/createfeaturecomponent.js @@ -13,10 +13,9 @@ goog.require('ol.Feature'); goog.require('ol.interaction.Draw'); goog.require('ol.style.Style'); -// Don't forget to add module dependencies - ngeo.editing.createfeatureComponent = angular.module('ngeoCreatefeature', [ + ngeo.misc.EventHelper.module.name ]); ngeo.module.requires.push(ngeo.editing.createfeatureComponent.name); diff --git a/src/editing/exportfeaturescomponent.js b/src/editing/exportfeaturescomponent.js index 33e9569e3ac..2c62ca094f8 100644 --- a/src/editing/exportfeaturescomponent.js +++ b/src/editing/exportfeaturescomponent.js @@ -1,9 +1,16 @@ -goog.provide('ngeo.exportfeaturesDirective'); +goog.provide('ngeo.editing.exportfeaturesComponent'); goog.require('ngeo'); goog.require('ngeo.misc.FeatureHelper'); +goog.require('ol'); +goog.require('ol.geom.Point'); +goog.require('ol.geom.LineString'); -// FIXME add ngeo.misc.FeatureHelper as module dependency +ngeo.editing.exportfeaturesComponent = angular.module('ngeoExportfeatures', [ + ngeo.misc.FeatureHelper.module.name +]); + +ngeo.module.requires.push(ngeo.editing.exportfeaturesComponent.name); /** * Directive used to export vector features in different types of format. @@ -29,7 +36,7 @@ goog.require('ngeo.misc.FeatureHelper'); * @ngdoc directive * @ngname ngeoExportfeatures */ -ngeo.exportfeaturesDirective = function() { +ngeo.editing.exportfeaturesComponent.directive_ = function() { return { controller: 'ngeoExportfeaturesController as efCtrl', scope: true, @@ -40,7 +47,7 @@ ngeo.exportfeaturesDirective = function() { }; -ngeo.module.directive('ngeoExportfeatures', ngeo.exportfeaturesDirective); +ngeo.module.directive('ngeoExportfeatures', ngeo.editing.exportfeaturesComponent.directive_); /** @@ -55,7 +62,7 @@ ngeo.module.directive('ngeoExportfeatures', ngeo.exportfeaturesDirective); * @ngdoc controller * @ngname ngeoExportfeaturesController */ -ngeo.ExportfeaturesController = function($element, $injector, $scope, +ngeo.editing.exportfeaturesComponent.Controller_ = function($element, $injector, $scope, ngeoFeatureHelper) { /** @@ -154,7 +161,7 @@ ngeo.ExportfeaturesController = function($element, $injector, $scope, * that doesn't support the type of geometry. * @private */ -ngeo.ExportfeaturesController.prototype.handleElementClick_ = function() { +ngeo.editing.exportfeaturesComponent.Controller_.prototype.handleElementClick_ = function() { const features = this.features.getArray(); @@ -186,7 +193,7 @@ ngeo.ExportfeaturesController.prototype.handleElementClick_ = function() { * @param {jQuery.Event} event Event. * @private */ -ngeo.ExportfeaturesController.prototype.handleMenuItemClick_ = function(format, event) { +ngeo.editing.exportfeaturesComponent.Controller_.prototype.handleMenuItemClick_ = function(format, event) { if (!$(event.target.parentElement).hasClass('disabled')) { const features = this.features.getArray(); this.featureHelper_.export(features, format); @@ -198,7 +205,7 @@ ngeo.ExportfeaturesController.prototype.handleMenuItemClick_ = function(format, * Cleanup event listeners and remove the menu from DOM, if any. * @private */ -ngeo.ExportfeaturesController.prototype.handleDestroy_ = function() { +ngeo.editing.exportfeaturesComponent.Controller_.prototype.handleDestroy_ = function() { const id = this.id_; this.element_.off(['click', id].join('.')); @@ -214,5 +221,5 @@ ngeo.ExportfeaturesController.prototype.handleDestroy_ = function() { }; -ngeo.module.controller( - 'ngeoExportfeaturesController', ngeo.ExportfeaturesController); +ngeo.editing.exportfeaturesComponent.controller( + 'ngeoExportfeaturesController', ngeo.editing.exportfeaturesComponent.Controller_); From b14597b8cba4b40b71bc3ccb8ee64756704babad Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Thu, 4 Jan 2018 16:17:25 +0100 Subject: [PATCH 6/6] Adding extraModule + small fixes to make it compile --- contribs/gmf/src/directives/drawfeature.js | 3 ++- src/editing/attributescomponent.js | 3 +-- src/editing/extraModule.js | 12 ++++++++++++ src/editing/module.js | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/editing/extraModule.js diff --git a/contribs/gmf/src/directives/drawfeature.js b/contribs/gmf/src/directives/drawfeature.js index 08a4ab6c670..a15aa42beb0 100644 --- a/contribs/gmf/src/directives/drawfeature.js +++ b/contribs/gmf/src/directives/drawfeature.js @@ -7,7 +7,7 @@ goog.require('ngeo.Menu'); /** @suppress {extraRequire} */ goog.require('ngeo.misc.btnComponent'); /** @suppress {extraRequire} */ -goog.require('ngeo.exportfeaturesDirective'); +goog.require('ngeo.editing.exportfeaturesComponent'); /** @suppress {extraRequire} */ goog.require('ngeo.draw.component'); goog.require('ngeo.interaction.Modify'); @@ -30,6 +30,7 @@ goog.require('ol.style.Text'); // - ngeo.interaction.Rotate.module.name // - ngeo.interaction.Translate.module.name // - ngeo.misc.FeatureHelper.module.name +// - ngeo.editing.exportfeaturesComponent.name /** diff --git a/src/editing/attributescomponent.js b/src/editing/attributescomponent.js index 550749f6698..3bed486cff8 100644 --- a/src/editing/attributescomponent.js +++ b/src/editing/attributescomponent.js @@ -5,10 +5,9 @@ goog.require('ol.events'); goog.require('ngeo'); goog.require('ngeo.misc.EventHelper'); -// FIXME Dont' forget to add ngeo.misc.EventHelper to the module - ngeo.editing.attributesComponent = angular.module('ngeoAttributes', [ + ngeo.misc.EventHelper.module.name, ]); ngeo.module.requires.push(ngeo.editing.attributesComponent.name); diff --git a/src/editing/extraModule.js b/src/editing/extraModule.js new file mode 100644 index 00000000000..9884d1be81c --- /dev/null +++ b/src/editing/extraModule.js @@ -0,0 +1,12 @@ +goog.provide('ngeo.editing.extraModule'); + +goog.require('ngeo'); +goog.require('ngeo.editing.exportfeaturesComponent'); + +/** + * @type {angular.Module} + */ +ngeo.editing.extraModule = angular.module('ngeoEditingExtraModule', [ + ngeo.module.name, // Change me when all dependencies are in a module. + ngeo.editing.exportfeaturesComponent.name, +]); diff --git a/src/editing/module.js b/src/editing/module.js index 32ba06fc03f..afd851ec7b7 100644 --- a/src/editing/module.js +++ b/src/editing/module.js @@ -1,5 +1,6 @@ goog.provide('ngeo.editing.module'); +goog.require('ngeo'); goog.require('ngeo.editing.attributesComponent'); goog.require('ngeo.editing.createfeatureComponent'); goog.require('ngeo.editing.createregularpolygonfromclickComponent'); @@ -8,6 +9,7 @@ goog.require('ngeo.editing.createregularpolygonfromclickComponent'); * @type {!angular.Module} */ ngeo.editing.module = angular.module('ngeoEditingModule', [ + ngeo.module.name, // Change me when all dependencies are in a module. ngeo.editing.attributesComponent.name, ngeo.editing.createfeatureComponent.name, ngeo.editing.createregularpolygonfromclickComponent.name,