1extern crate strum;
2use crate::svg_draw::svg_draw::{
3 WorkingStorageDrawPolyMorphNatal, WorkingStorageDrawPolyMorphTransit,
4};
5use libswe_sys::sweconst::Theme;
6use svg::node::element::path::{Data, Number};
7use svg::node::element::{Group, Path};
8use svg::Document;
9
10pub const HOUSE_SIZE: Number = 50.0;
11
12impl WorkingStorageDrawPolyMorphNatal {
13 pub fn houses_draw(&self, house: i16) -> Document {
14 draw_house(house, self.ws.theme)
15 }
16}
17
18impl WorkingStorageDrawPolyMorphTransit {
19 pub fn houses_draw(&self, house: i16) -> Document {
20 draw_house(house, self.ws.theme)
21 }
22}
23
24fn draw_house(house: i16, _theme: Theme) -> Document {
25 let size: (Number, Number) = (HOUSE_SIZE, HOUSE_SIZE);
26 let document: Document;
27 match house {
28 1 => {
29 let data = Data::new()
30 .move_to((22.9, 14.3)) .line_to((22.9, 14.3)) .line_by((-4.4, 2.4)) .line_to((17.8, 14.0)) .line_by((5.5, -2.9)) .horizontal_line_by(2.9) .vertical_line_by(25.1) .horizontal_line_by(-3.3) .vertical_line_to(14.3) .close(); let path = Path::new()
41 .set("fill", "black")
42 .set("stroke", "black")
43 .set("stroke-width", 0)
44 .set("d", data);
45 document = Document::new()
46 .set("viewBox", (0, 0, size.0, size.1))
47 .add(path);
48 },
49 2 => {
50 let data = Data::new()
51 .move_to((15.5, 36.2)) .vertical_line_by(-2.1) .line_by((2.7, -2.6)) .cubic_curve_by((6.4, -6.1, 9.3, -9.3, 9.3, -13.1)) .cubic_curve_by((0.0, -2.5, -1.2, -4.9, -5.0, -4.9)) .cubic_curve_by((-2.3, 0.0, -4.2, 1.2, -5.3, 2.1)) .line_by((-1.1, -2.4)) .cubic_curve_by((1.7, -1.5, 4.2, -2.6, 7.1, -2.6)) .cubic_curve_by((5.4, 0.0, 7.7, 3.7, 7.7, 7.3)) .cubic_curve_by((0.0, 4.6, -3.4, 8.4, -8.7, 13.5)) .line_by((-2.0, 1.9)) .vertical_line_by(0.1) .horizontal_line_by(11.3) .vertical_line_by(2.8) .horizontal_line_to(15.5) .close(); let path = Path::new()
68 .set("fill", "black")
69 .set("stroke", "black")
70 .set("stroke-width", 0)
71 .set("d", data);
72 document = Document::new()
73 .set("viewBox", (0, 0, size.0, size.1))
74 .add(path);
75 },
76 3 => {
77 let data = Data::new()
78 .move_to((16.3, 32.3)) .cubic_curve_by((1.0, 0.6, 3.2, 1.6, 5.6, 1.6)) .cubic_curve_by((4.4, 0.0, 5.7, -2.8, 5.7, -4.9)) .cubic_curve_by((0.0, -3.5, -3.2, -5.0, -6.5, -5.0)) .horizontal_line_by(-1.9) .vertical_line_by(-2.5) .horizontal_line_by(1.9) .cubic_curve_by((2.5, 0.0, 5.6, -1.3, 5.6, -4.2)) .cubic_curve_by((0.0, -2.0, -1.3, -3.8, -4.4, -3.8)) .cubic_curve_by((-2.0, 0.0, -3.9, 0.9, -5.0, 1.7)) .line_by((-0.9, -2.5)) .cubic_curve_by((1.3, -1.0, 3.9, -1.9, 6.6, -1.9)) .cubic_curve_by((4.9, 0.0, 7.2, 2.9, 7.2, 6.0)) .cubic_curve_by((0.0, 2.6, -1.5, 4.8, -4.6, 5.9)) .vertical_line_by(0.1) .cubic_curve_by((3.1, 0.6, 5.6, 2.9, 5.6, 6.5)) .cubic_curve_by((0.0, 4.0, -3.1, 7.5, -9.2, 7.5)) .cubic_curve_by((-2.8, 0.0, -5.3, -0.9, -6.5, -1.7)) .line_to((16.3, 32.3)) .close(); let path = Path::new()
99 .set("fill", "black")
100 .set("stroke", "black")
101 .set("stroke-width", 0)
102 .set("d", data);
103 document = Document::new()
104 .set("viewBox", (0, 0, size.0, size.1))
105 .add(path);
106 },
107 4 => {
108 let data = Data::new()
109 .move_to((26.0, 36.2)) .vertical_line_by(-6.8) .horizontal_line_to(14.4) .vertical_line_by(-2.2) .line_by((11.2, -16.0)) .horizontal_line_by(3.7) .vertical_line_by(15.6) .horizontal_line_by(3.5) .vertical_line_by(2.7) .horizontal_line_by(-3.5) .vertical_line_by(6.8) .horizontal_line_to(26.0) .close() .move_to((26.0, 26.7)) .vertical_line_by(-8.4) .cubic_curve_by((0.0, -1.3, 0.0, -2.6, 0.1, -3.9)) .horizontal_line_to(26.0) .cubic_curve_by((-0.8, 1.5, -1.4, 2.6, -2.1, 3.7)) .line_by((-6.1, 8.5)) .vertical_line_by(0.1) .horizontal_line_to(26.0) .close(); let path = Path::new()
132 .set("fill", "black")
133 .set("stroke", "black")
134 .set("stroke-width", 0)
135 .set("d", data);
136 document = Document::new()
137 .set("viewBox", (0, 0, size.0, size.1))
138 .add(path);
139 },
140 5 => {
141 let data = Data::new()
142 .move_to((30.5, 13.9)) .horizontal_line_by(-9.6) .line_by((-1.0, 6.5)) .cubic_curve_by((0.6, -0.1, 1.1, -0.2, 2.0, -0.2)) .cubic_curve_by((1.9, 0.0, 3.9, 0.4, 5.4, 1.4)) .cubic_curve_by((2.0, 1.1, 3.6, 3.3, 3.6, 6.5)) .cubic_curve_by((0.0, 4.9, -3.9, 8.6, -9.3, 8.6)) .cubic_curve_by((-2.7, 0.0, -5.1, -0.8, -6.3, -1.5)) .line_by((0.9, -2.6)) .cubic_curve_by((1.0, 0.6, 3.1, 1.4, 5.4, 1.4)) .cubic_curve_by((3.2, 0.0, 6.0, -2.1, 6.0, -5.4)) .cubic_curve_by((0.0, -3.2, -2.2, -5.6, -7.2, -5.6)) .cubic_curve_by((-1.4, 0.0, -2.5, 0.2, -3.5, 0.3)) .line_by((1.6, -12.1)) .horizontal_line_by(12.0) .vertical_line_to(13.9) .close(); let path = Path::new()
160 .set("fill", "black")
161 .set("stroke", "black")
162 .set("stroke-width", 0)
163 .set("d", data);
164 document = Document::new()
165 .set("viewBox", (0, 0, size.0, size.1))
166 .add(path);
167 },
168 6 => {
169 let data = Data::new()
170 .move_to((29.8, 13.5)) .cubic_curve_by((-0.7, 0.0, -1.6, 0.0, -2.5, 0.2)) .cubic_curve_by((-5.3, 0.9, -8.2, 4.8, -8.7, 8.9)) .horizontal_line_by(0.1) .cubic_curve_by((1.2, -1.6, 3.3, -2.9, 6.1, -2.9)) .cubic_curve_by((4.4, 0.0, 7.6, 3.2, 7.6, 8.1)) .cubic_curve_by((0.0, 4.6, -3.1, 8.8, -8.3, 8.8)) .cubic_curve_by((-5.4, 0.0, -8.9, -4.2, -8.9, -10.7)) .cubic_curve_by((0.0, -4.9, 1.8, -8.8, 4.2, -11.3)) .cubic_curve_by((2.1, -2.0, 4.9, -3.3, 8.0, -3.7)) .cubic_curve_by((1.0, -0.2, 1.9, -0.2, 2.5, -0.2)) .vertical_line_to(13.5) .close() .move_to((28.9, 28.0)) .cubic_curve_by((0.0, -3.6, -2.0, -5.8, -5.2, -5.8)) .cubic_curve_by((-2.0, 0.0, -3.9, 1.3, -4.9, 3.1)) .cubic_curve_by((-0.2, 0.4, -0.4, 0.9, -0.4, 1.5)) .cubic_curve_by((0.1, 4.1, 2.0, 7.2, 5.5, 7.2)) .cubic_curve_to((26.9, 34.0, 28.9, 31.6, 28.9, 28.0)) .close(); let path = Path::new()
191 .set("fill", "black")
192 .set("stroke", "black")
193 .set("stroke-width", 0)
194 .set("d", data);
195 document = Document::new()
196 .set("viewBox", (0, 0, size.0, size.1))
197 .add(path);
198 },
199 7 => {
200 let data = Data::new()
201 .move_to((31.8, 11.1)) .vertical_line_by(2.2) .line_to((20.9, 36.2)) .horizontal_line_by(-3.5) .line_to((28.3, 14.0)) .vertical_line_by(-0.1) .horizontal_line_to(16.0) .vertical_line_by(-2.8) .horizontal_line_to(31.8) .close(); let path = Path::new()
212 .set("fill", "black")
213 .set("stroke", "black")
214 .set("stroke-width", 0)
215 .set("d", data);
216 document = Document::new()
217 .set("viewBox", (0, 0, size.0, size.1))
218 .add(path);
219 },
220 8 => {
221 let data = Data::new()
222 .move_to((15.2, 29.8)) .cubic_curve_by((0.0, -3.2, 1.9, -5.4, 5.0, -6.7)) .line_by((0.0, -0.1)) .cubic_curve_by((-2.8, -1.3, -4.0, -3.5, -4.0, -5.6)) .cubic_curve_by((0.0, -4.0, 3.4, -6.7, 7.8, -6.7)) .cubic_curve_by((4.9, 0.0, 7.3, 3.1, 7.3, 6.2)) .cubic_curve_by((0.0, 2.1, -1.0, 4.4, -4.1, 5.9)) .vertical_line_by(0.1) .cubic_curve_by((3.1, 1.2, 5.1, 3.4, 5.1, 6.5)) .cubic_curve_by((0.0, 4.4, -3.7, 7.3, -8.5, 7.3)) .cubic_curve_to((18.4, 36.6, 15.2, 33.5, 15.2, 29.8)) .close() .move_to((28.7, 29.7)) .cubic_curve_by((0.0, -3.1, -2.1, -4.5, -5.5, -5.5)) .cubic_curve_by((-2.9, 0.8, -4.5, 2.8, -4.5, 5.2)) .cubic_curve_by((-0.1, 2.6, 1.8, 4.8, 5.0, 4.8)) .cubic_curve_to((26.8, 34.1, 28.7, 32.3, 28.7, 29.7)) .close() .move_to((19.4, 17.1)) .cubic_curve_by((0.0, 2.5, 1.9, 3.9, 4.8, 4.6)) .cubic_curve_by((2.2, -0.7, 3.8, -2.3, 3.8, -4.6)) .cubic_curve_by((0.0, -2.0, -1.2, -4.1, -4.2, -4.1)) .cubic_curve_to((20.9, 13.1, 19.4, 14.9, 19.4, 17.1)) .close(); let path = Path::new()
247 .set("fill", "black")
248 .set("stroke", "black")
249 .set("stroke-width", 0)
250 .set("d", data);
251 document = Document::new()
252 .set("viewBox", (0, 0, size.0, size.1))
253 .add(path);
254 },
255 9 => {
256 let data = Data::new()
257 .move_to((17.5, 33.8)) .cubic_curve_by((0.7, 0.1, 1.6, 0.0, 2.7, -0.1)) .cubic_curve_by((2.0, -0.3, 3.8, -1.1, 5.3, -2.4)) .cubic_curve_by((1.7, -1.5, 2.9, -3.7, 3.3, -6.7)) .horizontal_line_by(-0.1) .cubic_curve_by((-1.4, 1.7, -3.4, 2.7, -5.9, 2.7)) .cubic_curve_by((-4.5, 0.0, -7.4, -3.4, -7.4, -7.7)) .cubic_curve_by((0.0, -4.8, 3.4, -8.9, 8.6, -8.9)) .smooth_cubic_curve_by((8.3, 4.2, 8.3, 10.6)) .cubic_curve_by((0.0, 5.5, -1.9, 9.4, -4.3, 11.8)) .cubic_curve_by((-1.9, 1.9, -4.6, 3.1, -7.3, 3.4)) .cubic_curve_by((-1.2, 0.2, -2.3, 0.2, -3.1, 0.2)) .vertical_line_to(33.8) .close() .move_to((18.7, 19.4)) .cubic_curve_by((0.0, 3.1, 1.9, 5.3, 4.8, 5.3)) .cubic_curve_by((2.3, 0.0, 4.1, -1.1, 4.9, -2.6)) .cubic_curve_by((0.2, -0.3, 0.3, -0.7, 0.3, -1.2)) .cubic_curve_by((0.0, -4.3, -1.6, -7.6, -5.1, -7.6)) .cubic_curve_to((20.8, 13.2, 18.7, 15.8, 18.7, 19.4)) .close(); let path = Path::new()
279 .set("fill", "black")
280 .set("stroke", "black")
281 .set("stroke-width", 0)
282 .set("d", data);
283 document = Document::new()
284 .set("viewBox", (0, 0, size.0, size.1))
285 .add(path);
286 },
287 10 => {
288 let data1 = Data::new()
289 .move_to((13.0, 14.3)) .line_to((13.0, 14.3)) .line_by((-4.4, 2.4)) .line_to((7.9, 14.0)) .line_by((5.5, -2.9)) .horizontal_line_by(2.9) .vertical_line_by(25.1) .horizontal_line_to(13.0) .vertical_line_to(14.3) .close(); let data2 = Data::new()
300 .move_to((42.1, 23.4)) .cubic_curve_by((0.0, 8.5, -3.2, 13.3, -8.7, 13.3)) .cubic_curve_by((-4.9, 0.0, -8.2, -4.6, -8.3, -12.9)) .cubic_curve_by((0.0, -8.4, 3.6, -13.1, 8.7, -13.1)) .cubic_curve_to((39.1, 10.7, 42.1, 15.4, 42.1, 23.4)) .close() .move_to((28.5, 23.8)) .cubic_curve_by((0.0, 6.5, 2.0, 10.2, 5.1, 10.2)) .cubic_curve_by((3.5, 0.0, 5.1, -4.1, 5.1, -10.5)) .cubic_curve_by((0.0, -6.2, -1.6, -10.2, -5.1, -10.2)) .cubic_curve_to((30.6, 13.3, 28.5, 16.9, 28.5, 23.8)) .close(); let path1 = Path::new()
313 .set("fill", "black")
314 .set("stroke", "black")
315 .set("stroke-width", 0)
316 .set("d", data1);
317 let path2 = Path::new()
318 .set("fill", "black")
319 .set("stroke", "black")
320 .set("stroke-width", 0)
321 .set("d", data2);
322 let group = Group::new().add(path1).add(path2);
323 document = Document::new()
324 .set("viewBox", (0, 0, size.0, size.1))
325 .add(group);
326 },
327 11 => {
328 let data1 = Data::new()
329 .move_to((13.0, 14.3)) .line_to((13.0, 14.3)) .line_by((-4.4, 2.4)) .line_to((7.9, 14.0)) .line_by((5.5, -2.9)) .horizontal_line_by(2.9) .vertical_line_by(25.1) .horizontal_line_to(13.0) .vertical_line_to(14.3) .close(); let data2 = Data::new()
340 .move_to((32.8, 14.3)) .line_to((32.8, 14.3)) .line_by((-4.4, 2.4)) .line_to((27.7, 14.0)) .line_by((5.5, -2.9)) .horizontal_line_by(2.9) .vertical_line_by(25.1) .horizontal_line_by(-3.3) .vertical_line_to(14.3) .close(); let path1 = Path::new()
351 .set("fill", "black")
352 .set("stroke", "black")
353 .set("stroke-width", 0)
354 .set("d", data1);
355 let path2 = Path::new()
356 .set("fill", "black")
357 .set("stroke", "black")
358 .set("stroke-width", 0)
359 .set("d", data2);
360 let group = Group::new().add(path1).add(path2);
361 document = Document::new()
362 .set("viewBox", (0, 0, size.0, size.1))
363 .add(group);
364 },
365 12 => {
366 let data1 = Data::new()
367 .move_to((13.0, 14.3)) .line_to((13.0, 14.3)) .line_by((-4.4, 2.4)) .line_to((7.9, 14.0)) .line_by((5.5, -2.9)) .horizontal_line_by(2.9) .vertical_line_by(25.1) .horizontal_line_to(13.0) .vertical_line_to(14.3) .close(); let data2 = Data::new()
378 .move_to((25.4, 36.2)) .vertical_line_by(-2.1) .line_by((2.7, -2.6)) .cubic_curve_by((6.4, -6.1, 9.3, -9.3, 9.3, -13.1)) .cubic_curve_by((0.0, -2.5, -1.2, -4.9, -5.0, -4.9)) .cubic_curve_by((-2.3, 0.0, -4.2, 1.2, -5.3, 2.1)) .line_to((26.0, 13.2)) .cubic_curve_by((1.7, -1.5, 4.2, -2.6, 7.1, -2.6)) .cubic_curve_by((5.4, 0.0, 7.7, 3.7, 7.7, 7.3)) .cubic_curve_by((0.0, 4.6, -3.4, 8.4, -8.7, 13.5)) .line_by((-2.0, 1.9)) .vertical_line_by(0.1) .horizontal_line_by(11.3) .vertical_line_by(2.8) .horizontal_line_to(25.4) .close(); let path1 = Path::new()
395 .set("fill", "black")
396 .set("stroke", "black")
397 .set("stroke-width", 0)
398 .set("d", data1);
399 let path2 = Path::new()
400 .set("fill", "black")
401 .set("stroke", "black")
402 .set("stroke-width", 0)
403 .set("d", data2);
404 let group = Group::new().add(path1).add(path2);
405 document = Document::new()
406 .set("viewBox", (0, 0, size.0, size.1))
407 .add(group);
408 },
409 _ => document = Document::new(),
410 }
411 document
412}