Beispiel #1
0
 def getPostion(self):
     if len(self.response["features"]) == 0:
         return None
     toponym = self.response["features"][0]
     coords = toponym['geometry']['coordinates']
     toponym_longitude, toponym_lattitude = coords
     return Vector(float(toponym_longitude), float(toponym_lattitude))
Beispiel #2
0
 def __init__(self):
     self.position = Vector(0, 0)
     self.size = 1
     self.layer = "map"
     self.focusedAddress = None
     self.image = None
     self.markers = []
     self.update()
Beispiel #3
0
    def checkMouse(self, event):
        absX, absY = event.pos
        relX = absX - self.x
        relY = absY - self.y
        if relX >= self.width or relX < 0:
            return
        if relY >= self.height or relY < 0:
            return
        relCoords = Vector(relX - self.width // 2, -(relY - self.height // 2))

        pixelAbs = Vector(
            merc_x(MapClassObject.position.x, MapClassObject.size),
            merc_y(MapClassObject.position.y, MapClassObject.size))

        pixelAbs += relCoords

        lat, long = intoLatAndLong(pixelAbs.x, pixelAbs.y, MapClassObject.size)
        gradAbs = Vector(long, lat)
        self.callback(gradAbs, event)
Beispiel #4
0
def unitPositionSet(vect):
    positionDeltaX = 360 / (2**MapClassObject.size)
    positionDeltaY = 180 / (2**MapClassObject.size)
    return Vector(vect.x * positionDeltaX, vect.y * positionDeltaY)
Beispiel #5
0
 def getPostion(self):
     toponym = self.response["response"]["GeoObjectCollection"][
         "featureMember"][0]["GeoObject"]
     toponym_coodrinates = toponym["Point"]["pos"]
     toponym_longitude, toponym_lattitude = toponym_coodrinates.split(" ")
     return Vector(float(toponym_longitude), float(toponym_lattitude))
Beispiel #6
0
def main():
    MapClassObject.setPosition(Vector(0, 0))
    MapClassObject.update()
    while True:
        MainWindowClassObject.tick()