Commit 4054579f authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Putting cables into meshes for pylons. Therefore also removing obsolete parameters

parent 053acfc6
......@@ -399,8 +399,8 @@ def process(coords_transform: coordinates.Transformation, fg_elev: utilities.FGE
lmax = v.Vec2d(coords_transform.toLocal(cmax))
handled_clusters = list() # cluster.ClusterContainer objects
clusters_building_mesh_detailed = cluster.ClusterContainer(lmin, lmax)
clusters_building_mesh_detailed.stg_verb_type = stg_io2.STGVerbType.object_building_mesh_detailed
clusters_building_mesh_detailed = cluster.ClusterContainer(lmin, lmax,
stg_io2.STGVerbType.object_building_mesh_detailed)
handled_clusters.append(clusters_building_mesh_detailed)
clusters_building_mesh_rough = cluster.ClusterContainer(lmin, lmax,
stg_io2.STGVerbType.object_building_mesh_rough)
......@@ -466,7 +466,7 @@ def process(coords_transform: coordinates.Transformation, fg_elev: utilities.FGE
handled_index = 0
total_buildings_written = 0
for my_clusters in handled_clusters:
my_clusters.write_statistics("cluster_%d" % handled_index)
my_clusters.write_statistics_for_buildings("cluster_%d" % handled_index)
for ic, cl in enumerate(my_clusters):
number_of_buildings = len(cl.objects)
......
......@@ -101,21 +101,22 @@ class ClusterContainer(object):
for item in each_list:
yield item
def append(self, anchor: Vec2d, obj, stats: utils.utilities.Stats) -> Cluster:
def append(self, anchor: Vec2d, obj, stats: utils.utilities.Stats=None) -> Cluster:
"""Finds the cluster within the cluster grid where a given object's anchor point is situated and then
adds the object to that cluster."""
the_cluster = self(anchor)
the_cluster.objects.append(obj)
try:
# Local stats
self(anchor).stats.count(obj)
# Global stats
stats.count(obj)
except AttributeError:
pass
if stats is not None:
try:
# Local stats
self(anchor).stats.count(obj)
# Global stats
stats.count(obj)
except AttributeError:
pass
return the_cluster
def write_statistics(self, clusters_name: str) -> None:
def write_statistics_for_buildings(self, clusters_name: str) -> None:
if parameters.log_level_debug_or_lower() and parameters.WRITE_CLUSTER_STATS:
my_file = open(parameters.PREFIX + os.sep + clusters_name + ".dat", "w")
for j in range(self.max_grid.iy):
......
......@@ -164,20 +164,13 @@ CLUSTER_MIN_OBJECTS = 5 # -- discard cluster if too little objects
# =============================================================================
C2P_PROCESS_POWERLINES = True
C2P_PROCESS_POWERLINES_MINOR = False # only considered of C2P_PROCESS_POWERLINES is True
C2P_PROCESS_AERIALWAYS = False
C2P_PROCESS_OVERHEAD_LINES = True
C2P_PROCESS_OVERHEAD_LINES = False
C2P_PROCESS_WIND_TURBINES = True
C2P_PROCESS_STREETLAMPS = False
C2P_PROCESS_STORAGE_TANKS = True
# Each powerline and aerialway has segments delimited by pylons. The longer the value the better clustering and
# the better the performance. However due to rounding errors the longer the length per cluster the larger the
# error.
C2P_CLUSTER_POWER_LINE_MAX_LENGTH = 300
C2P_CLUSTER_AERIALWAY_MAX_LENGTH = 300
C2P_CLUSTER_OVERHEAD_LINE_MAX_LENGTH = 130
C2P_CABLES_NO_SHADOW = True
# The radius for the cable. The cable will be a triangle with side length 2*radius.
# In order to be better visible the radius might be chosen larger than in real life
C2P_RADIUS_POWER_LINE = 0.1
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment