Re: Many changes in layers and markers



On Thu, Feb 10, 2011 at 7:49 PM, Robert Park <rbpark exolucere ca> wrote:
>            view.center_on(lat, lon)
>            assert view.get_property('latitude') == lat

More explicitely, I have a method like this:

    def go_back(self, button, view):
        """Return the map view to where the user last set it."""
        history = gconf_get("history") or self.default[:]
        print history[-1]
        lat, lon, zoom = history.pop()
        if valid_coords(lat, lon):
            view.center_on(lat, lon)
            print "lat wrong by: ", abs(view.get_property('latitude') - lat)
            print "lon wrong by: ", abs(view.get_property('longitude') - lon)
            view.set_zoom_level(zoom)
        gconf_set("history", history)

This is what happens when I run the app, search for my city (centering
on precise coordinates from a database), then close and re-open the
app several times:

$ jhbuild run ./gottengeography
[54.97761367069626, -113.90625, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[53.550507262191466, -113.46885681152344, 11]

$ jhbuild run ./gottengeography
[53.550507262191466, -113.46885681152344, 11]
lat wrong by:  0.611926705876
lon wrong by:  0.437393188477
[54.16283598972908, -113.90625, 11]

$ jhbuild run ./gottengeography
[54.16283598972908, -113.90625, 11]
lat wrong by:  0.814777680967
lon wrong by:  0.0
[54.97761367069626, -113.90625, 11]

$ jhbuild run ./gottengeography
[54.97761367069626, -113.90625, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[54.97761367069626, -113.90625, 11]

Note that the coords being printed represent the top of the 'history'
stack at application start and exit, and the one printed last always
matches up to the one printed first at the next invocation, this
indicates that the history values are not being corrupted anywhere in
gconf.

Here's another place where this is happening:

$ jhbuild run ./gottengeography
[54.97761367069626, -113.90625, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[49.884459646312806, -97.14729309082031, 11]

$ jhbuild run ./gottengeography
[49.884459646312806, -97.14729309082031, 11]
lat wrong by:  0.851995490698
lon wrong by:  1.29020690918
[50.73645513701065, -98.4375, 11]

$ jhbuild run ./gottengeography
[50.73645513701065, -98.4375, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[50.73645513701065, -98.4375, 11]


And here's a final test outside of Canada to make sure it's not just
us Canucks ;-)

$ jhbuild run ./gottengeography
[50.73645513701065, -98.4375, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[48.85342092943525, 2.34832763671875, 11]

$ jhbuild run ./gottengeography
[48.85342092943525, 2.34832763671875, 11]
lat wrong by:  0.069078334323
lon wrong by:  0.942077636719
[48.92295044225695, 1.40625, 11]

$ jhbuild run ./gottengeography
[48.92295044225695, 1.40625, 11]
lat wrong by:  0.915032010828
lon wrong by:  0.0
[49.83798245308485, 1.40625, 11]

$ jhbuild run ./gottengeography
[49.83798245308485, 1.40625, 11]
lat wrong by:  0.0
lon wrong by:  0.0
[49.83798245308485, 1.40625, 11]


I hope this helps you fix it soon ;-)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]