From 30a69d5e9ea4f5391a1a16b4fbe55269dc57ac2c Mon Sep 17 00:00:00 2001 From: zakhy Date: Fri, 21 Feb 2025 11:33:32 +0700 Subject: [PATCH 1/6] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BA=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8E=20=D0=A0=D0=91=D0=A1=20(=D0=9D?= =?UTF-8?q?=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/general/views/settingsmodule.py | 2 ++ apps/management/templates/settings.html | 2 +- apps/pla/views/views_pla.py | 2 ++ templates/default.html | 13 +++++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/general/views/settingsmodule.py b/apps/general/views/settingsmodule.py index 9f5eee8..a40db06 100644 --- a/apps/general/views/settingsmodule.py +++ b/apps/general/views/settingsmodule.py @@ -42,4 +42,6 @@ def settings_install(): get_settings("susubsystem_seis","True") get_settings("susubsystem_seis_name","Cейсмические процессы") + + get_settings("plasystem", "noSystem") diff --git a/apps/management/templates/settings.html b/apps/management/templates/settings.html index eedb241..6be303b 100644 --- a/apps/management/templates/settings.html +++ b/apps/management/templates/settings.html @@ -439,7 +439,7 @@
diff --git a/apps/pla/views/views_pla.py b/apps/pla/views/views_pla.py index ca7258b..88374bc 100644 --- a/apps/pla/views/views_pla.py +++ b/apps/pla/views/views_pla.py @@ -19,6 +19,8 @@ def main_index(request): return redirect("radiusip_main_index") elif plasystem == "Asterisk": return redirect("asterisk_main_index") + else: + return redirect("mainindex") except Exception as err: logging.error(traceback.format_exc()) return redirect("/main/") diff --git a/templates/default.html b/templates/default.html index bfeabcc..fb309e9 100644 --- a/templates/default.html +++ b/templates/default.html @@ -231,10 +231,15 @@
@@ -235,6 +235,10 @@ const kml = e.target.result; clearVectorLayer(); addKMLToMap(kml); + } else if (fileExtension === "json" || fileExtension === "geojson") { + const geojson = JSON.parse(e.target.result) + clearVectorLayer() + addGeoJSONToMap(geojson) } }; reader.readAsText(file); From b4ab491074107dd31d51a067063c147d68bf54b0 Mon Sep 17 00:00:00 2001 From: zakhy Date: Fri, 21 Feb 2025 16:27:55 +0700 Subject: [PATCH 4/6] =?UTF-8?q?=D0=92=D0=BD=D0=B0=D0=B3=D0=BB=D1=83=D1=8E?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20=D1=86=D0=B2?= =?UTF-8?q?=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/ol/dxf-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/ol/dxf-parser.js b/static/js/ol/dxf-parser.js index da97bbe..03a477f 100644 --- a/static/js/ol/dxf-parser.js +++ b/static/js/ol/dxf-parser.js @@ -38,7 +38,7 @@ const getColorByColorTable = function (index) { }, { "aci": 7, "hex": "#FFFFFF", - "rgb": "rgb(255,255,255)" + "rgb": "rgb(0,0,0)" }, { "aci": 8, "hex": "#414141", From a979dd357aa1869b7f19ef4d4c360a6bab818039 Mon Sep 17 00:00:00 2001 From: zakhy Date: Fri, 21 Feb 2025 16:28:16 +0700 Subject: [PATCH 5/6] =?UTF-8?q?=D0=A7=D1=82=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20=D0=B8=D0=B7=20=D1=84=D0=B8?= =?UTF-8?q?=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/main/templates/main_index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/main/templates/main_index.html b/apps/main/templates/main_index.html index 4bb634b..e633145 100644 --- a/apps/main/templates/main_index.html +++ b/apps/main/templates/main_index.html @@ -305,7 +305,7 @@ function polygonBrownStyleFunction(feature, resolution) { return new ol.style.Style({ stroke: new ol.style.Stroke({ - color: 'rgb(199,136,10)', + color: feature.get("color") ? feature.get("color") :'rgb(199,136,10)', width: 2, }), fill: new ol.style.Fill({ @@ -472,7 +472,7 @@ function createLayer(layer) { let newLayer; - + console.log(layer) if (layer.layer_type === 'Tile') { newLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ @@ -487,7 +487,7 @@ format: new ol.format.GeoJSON(), }), visible: layer.is_visible, - style: polygonBrownStyleFunction, + style: polygonBrownStyleFunction }); } newLayer.set('title', layer.name) From 7303c48c5493e35a60157922e130b9381bf1baba Mon Sep 17 00:00:00 2001 From: zakhy Date: Fri, 21 Feb 2025 16:28:34 +0700 Subject: [PATCH 6/6] =?UTF-8?q?=D0=A1=D0=B2=D0=BE=D0=B9=D1=81=D1=82=D0=B2?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/main/admin.py | 17 +++++++++++++++-- apps/main/models/model_static_layer.py | 6 +++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/apps/main/admin.py b/apps/main/admin.py index f917d09..05ad847 100644 --- a/apps/main/admin.py +++ b/apps/main/admin.py @@ -1,14 +1,27 @@ +import json + from django.contrib import admin from apps.main.models.model_dinamic_layer import DynamicLayer from apps.main.models.model_static_layer import StaticLayer +from django import forms + + +class PrettyJSONEncoder(json.JSONEncoder): + def __init__(self, *args, indent, sort_keys, **kwargs): + super().__init__(*args, indent=2, sort_keys=True, **kwargs) + + +class LayerModelForm(forms.ModelForm): + layer_style = forms.JSONField(encoder=PrettyJSONEncoder) + @admin.register(StaticLayer) class StaticLayerAdmin(admin.ModelAdmin): - pass + form = LayerModelForm @admin.register(DynamicLayer) class DynamicLayerAdmin(admin.ModelAdmin): - pass + form = LayerModelForm diff --git a/apps/main/models/model_static_layer.py b/apps/main/models/model_static_layer.py index c78a4fc..60c0ac9 100644 --- a/apps/main/models/model_static_layer.py +++ b/apps/main/models/model_static_layer.py @@ -35,11 +35,15 @@ def get_style_template() -> dict: "offsetY": -25, "placement": 'point', "maxAngle": '0.7853981633974483', - "overflow": 'false', + "overflow": False, "rotation": 0.0, "backgroundFill": { "color": '#fff' }, + "stroke": { + "color": "rgba(0, 0, 0, 1)", + "width": 1, + }, "backgroundStroke": { "color": '#000', "width": 1