]> marstr Code Repo - orthographic/commitdiff
Removed comments in some code, updated repoinfo
authorMarcus Str. <marcus@marstr.online>
Sun, 17 Nov 2024 08:11:52 +0000 (09:11 +0100)
committerMarcus Str. <marcus@marstr.online>
Sun, 17 Nov 2024 08:11:52 +0000 (09:11 +0100)
layergen.py
orthographic.py
photogen.py
repoinfo

index 21520ce04b44a1557bebc0341fb8e7449dcde27b..5b04f371b9a467c51d7e53852cfddfdd1fecd219 100644 (file)
@@ -199,14 +199,6 @@ class mstr_layergen:
             for p in ptc:\r
                 ptc_src.append(Image.open(p))\r
             mstr_msg("layergen", "Layer sources selected")\r
-\r
-            """\r
-            # OK! Load the mask\r
-            if self._is_completion == False:\r
-                mask = Image.open( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + ".png" )\r
-            if self._is_completion == True:\r
-                mask = Image.open( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_tile-completion.png" )\r
-            """\r
             \r
             # Generate an edge mask from the original\r
             osm_edge = mask.filter(ImageFilter.FIND_EDGES)\r
@@ -376,23 +368,6 @@ class mstr_layergen:
             mstr_msg("layergen", "Generating adjacent fades")\r
             adjfade = self.generate_adjacent_fades(mask)\r
 \r
-            # Determine if there are any fades, and if so, fade those in first before we save the layer\r
-            """\r
-            fade_fn = mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value\r
-            if os.path.isfile(fade_fn + "_fade_top.png") == True:\r
-                fade = Image.open(fade_fn + "_fade_top.png")\r
-                layer_comp.alpha_composite(fade)\r
-            if os.path.isfile(fade_fn + "_fade_right.png") == True:\r
-                fade = Image.open(fade_fn + "_fade_right.png")\r
-                layer_comp.alpha_composite(fade)\r
-            if os.path.isfile(fade_fn + "_fade_bottom.png") == True:\r
-                fade = Image.open(fade_fn + "_fade_bottom.png")\r
-                layer_comp.alpha_composite(fade)\r
-            if os.path.isfile(fade_fn + "_fade_left.png") == True:\r
-                fade = Image.open(fade_fn + "_fade_left.png")\r
-                layer_comp.alpha_composite(fade)\r
-            """\r
-\r
             layer_comp.alpha_composite(adjfade)\r
             mstr_msg("layergen", "Adjacent fading completed")\r
 \r
@@ -726,16 +701,6 @@ class mstr_layergen:
                         tree_shadow = tree_shadow.filter(ImageFilter.GaussianBlur(radius=2))\r
                         tree_shadow.alpha_composite(trees)\r
 \r
-                        # Save this separately, so that we can blur buildings, but not the trees\r
-                        #fn = mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_building_trees.png"\r
-\r
-                        #if os.path.isfile(fn) == True:\r
-                        #    extrees = Image.open(fn)\r
-                        #    extrees.alpha_composite(tree_shadow)\r
-                        #    extrees.save(fn)\r
-                        #else:\r
-                        #    tree_shadow.save(fn)\r
-\r
                 # Let's try this one on for size\r
                 bld_comp = Image.new("RGBA", (self._imgsize, self._imgsize))\r
                 details = details.filter(ImageFilter.GaussianBlur(radius=1))\r
index f316ac6b2b86d524dfad0caa4e297d998179758f..e5b515fd0537585b2fff6e017783f38f7194c32a 100644 (file)
@@ -221,10 +221,6 @@ class mstr_orthographic:
             # Let the user know\r
             mstr_msg("orthographic", "Generating orthophoto " + str(grid_lat) + "-" + str(grid_lng))\r
 \r
-            # Get the data\r
-            #osmxml.acquire_osm(cur_tile_y, cur_tile_x) # <- This acquires current OSM info\r
-            #mstr_msg("orthographic", "Acquired current OSM info from marstr.online repository")\r
-\r
             # Check for work to be done\r
             layers = self.determineLayerWork(osmxml)\r
 \r
index 3aad51d536a8d211fc7bec733530852dcbfb645c..a76534296631ab13394a1665a70f8a84b592548e 100644 (file)
@@ -46,86 +46,8 @@ class mstr_photogen:
         # First, we walk through all layers and blend them on top of each other, in order\r
         mstr_msg("photogen", "Merging layers")\r
 \r
