Geography : solved the get_degrees and get_bbox python calls. ( osmgpsmap changes )

svn: r20311
This commit is contained in:
Serge Noiraud 2012-09-02 09:11:55 +00:00
parent 9b42432844
commit 6a9cb1694e
2 changed files with 23 additions and 27 deletions

View File

@ -531,18 +531,15 @@ class GeoGraphyView(OsmGps, NavigationView):
""" """
Is this marker in the visible area ? Is this marker in the visible area ?
""" """
#return True bbox = self.osm.get_bbox()
# BUG here : how to replace that ?
pt1 = osmgpsmap.MapPoint.new_degrees(0.0, 0.0)
pt2 = osmgpsmap.MapPoint.new_degrees(0.0, 0.0)
bbox = self.osm.get_bbox(pt1,pt2)
print bbox
s_lon = lon + 10.0 s_lon = lon + 10.0
s_lat = lat + 10.0 s_lat = lat + 10.0
s_bbox_lat1 = bbox[0] + 10.0 pt1 = bbox[0]
s_bbox_lon1 = bbox[1] + 10.0 s_bbox_lat1 = pt1.rlat + 10.0
s_bbox_lat2 = bbox[2] + 10.0 s_bbox_lon1 = pt1.rlon + 10.0
s_bbox_lon2 = bbox[3] + 10.0 pt2 = bbox[1]
s_bbox_lat2 = pt2.rlat + 10.0
s_bbox_lon2 = pt2.rlon + 10.0
result = ( s_bbox_lat1 > s_lat > s_bbox_lat2 ) and \ result = ( s_bbox_lat1 > s_lat > s_bbox_lat2 ) and \
( s_bbox_lon1 < s_lon < s_bbox_lon2 ) ( s_bbox_lon1 < s_lon < s_bbox_lon2 )
return result return result
@ -586,13 +583,12 @@ class GeoGraphyView(OsmGps, NavigationView):
We must use function called by timeout to force map updates. We must use function called by timeout to force map updates.
""" """
level_start = self.osm.props.zoom level_start = self.osm.props.zoom
# BUG here : how to replace that ? p1lat, p1lon = self.begin_selection.get_degrees()
#p1lat, p1lon = self.begin_selection.get_degrees() p2lat, p2lon = self.end_selection.get_degrees()
#p2lat, p2lon = self.end_selection.get_degrees() #p1lat = 180 * self.begin_selection.rlat / pi
p1lat = 180 * self.begin_selection.rlat / pi #p1lon = 180 * self.begin_selection.rlon / pi
p1lon = 180 * self.begin_selection.rlon / pi #p2lat = 180 * self.end_selection.rlat / pi
p2lat = 180 * self.end_selection.rlat / pi #p2lon = 180 * self.end_selection.rlon / pi
p2lon = 180 * self.end_selection.rlon / pi
lat = p1lat + ( p2lat - p1lat ) / 2 lat = p1lat + ( p2lat - p1lat ) / 2
lon = p1lon + ( p2lon - p1lon ) / 2 lon = p1lon + ( p2lon - p1lon ) / 2
# We center the map on the center of the region # We center the map on the center of the region

View File

@ -249,10 +249,10 @@ class OsmGps():
Moving during selection Moving during selection
""" """
current = osmmap.convert_screen_to_geographic(int(event.x), int(event.y)) current = osmmap.convert_screen_to_geographic(int(event.x), int(event.y))
#lat, lon = current.get_degrees() lat, lon = current.get_degrees()
lat = 180 * current.rlat / pi #lat = 180 * current.rlat / pi
lon = 180 * current.rlon / pi #lon = 180 * current.rlon / pi
print event.x, event.y, lat, lon #print event.x, event.y, lat, lon
if self.zone_selection: if self.zone_selection:
# We draw a rectangle to show the selected region. # We draw a rectangle to show the selected region.
layer = self.get_selection_layer() layer = self.get_selection_layer()
@ -306,13 +306,13 @@ class OsmGps():
mouse button 2 : begin zone selection mouse button 2 : begin zone selection
mouse button 3 : call the menu mouse button 3 : call the menu
""" """
#lat, lon = self.osm.get_event_location(event).get_degrees() lat, lon = self.osm.get_event_location(event).get_degrees()
lat = 180 * self.osm.get_event_location(event).rlat / pi #lat = 180 * self.osm.get_event_location(event).rlat / pi
lon = 180 * self.osm.get_event_location(event).rlon / pi #lon = 180 * self.osm.get_event_location(event).rlon / pi
current = osm.convert_screen_to_geographic(int(event.x), int(event.y)) current = osm.convert_screen_to_geographic(int(event.x), int(event.y))
#lat, lon = current.get_degrees() lat, lon = current.get_degrees()
lat = 180 * current.rlat / pi #lat = 180 * current.rlat / pi
lon = 180 * current.rlon / pi #lon = 180 * current.rlon / pi
if event.button == 1: if event.button == 1:
if self.end_selection is not None: if self.end_selection is not None:
self.activate_selection_zoom(osm, event) self.activate_selection_zoom(osm, event)