From 5292fa59426dc69c78b8aa21d0f862ff9282b143 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Wed, 4 May 2011 07:35:51 +0000 Subject: [PATCH] geography : geoperson - try to show animation better when we have big moves. geofamily - better message. svn: r17402 --- src/plugins/view/geofamily.py | 6 +++--- src/plugins/view/geoperson.py | 31 ++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/plugins/view/geofamily.py b/src/plugins/view/geofamily.py index 3fa9512f8..81a69f767 100644 --- a/src/plugins/view/geofamily.py +++ b/src/plugins/view/geofamily.py @@ -199,15 +199,15 @@ class GeoFamily(GeoGraphyView): dbstate.db.find_backlink_handles(event.handle) if ref_type == 'Family' ] - fnam = mnam = "" + fnam = mnam = _("Unknown") if family_list: for family in family_list: handle = family.get_father_handle() father = dbstate.db.get_person_from_handle(handle) handle = family.get_mother_handle() mother = dbstate.db.get_person_from_handle(handle) - fnam = _nd.display(father) if father else "???" - mnam = _nd.display(mother) if mother else "???" + fnam = _nd.display(father) if father else _("Unknown") + mnam = _nd.display(mother) if mother else _("Unknown") return ( fnam, mnam ) def _createpersonmarkers(self, dbstate, person, comment, fam_id): diff --git a/src/plugins/view/geoperson.py b/src/plugins/view/geoperson.py index 416d93ee4..7b02a5f5d 100644 --- a/src/plugins/view/geoperson.py +++ b/src/plugins/view/geoperson.py @@ -208,9 +208,17 @@ class GeoPerson(GeoGraphyView): heading = 1 if index == 0 and stepyear == 0: self.remove_all_gps() + self.large_move = False self.osm.gps_add(startlat, startlon, heading) endlat = float(marks[ni][3]) endlon = float(marks[ni][4]) + if stepyear < 9000: + if (( abs(float(endlat) - float(startlat)) > 3.0 ) or + ( abs(float(endlon) - float(startlon)) > 3.0 )): + self.large_move = True + stepyear = 9000 + else: + self.large_move = False # year format = YYYYMMDD ( for sort ) startyear = str(marks[i][6])[0:4] endyear = str(marks[ni][6])[0:4] @@ -218,11 +226,19 @@ class GeoPerson(GeoGraphyView): years = int(endyear) - int(startyear) if years < 1: years = 1 - latstep = ( endlat - startlat ) / years - lonstep = ( endlon - startlon ) / years - stepyear = 1 if stepyear < 1 else stepyear - startlat += ( latstep * stepyear ) - startlon += ( lonstep * stepyear ) + if stepyear > 8999: + latstep = ( endlat - startlat ) / 30 + lonstep = ( endlon - startlon ) / 30 + startlat += ( latstep * (stepyear - 8999) ) + startlon += ( lonstep * (stepyear - 8999) ) + print "shift : ", latstep, lonstep + else: + latstep = ( endlat - startlat ) / years + lonstep = ( endlon - startlon ) / years + stepyear = 1 if stepyear < 1 else stepyear + startlat += ( latstep * stepyear ) + startlon += ( lonstep * stepyear ) + print "position : ", startlat, startlon, stepyear self.osm.gps_add(startlat, startlon, heading) stepyear += 1 difflat = round(( startlat - endlat ) if startlat > endlat else \ @@ -231,9 +247,14 @@ class GeoPerson(GeoGraphyView): ( endlon - startlon ), 8) if ( difflat == 0.0 and difflon == 0.0 ): i += 1 + self.large_move = False stepyear = 1 # 100ms => 1s per 10 years. # For a 100 years person, it takes 10 secondes. + # if large_move, one step is the difflat or difflon / 30 + # in this case, stepyear is >= 9000 + # large move means longitude or latitude differences greater than 3.0 + # degrees. glib.timeout_add(100, self.animate, menu, marks, i, stepyear) return False