Geography: pins very big when related to 2 places (#830)

Fixes #10644
This commit is contained in:
Serge Noiraud 2019-07-05 05:13:24 +02:00 committed by Sam Manzi
parent bb3a1d3609
commit 804c03b286

View File

@ -117,9 +117,9 @@ class MarkerLayer(GObject.GObject, osmgpsmap.MapLayer):
""" """
max_interval = self.max_value - self.nb_ref_by_places max_interval = self.max_value - self.nb_ref_by_places
min_interval = self.nb_ref_by_places - self.min_value min_interval = self.nb_ref_by_places - self.min_value
if max_interval == 0: # This to avoid divide by zero if max_interval <= 0: # This to avoid divide by zero
max_interval = 0.01 max_interval = 0.01
if min_interval == 0: # This to avoid divide by zero if min_interval <= 0: # This to avoid divide by zero
min_interval = 0.01 min_interval = 0.01
_LOG.debug("%s", time.strftime("start drawing : " _LOG.debug("%s", time.strftime("start drawing : "
"%a %d %b %Y %H:%M:%S", time.gmtime())) "%a %d %b %Y %H:%M:%S", time.gmtime()))
@ -127,13 +127,13 @@ class MarkerLayer(GObject.GObject, osmgpsmap.MapLayer):
# the icon size in 48, so the standard icon size is 0.6 * 48 = 28.8 # the icon size in 48, so the standard icon size is 0.6 * 48 = 28.8
size = 0.6 size = 0.6
mark = float(marker[2]) mark = float(marker[2])
if mark > self.nb_ref_by_places: if mark > self.nb_ref_by_places or max_interval > 3:
# at maximum, we'll have an icon size = (0.6 + 0.3) * 48 = 43.2 # at maximum, we'll have an icon size = (0.6 + 0.2) * 48 = 38.4
size += (0.3 * ((mark - self.nb_ref_by_places) size += (0.2 * ((mark - self.nb_ref_by_places)
/ max_interval)) / max_interval))
else: else:
# at minimum, we'll have an icon size = (0.6 - 0.3) * 48 = 14.4 # at minimum, we'll have an icon size = (0.6 - 0.2) * 48 = 19.2
size -= (0.3 * ((self.nb_ref_by_places - mark) size -= (0.2 * ((self.nb_ref_by_places - mark)
/ min_interval)) / min_interval))
conv_pt = osmgpsmap.MapPoint.new_degrees(float(marker[0][0]), conv_pt = osmgpsmap.MapPoint.new_degrees(float(marker[0][0]),