def _graph_bounds(self): 'Vrati hranice grafu ako signed georect.' graph_header = self.gfile.read_header() bounds = graph_header['bounds'] sw = gps.signed_position(bounds[0][0], bounds[0][1]) ne = gps.signed_position(bounds[1][0], bounds[1][1]) return gps.georect(sw, ne)
def _graph_gps_bounds(self): b = self._graph_bounds() sw = gps.gpspos(b.sw.lat/float(1e7), b.sw.lon/float(1e7)) ne = gps.gpspos(b.ne.lat/float(1e7), b.ne.lon/float(1e7)) assert valid_bounds(b), 'invalid bounds' return gps.georect(sw, ne)
def qrect_to_grect(qrect): 'skonvertuje qtrect na gps.georect' r = qrect sw = r.topLeft() ne = r.bottomRight() return gps.georect(gps.gpspos(sw.x(), sw.y()), gps.gpspos(ne.x(), ne.y()))