Compare commits
No commits in common. "1d37f31a7e6363b3c0bf7206860845f20a0e3d58" and "8aa59ef749ecfcff84f605ca07fb936e532d5151" have entirely different histories.
1d37f31a7e
...
8aa59ef749
|
|
@ -24,7 +24,6 @@ To use Mappersons, follow these steps:
|
||||||
This YAML file has a structure that includes the following fields:
|
This YAML file has a structure that includes the following fields:
|
||||||
- `name`: The name of the person or entity.
|
- `name`: The name of the person or entity.
|
||||||
- `image`: The image associated with 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:
|
- `weeks`: A list of weeks, each containing:
|
||||||
- `location`: The location where tasks were performed. Identically to locations.yml
|
- `location`: The location where tasks were performed. Identically to locations.yml
|
||||||
- `tasks`: A list of tasks performed during that week at that location.
|
- `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
|
- name: Lisa Lurch
|
||||||
image: lurch_l.jpg
|
image: lurch_l.jpg
|
||||||
base: Hamburg
|
|
||||||
weeks:
|
weeks:
|
||||||
21/2023:
|
21/2023:
|
||||||
- location: Hamburg
|
- location: Hamburg
|
||||||
|
|
@ -47,7 +45,6 @@ This YAML file has a structure that includes the following fields:
|
||||||
- Maintenance NSP
|
- Maintenance NSP
|
||||||
- name: Walter Wiesel
|
- name: Walter Wiesel
|
||||||
image: wiesel_w.jpg
|
image: wiesel_w.jpg
|
||||||
base: Hamburg
|
|
||||||
weeks:
|
weeks:
|
||||||
21/2023:
|
21/2023:
|
||||||
- location: Teisnach
|
- location: Teisnach
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
function loadWeek(locations) {
|
function loadWeek(locations) {
|
||||||
locations.map(location => {
|
locations.map(location => {
|
||||||
L.marker([location.lat, location.lng], {
|
return L.marker([location.lat, location.lng], {
|
||||||
icon: L.icon({
|
icon: L.icon({
|
||||||
iconUrl: location.icon,
|
iconUrl: location.icon,
|
||||||
iconAnchor: location.anchor
|
iconAnchor: location.anchor
|
||||||
|
|
@ -60,12 +60,8 @@
|
||||||
})
|
})
|
||||||
.bindPopup(location.popup)
|
.bindPopup(location.popup)
|
||||||
.addTo(markerLayer);
|
.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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ def create_circle(image_paths):
|
||||||
# Cut out a circle from each image
|
# Cut out a circle from each image
|
||||||
circular_images = [circular_mask(img) for img in shrunk_images]
|
circular_images = [circular_mask(img) for img in shrunk_images]
|
||||||
if len(circular_images) == 1:
|
if len(circular_images) == 1:
|
||||||
return circular_images[0]
|
circular_images[0].save(output_path)
|
||||||
|
return
|
||||||
|
|
||||||
if len(circular_images) < 7:
|
if len(circular_images) < 7:
|
||||||
output_img = arrange_images_in_circle(circular_images)
|
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():
|
if week in person['weeks'].keys():
|
||||||
cur_name = person['name']
|
cur_name = person['name']
|
||||||
cur_image = person['image']
|
cur_image = person['image']
|
||||||
cur_base = person['base']
|
|
||||||
for task in person['weeks'][week]:
|
for task in person['weeks'][week]:
|
||||||
cur_loc = task['location']
|
cur_loc = task['location']
|
||||||
cur_tasks = task['tasks']
|
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():
|
if cur_name not in loc[cur_loc].keys():
|
||||||
loc[cur_loc][cur_name] = {
|
loc[cur_loc][cur_name] = {
|
||||||
'image': cur_image,
|
'image': cur_image,
|
||||||
'base': cur_base,
|
|
||||||
'tasks': []
|
'tasks': []
|
||||||
}
|
}
|
||||||
loc[cur_loc][cur_name]['tasks'] += cur_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('/')
|
w,y = week.split('/')
|
||||||
json_file = "cw_%s_%s.json" % (w,y)
|
json_file = "cw_%s_%s.json" % (w,y)
|
||||||
for cur_loc, cur_persons in loc.items():
|
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()]
|
image_paths = [("persons/%s" % x['image']) for n,x in cur_persons.items()]
|
||||||
img = create_circle(image_paths)
|
img = create_circle(image_paths)
|
||||||
img.save(output_path / Path(png_file))
|
img.save(output_path / Path(png_file))
|
||||||
bases = []
|
|
||||||
base_names = []
|
|
||||||
popup = "<h2>%s</h2>" % cur_loc
|
popup = "<h2>%s</h2>" % cur_loc
|
||||||
for cur_per, cur_info in cur_persons.items():
|
for cur_per, cur_info in cur_persons.items():
|
||||||
popup += "<h3>%s</h3>" % cur_per
|
popup += "<h3>%s</h3>" % cur_per
|
||||||
popup += "</br>".join(cur_info['tasks'])
|
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]
|
l = [x for x in locations if x['name'] == cur_loc][0]
|
||||||
week_json.append({
|
week_json.append({
|
||||||
"city": cur_loc,
|
"city": cur_loc,
|
||||||
|
|
@ -130,8 +115,7 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
|
||||||
"lng": l['lng'],
|
"lng": l['lng'],
|
||||||
"icon": png_file,
|
"icon": png_file,
|
||||||
"anchor": [x//2 for x in img.size],
|
"anchor": [x//2 for x in img.size],
|
||||||
"popup": popup,
|
"popup": popup
|
||||||
"bases": bases
|
|
||||||
})
|
})
|
||||||
with open(output_path / Path(json_file),"w") as j:
|
with open(output_path / Path(json_file),"w") as j:
|
||||||
json.dump(week_json, j)
|
json.dump(week_json, j)
|
||||||
|
|
|
||||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 471 KiB After Width: | Height: | Size: 421 KiB |
Loading…
Reference in a new issue