]> marstr Code Repo - orthographic/commitdiff
Re-enabled download of elevation, activated proper code in orthographic.py master
authorMarcus Str. <marcus@marstr.online>
Tue, 3 Dec 2024 15:23:52 +0000 (16:23 +0100)
committerMarcus Str. <marcus@marstr.online>
Tue, 3 Dec 2024 15:23:52 +0000 (16:23 +0100)
orthographic.py
xp_scenery.py

index b9fdd84402d598ad31bf9df2c3552f430fd3bd92..c16e705c4f3975001e3a54efd6796dce7c287658 100644 (file)
@@ -456,27 +456,14 @@ class mstr_orthographic:
         xpscn = mstr_xp_scenery(self._lat, self._long, maxlatlng[0], maxlatlng[1], self._vstep, self._latlngfld)\r
         mstr_msg("orthographic", "[X-Plane] Scenery object instantiated")\r
 \r
         xpscn = mstr_xp_scenery(self._lat, self._long, maxlatlng[0], maxlatlng[1], self._vstep, self._latlngfld)\r
         mstr_msg("orthographic", "[X-Plane] Scenery object instantiated")\r
 \r
-        # Generate the script\r
-        #xpscn.build_mesh_script()\r
-        #mstr_msg("orthographic", "[X-Plane] Mesh script written")\r
-\r
         # Download LIDAR scan from our endpoint\r
         # Download LIDAR scan from our endpoint\r
-        #xpscn.acquire_elevation_data()\r
-        #mstr_msg("orthographic", "[X-Plane] LIDAR scan acquired")\r
-\r
-        # Download required XES data\r
-        #xpscn.acquire_xes_data()\r
-        #mstr_msg("orthographic", "[X-Plane] MeshTool XES data acquired")\r
+        xpscn.acquire_elevation_data()\r
+        mstr_msg("orthographic", "[X-Plane] Elevation data acquired")\r
 \r
         # Generate the .ter files\r
         xpscn.build_ter_files()\r
         mstr_msg("orthographic", "[X-Plane] Terrain files (.ter) generated and written")\r
 \r
 \r
         # Generate the .ter files\r
         xpscn.build_ter_files()\r
         mstr_msg("orthographic", "[X-Plane] Terrain files (.ter) generated and written")\r
 \r
-        # Build mesh\r
-        #xpscn.build_mesh()\r
-        #xpscn._dsf_test()\r
-        #xpscn.build_and_convert_dsf()\r
-\r
         # And lastly, generate the mesh\r
         xpscn.generate_terrain_mesh()\r
         mstr_msg("orthographic", "[X-Plane] Scenery mesh constructed")\r
         # And lastly, generate the mesh\r
         xpscn.generate_terrain_mesh()\r
         mstr_msg("orthographic", "[X-Plane] Scenery mesh constructed")\r
index 2bfeee15be30dfd64fd26505752f72aada4481f8..0ba44d4495fb840135a56e9c07c860c898b78c48 100644 (file)
@@ -360,85 +360,6 @@ class mstr_xp_scenery:
                     curpatch = curpatch + 1
 
 
                     curpatch = curpatch + 1
 
 
-                    # Let's check if this tile needs water beneath
-                    """
-                    if self.does_ortho_have_water(str(lat) + "_" + str(lng)):
-
-                        # Begin a new patch
-                        with open(meshtxt, 'a') as textfile:
-                            textfile.write("BEGIN_PATCH " + str(curpatch) + " 0.000000 -1.000000 2 5\r\n")
-
-                        # Generate the ortho tile
-                        for y in range(0,odiv):
-                            for x in range(0,odiv):
-                                # Coordinates
-                                lat_b = round(base_lat + (y*latstep), 6)
-                                lat_t = round(base_lat + ((y+1)*latstep), 6)
-                                lng_l = round(base_lng + (x*lngstep), 6)
-                                lng_r = round(base_lng + ((x+1)*lngstep), 6)
-
-                                # Minimal adjustment
-                                if x == 0:
-                                    lng_l = base_lng
-                                if y == 0:
-                                    lat_b = base_lat
-                                if y == 3:
-                                    lat_t = base_lat + self._vstep
-                                if x == 3:
-                                    lng_r = base_lng + mstr_zl_18
-
-                                # Corrections, just in case
-                                if lat_b > self._lat + 1: lat_b = self._lat+1
-                                if lat_t > self._lat + 1: lat_t = self._lat+1
-                                if lng_l > self._lng + 1: lng_l = self._lng+1
-                                if lng_r > self._lng + 1: lng_r = self._lng+1
-
-                                hgt_bl_idx = self.find_height_for_coord([lat_b, lng_l])
-                                hgt_br_idx = self.find_height_for_coord([lat_b, lng_r])
-                                hgt_tr_idx = self.find_height_for_coord([lat_t, lng_r])
-                                hgt_tl_idx = self.find_height_for_coord([lat_t, lng_l])
-                                hgt_bl = round(self._demcoord[ hgt_bl_idx[0] ][ hgt_bl_idx[1] ][2] - .01, 6)
-                                hgt_br = round(self._demcoord[ hgt_br_idx[0] ][ hgt_br_idx[1] ][2] - .01, 6)
-                                hgt_tr = round(self._demcoord[ hgt_tr_idx[0] ][ hgt_tr_idx[1] ][2] - .01, 6)
-                                hgt_tl = round(self._demcoord[ hgt_tl_idx[0] ][ hgt_tl_idx[1] ][2] - .01, 6)
-
-                                # Coords of triangle vertices
-                                # 0 - Longitude
-                                # 1 - Latitude
-                                # 2 - Height in m
-                                t1_v1 = [ lng_r, lat_b, hgt_br ]
-                                t1_v2 = [ lng_l, lat_t, hgt_tl ]
-                                t1_v3 = [ lng_r, lat_t, hgt_tr ]
-                                t2_v1 = [ lng_l, lat_t, hgt_tl ]
-                                t2_v2 = [ lng_r, lat_b, hgt_br ]
-                                t2_v3 = [ lng_l, lat_b, hgt_bl ]
-
-                                # Write down the two triangles
-                                t_str = ""
-                                t_str = t_str + "BEGIN_PRIMITIVE 0\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t1_v1[0]) + " " + str(t1_v1[1]) + " " + str(t1_v1[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t1_v2[0]) + " " + str(t1_v2[1]) + " " + str(t1_v2[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t1_v3[0]) + " " + str(t1_v3[1]) + " " + str(t1_v3[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "END_PRIMITIVE 0\r\n"
-                                t_str = t_str + "BEGIN_PRIMITIVE 0\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t2_v1[0]) + " " + str(t2_v1[1]) + " " + str(t2_v1[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t2_v2[0]) + " " + str(t2_v2[1]) + " " + str(t2_v2[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "PATCH_VERTEX " + str(t2_v3[0]) + " " + str(t2_v3[1]) + " " + str(t2_v3[2]) + " 0.000015 0.000015\r\n"
-                                t_str = t_str + "END_PRIMITIVE 0\r\n"
-
-                                # Send to the file
-                                with open(meshtxt, 'a') as textfile:
-                                    textfile.write(t_str)
-
-                        # End this patch
-                        with open(meshtxt, 'a') as textfile:
-                            textfile.write("END PATCH\r\n")
-
-                        # Increase patch number
-                        curpatch = curpatch + 1
-                    """
-
-
 
 
     # Find the next best matching height for a point
 
 
     # Find the next best matching height for a point