New mechanism for resource allocation
This commit is contained in:
parent
f460964722
commit
ce631dc9f9
@ -468,16 +468,11 @@ class mstr_orthographic:
|
||||
tp._setLatLngFold(self._latlngfld)
|
||||
tp._setAlreadyVisitedTiles(self._tiles_visited[vstidx])
|
||||
tp._placeTileSources(mlat, mlng)
|
||||
self.adjust_tiles_visited(lyr[0], lyr[1], tp._all_visited)
|
||||
self.adjust_tiles_visited(vstidx, tp._all_visited)
|
||||
|
||||
|
||||
# Adjust the tiles visited for one resource
|
||||
def adjust_tiles_visited(self, tag, value, tiles):
|
||||
lyridx = -1
|
||||
for v in range(0, len(self._tiles_visited)):
|
||||
if self._tiles_visited[v][0][0] == tag and self._tiles_visited[v][0][1] == value:
|
||||
lyridx = v
|
||||
break
|
||||
def adjust_tiles_visited(self, lyridx, tiles):
|
||||
|
||||
for t in range(1, len(tiles)):
|
||||
fnd = False
|
||||
@ -486,7 +481,9 @@ class mstr_orthographic:
|
||||
fnd = True
|
||||
break
|
||||
if fnd == False:
|
||||
self._tiles_visited[lyridx].append((tiles[t][0], tiles[t][1]))
|
||||
if tiles[t][0] > 0 and tiles[t][1] > 0:
|
||||
self._tiles_visited[lyridx].append((tiles[t][0], tiles[t][1]))
|
||||
|
||||
|
||||
# Generates X-Plane 11/12 scenery with
|
||||
# - the finished orthos
|
||||
|
41
tileprep.py
41
tileprep.py
@ -314,26 +314,33 @@ class mstr_tileprep:
|
||||
# sources for every tile, thus evading previous edge detection errors
|
||||
def _placeTileSources(self, mlat, mlng):
|
||||
|
||||
# Initial scan "cross"
|
||||
visited = self._scanConnections((self._tile_v, self._tile_h))
|
||||
# Check if this tile was already processed
|
||||
alr_processed = self._checkVisited(self._already_visited, (self._tile_v, self._tile_h))
|
||||
|
||||
# Recursive scan of initial cross
|
||||
for v in range(len(visited)):
|
||||
vst = self._scanConnections((visited[v][0], visited[v][1]))
|
||||
for l in range(len(vst)):
|
||||
if self._checkVisited(visited, (vst[l][0], vst[l][1])) == False: visited.append((vst[l][0], vst[l][1]))
|
||||
# If this is not the case, we can proceed
|
||||
if alr_processed == False:
|
||||
|
||||
self._all_visited = visited
|
||||
|
||||
# We will take the resource of the original tile we have started
|
||||
# our scan from. If there is nothing, we can choose.
|
||||
# This is then used for all visited tiles.
|
||||
tv = self._tile_v
|
||||
th = self._tile_h
|
||||
resstring = self._selectResources()
|
||||
for v in range(0, len(visited)):
|
||||
self._storeResourceInfo(visited[v][0], visited[v][1], resstring)
|
||||
# Initial scan "cross"
|
||||
visited = self._scanConnections((self._tile_v, self._tile_h))
|
||||
|
||||
# Recursive scan of initial cross
|
||||
for v in range(len(visited)):
|
||||
vst = self._scanConnections((visited[v][0], visited[v][1]))
|
||||
for l in range(len(vst)):
|
||||
if self._checkVisited(visited, (vst[l][0], vst[l][1])) == False: visited.append((vst[l][0], vst[l][1]))
|
||||
|
||||
self._all_visited = visited
|
||||
|
||||
# We will take the resource of the original tile we have started
|
||||
# our scan from. If there is nothing, we can choose.
|
||||
# This is then used for all visited tiles.
|
||||
tv = self._tile_v
|
||||
th = self._tile_h
|
||||
|
||||
resstring = self._selectResources()
|
||||
|
||||
for v in range(0, len(visited)):
|
||||
self._storeResourceInfo(visited[v][0], visited[v][1], resstring)
|
||||
|
||||
|
||||
# Check if a tile was visited
|
||||
|
Loading…
x
Reference in New Issue
Block a user