sborka
This commit is contained in:
parent
4d73fd6107
commit
104229d390
@ -350,51 +350,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
const getGTOMarkerText = function (feature) {
|
||||
const statemum = feature.get('garagenum')
|
||||
if (statemum) {
|
||||
return statemum;
|
||||
}
|
||||
return feature.get('name')
|
||||
};
|
||||
|
||||
const createGTOStateNumTextStyle = function (feature, resolution) {
|
||||
const font = 'bold' + ' ' + '12px' + '/' + '1' + ' ' + 'Arial';
|
||||
return new ol.style.Text({
|
||||
textAlign: 'center',
|
||||
textBaseline: 'middle',
|
||||
font: font,
|
||||
text: getGTOMarkerText(feature, resolution),
|
||||
fill: new ol.style.Fill({color: '#000'}),
|
||||
offsetX: 0,
|
||||
offsetY: -25,
|
||||
placement: 'point',
|
||||
maxAngle: '0.7853981633974483',
|
||||
overflow: 'false',
|
||||
rotation: parseFloat('0'),
|
||||
backgroundFill: new ol.style.Fill({color: '#fff'}),
|
||||
backgroundStroke: new ol.style.Stroke({color: '#000', width: 1}),
|
||||
padding: [3, 3, 3, 3],
|
||||
});
|
||||
};
|
||||
|
||||
const createGTOZoneNameTextStyle = function (feature, resolution) {
|
||||
const font = 'bold' + ' ' + '9px' + '/' + '1' + ' ' + 'Arial';
|
||||
return new ol.style.Text({
|
||||
textAlign: 'center',
|
||||
textBaseline: 'middle',
|
||||
font: font,
|
||||
text: getGTOMarkerText(feature, resolution),
|
||||
fill: new ol.style.Fill({color: '#000'}),
|
||||
offsetX: 0,
|
||||
offsetY: -25,
|
||||
placement: 'point',
|
||||
maxAngle: '0.7853981633974483',
|
||||
overflow: 'false',
|
||||
rotation: parseFloat('0'),
|
||||
padding: [3, 3, 3, 3],
|
||||
});
|
||||
};
|
||||
|
||||
function GTOStyleFunction(feature, resolution) {
|
||||
return new ol.style.Style({
|
||||
@ -506,99 +461,6 @@
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
class LayerSwitcherControl extends ol.control.Control {
|
||||
/**
|
||||
* @param {Object} [opt_options] Control options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options || {};
|
||||
|
||||
// Создание кнопки для переключателя слоёв
|
||||
const button = document.createElement('button');
|
||||
button.innerHTML = `<i class="fa fa-layer-group"></i>`; // Иконка для кнопки
|
||||
|
||||
// Создание контейнера для контрола
|
||||
const element = document.createElement('div');
|
||||
element.className = 'layer-switcher ol-unselectable ol-control layer-switcher-bottom-right'; // Добавляем класс для позиционирования
|
||||
element.appendChild(button);
|
||||
|
||||
super({
|
||||
element: element,
|
||||
target: options.target,
|
||||
});
|
||||
|
||||
// Слушатель нажатия на кнопку
|
||||
button.addEventListener('click', this.toggleLayerList.bind(this), false);
|
||||
|
||||
// Список слоёв (скрытый по умолчанию)
|
||||
this.layerList = document.createElement('ul');
|
||||
this.layerList.className = 'ol-layer-list';
|
||||
this.layerList.style.display = 'none';
|
||||
element.appendChild(this.layerList);
|
||||
|
||||
// Подключаем событие для обновления списка слоёв после инициализации карты
|
||||
this.onMapLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Переключение видимости списка слоёв
|
||||
*/
|
||||
toggleLayerList() {
|
||||
if (this.layerList.style.display === 'block') {
|
||||
this.layerList.style.display = 'none';
|
||||
} else {
|
||||
this.layerList.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновление списка слоёв в контроле
|
||||
*/
|
||||
updateLayerList() {
|
||||
const map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
|
||||
const layers = map.getLayers().getArray();
|
||||
|
||||
// Очищаем старый список
|
||||
this.layerList.innerHTML = '';
|
||||
|
||||
layers.forEach((layer) => {
|
||||
const layerItem = document.createElement('li');
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.checked = layer.getVisible(); // Задаем состояние видимости слоя
|
||||
checkbox.addEventListener('click', () => {
|
||||
layer.setVisible(checkbox.checked); // Изменение видимости слоя
|
||||
});
|
||||
const label = document.createElement('label');
|
||||
label.innerHTML = layer.get('name') || 'Unnamed Layer'; // Отображение названия слоя
|
||||
layerItem.appendChild(checkbox);
|
||||
layerItem.appendChild(label);
|
||||
this.layerList.appendChild(layerItem);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ожидаем, когда карта будет инициализирована, и обновим список слоёв
|
||||
*/
|
||||
onMapLoaded() {
|
||||
const map = this.getMap();
|
||||
if (map) {
|
||||
this.updateLayerList();
|
||||
// Подписываемся на изменения слоёв
|
||||
map.on('change:layers', () => {
|
||||
this.updateLayerList();
|
||||
});
|
||||
} else {
|
||||
// В случае, если карта еще не инициализирована, используем setTimeout
|
||||
setTimeout(this.onMapLoaded.bind(this), 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initializeMap() {
|
||||
OSM = new ol.layer.Tile({
|
||||
source: new ol.source.OSM(), // Open street Map
|
||||
@ -1032,7 +894,6 @@
|
||||
console.error("Ошибка при получении данных:", error);
|
||||
});
|
||||
|
||||
{#fetchEarthquakes()#}
|
||||
}
|
||||
|
||||
let toStart = document.querySelector('#toStart')
|
||||
@ -1053,17 +914,6 @@
|
||||
fetchLayers();
|
||||
}
|
||||
|
||||
// Событие при открытии dropdown
|
||||
dropdown.addEventListener('show.bs.dropdown', function () {
|
||||
dropdownIcon.classList.add('rotated');
|
||||
});
|
||||
|
||||
// Событие при закрытии dropdown
|
||||
dropdown.addEventListener('hide.bs.dropdown', function () {
|
||||
dropdownIcon.classList.remove('rotated');
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ INSTALLED_APPS = [
|
||||
"""Информация о приложении """
|
||||
SITE_TITLE = u'Многофункциональная система безопасности ОГР'
|
||||
SITE_TITLE_S = u'МФСБ ОГР'
|
||||
APP_VER = '1.0.09.0'
|
||||
APP_VER = '1.0.09.1'
|
||||
APP_VEK = u'2023 - 2025гг'
|
||||
APP_COPPIRIGHT = u'Многофункциональная система безопасности ОГР'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user