Compare commits

..

No commits in common. "1d37f31a7e6363b3c0bf7206860845f20a0e3d58" and "8aa59ef749ecfcff84f605ca07fb936e532d5151" have entirely different histories.

4 changed files with 6 additions and 29 deletions

View file

@ -24,7 +24,6 @@ To use Mappersons, follow these steps:
This YAML file has a structure that includes the following fields:
- `name`: The name of the person or entity.
- `image`: The image associated with the person or entity.
- `base`: The location where person is based. Identically to locations.yml
- `weeks`: A list of weeks, each containing:
- `location`: The location where tasks were performed. Identically to locations.yml
- `tasks`: A list of tasks performed during that week at that location.
@ -35,7 +34,6 @@ This YAML file has a structure that includes the following fields:
---
- name: Lisa Lurch
image: lurch_l.jpg
base: Hamburg
weeks:
21/2023:
- location: Hamburg
@ -47,7 +45,6 @@ This YAML file has a structure that includes the following fields:
- Maintenance NSP
- name: Walter Wiesel
image: wiesel_w.jpg
base: Hamburg
weeks:
21/2023:
- location: Teisnach

View file

@ -52,7 +52,7 @@
function loadWeek(locations) {
locations.map(location => {
L.marker([location.lat, location.lng], {
return L.marker([location.lat, location.lng], {
icon: L.icon({
iconUrl: location.icon,
iconAnchor: location.anchor
@ -60,12 +60,8 @@
})
.bindPopup(location.popup)
.addTo(markerLayer);
location.bases.map(base => {
return L.polyline([[location.lat, location.lng],[base.lat,base.lng]],{color: 'red', weight: 1}).addTo(markerLayer);
});
return;
});
map.addLayer(markerLayer);
map.addLayer(markerLayer)
}
</script>

View file

@ -59,7 +59,8 @@ def create_circle(image_paths):
# Cut out a circle from each image
circular_images = [circular_mask(img) for img in shrunk_images]
if len(circular_images) == 1:
return circular_images[0]
circular_images[0].save(output_path)
return
if len(circular_images) < 7:
output_img = arrange_images_in_circle(circular_images)
@ -84,7 +85,6 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
if week in person['weeks'].keys():
cur_name = person['name']
cur_image = person['image']
cur_base = person['base']
for task in person['weeks'][week]:
cur_loc = task['location']
cur_tasks = task['tasks']
@ -93,7 +93,6 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
if cur_name not in loc[cur_loc].keys():
loc[cur_loc][cur_name] = {
'image': cur_image,
'base': cur_base,
'tasks': []
}
loc[cur_loc][cur_name]['tasks'] += cur_tasks
@ -101,28 +100,14 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
w,y = week.split('/')
json_file = "cw_%s_%s.json" % (w,y)
for cur_loc, cur_persons in loc.items():
png_file = "%s_%s_%s.png" % (cur_loc.lower().replace(' ','_'),w,y)
png_file = "%s_%s_%s.png" % (cur_loc.lower(),w,y)
image_paths = [("persons/%s" % x['image']) for n,x in cur_persons.items()]
img = create_circle(image_paths)
img.save(output_path / Path(png_file))
bases = []
base_names = []
popup = "<h2>%s</h2>" % cur_loc
for cur_per, cur_info in cur_persons.items():
popup += "<h3>%s</h3>" % cur_per
popup += "</br>".join(cur_info['tasks'])
if cur_info['base'] != cur_loc:
base_names.append(cur_info['base'])
base_names = list(set(base_names))
for base in base_names:
l = [x for x in locations if x['name'] == base][0]
bases.append({
"city": base,
"lat": l['lat'],
"lng": l['lng'],
})
l = [x for x in locations if x['name'] == cur_loc][0]
week_json.append({
"city": cur_loc,
@ -130,8 +115,7 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
"lng": l['lng'],
"icon": png_file,
"anchor": [x//2 for x in img.size],
"popup": popup,
"bases": bases
"popup": popup
})
with open(output_path / Path(json_file),"w") as j:
json.dump(week_json, j)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 KiB

After

Width:  |  Height:  |  Size: 421 KiB