diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index 8774158c340752e3479b07670132f8a29d1b7895..a2fc845cfd558cad7be52f9f575d636ede8550dd 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -362,6 +362,10 @@ class PILSVG(PILGL): "Scenery-Bergwelt_A_Teil_3_rechts.svg" ] + scenery_files_water = [ + "Scenery_Water.svg" + ] + img_back_ground = self.pil_from_svg_file('svg', "Background_Light_green.svg") self.scenery = [] @@ -382,6 +386,13 @@ class PILSVG(PILGL): img = Image.alpha_composite(img_back_ground, img) self.scenery_d3.append(img) + self.scenery_water = [] + for file in scenery_files_water: + img = self.pil_from_svg_file('svg', file) + img = Image.alpha_composite(img_back_ground, img) + self.scenery_water.append(img) + + def load_rail(self): """ Load the rail SVG images, apply rotations, and store as PIL images. """ @@ -513,10 +524,10 @@ class PILSVG(PILGL): city_size = 1 if num_agents is not None: - city_size = max(1,np.log(1+num_agents)/1.5) + city_size = max(1, np.log(1 + num_agents) / 1.5) if binary_trans == 0: - if self.background_grid[col][row] <= 4 + np.ceil(((col * row + col) % 10)/city_size): + if self.background_grid[col][row] <= 4 + np.ceil(((col * row + col) % 10) / city_size): a = int(self.background_grid[col][row]) a = a % len(self.dBuildings) if (col + row + col * row) % 13 > 11: @@ -533,7 +544,10 @@ class PILSVG(PILGL): if a2 % 64 > 11: a = a2 a_l = a % len(self.scenery) - pil_track = self.scenery[a_l] + if a2 % 50 == 49: + pil_track = self.scenery_water[0] + else: + pil_track = self.scenery[a_l] if rail_grid is not None: if a2 % 11 > 3: if a_l == len(self.scenery) - 1: diff --git a/svg/Scenery_Water.svg b/svg/Scenery_Water.svg new file mode 100644 index 0000000000000000000000000000000000000000..27ae56d073db82857a6fec28ddd5d0f73e87c11f --- /dev/null +++ b/svg/Scenery_Water.svg @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Ebene_1" + x="0px" + y="0px" + viewBox="0 0 240 240" + style="enable-background:new 0 0 240 240;" + xml:space="preserve" + sodipodi:docname="Scenery_Water.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata + id="metadata47"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs + id="defs45"> + + + + + + + + + + + + + + + + +</defs><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1017" + id="namedview43" + showgrid="false" + inkscape:zoom="0.98333333" + inkscape:cx="-102.20339" + inkscape:cy="120" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + inkscape:current-layer="Ebene_1" /> +<style + type="text/css" + id="style2"> + .st0{fill:none;} + .st1{fill:#8B5420;} + .st2{fill:#A8642A;} + .st3{fill:#5DAD61;} + .st4{fill:#418050;} +</style> +<g + id="g6"> + <rect + x="0" + class="st0" + width="240" + height="240" + id="rect4" /> +</g> + +<g + id="g980" + style="fill:#4cc1ff;fill-opacity:1;stroke-width:1.70416141" + transform="matrix(0.58536585,0,0,0.5882353,319.96693,139.86042)"><ellipse + ry="26.440678" + rx="141.86441" + cy="-48.81356" + cx="-355.42374" + id="path948" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="39.661018" + rx="77.796608" + cy="6.1016951" + cx="-228.30508" + id="path950" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="15.762712" + rx="30" + cy="7.6271186" + cx="-216.1017" + id="path952" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="21.864407" + rx="92.033897" + cy="-12.711864" + cx="-333.05084" + id="path954" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="38.135593" + rx="65.593224" + cy="-21.864407" + cx="-457.11865" + id="path956" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="19.830509" + rx="140.84746" + cy="18.813559" + cx="-349.32202" + id="path958" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="10.677966" + rx="62.542374" + cy="-36.101696" + cx="-264.91525" + id="path960" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="46.271187" + rx="77.288132" + cy="-17.79661" + cx="-253.22034" + id="path962" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="36.610168" + rx="56.440678" + cy="-28.474577" + cx="-456.10168" + id="path964" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /><ellipse + ry="20.338984" + rx="79.322037" + cy="24.40678" + cx="-446.44067" + id="path966" + style="opacity:1;fill:#4cc1ff;fill-opacity:1;stroke:none;stroke-width:1.70416141;stroke-opacity:1" /></g></svg> \ No newline at end of file