Skip to content

Commit f0dc1e8

Browse files
committed
editoast: add sprites endpoint used by map libre
1 parent e32e129 commit f0dc1e8

17 files changed

+467
-0
lines changed

editoast/Cargo.lock

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editoast/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ image = "0.24"
3535
json-patch = "1.1.0"
3636
pathfinding = "4.3.2"
3737
rand = "0.8.5"
38+
actix-files = "0.6.2"
3839
actix-web = "4.4.0"
3940
actix-http = "3.4.0"
4041
actix-cors = "0.6.4"

editoast/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ RUN apt update -yqq && \
3333
COPY --from=builder /usr/local/cargo/bin/editoast /usr/local/bin/editoast
3434
COPY --from=builder /usr/local/cargo/bin/diesel /usr/local/bin/diesel
3535
COPY --from=builder /app/migrations /migrations
36+
COPY --from=builder /app/src/assets /assets
3637

3738
ARG OSRD_GIT_DESCRIBE
3839
ENV OSRD_GIT_DESCRIBE=${OSRD_GIT_DESCRIBE}
40+
ENV ASSETS_PATH=/assets
41+
3942
# We use jemalloc to reduce allocation fragmentation
4043
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
4144
CMD ["editoast", "runserver"]

editoast/openapi.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -4508,6 +4508,48 @@ paths:
45084508
type: array
45094509
description: Search results, the structure of the returned objects depend on their type
45104510
summary: Generic search endpoint
4511+
/sprites/signaling_systems/:
4512+
get:
4513+
description: This endpoint returns the list of supported signaling systems
4514+
responses:
4515+
'200':
4516+
content:
4517+
application/json:
4518+
example:
4519+
- BAL
4520+
- TVM
4521+
schema:
4522+
items:
4523+
type: string
4524+
type: array
4525+
description: List of supported signaling systems
4526+
summary: This endpoint returns the list of supported signaling systems
4527+
tags:
4528+
- sprites
4529+
/sprites/{signaling_system}/{file_name}/:
4530+
get:
4531+
description: This endpoint is used by map libre to retrieve the atlas of each signaling system
4532+
parameters:
4533+
- description: Signaling system name
4534+
in: path
4535+
name: signaling_system
4536+
required: true
4537+
schema:
4538+
type: string
4539+
- description: Atlas file name (json or png) respecting map libre documentation
4540+
in: path
4541+
name: file_name
4542+
required: true
4543+
schema:
4544+
type: string
4545+
responses:
4546+
'200':
4547+
description: Atlas image of config
4548+
'404':
4549+
description: Signaling system not found
4550+
summary: This endpoint is used by map libre to retrieve the atlas of each signaling system
4551+
tags:
4552+
- sprites
45114553
/stdcm/:
45124554
post:
45134555
requestBody:

editoast/signal_sprites.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BAL:
2+
default: "S VL"
3+
sprites:
4+
- conditions:
5+
Nf: "true"
6+
sprite: "CARRE"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"CARRE": {
3+
"height": 128,
4+
"pixelRatio": 1,
5+
"width": 128,
6+
"x": 0,
7+
"y": 0
8+
},
9+
"CARRE A": {
10+
"height": 128,
11+
"pixelRatio": 1,
12+
"width": 128,
13+
"x": 128,
14+
"y": 0
15+
},
16+
"CARRE A CLI": {
17+
"height": 128,
18+
"pixelRatio": 1,
19+
"width": 128,
20+
"x": 0,
21+
"y": 128
22+
},
23+
"CARRE R30": {
24+
"height": 128,
25+
"pixelRatio": 1,
26+
"width": 128,
27+
"x": 128,
28+
"y": 128
29+
},
30+
"CARRE R60": {
31+
"height": 128,
32+
"pixelRatio": 1,
33+
"width": 128,
34+
"x": 256,
35+
"y": 0
36+
},
37+
"CARRE RR30": {
38+
"height": 128,
39+
"pixelRatio": 1,
40+
"width": 128,
41+
"x": 384,
42+
"y": 0
43+
},
44+
"CARRE RR60": {
45+
"height": 128,
46+
"pixelRatio": 1,
47+
"width": 128,
48+
"x": 256,
49+
"y": 128
50+
},
51+
"CARRE VL": {
52+
"height": 128,
53+
"pixelRatio": 1,
54+
"width": 128,
55+
"x": 384,
56+
"y": 128
57+
},
58+
"S": {
59+
"height": 128,
60+
"pixelRatio": 1,
61+
"width": 128,
62+
"x": 0,
63+
"y": 256
64+
},
65+
"S A": {
66+
"height": 128,
67+
"pixelRatio": 1,
68+
"width": 128,
69+
"x": 128,
70+
"y": 256
71+
},
72+
"S VL": {
73+
"height": 128,
74+
"pixelRatio": 1,
75+
"width": 128,
76+
"x": 256,
77+
"y": 256
78+
}
79+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"CARRE": {
3+
"height": 256,
4+
"pixelRatio": 2,
5+
"width": 256,
6+
"x": 0,
7+
"y": 0
8+
},
9+
"CARRE A": {
10+
"height": 256,
11+
"pixelRatio": 2,
12+
"width": 256,
13+
"x": 256,
14+
"y": 0
15+
},
16+
"CARRE A CLI": {
17+
"height": 256,
18+
"pixelRatio": 2,
19+
"width": 256,
20+
"x": 0,
21+
"y": 256
22+
},
23+
"CARRE R30": {
24+
"height": 256,
25+
"pixelRatio": 2,
26+
"width": 256,
27+
"x": 256,
28+
"y": 256
29+
},
30+
"CARRE R60": {
31+
"height": 256,
32+
"pixelRatio": 2,
33+
"width": 256,
34+
"x": 512,
35+
"y": 0
36+
},
37+
"CARRE RR30": {
38+
"height": 256,
39+
"pixelRatio": 2,
40+
"width": 256,
41+
"x": 768,
42+
"y": 0
43+
},
44+
"CARRE RR60": {
45+
"height": 256,
46+
"pixelRatio": 2,
47+
"width": 256,
48+
"x": 512,
49+
"y": 256
50+
},
51+
"CARRE VL": {
52+
"height": 256,
53+
"pixelRatio": 2,
54+
"width": 256,
55+
"x": 768,
56+
"y": 256
57+
},
58+
"S": {
59+
"height": 256,
60+
"pixelRatio": 2,
61+
"width": 256,
62+
"x": 0,
63+
"y": 512
64+
},
65+
"S A": {
66+
"height": 256,
67+
"pixelRatio": 2,
68+
"width": 256,
69+
"x": 256,
70+
"y": 512
71+
},
72+
"S VL": {
73+
"height": 256,
74+
"pixelRatio": 2,
75+
"width": 256,
76+
"x": 512,
77+
"y": 512
78+
}
79+
}
Loading

0 commit comments

Comments
 (0)