изменение стандарта

This commit is contained in:
zakhy 2025-03-03 12:28:12 +07:00
parent 27e7425538
commit 160e9407ec

View File

@ -3,44 +3,29 @@ from django.db import models
def get_style_template() -> dict:
return {
"fill": {"color": "rgba(255, 255, 255, 1)"},
"stroke": {
"color": "rgba(0, 0, 0, 1)",
"width": 1,
"lineCap": "round",
"lineJoin": "round",
"lineDash": None, # [10, 5]
"lineDashOffset": 0,
"miterLimit": 10,
},
"image": {
"src": "/static/img/marker.png",
"width": 30,
"height": 20,
"opacity": 1,
# "color":
"scale": 1,
},
"text": {
"font": "bold" + " " + "12px" + "/" + "1" + " " + "Arial",
"textAlign": "center",
"textBaseline": "middle",
"text": "Example",
"fill": {"color": "rgba(255, 255, 255, 1)"},
"offsetX": 0,
"offsetY": -25,
"placement": "point",
"maxAngle": "0.7853981633974483",
"overflow": False,
"rotation": 0.0,
"backgroundFill": {"color": "#fff"},
"stroke": {
"color": "rgba(0, 0, 0, 1)",
"width": 1,
},
"backgroundStroke": {"color": "#000", "width": 1},
"padding": [3, 3, 3, 3],
},
# Заливка
'fill-color': 'rgba(255, 0, 0, 0.5)',
'fill-opacity': 1,
# Линия
'stroke-color': 'blue',
'stroke-width': 2,
'stroke-opacity': 1,
# # Круг (для точек. Потом на иконки заменить)
# 'circle-radius': 10,
# 'circle-fill-color': 'green',
# 'circle-stroke-color': 'black',
# 'circle-stroke-width': 1,
#
# # Текст
# 'text-value': 'Hello, OpenLayers!',
# 'text-font': '14px Calibri,sans-serif',
# 'text-color': 'white',
# 'text-offset-x': 0,
# 'text-offset-y': -20,
# 'text-align': 'center',
# 'text-baseline': 'middle',
}
@ -63,8 +48,10 @@ class StaticLayer(models.Model):
layer_type = models.CharField(
max_length=50, verbose_name="Тип слоя", default="Vector"
)
is_visible = models.BooleanField(default=True, verbose_name="Видимость слоя")
layer_style = models.JSONField(blank=True, null=True, default=get_style_template)
is_visible = models.BooleanField(default=True,
verbose_name="Видимость слоя")
layer_style = models.JSONField(blank=True, null=True,
default=get_style_template)
order = models.IntegerField(default=0, verbose_name="Порядок отображения")
def __str__(self):
@ -73,4 +60,5 @@ class StaticLayer(models.Model):
class Meta: # отображение в админики
verbose_name = "Статический слой"
verbose_name_plural = "Статические слои"
indexes = [models.Index(fields=["name"]), models.Index(fields=["is_visible"])]
indexes = [models.Index(fields=["name"]),
models.Index(fields=["is_visible"])]