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

Rgis develop #838

Merged
merged 48 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
42d7109
RGIS project functionality buttons have been removed from the technol…
Oct 9, 2023
4e7ee52
jscs fix
Oct 9, 2023
0d5f2a8
fix bounds CRS
SnezhanaAbramova Oct 16, 2023
1a6e6a4
fix _boundsCrs
SnezhanaAbramova Oct 16, 2023
1cd1737
fix jslint
SnezhanaAbramova Oct 16, 2023
ff8845d
Merge pull request #827 from Flexberry/fix_previewError
DaryaNeko Oct 16, 2023
acba3a9
Ошибки карты
Oct 18, 2023
df70bf3
marker anchor
SnezhanaAbramova Oct 23, 2023
9ebc0be
fix opacity
SnezhanaAbramova Oct 23, 2023
2c601bd
fix style for rule
SnezhanaAbramova Oct 24, 2023
a1c9c95
fix null leafletObject
SnezhanaAbramova Oct 24, 2023
a044156
fix empty leafletObject
SnezhanaAbramova Oct 24, 2023
957c981
fix update line
SnezhanaAbramova Oct 25, 2023
f0d3536
Fix zoom-view button style
pepelyaeva Oct 25, 2023
cbb9027
remove empty geometry
SnezhanaAbramova Oct 26, 2023
eae98ca
Merge pull request #832 from Flexberry/rgis-develop-131023
DaryaNeko Oct 27, 2023
099b426
Merge pull request #831 from Flexberry/wi_2_addNewCrs
DaryaNeko Oct 27, 2023
8f242f8
Merge pull request #830 from Flexberry/fix-16-styles
DaryaNeko Oct 30, 2023
611e9d5
Merge pull request #819 from Flexberry/refactor_feature_buttons
DaryaNeko Oct 30, 2023
9252b3c
fix label for marker
SnezhanaAbramova Oct 30, 2023
c8dd6d2
merge develop
SnezhanaAbramova Oct 30, 2023
abe2490
fix jscs test
SnezhanaAbramova Oct 30, 2023
f407aa3
fix test
SnezhanaAbramova Nov 7, 2023
edcf541
fix circle
SnezhanaAbramova Nov 7, 2023
eb2854e
fix jscs
SnezhanaAbramova Nov 7, 2023
3fac716
Перенос логики загрузки в загрузчик
Nov 9, 2023
ef30cef
test
Nov 9, 2023
fdf8ded
remove developing addon
SnezhanaAbramova Nov 9, 2023
9d51f40
Merge pull request #828 from Flexberry/max-fix-1710
DaryaNeko Nov 10, 2023
5a675d4
Merge pull request #833 from Flexberry/loader-fix
DaryaNeko Nov 10, 2023
be9783d
fix circle
SnezhanaAbramova Nov 7, 2023
4a59100
fix jscs
SnezhanaAbramova Nov 7, 2023
cf2c770
fix legend for wfs and wms-wfs
SnezhanaAbramova Nov 14, 2023
054b386
fix jscs
SnezhanaAbramova Nov 14, 2023
330b19e
fix
SnezhanaAbramova Nov 15, 2023
e2c5706
fix draw error
SnezhanaAbramova Nov 15, 2023
3c72cfd
fix legend via layer-model
SnezhanaAbramova Nov 15, 2023
cb6dd59
Ошибки карты
Nov 15, 2023
ed90520
Merge branch 'rgis-develop' into rgis-develop-131023
DaryaNeko Nov 15, 2023
276fae3
Merge pull request #834 from Flexberry/rgis-develop-131023
DaryaNeko Nov 15, 2023
fe88be0
Merge pull request #829 from Flexberry/fix_19_styleMarkerAndLabel
DaryaNeko Nov 15, 2023
b228e3d
Расположение надписей для полигонов
DaryaNeko Mar 4, 2024
caf7044
Merge branch 'rgis-develop-151123' into merge-151123-040324
DaryaNeko Mar 4, 2024
5398fc9
merge-151123-040324
DaryaNeko Mar 4, 2024
046078e
Merge pull request #836 from Flexberry/merge-151123-040324
DaryaNeko Mar 4, 2024
b6e732a
Косяк надписей
DaryaNeko Mar 19, 2024
c97058c
Merge branch 'rgis-develop-151123' into merge-151123-190324
DaryaNeko Mar 19, 2024
d018581
Merge pull request #837 from Flexberry/merge-151123-190324
DaryaNeko Mar 19, 2024
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
27 changes: 27 additions & 0 deletions addon/components/base-vector-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,5 +1317,32 @@ export default BaseLayer.extend(layerLabel, {
} else {
return geoJSONLayer.geometry.coordinates;
}
},

