diff --git a/src/plugins/lib/maps/geography.py b/src/plugins/lib/maps/geography.py index 9b949c66b..9abdbedfb 100644 --- a/src/plugins/lib/maps/geography.py +++ b/src/plugins/lib/maps/geography.py @@ -117,6 +117,7 @@ class GeoGraphyView(OsmGps, NavigationView): ('geography.center-lon', 0.0), ('geography.map_service', constants.OPENSTREETMAP), + ('geography.max_places', 5000), ) def __init__(self, title, pdata, dbstate, uistate, @@ -435,7 +436,10 @@ class GeoGraphyView(OsmGps, NavigationView): Create a list of places with coordinates. """ found = any(p[0] == place for p in self.places_found) - if not found: + if not found and self.nbplaces < self._config.get("geography.max_places"): + # We only show the first "geography.max_places". + # over 3000 or 4000 places, the geography become unusable. + # In this case, filter the places ... self.nbplaces += 1 self.places_found.append([place, lat, longit]) self.place_list.append([place, name, evttype, lat, @@ -912,6 +916,8 @@ class GeoGraphyView(OsmGps, NavigationView): self._config.set('geography.path', config.get('geography.path')) self._config.set('geography.zoom_when_center', config.get('geography.zoom_when_center')) + self._config.set('geography.max_places', + self._config.get('geography.max_places')) table = gtk.Table(1, 1) table.set_border_width(12) table.set_col_spacings(6) @@ -930,6 +936,10 @@ class GeoGraphyView(OsmGps, NavigationView): _('Zoom used when centering'), 4, 'geography.zoom_when_center', (2, 16)) + configdialog.add_slider(table, + _('The maximum number of places to show'), + 5, 'geography.max_places', + (1000, 10000)) # there is no button. I need to found a solution for this. # it can be very dangerous ! if someone put / in geography.path ... # perhaps we need some contrĂ´l on this path : diff --git a/src/plugins/lib/maps/messagelayer.py b/src/plugins/lib/maps/messagelayer.py index 39a93d4b1..5190f8fee 100644 --- a/src/plugins/lib/maps/messagelayer.py +++ b/src/plugins/lib/maps/messagelayer.py @@ -128,7 +128,7 @@ class MessageLayer(gobject.GObject, osmgpsmap.GpsMapLayer): ctx.set_source_rgba(float(color.red / 65535.0), float(color.green / 65535.0), float(color.blue / 65535.0), - 0.6) # transparency + 0.9) # transparency coord_x = 100 coord_y = int(self.size) # Show the first line under the zoom button (d_width, d_height) = drawable.get_size() diff --git a/src/plugins/view/geoclose.py b/src/plugins/view/geoclose.py index 9d0c2d89c..70a04ace9 100644 --- a/src/plugins/view/geoclose.py +++ b/src/plugins/view/geoclose.py @@ -115,6 +115,7 @@ class GeoClose(GeoGraphyView): ('geography.center-lon', 0.0), ('geography.map_service', constants.OPENSTREETMAP), + ('geography.max_places', 5000), # specific to geoclose : diff --git a/src/plugins/view/geoevents.py b/src/plugins/view/geoevents.py index 44277ff50..bb52a1d24 100644 --- a/src/plugins/view/geoevents.py +++ b/src/plugins/view/geoevents.py @@ -201,6 +201,8 @@ class GeoEvents(GeoGraphyView): a lat/lon. """ dbstate = self.dbstate + if self.nbplaces >= self._config.get("geography.max_places"): + return descr = descr2 = "" place_handle = event.get_place_handle() eventyear = event.get_date_object().to_calendar(self.cal).get_year() diff --git a/src/plugins/view/geofamclose.py b/src/plugins/view/geofamclose.py index 671921512..ca02a1f4d 100644 --- a/src/plugins/view/geofamclose.py +++ b/src/plugins/view/geofamclose.py @@ -115,6 +115,7 @@ class GeoFamClose(GeoGraphyView): ('geography.center-lon', 0.0), ('geography.map_service', constants.OPENSTREETMAP), + ('geography.max_places', 5000), # specific to geoclose : diff --git a/src/plugins/view/geomoves.py b/src/plugins/view/geomoves.py index 119cd2f28..2a2e6c59f 100644 --- a/src/plugins/view/geomoves.py +++ b/src/plugins/view/geomoves.py @@ -117,6 +117,7 @@ class GeoMoves(GeoGraphyView): ('geography.center-lon', 0.0), ('geography.map_service', constants.OPENSTREETMAP), + ('geography.max_places', 5000), # specific to geoclose : diff --git a/src/plugins/view/geoperson.py b/src/plugins/view/geoperson.py index 6014bc4ae..1c0ed45f5 100644 --- a/src/plugins/view/geoperson.py +++ b/src/plugins/view/geoperson.py @@ -131,6 +131,7 @@ class GeoPerson(GeoGraphyView): #('geography.gps_increment', GPS_INCREMENT), ('geography.map_service', constants.OPENSTREETMAP), + ('geography.max_places', 5000), # specific to geoperson : diff --git a/src/plugins/view/geoplaces.py b/src/plugins/view/geoplaces.py index ea0827151..abd878942 100644 --- a/src/plugins/view/geoplaces.py +++ b/src/plugins/view/geoplaces.py @@ -201,6 +201,8 @@ class GeoPlaces(GeoGraphyView): """ if place is None: return + if self.nbplaces >= self._config.get("geography.max_places"): + return descr = place.get_title() longitude = place.get_longitude() latitude = place.get_latitude() @@ -240,7 +242,9 @@ class GeoPlaces(GeoGraphyView): latitude = "" longitude = "" self.nbmarkers = 0 + self.nbplaces = 0 self.message_layer.clear_messages() + self.message_layer.clear_font_attributes() self.no_show_places_in_status_bar = False # base "villes de france" : 38101 places : # createmap : 8'50"; create_markers : 1'23" @@ -281,8 +285,22 @@ class GeoPlaces(GeoGraphyView): _LOG.debug("%s" % time.strftime(" end sort : " "%a %d %b %Y %H:%M:%S", time.gmtime())) if self.nbmarkers > 500 : # performance issue. Is it the good value ? - self.message_layer.add_message(_("The place name in the status bar is disabled.")) + self.message_layer.add_message( + _("The place name in the status bar is disabled.")) self.no_show_places_in_status_bar = True + if self.nbplaces >= self._config.get("geography.max_places") : + self.message_layer.set_font_attributes(None,None,"red") + self.message_layer.add_message( + _("The maximum number of places is reached (%d)." % + self._config.get("geography.max_places"))) + self.message_layer.add_message( + _("Some information are missing.")) + self.message_layer.add_message( + _("Please, use filtering to reduce this number.")) + self.message_layer.add_message( + _("You can modify this value in the geography option.")) + self.message_layer.add_message( + _("In this case, it may take time to show all markers.")) self._create_markers() @@ -354,7 +372,8 @@ class GeoPlaces(GeoGraphyView): oldplace = mark[0] modify = gtk.MenuItem(mark[0]) modify.show() - modify.connect("activate", self.goto_place, float(mark[3]), float(mark[4])) + modify.connect("activate", self.goto_place, + float(mark[3]), float(mark[4])) itemoption.append(modify) def goto_place(self, obj, lat, lon):