Skip to content

Commit 2fa5908

Browse files
committed
merging 2025 mida viz updates with main
2 parents e7b7d9a + 10127a2 commit 2fa5908

5 files changed

Lines changed: 111 additions & 18 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ mp_visualize.egg-info
22
*.pyc
33
.DS_Store
44
.idea
5+
Icon*
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Generated by Django 4.2 on 2024-02-28 18:46
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('contenttypes', '0002_remove_content_type_name'),
12+
('auth', '0012_alter_user_first_name_max_length'),
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
('visualize', '0011_auto_20221102_1744'),
15+
]
16+
17+
operations = [
18+
migrations.AlterField(
19+
model_name='bookmark',
20+
name='content_type',
21+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related', to='contenttypes.contenttype'),
22+
),
23+
migrations.AlterField(
24+
model_name='bookmark',
25+
name='sharing_groups',
26+
field=models.ManyToManyField(blank=True, editable=False, related_name='%(app_label)s_%(class)s_related', to='auth.group', verbose_name='Share with the following groups'),
27+
),
28+
migrations.AlterField(
29+
model_name='bookmark',
30+
name='user',
31+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_related', to=settings.AUTH_USER_MODEL),
32+
),
33+
migrations.AlterField(
34+
model_name='userlayer',
35+
name='content_type',
36+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related', to='contenttypes.contenttype'),
37+
),
38+
migrations.AlterField(
39+
model_name='userlayer',
40+
name='sharing_groups',
41+
field=models.ManyToManyField(blank=True, editable=False, related_name='%(app_label)s_%(class)s_related', to='auth.group', verbose_name='Share with the following groups'),
42+
),
43+
migrations.AlterField(
44+
model_name='userlayer',
45+
name='user',
46+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_related', to=settings.AUTH_USER_MODEL),
47+
),
48+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Generated by Django 4.2 on 2024-04-11 21:35
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('visualize', '0012_alter_bookmark_content_type_and_more'),
10+
('visualize', '0012_userlayer_password_protected'),
11+
]
12+
13+
operations = [
14+
]

visualize/static/js/models.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,9 @@ function layerModel(options, parent) {
16641664
url: '/data_manager/get_layer_details/' + layer.id,
16651665
crossDomain: true,
16661666
success: function(data) {
1667+
if (data === undefined) {
1668+
console.error('Error: Received undefined data from the server.');
1669+
}
16671670
if (data.hasOwnProperty('layerName')) {
16681671
layer.layerName = data.layerName;
16691672
app.viewModel.layerIndex[layer.id.toString()] = layer;

visualize/static/js/scenarios.js

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,56 @@ var madrona = {
5353
stroke_color = $('#id_stroke_color').val();
5454
stroke_width = parseInt($('#id_stroke_width').val());
5555

56-
new_style = {
57-
"fill-color": fill_val,
58-
};
59-
if (stroke_width > 0) {
60-
new_style["stroke-color"] = stroke_color;
61-
new_style["stroke-width"] = stroke_width;
62-
63-
}
56+
// Allowing users a stroke-width of 0 would be cool, but
57+
// makes no sense for linestrings. Also 0-width strokes
58+
// are not yet respected when rendering the final style
59+
// after editing is done. Uncomment the code below once
60+
// that is fixed.
6461

65-
// app.map.drawingLayer.setStyle(new_style);
66-
67-
68-
app.map.drawingLayer.setStyle(
69-
new ol.style.Style({
62+
// if (stroke_width > 0) {
63+
line_poly_style = new ol.style.Style({
7064
fill: new ol.style.Fill({
71-
color: new_style['fill-color'],
65+
color: fill_val,
7266
}),
7367
stroke: new ol.style.Stroke({
74-
color: new_style['stroke-color'],
75-
width: new_style['stroke-width']
68+
color: stroke_color,
69+
width: stroke_width
70+
}),
71+
});
72+
point_style = new ol.style.Style({
73+
image: new ol.style.Circle({
74+
fill: new ol.style.Fill({
75+
color: fill_val,
76+
}),
77+
radius: 5,
78+
stroke: new ol.style.Stroke({
79+
color: stroke_color,
80+
width: stroke_width
81+
}),
7682
})
77-
})
78-
);
83+
});
84+
// } else {
85+
// line_poly_style = new ol.style.Style({
86+
// fill: new ol.style.Fill({
87+
// color: fill_val,
88+
// }),
89+
// });
90+
// point_style = new ol.style.Style({
91+
// image: new ol.style.Circle({
92+
// fill: new ol.style.Fill({
93+
// color: fill_val,
94+
// }),
95+
// radius: 5,
96+
// })
97+
// });
98+
// }
99+
100+
styles = [
101+
line_poly_style,
102+
point_style
103+
]
104+
105+
app.map.drawingLayer.setStyle(styles);
79106
}
80107

81108
$form.find('#id_color').on('change', function(e){

0 commit comments

Comments
 (0)