-        """\r
-        # Note if we added building shadows\r
-        bldg_shadow_added = False\r
-\r
-        # Shadow merging\r
-        bldg_shadow = Image.new("RGBA", (self._imgsize, self._imgsize))\r
-        if mstr_shadow_enabled == True:\r
-            for l in mstr_ortho_layers:\r
-                if l[0] == "building":\r
-                    if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"):\r
-                        shd = Image.open(root_filename + l[0] + "-" + l[1] + "_layer_shadow.png")\r
-                        shd = shd.filter(ImageFilter.GaussianBlur(radius=2))\r
-                        bldg_shadow.alpha_composite(shd)\r
-        # Details merging\r
-        bldg_details = Image.new("RGBA", (self._imgsize, self._imgsize))\r
-        for l in mstr_ortho_layers:\r
-            if l[0] == "building":\r
-                if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_details.png"):\r
-                    dtl = Image.open(root_filename + l[0] + "-" + l[1] + "_layer_details.png")\r
-                    dtl = dtl.filter(ImageFilter.GaussianBlur(radius=1))\r
-                    bldg_details.alpha_composite(dtl)\r
-        # Building merging\r
-        bldg_main = Image.new("RGBA", (self._imgsize, self._imgsize))\r
-        for l in mstr_ortho_layers:\r
-            if l[0] == "building":\r
-                if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer.png"):\r
-                    bld = Image.open(root_filename + l[0] + "-" + l[1] + "_layer.png")\r
-                    bld = bld.filter(ImageFilter.GaussianBlur(radius=0.7))\r
-                    bldg_main.alpha_composite(bld)\r
-        # Trees merging\r
-        tree_main = Image.new("RGBA", (self._imgsize, self._imgsize))\r
-        for l in mstr_ortho_layers:\r
-            if l[0] == "building":\r
-                if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_building_trees.png"):\r
-                    trs= Image.open(root_filename + l[0] + "-" + l[1] + "_layer_building_trees.png")\r
-                    tree_main.alpha_composite(trs)\r
-        # Merge the building layers\r
-        bldg_final = Image.new("RGBA", (self._imgsize, self._imgsize))\r
-        bldg_final.alpha_composite(bldg_details)\r
-        #bldg_final.alpha_composite(bldg_shadow)\r
-        bldg_final.alpha_composite(tree_main)\r
-        bldg_final.alpha_composite(bldg_main)\r
-        """\r
-\r
         for l in layers:\r
             self._tile.alpha_composite(l)\r
-            """\r
-            if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer.png"):\r
-                # Need to divert in case we have shadows\r
-                if mstr_shadow_enabled == True:\r
-\r
-                    # Make sure building shadows appear below forests\r
-                    shdc = False\r
-                    for s in mstr_shadow_casters:\r
-                        if s[0] == l[0] and s[1] == l[1]:\r
-                            shdc = True\r
-                            break\r
-                    if shdc == True:\r
-                        if bldg_shadow_added == False:\r
-                            self._tile.alpha_composite(bldg_shadow)\r
-                            bldg_shadow_added = True\r
-\r
-                    if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"):\r
-                        if l[0] != "building":\r
-                            sn = root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"\r
-                            s_layer = Image.open(sn)\r
-                            self._tile.alpha_composite(s_layer)\r
-                if l[0] != "building":\r
-                    # Complete the file name based on the template\r
-                    fn = root_filename + l[0] + "-" + l[1] + "_layer.png"\r
-                    # Open the layer\r
-                    layer = Image.open(fn)\r
-                    if l[0] == "leisure" and l[1] == "pitch":\r
-                        layer = layer.filter(ImageFilter.GaussianBlur(radius=0.2))\r
-                    # Converge the layer with this image\r
-                    self._tile.alpha_composite(layer)\r
-            """\r
-\r
-        # Drop the buildings on top\r
-        #self._tile.alpha_composite(bldg_final)\r
 \r
 \r
         # When we have run through this loop, we will end up with a sandwiched\r
@@ -248,9 +170,6 @@ class mstr_photogen:
                     corrpix[x,y] = (0,0,0,0)\r
         \r
         # We are now in posession of the final image.\r
-\r
-        # Scale to correct size.\r
-        #self._tile = self._tile.resize((mstr_photores, mstr_photores), Image.Resampling.BILINEAR)\r
         \r
         # Contrast\r
         self._tile = ImageEnhance.Contrast(self._tile).enhance(1)\r
index fe7c88cc66ba902420612e5e113857c4ffa07b3b..cd082eb57b6ae875711a8c08ef1b4907f7d93871 100644 (file)
--- a/repoinfo
+++ b/repoinfo
@@ -101,21 +101,21 @@ Also in defines.py, you will find the single layers, along with their correspond
 Very simple.\r
 \r
 First step: \r
-[codebox]python og.py LATITUDE LONGITUDE true[/codebox]\r
+python og.py LATITUDE LONGITUDE true\r
 \r
 So for example\r
 \r
-[codebox]python main.py 51 7 true[codebox]\r
+python og.py 51 7 true\r
 \r
 This will generate a complete dataset containing which sources to use in which quadrant of the image grid.\r
 \r
 Then:\r
 \r
-[codebox]python og.py LATITUDE LONGITUDE NUMBER_OF_SIMULTANEOUS_IMAGES_TO_PRODUCE[/codebox]\r
+python og.py LATITUDE LONGITUDE NUMBER_OF_SIMULTANEOUS_IMAGES_TO_PRODUCE\r
 \r
 So for example\r
 \r
-[codebox]python main.py 51 7 32[codebox]\r
+python og.py 51 7 32\r
 \r
 This will generate 32 "orthos" at once. Which number you can use highly depends on the performance of your hardware.\r
 \r
@@ -125,7 +125,7 @@ ATTENTION! This process will take a considerable amount of time due to the work
 \r
 For X-Plane scenery, you will need to do this once step 2 is done:\r
 \r
-[codebox]python main.py 51 7 xpscenery[codebox]\r
+python og.py 51 7 xpscenery\r
 \r
 This will generate the terrain mesh and associate the textures with the mesh.\r
 \r