From 5f3187ae34807e06709af217f662f1a3afdceb2d Mon Sep 17 00:00:00 2001 From: dronzhin Date: Wed, 11 Oct 2023 21:05:09 +0500 Subject: [PATCH 1/5] geometryTypes for gpx --- addon/components/flexberry-identify-file.js | 12 ++++++++++++ addon/components/flexberry-identify-panel.js | 1 + addon/mixins/flexberry-check-file.js | 3 +++ .../templates/components/flexberry-identify-file.hbs | 10 ++++++++++ 4 files changed, 26 insertions(+) diff --git a/addon/components/flexberry-identify-file.js b/addon/components/flexberry-identify-file.js index 82f18c4a5..ff511c122 100644 --- a/addon/components/flexberry-identify-file.js +++ b/addon/components/flexberry-identify-file.js @@ -56,6 +56,11 @@ export default Ember.Component.extend(CheckFileMixin, { return geomOnly ? '-geom' : ''; }), + init() { + this._super(...arguments); + this.set('_geometryTypes', ['point','polyline','polygon']); + }, + didInsertElement() { this._super(...arguments); @@ -143,12 +148,14 @@ export default Ember.Component.extend(CheckFileMixin, { this.set('_errorMessage', this.get('importErrorMessage') + this.get('emptyHeaderErrorMessage')); this.set('_showError', true); this.set('needGeometryFieldName', false); + this.set('needGeometryType', false); } }).fail(() => { let message = this.get('badFileMessage'); this.set('_errorMessage', this.get('importErrorMessage') + message); this.set('_showError', true); this.set('needGeometryFieldName', false); + this.set('needGeometryType', false); }); } }, @@ -163,6 +170,7 @@ export default Ember.Component.extend(CheckFileMixin, { this.set('file', null); this.set('coordinate', 'auto'); this.set('needGeometryFieldName', false); + this.set('needGeometryType', false); this.set('geometryField1', null); this.set('geometryField2', null); this.set('geometryFieldFile', null); @@ -192,6 +200,10 @@ export default Ember.Component.extend(CheckFileMixin, { this.set('warningMessage', this.get('warningMessageSRS')); } + if (ext.toLowerCase() === '.gpx') { + this.set('needGeometryType', true); + } + this.clearAjax(); this.$('.ui.button.upload').addClass('hidden'); this.$('.ui.button.remove').removeClass('hidden'); diff --git a/addon/components/flexberry-identify-panel.js b/addon/components/flexberry-identify-panel.js index ee4a7d5eb..19b982704 100644 --- a/addon/components/flexberry-identify-panel.js +++ b/addon/components/flexberry-identify-panel.js @@ -539,6 +539,7 @@ let FlexberryIdentifyPanelComponent = Ember.Component.extend({ init() { this._super(...arguments); + const layersButton = [ { iconClass: this.allIconClass, diff --git a/addon/mixins/flexberry-check-file.js b/addon/mixins/flexberry-check-file.js index b68ee3632..2377dc583 100644 --- a/addon/mixins/flexberry-check-file.js +++ b/addon/mixins/flexberry-check-file.js @@ -13,6 +13,8 @@ export default Ember.Mixin.create({ coordinate: null, geometryType: null, + _geometryTypes: [], + _geometryType: null, importErrorMessage: t('components.geometry-add-modes.import.import-error.message'), createLayerErrorMessage: t('components.geometry-add-modes.import.create-layer-error.message'), @@ -125,6 +127,7 @@ export default Ember.Mixin.create({ let data = new FormData(); data.append(file.name, file); data.append('crs', this.get('coordinate')); + data.append('typeGeometryLayer', this.get('_geometryType')); if (this.get('needGeometryFieldName')) { data.append('geometryFieldFile', this.get('geometryFieldFile')); diff --git a/addon/templates/components/flexberry-identify-file.hbs b/addon/templates/components/flexberry-identify-file.hbs index 67e149db3..96f2ef6ba 100644 --- a/addon/templates/components/flexberry-identify-file.hbs +++ b/addon/templates/components/flexberry-identify-file.hbs @@ -19,6 +19,16 @@ }} + {{#if needGeometryType}} +
+ + {{flexberry-dropdown + class=(concat "fluid geometryType") + items=_geometryTypes + value=_geometryType + }} +
+ {{/if}} {{#if needGeometryFieldName}}
From b21d6e09c213da5d3ade4258864708fe2464f0be Mon Sep 17 00:00:00 2001 From: dronzhin Date: Wed, 11 Oct 2023 23:24:20 +0500 Subject: [PATCH 2/5] fix list geo types --- addon/components/flexberry-identify-file.js | 34 ++++++++++++++++++- addon/locales/en/components.js | 2 ++ .../en/components/flexberry-identify-file.js | 17 ++++++++++ addon/locales/ru/components.js | 2 ++ .../ru/components/flexberry-identify-file.js | 17 ++++++++++ addon/mixins/flexberry-check-file.js | 5 ++- .../components/flexberry-identify-file.hbs | 5 +-- 7 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 addon/locales/en/components/flexberry-identify-file.js create mode 100644 addon/locales/ru/components/flexberry-identify-file.js diff --git a/addon/components/flexberry-identify-file.js b/addon/components/flexberry-identify-file.js index f49fb8704..80f5c7450 100644 --- a/addon/components/flexberry-identify-file.js +++ b/addon/components/flexberry-identify-file.js @@ -2,6 +2,7 @@ import Ember from 'ember'; import layout from '../templates/components/flexberry-identify-file'; import CheckFileMixin from '../mixins/flexberry-check-file'; import { availableCoordinateReferenceSystemsCodesWithCaptions } from '../utils/available-coordinate-reference-systems-for-dropdown'; +import { translationMacro as t } from 'ember-i18n'; export default Ember.Component.extend(CheckFileMixin, { layout, @@ -49,6 +50,33 @@ export default Ember.Component.extend(CheckFileMixin, { emptyGeometryField: 'Укажите название поля с геометрией в файле (WKT/X,Y)', + /** + Tools option's 'marker' mode's caption. + + @property markerCaption + @type String + @default t('components.flexberry-identify-file.marker.caption') + */ + markerCaption: t('components.flexberry-identify-file.marker'), + + /** + Tools option's 'polyline' mode's caption. + + @property polylineCaption + @type String + @default t('components.flexberry-identify-file.polyline.caption') + */ + polylineCaption: t('components.flexberry-identify-file.polyline.caption'), + + /** + Tools option's 'polyline' mode's caption. + + @property polygonCaption + @type String + @default t('components.flexberry-identify-file.polygon.caption') + */ + polygonCaption: t('components.flexberry-identify-file.polygon.caption'), + /** * We need to differentiate events from different instances, because we don't turn off event subscriptions * @@ -60,7 +88,11 @@ export default Ember.Component.extend(CheckFileMixin, { init() { this._super(...arguments); - this.set('_geometryTypes', ['point','polyline','polygon']); + this.set('_geometryTypes', { + 'point': 'Точка', + 'polyline': 'Ломаная', + 'polygon': 'Полигон' + }); }, setAcceptFiles() { diff --git a/addon/locales/en/components.js b/addon/locales/en/components.js index 6f6dc6721..73287ea62 100644 --- a/addon/locales/en/components.js +++ b/addon/locales/en/components.js @@ -22,6 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; +import FlexberryIdentifyFile from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -63,6 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, + 'flexberry-identify-file': FlexberryIdentifyFile, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel, diff --git a/addon/locales/en/components/flexberry-identify-file.js b/addon/locales/en/components/flexberry-identify-file.js new file mode 100644 index 000000000..2fece51af --- /dev/null +++ b/addon/locales/en/components/flexberry-identify-file.js @@ -0,0 +1,17 @@ +export default { + 'marker': { + 'caption': 'Point' + }, + 'polyline': { + 'caption': 'Polyline' + }, + 'polygon': { + 'caption': 'Polygon' + }, + 'geometry-type': { + 'caption': 'Geometry type' + }, + 'geometry-fields': { + 'caption': 'Fields with geometry in the file' + } +}; diff --git a/addon/locales/ru/components.js b/addon/locales/ru/components.js index a1cb9bc04..ca03bbc0a 100644 --- a/addon/locales/ru/components.js +++ b/addon/locales/ru/components.js @@ -22,6 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; +import FlexberryIdentifyFile from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -63,6 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, + 'flexberry-identify-file': FlexberryIdentifyFile, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel, diff --git a/addon/locales/ru/components/flexberry-identify-file.js b/addon/locales/ru/components/flexberry-identify-file.js new file mode 100644 index 000000000..ea11c3db6 --- /dev/null +++ b/addon/locales/ru/components/flexberry-identify-file.js @@ -0,0 +1,17 @@ +export default { + 'marker': { + 'caption': 'Точка' + }, + 'polyline': { + 'caption': 'Ломаная' + }, + 'polygon': { + 'caption': 'Полигон' + }, + 'geometry-type': { + 'caption': 'Тип геометрии' + }, + 'geometry-fields': { + 'caption': 'Название полей с геометрией в файле' + } +}; diff --git a/addon/mixins/flexberry-check-file.js b/addon/mixins/flexberry-check-file.js index 2377dc583..22b260831 100644 --- a/addon/mixins/flexberry-check-file.js +++ b/addon/mixins/flexberry-check-file.js @@ -127,7 +127,10 @@ export default Ember.Mixin.create({ let data = new FormData(); data.append(file.name, file); data.append('crs', this.get('coordinate')); - data.append('typeGeometryLayer', this.get('_geometryType')); + + if (this.get('needGeometryType')) { + data.append('typeGeometryLayer', this.get('_geometryType')); + } if (this.get('needGeometryFieldName')) { data.append('geometryFieldFile', this.get('geometryFieldFile')); diff --git a/addon/templates/components/flexberry-identify-file.hbs b/addon/templates/components/flexberry-identify-file.hbs index 206c6eb14..95dea46ec 100644 --- a/addon/templates/components/flexberry-identify-file.hbs +++ b/addon/templates/components/flexberry-identify-file.hbs @@ -21,17 +21,18 @@ {{#if needGeometryType}}
- + {{flexberry-dropdown class=(concat "fluid geometryType") items=_geometryTypes value=_geometryType + displayCaptions=true }}
{{/if}} {{#if needGeometryFieldName}}
- + {{flexberry-dropdown class=(concat "fluid geometryField1") items=_availableFields From 5f011b4c36b756f06d84bd8efc699b4a6ed7c136 Mon Sep 17 00:00:00 2001 From: dronzhin Date: Thu, 12 Oct 2023 12:09:30 +0500 Subject: [PATCH 3/5] pr fix --- addon/components/flexberry-identify-file.js | 29 +-------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/addon/components/flexberry-identify-file.js b/addon/components/flexberry-identify-file.js index 80f5c7450..5d5afd923 100644 --- a/addon/components/flexberry-identify-file.js +++ b/addon/components/flexberry-identify-file.js @@ -50,33 +50,6 @@ export default Ember.Component.extend(CheckFileMixin, { emptyGeometryField: 'Укажите название поля с геометрией в файле (WKT/X,Y)', - /** - Tools option's 'marker' mode's caption. - - @property markerCaption - @type String - @default t('components.flexberry-identify-file.marker.caption') - */ - markerCaption: t('components.flexberry-identify-file.marker'), - - /** - Tools option's 'polyline' mode's caption. - - @property polylineCaption - @type String - @default t('components.flexberry-identify-file.polyline.caption') - */ - polylineCaption: t('components.flexberry-identify-file.polyline.caption'), - - /** - Tools option's 'polyline' mode's caption. - - @property polygonCaption - @type String - @default t('components.flexberry-identify-file.polygon.caption') - */ - polygonCaption: t('components.flexberry-identify-file.polygon.caption'), - /** * We need to differentiate events from different instances, because we don't turn off event subscriptions * @@ -90,7 +63,7 @@ export default Ember.Component.extend(CheckFileMixin, { this._super(...arguments); this.set('_geometryTypes', { 'point': 'Точка', - 'polyline': 'Ломаная', + 'polyline': 'Линия', 'polygon': 'Полигон' }); }, From 8ff1760d922ac661816ffaca950a9a554dbc665d Mon Sep 17 00:00:00 2001 From: dronzhin Date: Thu, 12 Oct 2023 12:17:34 +0500 Subject: [PATCH 4/5] sonar fix duplicate --- addon/locales/en/components.js | 4 ++-- addon/locales/ru/components.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/locales/en/components.js b/addon/locales/en/components.js index 73287ea62..fce0efc7b 100644 --- a/addon/locales/en/components.js +++ b/addon/locales/en/components.js @@ -22,7 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; -import FlexberryIdentifyFile from './components/flexberry-identify-file'; +import FlexberryIdentifyFileField from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -64,7 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, - 'flexberry-identify-file': FlexberryIdentifyFile, + 'flexberry-identify-file': FlexberryIdentifyFileField, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel, diff --git a/addon/locales/ru/components.js b/addon/locales/ru/components.js index ca03bbc0a..861314571 100644 --- a/addon/locales/ru/components.js +++ b/addon/locales/ru/components.js @@ -22,7 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; -import FlexberryIdentifyFile from './components/flexberry-identify-file'; +import FlexberryIdentifyFileField from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -64,7 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, - 'flexberry-identify-file': FlexberryIdentifyFile, + 'flexberry-identify-file': FlexberryIdentifyFileField, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel, From a385aa1aea4b44c47470bf84c8108f17a5d6fa4b Mon Sep 17 00:00:00 2001 From: dronzhin Date: Thu, 12 Oct 2023 12:24:59 +0500 Subject: [PATCH 5/5] eslint fix --- addon/components/flexberry-identify-file.js | 1 - addon/locales/en/components.js | 4 ++-- addon/locales/ru/components.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addon/components/flexberry-identify-file.js b/addon/components/flexberry-identify-file.js index 5d5afd923..28f65bdc3 100644 --- a/addon/components/flexberry-identify-file.js +++ b/addon/components/flexberry-identify-file.js @@ -2,7 +2,6 @@ import Ember from 'ember'; import layout from '../templates/components/flexberry-identify-file'; import CheckFileMixin from '../mixins/flexberry-check-file'; import { availableCoordinateReferenceSystemsCodesWithCaptions } from '../utils/available-coordinate-reference-systems-for-dropdown'; -import { translationMacro as t } from 'ember-i18n'; export default Ember.Component.extend(CheckFileMixin, { layout, diff --git a/addon/locales/en/components.js b/addon/locales/en/components.js index fce0efc7b..73287ea62 100644 --- a/addon/locales/en/components.js +++ b/addon/locales/en/components.js @@ -22,7 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; -import FlexberryIdentifyFileField from './components/flexberry-identify-file'; +import FlexberryIdentifyFile from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -64,7 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, - 'flexberry-identify-file': FlexberryIdentifyFileField, + 'flexberry-identify-file': FlexberryIdentifyFile, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel, diff --git a/addon/locales/ru/components.js b/addon/locales/ru/components.js index 861314571..ca03bbc0a 100644 --- a/addon/locales/ru/components.js +++ b/addon/locales/ru/components.js @@ -22,7 +22,7 @@ import FlexberryLinksEditorComponent from './components/flexberry-links-editor'; import FlexberryWfsFilterComponent from './components/flexberry-wfs-filter'; import FlexberryBoundingboxComponent from './components/flexberry-boundingbox'; import FlexberryEditCrsComponent from './components/flexberry-edit-crs'; -import FlexberryIdentifyFileField from './components/flexberry-identify-file'; +import FlexberryIdentifyFile from './components/flexberry-identify-file'; import FlexberryIdentifyPanel from './components/flexberry-identify-panel'; import FlexberryLayersAttributesPanel from './components/flexberry-layers-attributes-panel'; import FlexberryLayersIntersectionPanel from './components/flexberry-layers-intersections-panel'; @@ -64,7 +64,7 @@ export default { 'flexberry-wfs-filter': FlexberryWfsFilterComponent, 'flexberry-boundingbox': FlexberryBoundingboxComponent, 'flexberry-edit-crs': FlexberryEditCrsComponent, - 'flexberry-identify-file': FlexberryIdentifyFileField, + 'flexberry-identify-file': FlexberryIdentifyFile, 'flexberry-identify-panel': FlexberryIdentifyPanel, 'flexberry-layers-attributes-panel': FlexberryLayersAttributesPanel, 'flexberry-layers-intersections-panel': FlexberryLayersIntersectionPanel,