\n")
if maxpages > 1:
message = _("There are %d markers to display. They are split up "
"over %d pages of %d markers : " % (self.nbmarkers,
maxpages, NB_MARKERS_PER_PAGE))
self.mapview.write("%s
\n" % message)
if curpage != 1:
priorfile = os.path.join(GEOVIEW_SUBPATH,
"GeoV-%c-%05d.html" %
(ftype, curpage-1))
priorfile = urlparse.urlunsplit(
('file', '',
URL_SEP.join(priorfile.split(os.sep)),
'', ''))
self.mapview.write("
--" % priorfile)
else:
self.mapview.write(" --")
for page in range(1, maxpages+1, 1):
if page == curpage:
self.mapview.write(" %d" % page)
else:
if ( page < curpage + 11 ) and ( page > curpage - 11 ):
nextfile = os.path.join(GEOVIEW_SUBPATH,
"GeoV-%c-%05d.html" % \
(ftype, page))
nextfile = urlparse.urlunsplit(
('file', '',
URL_SEP.join(nextfile.split(os.sep)),
'', ''))
self.mapview.write("\n
%d" %
(nextfile, page))
if curpage != maxpages:
nextfile = os.path.join(GEOVIEW_SUBPATH,
"GeoV-%c-%05d.html" % (ftype, curpage+1))
nextfile = urlparse.urlunsplit(
('file', '',
URL_SEP.join(nextfile.split(os.sep)),
'', ''))
self.mapview.write("\n
++" % nextfile)
else:
self.mapview.write(" ++")
if self.without != 0:
self.without_coord_file = os.path.join(GEOVIEW_SUBPATH,
"without_coord.html")
self.mapview.write("
\n" )
self._createpageplaceswithoutcoord()
if self.displaytype != "places":
self.mapview.write("
\n")
self.mapview.write("
%s
" % h3mess)
if h4mess:
self.mapview.write("
%s
" % h4mess)
margin = 10
self.mapview.write("
\n")
self.mapview.write("")
self.mapview.write(_("You have no places in your family tree "
" with coordinates."))
self.mapview.write("
")
self.mapview.write(_("You are looking at the default map."))
self.mapview.write("
\");\n")
self._set_icon(None, True, 1)
self.mapview.write(" mapstraction.addMarker(my_marker);")
self.mapview.write("\n}")
self.mapview.write("\n\n")
def _createpersonmarkers(self, dbstate, person, comment):
"""
Create all markers for the specified person.
"""
latitude = ""
longitude = ""
if person:
birth_ref = person.get_birth_ref()
if birth_ref:
birth = dbstate.db.get_event_from_handle(birth_ref.ref)
birthdate = birth.get_date_object()
birthyear = birthdate.get_year()
bplace_handle = birth.get_place_handle()
if bplace_handle:
place = dbstate.db.get_place_from_handle(bplace_handle)
if place:
longitude = place.get_longitude()
latitude = place.get_latitude()
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
if comment:
descr1 = _("%(comment)s : birth place.") % {
'comment': comment}
else:
descr1 = _("birth place.")
descr = place.get_title()
# place.get_longitude and place.get_latitude return
# one string. We have coordinates when the two values
# contains non null string.
if ( longitude and latitude ):
self._append_to_places_list(descr,
gen.lib.EventType.BIRTH,
_nd.display(person),
latitude, longitude,
descr1,
int(self.center),
birthyear,
birth.get_type()
)
self.center = False
else:
self._append_to_places_without_coord(
place.gramps_id, descr)
latitude = ""
longitude = ""
death_ref = person.get_death_ref()
if death_ref:
death = dbstate.db.get_event_from_handle(death_ref.ref)
deathdate = death.get_date_object()
deathyear = deathdate.get_year()
dplace_handle = death.get_place_handle()
if dplace_handle:
place = dbstate.db.get_place_from_handle(dplace_handle)
if place:
longitude = place.get_longitude()
latitude = place.get_latitude()
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
if comment:
descr1 = _("%(comment)s : death place.") % {
'comment': comment}
else:
descr1 = _("death place.")
# place.get_longitude and place.get_latitude return
# one string. We have coordinates when the two values
# contains non null string.
if ( longitude and latitude ):
self._append_to_places_list(descr,
gen.lib.EventType.DEATH,
_nd.display(person),
latitude, longitude,
descr1,
int(self.center),
deathyear,
death.get_type()
)
self.center = False
else:
self._append_to_places_without_coord(
place.gramps_id, descr)
def _createmapstractionplaces(self, dbstate):
"""
Create the marker for each place in the database which has a lat/lon.
"""
self.place_list = []
self.place_without_coordinates = []
self.minlat = 0.0
self.maxlat = 0.0
self.minlon = 0.0
self.maxlon = 0.0
self.minyear = 9999
self.maxyear = 0
latitude = ""
longitude = ""
self.center = True
for place in dbstate.db.iter_places():
descr = place.get_title()
descr1 = _("Id : %s") % place.gramps_id
longitude = place.get_longitude()
latitude = place.get_latitude()
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
# place.get_longitude and place.get_latitude return
# one string. We have coordinates when the two values
# contains non null string.
if ( longitude and latitude ):
self._append_to_places_list(descr, None, "",
latitude, longitude,
descr1, self.center, None,
gen.lib.EventType.UNKNOWN)
self.center = False
else:
self._append_to_places_without_coord(place.gramps_id, descr)
if self.center:
mess = _("Cannot center the map. No location with coordinates.")
else:
mess = ""
self._create_pages(1,
_("All places in the family tree with coordinates."),
mess)
def _createmapstractionevents(self, dbstate):
"""
Create one marker for each place associated with an event in the database
which has a lat/lon.
"""
self.place_list = []
self.place_without_coordinates = []
self.minlat = 0.0
self.maxlat = 0.0
self.minlon = 0.0
self.maxlon = 0.0
self.minyear = 9999
self.maxyear = 0
latitude = ""
longitude = ""
self.center = True
for event in dbstate.db.iter_events():
place_handle = event.get_place_handle()
eventdate = event.get_date_object()
eventyear = eventdate.get_year()
if place_handle:
place = dbstate.db.get_place_from_handle(place_handle)
if place:
descr1 = place.get_title()
longitude = place.get_longitude()
latitude = place.get_latitude()
latitude, longitude = conv_lat_lon(latitude, longitude,
"D.D8")
city = place.get_main_location().get_city()
country = place.get_main_location().get_country()
# place.get_longitude and place.get_latitude return
# one string. We have coordinates when the two values
# contains non null string.
if ( longitude and latitude ):
person_list = [
dbstate.db.get_person_from_handle(ref_handle)
for (ref_type, ref_handle) in
dbstate.db.find_backlink_handles(event.handle)
if ref_type == 'Person'
]
if person_list:
descr2 = event.get_type()
for person in person_list:
descr2 = ("%(description)s - %(name)s") % {
'description' : descr2,
'name' : _nd.display(person)}
descr = ("%(eventtype)s;"+
" %(place)s%(description)s"
) % { 'eventtype': gen.lib.EventType(
event.get_type()
),
'place': place.get_title(),
'description': descr2}
else:
descr = ("%(eventtype)s; %(place)s