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

Added BackgroundLayer model #581

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
export default {
projections: {
AuditView: {
name: {
__caption__: 'name'
},
creator: {
__caption__: 'creator'
},
createTime: {
__caption__: 'createTime'
},
editor: {
__caption__: 'editor'
},
editTime: {
__caption__: 'editTime'
}
},
BackgroundLayerD: {
name: {
__caption__: 'name'
},
description: {
__caption__: 'description'
},
keyWords: {
__caption__: 'keyWords'
},
anyText: {
__caption__: 'anyText'
},
index: {
__caption__: 'index'
},
visibility: {
__caption__: 'visibility'
},
type: {
__caption__: 'type'
},
settings: {
__caption__: 'settings'
},
scale: {
__caption__: 'scale'
},
coordinateReferenceSystem: {
__caption__: 'coordinateReferenceSystem'
},
boundingBox: {
__caption__: 'boundingBox'
},
public: {
__caption__: 'public'
},
owner: {
__caption__: 'owner'
},
securityKey: {
__caption__: 'securityKey'
}
},
BackgroundLayerE: {
name: {
__caption__: 'name'
},
description: {
__caption__: 'description'
},
keyWords: {
__caption__: 'keyWords'
},
index: {
__caption__: 'index'
},
visibility: {
__caption__: 'visibility'
},
type: {
__caption__: 'type'
},
settings: {
__caption__: 'settings'
},
scale: {
__caption__: 'scale'
},
coordinateReferenceSystem: {
__caption__: 'coordinateReferenceSystem'
},
boundingBox: {
__caption__: 'boundingBox'
},
securityKey: {
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.

Исправлено

__caption__: 'securityKey'
}
},
BackgroundLayerL: {
name: {
__caption__: 'name'
},
description: {
__caption__: 'description'
},
type: {
__caption__: 'type'
}
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
export default {
projections: {
AuditView: {
name: {
__caption__: 'Наименование'
},
creator: {
__caption__: 'Создатель'
},
createTime: {
__caption__: 'Время создания'
},
editor: {
__caption__: 'Редактор'
},
editTime: {
__caption__: 'Время редактирования'
}
},
BackgroundLayerD: {
name: {
__caption__: 'Наименование'
},
description: {
__caption__: 'Описание'
},
keyWords: {
__caption__: 'Ключевые слова'
},
anyText: {
__caption__: ''
},
index: {
__caption__: 'Индекс'
},
visibility: {
__caption__: 'Видимость'
},
type: {
__caption__: 'Тип'
},
settings: {
__caption__: 'Настройки'
},
scale: {
__caption__: 'Масштаб'
},
coordinateReferenceSystem: {
__caption__: 'Система координат'
},
boundingBox: {
__caption__: 'Граница'
},
public: {
__caption__: ''
},
owner: {
__caption__: ''
},
securityKey: {
__caption__: ''
}
},
BackgroundLayerE: {
name: {
__caption__: 'Наименование'
},
description: {
__caption__: 'Описание'
},
keyWords: {
__caption__: 'Ключевые слова'
},
index: {
__caption__: 'Индекс'
},
visibility: {
__caption__: 'Видимость'
},
type: {
__caption__: 'Тип'
},
settings: {
__caption__: 'Настройки'
},
scale: {
__caption__: 'Масштаб'
},
coordinateReferenceSystem: {
__caption__: 'Система координат'
},
boundingBox: {
__caption__: 'Граница'
},
securityKey: {
__caption__: ''
}
},
BackgroundLayerL: {
name: {
__caption__: 'Наименование'
},
description: {
__caption__: 'Описание'
},
type: {
__caption__: 'Тип'
}
}
}
};
12 changes: 0 additions & 12 deletions addon/mixins/flexberry-map-model-api-cosmos.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,8 @@ export default Ember.Mixin.create({
let mapLayer = createLayerFromMetadata(model, this.get('store'));
mapLayer.set('index', index);
mapLayer.set('map', this);
let canBeBackground = mapLayer.get('settingsAsObject.backgroundSettings.canBeBackground');
const layers = this.get('hierarchy');
const layersInTree = this.get('otherLayers');
const layerBackground = this.get('backgroundLayers');
layers.addObject(mapLayer);
if (canBeBackground) {
if (!Ember.isNone(layerBackground)) {
layerBackground.addObject(mapLayer);
}
} else {
if (!Ember.isNone(layersInTree)) {
layersInTree.addObject(mapLayer);
}
}

let rootArray = this.get('mapLayer');
Copy link
Contributor

Choose a reason for hiding this comment

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

а как оно теперь в дерево слоев попадает? Дерево слоев по идее в model.hierarchy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Раньше дерево слоев лежало в model.otherlayers (отфильтрованные слои из model.hierarchy по canbebackground=false), подложки в model.backgroundLayers. Сейчас дерево слоев - это model.hierarchy, так как все слои с canbebackground=false удалены.

Copy link
Contributor

Choose a reason for hiding this comment

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

об этом и пишу. Надо сделать чтоб добавлялось в model.hierarchy

Copy link
Contributor Author

@viatkinviatkin viatkinviatkin Apr 4, 2022

Choose a reason for hiding this comment

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

Они попадают же в дерево слоев?

const layers = this.get('hierarchy');
layers.addObject(mapLayer);

Copy link
Contributor

Choose a reason for hiding this comment

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

все ок, я проглядела эту строчку

rootArray.pushObject(mapLayer);
Expand Down
4 changes: 2 additions & 2 deletions addon/mixins/flexberry-maplayer-actions-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ export default Ember.Mixin.create({
`but \`string\` is expected`,
Ember.typeOf(primaryParentLayerPath) === 'string');

let secondaryParentLayerPath = primaryParentLayerPath.indexOf('hierarchy') !== -1 ? 'model.otherLayers' : 'model.hierarchy';
let backgroundLayerPath = 'model.backgroundLayers';
let secondaryParentLayerPath = 'model.hierarchy';
let backgroundLayerPath = 'backgroundLayers';
Copy link
Contributor

Choose a reason for hiding this comment

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

я вот тут немного не поняла, почему ушла 'model'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Да, это ошибка. Сначала клал подложки в свойство контроллера после загрузки модели, сейчас они загружаются вместе с моделью и лежат в model.backgroundLayers


let {
layerProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import Ember from 'ember';
import DS from 'ember-data';
import { attr } from 'ember-flexberry-data/utils/attributes';

export let Model = Ember.Mixin.create({
name: DS.attr('string'),
description: DS.attr('string'),
keyWords: DS.attr('string'),
/**
Non-stored property.

@property anyText
*/
anyText: DS.attr('string'),
/**
Method to set non-stored property.
Please, use code below in model class (outside of this mixin) otherwise it will be replaced during regeneration of models.
Please, implement 'anyTextCompute' method in model class (outside of this mixin) if you want to compute value of 'anyText' property.

@method _anyTextCompute
@private
@example
```javascript
_anyTextChanged: Ember.on('init', Ember.observer('anyText', function() {
Ember.run.once(this, '_anyTextCompute');
}))
```
*/
_anyTextCompute: function() {
let result = (this.anyTextCompute && typeof this.anyTextCompute === 'function') ? this.anyTextCompute() : null;
this.set('anyText', result);
},
index: DS.attr('number'),
visibility: DS.attr('boolean', { defaultValue: true }),
type: DS.attr('string'),
settings: DS.attr('string'),
scale: DS.attr('number'),
coordinateReferenceSystem: DS.attr('string'),
boundingBox: DS.attr('string'),
public: DS.attr('boolean'),
owner: DS.attr('string'),
securityKey: DS.attr('string'),
createTime: DS.attr('date'),
creator: DS.attr('string'),
editTime: DS.attr('date'),
editor: DS.attr('string'),
getValidations: function () {
let parentValidations = this._super();
let thisValidations = {
};
return Ember.$.extend(true, {}, parentValidations, thisValidations);
},
init: function () {
this.set('validations', this.getValidations());
this._super.apply(this, arguments);
}
});

export let defineNamespace = function (modelClass) {
modelClass.reopenClass({
namespace: 'NewPlatform.Flexberry.GIS',
});
};

export let defineProjections = function (modelClass) {
modelClass.defineProjection('AuditView', 'new-platform-flexberry-g-i-s-background-layer', {
name: attr('Наименование', { index: 0 }),
creator: attr('Создатель', { index: 1 }),
createTime: attr('Время создания', { index: 2 }),
editor: attr('Редактор', { index: 3 }),
editTime: attr('Время редактирования', { index: 4 })
});

modelClass.defineProjection('BackgroundLayerD', 'new-platform-flexberry-g-i-s-background-layer', {
name: attr('Наименование', { index: 0 }),
description: attr('Описание', { index: 1 }),
keyWords: attr('Ключевые слова', { index: 2 }),
anyText: attr('', { index: 3 }),
index: attr('Индекс', { index: 4 }),
visibility: attr('Видимость', { index: 5 }),
type: attr('Тип', { index: 6 }),
settings: attr('Настройки', { index: 7 }),
scale: attr('Масштаб', { index: 8 }),
coordinateReferenceSystem: attr('Система координат', { index: 9 }),
boundingBox: attr('Граница', { index: 10 }),
public: attr('', { index: 11 }),
owner: attr('', { index: 12 }),
securityKey: attr('', { index: 13 })
});

modelClass.defineProjection('BackgroundLayerE', 'new-platform-flexberry-g-i-s-background-layer', {
name: attr('Наименование', { index: 0 }),
description: attr('Описание', { index: 1 }),
keyWords: attr('Ключевые слова', { index: 2 }),
index: attr('Индекс', { index: 3 }),
visibility: attr('Видимость', { index: 4 }),
type: attr('Тип', { index: 5 }),
settings: attr('Настройки', { index: 6 }),
scale: attr('Масштаб', { index: 7 }),
coordinateReferenceSystem: attr('Система координат', { index: 8 }),
boundingBox: attr('Граница', { index: 9 }),
securityKey: attr('', { index: 10 })
});

modelClass.defineProjection('BackgroundLayerL', 'new-platform-flexberry-g-i-s-background-layer', {
name: attr('Наименование', { index: 0 }),
description: attr('Описание', { index: 1 }),
type: attr('Тип', { index: 2 })
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Ember from 'ember';

/**
Mixin containing initializetion logic for background layer serializer.

@class NewPlatformFlexberyGISBackgroundLayerSerializerMixin
@extends <a href="http://emberjs.com/api/classes/Ember.Mixin.html">Ember.Mixin</a>
*/
export let Serializer = Ember.Mixin.create({
getAttrs: function () {
let parentAttrs = this._super();
let attrs = {

};

return Ember.$.extend(true, {}, parentAttrs, attrs);
},
init: function () {
this.set('attrs', this.getAttrs());
this._super(...arguments);
}
});
Loading