summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-01-09 12:16:15 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-05 10:56:44 +0100
commit61e981d30af776e6a64394b56110063e86f0bab0 (patch)
tree5decd678762fe49a661730395e66e840c81b3332
parent2d08645c3245c467ea55af70f5cd5dcc74e4b74a (diff)
downloadIshtar-61e981d30af776e6a64394b56110063e86f0bab0.tar.bz2
Ishtar-61e981d30af776e6a64394b56110063e86f0bab0.zip
✨ sheet map: display buffer - 🐛 sheet map: fix 2d point display
-rw-r--r--changelog/en/changelog_2022-06-15.md8
-rw-r--r--changelog/fr/changelog_2023-01-25.md9
-rw-r--r--ishtar_common/models_common.py6
-rw-r--r--ishtar_common/static/js/ishtar-map.js43
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_map.html1
5 files changed, 59 insertions, 8 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md
index 38961c599..ca5a8d547 100644
--- a/changelog/en/changelog_2022-06-15.md
+++ b/changelog/en/changelog_2022-06-15.md
@@ -2,6 +2,10 @@ v4.0.XX - 2099-12-31
--------------------
### Features/improvements ###
+- geo form:
+ - add coordinates display
+ - get coordinates from geolocalisation
+- geo sheet: display point buffer
#### Imports #####
- pre-import forms
@@ -36,7 +40,9 @@ v4.0.XX - 2099-12-31
- tables: user, action, IP, routable IP
### Bug fixes ###
-- geo sheet: do not zoom or select point with no x, y coordinates
+- geo sheet:
+ - do not zoom or select point with no x, y coordinates
+ - fix 2d point display
v4.0.72 - 2024-02-05
--------------------
diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md
index 5aa63679c..179015abc 100644
--- a/changelog/fr/changelog_2023-01-25.md
+++ b/changelog/fr/changelog_2023-01-25.md
@@ -2,6 +2,11 @@ v4.0.XX - 2099-12-31
--------------------
### Fonctionnalités/améliorations ###
+- formulaire géographique :
+ - affichage des coordonnées
+ - obtention des coordonnées depuis la géolocalisation
+- fiche géographique: affichage du tampon du point
+
#### Imports #####
- ajout de formulaire pré-imports
@@ -37,7 +42,9 @@ v4.0.XX - 2099-12-31
- tables RGPD : informations sur utilisateur, action, IP, IP routable
### Corrections de dysfonctionnements ###
-- fiche géo : retrait des fonctions de zoom et de sélection pour les points sans coordonnées x et y
+- fiche géo :
+ - retrait des fonctions de zoom et de sélection pour les points sans coordonnées x et y
+ - correction de l'affichage de points 2D
v4.0.72 - 2024-02-05
--------------------
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index c8686d7b3..e4438be43 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2430,9 +2430,9 @@ class GeoVectorData(Imported, OwnPerms):
if dim == 3:
coordinates.append(point.z)
else:
- if self.point_2d and dim == 2:
+ if self.point_2d:
geom = self.point_2d
- elif self.point_3d and dim == 3:
+ elif self.point_3d:
geom = self.point_3d
elif self.multi_points:
geom = self.multi_points.centroid
@@ -2639,6 +2639,8 @@ class GeoVectorData(Imported, OwnPerms):
round(coord, precision)
for coord in feature["geometry"]["coordinates"]
]
+ if self.buffer:
+ feature["properties"]["buffer"] = self.buffer
geojson_dct["features"] = features
try:
geojson_dct["link_template"] = simple_link_to_window(self).replace(
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index 394b27feb..3ee41e2d1 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -309,11 +309,43 @@ var cluster_get_style = function(feature, resolution){
var style = _styleCache[size];
if (!style && size == 1){
- style = _styleCache[size] = [get_icon_style()];
+ style = new Array();
+ if (ishtar_display_buffer){
+ let _current_feature = feature.getProperties()["features"][0];
+ let _feat_properties = _current_feature.getProperties();
+ let _buffer = _feat_properties["buffer"];
+ if (_buffer){
+ let point_resolution = ol.proj.getPointResolution(
+ map[_feat_properties["map_id"]].getView().getProjection(), 1,
+ _current_feature.getGeometry().flatCoordinates
+ );
+ let radius = _buffer * point_resolution / resolution * 2;
+ let color = "255,128,0";
+ style.push(
+ new ol.style.Style({
+ image: new ol.style.Circle({
+ radius: radius,
+ stroke: new ol.style.Stroke({
+ color:"rgba("+color+", 0.8)",
+ width: 2
+ }),
+ fill: new ol.style.Fill({
+ color:"rgba("+color+", 0.5)"
+ })
+ })
+ })
+
+ )
+ }
+ }
+ style.push(get_icon_style());
+ if (!ishtar_display_buffer){
+ _styleCache[size] = style;
+ }
} else if (!style && size > 1){
- var color = size > cluster_threshold_2 ? "192,0,0" : size > cluster_threshold_1 ? "255,128,0" : "0,128,0";
- var radius = Math.max(8, Math.min(size * 0.75, 20));
- var lbl = size.toString();
+ let color = size > cluster_threshold_2 ? "192,0,0" : size > cluster_threshold_1 ? "255,128,0" : "0,128,0";
+ let radius = Math.max(8, Math.min(size * 0.75, 20));
+ let lbl = size.toString();
style = _styleCache[size] = [
new ol.style.Style({
image: new ol.style.Circle({
@@ -734,6 +766,8 @@ var display_map = function(map_id, points, lines_and_polys, layers){
}
};
+var ishtar_display_buffer = false;
+
var display_points = function(map_id, points){
if (!points) return;
point_features[map_id] = geojson_format.readFeatures(points);
@@ -742,6 +776,7 @@ var display_points = function(map_id, points){
} else {
reinit_clustering(map_id);
}
+ point_features[map_id].forEach(function(feat){feat.set("map_id", map_id)});
cluster_source[map_id].getSource().addFeatures(point_features[map_id]);
};
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html
index 0a00a950b..8af6cd294 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_map.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html
@@ -86,6 +86,7 @@ const display_map_{{geo_item.SLUG}}_{{geo_item.pk}} = function() {
);
}
+ishtar_display_buffer = true;
display_map_{{geo_item.SLUG}}_{{geo_item.pk}}();
refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(true);
</script>