Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix identity file #825

Merged
merged 6 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions addon/components/flexberry-identify-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а вот это все зачем если не используется?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Планировал использовать при заполнении _geometryTypes, не понял как это сделать.


/**
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
*
Expand All @@ -60,6 +88,11 @@ export default Ember.Component.extend(CheckFileMixin, {

init() {
this._super(...arguments);
this.set('_geometryTypes', {
DaryaNeko marked this conversation as resolved.
Show resolved Hide resolved
'point': 'Точка',
'polyline': 'Ломаная',
DaryaNeko marked this conversation as resolved.
Show resolved Hide resolved
'polygon': 'Полигон'
});
},

setAcceptFiles() {
Expand Down Expand Up @@ -156,12 +189,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);
});
}
},
Expand All @@ -176,6 +211,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);
Expand Down Expand Up @@ -205,6 +241,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');
Expand Down
2 changes: 2 additions & 0 deletions addon/locales/en/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions addon/locales/en/components/flexberry-identify-file.js
Original file line number Diff line number Diff line change
@@ -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'
}
};
2 changes: 2 additions & 0 deletions addon/locales/ru/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions addon/locales/ru/components/flexberry-identify-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
'marker': {
'caption': 'Точка'
},
'polyline': {
'caption': 'Ломаная'
},
'polygon': {
'caption': 'Полигон'
},
'geometry-type': {
'caption': 'Тип геометрии'
},
'geometry-fields': {
'caption': 'Название полей с геометрией в файле'
}
};
6 changes: 6 additions & 0 deletions addon/mixins/flexberry-check-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -126,6 +128,10 @@ export default Ember.Mixin.create({
data.append(file.name, file);
data.append('crs', this.get('coordinate'));

if (this.get('needGeometryType')) {
data.append('typeGeometryLayer', this.get('_geometryType'));
}

if (this.get('needGeometryFieldName')) {
data.append('geometryFieldFile', this.get('geometryFieldFile'));
}
Expand Down
13 changes: 12 additions & 1 deletion addon/templates/components/flexberry-identify-file.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@
}}
</div>

{{#if needGeometryType}}
<div class="field geometryField">
<label>{{t "components.flexberry-identify-file.geometry-type.caption"}} <span class="required">*</span></label>
{{flexberry-dropdown
class=(concat "fluid geometryType")
items=_geometryTypes
value=_geometryType
displayCaptions=true
}}
</div>
{{/if}}
{{#if needGeometryFieldName}}
<div class="field geometryField">
<label>Название полей с геометрией в файле*</label>
<label>{{t "components.flexberry-identify-file.geometry-fields.caption"}} <span class="required">*</span></label>
{{flexberry-dropdown
class=(concat "fluid geometryField1")
items=_availableFields
Expand Down
Loading