_boundsCrs(leafletObject) {
let leafletMap = this.get('leafletMap');
let boundsMap = leafletMap.getBounds();
if (boundsMap && leafletObject.options && leafletObject.options.crs && leafletObject.options.crs.bounds) {
let crsBounds = leafletObject.options.crs.bounds;
if (boundsMap._northEast.lat > crsBounds.max.x) {
boundsMap._northEast.lat = crsBounds.max.x;
}

if (boundsMap._northEast.lng > crsBounds.max.y) {
boundsMap._northEast.lng = crsBounds.max.y;
}

if ((boundsMap._southWest.lat < 0 && boundsMap._southWest.lat < crsBounds.min.x) ||
(boundsMap._southWest.lat > 0 && boundsMap._southWest.lat > crsBounds.min.x)) {
boundsMap._southWest.lat = crsBounds.min.x;
}

if ((boundsMap._southWest.lng < 0 && boundsMap._southWest.lng < crsBounds.min.y) ||
(boundsMap._southWest.lng > 0 && boundsMap._southWest.lng > crsBounds.min.y)) {
boundsMap._southWest.lng = crsBounds.min.y;
}
}

return boundsMap;
}
});
12 changes: 2 additions & 10 deletions addon/components/feature-result-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { translationMacro as t } from 'ember-i18n';
import openCloseSubmenu from 'ember-flexberry-gis/utils/open-close-sub-menu';
import { zoomToBounds } from '../utils/zoom-to-bounds';
import ResultFeatureInitializer from '../mixins/result-feature-initializer';
import SlotsMixin from 'ember-block-slots';
/**
Component for display GeoJSON feature object details

@class FeatureResultItemComponent
@extends <a href="http://emberjs.com/api/classes/Ember.Component.html">Ember.Component</a>
*/
export default Ember.Component.extend(ResultFeatureInitializer, {
export default Ember.Component.extend(SlotsMixin, ResultFeatureInitializer, {

/**
Service for managing map API.
Expand Down Expand Up @@ -600,15 +601,6 @@ export default Ember.Component.extend(ResultFeatureInitializer, {
this.sendAction('findIntersection', this.get('feature'));
},

/**
* Action for search satellites
* @method actions.searchSatellites
*/
searchSatellites() {
this.set('isSubmenu', false);
this.sendAction('searchSatellites', this.get('feature'));
},

/**
Add feature to favorites list
Action is sended to layer-result-list.
Expand Down
91 changes: 10 additions & 81 deletions addon/components/flexberry-edit-layer-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import SnapDrawMixin from '../mixins/snap-draw';
import EditFeatureMixin from '../mixins/edit-feature';
import LeafletZoomToFeatureMixin from '../mixins/leaflet-zoom-to-feature';
import { translationMacro as t } from 'ember-i18n';
import { getLeafletCrs } from '../utils/leaflet-crs';
import { addAlpha, splitColor } from '../utils/leaflet-opacity';

export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin, EditFeatureMixin, {
Expand Down Expand Up @@ -778,8 +777,10 @@ export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin,

// Removing a layer from the map that was added for edit mode
if (leafletMap.hasLayer(layer)) {
layer.setStyle(layer.defaultFeatureStyle);
layer.styleIsSet = layer.defaultSetStyle;
if (!this.get('isLayerCopy')) {
layer.setStyle(layer.defaultFeatureStyle);
layer.styleIsSet = layer.defaultSetStyle;
}

if (this.get('isLayerCopy')) {
leafletMap.removeLayer(layer);
Expand Down Expand Up @@ -893,81 +894,6 @@ export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin,
}
},

/**
Sends request to trancate GeoWebCache for layer by boundingBox.

@method trancateGeoWebCache
@param {Object} leafletObject laeflet layer.
*/
trancateGeoWebCache(leafletObject) {
let layers = leafletObject.wmsParams.layers.split();
let workspace;
let layer;
let geoWebCache;
if (layers.length === 2) {
workspace = layers[0];
layer = layers[1];
} else {
let urlSplit = leafletObject._url.split('/');
let indexGeoserver = urlSplit.indexOf('geoserver');
if (indexGeoserver > -1 && urlSplit.length === indexGeoserver + 3) {
workspace = urlSplit.at(indexGeoserver + 1);
} else {
console.error('Can\'t get workspace in geoserver');
return;
}

layer = layers[0];
}

if (!Ember.isBlank(leafletObject._url.match(new RegExp('(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?')))) {
let indexGeoserver = leafletObject._url.indexOf('geoserver');
if (indexGeoserver === -1) {
console.error('Can\'t get url geoserver');
return;
}

geoWebCache = leafletObject._url.slice(0, indexGeoserver + 10) + '/gwc/rest/seed/';
}

if (!Ember.isNone(geoWebCache)) {
let url = geoWebCache + workspace + ':' + layer;
let gridSetId = leafletObject.wmsParams.crs + '_' + leafletObject.wmsParams.width;
let leafletMap = this.get('leafletMap');
let zoom = Math.trunc(leafletMap.getZoom());
let zoomStart = zoom - 1 > 0 ? zoom - 1 : zoom;
let zoomStop = zoom + 1 < 20 ? zoom + 1 : zoom;
let styles = leafletObject.wmsParams.styles;
let parameterStyles = '';
if (!Ember.isNone(styles)) {
parameterStyles = `parameter_STYLES=${workspace}:${styles}&`;
}

let crsName = leafletObject.wmsParams.crs;
let crs;
if (!Ember.isNone(crsName)) {
crs = getLeafletCrs('{ "code": "' + crsName.toUpperCase() + '", "definition": "" }', this);
}

let bounds = leafletMap.getBounds();
let minXY = L.marker(bounds._southWest).toProjectedGeoJSON(crs);
let maxXY = L.marker(bounds._northEast).toProjectedGeoJSON(crs);

Ember.$.ajax({
method: 'POST',
url: url,
async: true,
data: `threadCount=01&type=truncate&gridSetId=${gridSetId}&tileFormat=image%2Fpng&zoomStart=${zoomStart}&zoomStop=${zoomStop}&` +
`${parameterStyles}minX=${minXY.geometry.coordinates[0]}&minY=${minXY.geometry.coordinates[1]}` +
`&maxX=${maxXY.geometry.coordinates[0]}&maxY=${maxXY.geometry.coordinates[1]}`,
contentType: 'text/html',
error: function(data) {
console.error(data);
}
});
}
},

actions: {

blockForm(block) {
Expand Down Expand Up @@ -1172,8 +1098,10 @@ export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin,
leafletObject.editLayer(layer);

if (leafletMap.hasLayer(layer)) {
layer.setStyle(layer.defaultFeatureStyle);
layer.styleIsSet = layer.defaultSetStyle;
if (!this.get('isLayerCopy')) {
layer.setStyle(layer.defaultFeatureStyle);
layer.styleIsSet = layer.defaultSetStyle;
}

if (this.get('isLayerCopy')) {
// Deleting a copy of an edited layer from the map
Expand Down Expand Up @@ -1248,8 +1176,9 @@ export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin,
this.set('mode', 'Saved');

let _leafletObjectFirst = this.get('layerModel.layerModel._leafletObjectFirst');
let leafletMap = this.get('leafletMap');
if (!Ember.isNone(_leafletObjectFirst) && typeof _leafletObjectFirst.setParams === 'function') {
this.trancateGeoWebCache(_leafletObjectFirst);
this.trancateGeoWebCache(_leafletObjectFirst, leafletMap);
_leafletObjectFirst.setParams({ fake: Date.now() }, false);
}

Expand Down
82 changes: 51 additions & 31 deletions addon/components/flexberry-identify-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,26 @@ export default Ember.Component.extend(CheckFileMixin, {
*/
geometryField2: null,

/**
Necessity of geometry field names (one (with WKT geometry) or two (X,Y coordinates - points only))
geometryField1 and geometryField2
For .csv, .xls, .xlsx
*/
needGeometryFieldName: false,

acceptFiles: null,
/**
Necessity of geometry type. For .gpx (it contains different types of data and can be transformed to different types of data)
*/
needGeometryType: false,

/**
Necessity of "not auto" CRS
*/
needCRS: false,

acceptFiles: '.zip,.GEOJSON,.gml,.xls,.xlsx,.csv,.xml,.gpx,.kml',

importErrorMessage: 'Загруженный файл не соответствует требованиям: ',
importErrorMessage: 'Загруженный файл не соответствует требованиям',

emptyErrorMessage: 'Файл не содержит геометрических объектов',

Expand All @@ -42,11 +57,10 @@ export default Ember.Component.extend(CheckFileMixin, {

typeGeometryErrorMessage: 'Указанный тип геометрии противоречит объектам в файле',

warningMessageSRS: 'Укажите верную систему координат, указанную в загружаемом файле. ' +
'При выборе ошибочной системы координат слой может некорректно отображаться на карте',

warningMessageEmptyGeometry: 'В файле обнаружены объекты без геометрии. Дальнейшая загрузка будет осуществлена без них',

warningMessageAutoCRS: 'У загруженного файла не определена система координат. Выберите систему координат из списка',

emptyGeometryField: 'Укажите название поля с геометрией в файле (WKT/X,Y)',

/**
Expand All @@ -67,18 +81,11 @@ export default Ember.Component.extend(CheckFileMixin, {
});
},

setAcceptFiles() {
if (Ember.isEmpty(this.get('acceptFiles'))) {
this.set('acceptFiles', '.zip,.GEOJSON,.gml,.xls,.xlsx,.csv,.xml,.gps,.kml');
}
},

didInsertElement() {
this._super(...arguments);

this.set('systemCoordinates', this.get('systemCoordinates') || availableCoordinateReferenceSystemsCodesWithCaptions(this));
this.set('coordinate', 'auto');
this.setAcceptFiles();

this.send('clearFile');
},
Expand Down Expand Up @@ -121,7 +128,7 @@ export default Ember.Component.extend(CheckFileMixin, {

@method fieldsSet
*/
fieldsSet: Ember.observer('file', 'needGeometryFieldName', 'geometryField1', 'geometryField2', function() {
fieldsSet: Ember.observer('file', 'needGeometryFieldName', 'geometryField1', 'geometryField2', function () {
let file = this.get('file');
if (this.get('needGeometryFieldName') && !Ember.isNone(file)) {
let geometryField1 = this.get('geometryField1');
Expand All @@ -134,11 +141,11 @@ export default Ember.Component.extend(CheckFileMixin, {
}),

/**
Get headers fields from csv or xls file.
Get headers fields from csv or xls|xlsx file.

@method getFieldsFromCsv
@method getFields
*/
getFieldsFromCsv() {
getFields() {
this.set('_showError', false);
let config = Ember.getOwner(this).resolveRegistration('config:environment');
let data = new FormData();
Expand All @@ -154,36 +161,35 @@ export default Ember.Component.extend(CheckFileMixin, {
processData: false,
}).done((response) => {
if (response && response.length) {
const items = response.split(',');
this.set('_availableFields', Ember.A(items));
this.set('needGeometryFieldName', true);
this.set('_availableFields', Ember.A(response));
} else {
this.set('_errorMessage', this.get('importErrorMessage') + this.get('emptyHeaderErrorMessage'));
this.set('_errorMessage', 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('_errorMessage', message);
this.set('_showError', true);
this.set('needGeometryFieldName', false);
this.set('needGeometryType', false);
});
}
},

actions: {
onCoordinateChange() {
clearCacheAndPreview() {
this.set('_showError', false);
this.clearAjax();
if (this.get('filePreview')) {
this.get('mapApi').getFromApi('leafletMap').fire(`flexberry-map-loadfile${this.get('suffix')}:clear`);
this.set('filePreview', false);
}
},

clearFile() {
this.set('file', null);
this.set('coordinate', 'auto');
this.set('needGeometryFieldName', false);
this.set('needGeometryType', false);
this.set('needCRS', false);
this.set('geometryField1', null);
this.set('geometryField2', null);
this.set('geometryFieldFile', null);
Expand All @@ -201,19 +207,33 @@ export default Ember.Component.extend(CheckFileMixin, {
this.$('.ui.button.remove').addClass('hidden');
},

/**
* Выбор пользователем файла
*/
clickFile(e) {
let file = e.target.files[0];
if (!file) {
return;
}

let fileName = file.name;
let ext = fileName.substring(fileName.indexOf('.'), fileName.length);
let ext = fileName.substring(fileName.lastIndexOf('.'), fileName.length).toLowerCase();
this.set('file', file);

if (ext.toLowerCase() === '.csv' || ext.toLowerCase() === '.xls' || ext.toLowerCase() === '.xlsx') {
if (ext === '.csv' || ext === '.xls' || ext === '.xlsx') {
this.set('needGeometryFieldName', true);
this.getFieldsFromCsv();
this.set('warningMessage', this.get('warningMessageSRS'));
this.getFields();
}

if (ext === '.gpx' || ext === '.kml') {
this.set('coordinate', 'EPSG:4326');
}

if (ext === '.gpx' || ext === '.gml' || ext === '.csv' || ext === '.xls' || ext === '.xlsx') {
this.set('needCRS', true);
}

if (ext.toLowerCase() === '.gpx') {
if (ext === '.gpx') {
this.set('needGeometryType', true);
}

Expand Down
6 changes: 6 additions & 0 deletions addon/components/flexberry-layers-attributes-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,12 @@ export default Ember.Component.extend(SnapDrawMixin, LeafletZoomToFeatureMixin,
this.set('loading', false);
tabModel._reload();
leafletObject.off('save:failed', saveFailed);

let _leafletObjectFirst = tabModel.layerModel._leafletObjectFirst;
if (!Ember.isNone(_leafletObjectFirst) && typeof _leafletObjectFirst.setParams === 'function') {
this.trancateGeoWebCache(_leafletObjectFirst, leafletMap);
_leafletObjectFirst.setParams({ fake: Date.now() }, false);
}
};

this.set('loading', true);
Expand Down
4 changes: 4 additions & 0 deletions addon/components/flexberry-search-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ export default Ember.Component.extend({

actions: {
querySearch() {
this.sendAction('clearSearch');

if (this.get('attrVisible')) {
if (Ember.isNone(this.get('_selectedLayer'))) {
this.set('errorMessage', this.get('i18n').t('components.flexberry-search.error-message-empty-selected-layer'));
Expand Down Expand Up @@ -275,6 +277,8 @@ export default Ember.Component.extend({
},

attrSearch() {
this.sendAction('clearSearch');

let attrVisible = !this.get('attrVisible');
if (attrVisible) {
this.set('attrVisible', attrVisible);
Expand Down
Loading
Loading