%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(" ++")
self.mapview.write("\n
\n")
if self.without != 0:
self.without_coord_file = os.path.join(GEOVIEW_SUBPATH,
"without_coord.html")
self.mapview.write("" %
( self.height/5 ) )
self.mapview.write("%s
" % mark[0])
if formatype == 1:
self.mapview.write("
%s" % mark[5])
elif formatype == 2:
self.mapview.write("
%s - %s" % (mark[7],
mark[5]))
elif formatype == 3:
self.mapview.write("
%s - %s" % (mark[7],
mark[5]))
elif formatype == 4:
self.mapview.write("
%s - %s" % (mark[7],
mark[5]))
else: # This marker already exists. add info.
if ( mark[8] and savetype != mark[8] ):
differtype = True
self.mapview.write("
%s - %s" % (mark[7], mark[5]))
ret = 1
for year in self.yearinmarker:
if year == mark[7]:
ret = 0
if (ret):
self.yearinmarker.append(mark[7])
else:
indm += 1
if self.nbmarkers > 0 and ininterval:
years = ""
if mark[2]:
for year in self.yearinmarker:
years += "%d " % year
years += "end"
self.mapview.write("
\");")
self.mapview.write("my_marker.setAttribute('year','%s');" % years)
self._set_icon(savetype, differtype, formatype)
self.mapview.write("mapstraction.addMarker(my_marker);")
if self.nbmarkers == 0:
# We have no valid geographic point to center the map.
longitude = 0.0
latitude = 0.0
self.mapview.write("\nvar point = new LatLonPoint")
self.mapview.write("(%s,%s);\n" % (latitude, longitude))
self.mapview.write(" mapstraction.setCenterAndZoom")
self.mapview.write("(point, %d);\n" % 2)
self.mapview.write(" my_marker = new Marker(point);\n")
self.mapview.write(" my_marker.setLabel")
self.mapview.write("(\"%s\");\n" % _("No location."))
self.mapview.write(" my_marker.setInfoBubble(\"")
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 = ""
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