示例#1
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        options = MapOptions()
        options.zoom = 4
        options.center = LatLng(-25.363882, 131.044922)
        options.mapTypeId = MapTypeId.ROADMAP

        self.map = Map(self.getElement(), options)

        self.map.addListener("click", self.clicked)
示例#2
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        options = MapOptions()

        options.zoom = 4
        options.center = LatLng(-33, 151)
        options.mapTypeId = MapTypeId.ROADMAP

        options.disableDefaultUI = True

        self.map = Map(self.getElement(), options)
示例#3
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        self.myLatLng = LatLng(-25.363882, 131.044922)

        options = MapOptions()
        options.zoom = 4
        options.center = self.myLatLng
        options.mapTypeId = MapTypeId.ROADMAP

        self.map = Map(self.getElement(), options)
        self.map.addListener("zoom_changed", self.zoomChanged)

        options = InfoWindowOptions()
        options.content = "Zoom Level Test"
        options.position = self.myLatLng

        self.infoWindow = InfoWindow(options)
        self.infoWindow.open(self.map)

        self.map.addListener("zoom_changed", self.zoomChanged)
示例#4
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        self.myLatLng = LatLng(-25.363882, 131.044922)

        options = MapOptions()
        options.zoom = 4
        options.center = self.myLatLng
        options.mapTypeId = MapTypeId.ROADMAP

        self.map = Map(self.getElement(), options)
        self.map.addListener("zoom_changed", self.zoomChanged)

        options = InfoWindowOptions()
        options.content = "Zoom Level Test"
        options.position = self.myLatLng

        self.infoWindow = InfoWindow(options)
        self.infoWindow.open(self.map)

        self.map.addListener("zoom_changed", self.zoomChanged)
示例#5
0
文件: EventClosure.py 项目: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        options = MapOptions()
        options.zoom = 4
        options.center = LatLng(-25.363882, 131.044922)
        options.mapTypeId = MapTypeId.ROADMAP

        # the fitBounds will only work if I do this:
        element=JS("""$wnd.document.getElementById("map_canvas")""")
        # instead of
        #element=self.getElement()
        self.map = Map(element, options)

        # if I create te map in js, the problem happens anyway!
        # The problem is solved if i create the map with $wnd.document.getElementById("map_canvas")!!!

#         JS("""
#             var myLatlng = new $wnd.google.maps.LatLng(-25.363882,131.044922);
#             var myOptions = {
#               zoom: 4,
#               center: myLatlng,
#               mapTypeId: $wnd.google.maps.MapTypeId.ROADMAP
#             };
#             //this.map=new $wnd.google.maps.Map(this.getElement(), myOptions);
#             this.map=new $wnd.google.maps.Map($wnd.document.getElementById("map_canvas"), myOptions);
#             var southWest =
#               new $wnd.google.maps.LatLng(-31.203405,125.244141);
#             var northEast =
#               new $wnd.google.maps.LatLng(-25.363882, 131.044922);
#             var bounds =
#               new $wnd.google.maps.LatLngBounds(southWest, northEast);
#             this.map.fitBounds(bounds);
#             //this.map.setCenter(southWest)
#         """)

        # Add 5 markers to the map at random locations

        southWest = LatLng(-31.203405, 125.244141)
        northEast = LatLng(-25.363882, 131.044922)
        bounds = LatLngBounds(southWest, northEast)
        print "bounds", bounds

        # this is not working well!! it opens the entire world...
        self.map.fitBounds(bounds)

        lngSpan = northEast.lng() - southWest.lng()
        latSpan = northEast.lat() - southWest.lat()

        for i in range(0, 5):
            location = LatLng(southWest.lat() + latSpan * random(),
              southWest.lng() + lngSpan * random())

            options = MarkerOptions()
            options.position = location
            options.map = self.map

            marker = Marker(options)
            marker.setTitle(str(i + 1))

            self.attachSecretMessage(marker, i)
示例#6
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        options = MapOptions()
        options.zoom = 4
        options.center = LatLng(-25.363882, 131.044922)
        options.mapTypeId = MapTypeId.ROADMAP

        # the fitBounds will only work if I do this:
        element = JS("""$wnd.document.getElementById("map_canvas")""")
        # instead of
        #element=self.getElement()
        self.map = Map(element, options)

        # if I create te map in js, the problem happens anyway!
        # The problem is solved if i create the map with $wnd.document.getElementById("map_canvas")!!!

        #         JS("""
        #             var myLatlng = new $wnd.google.maps.LatLng(-25.363882,131.044922);
        #             var myOptions = {
        #               zoom: 4,
        #               center: myLatlng,
        #               mapTypeId: $wnd.google.maps.MapTypeId.ROADMAP
        #             };
        #             //this.map=new $wnd.google.maps.Map(this.getElement(), myOptions);
        #             this.map=new $wnd.google.maps.Map($wnd.document.getElementById("map_canvas"), myOptions);
        #             var southWest =
        #               new $wnd.google.maps.LatLng(-31.203405,125.244141);
        #             var northEast =
        #               new $wnd.google.maps.LatLng(-25.363882, 131.044922);
        #             var bounds =
        #               new $wnd.google.maps.LatLngBounds(southWest, northEast);
        #             this.map.fitBounds(bounds);
        #             //this.map.setCenter(southWest)
        #         """)

        # Add 5 markers to the map at random locations

        southWest = LatLng(-31.203405, 125.244141)
        northEast = LatLng(-25.363882, 131.044922)
        bounds = LatLngBounds(southWest, northEast)
        print "bounds", bounds

        # this is not working well!! it opens the entire world...
        self.map.fitBounds(bounds)

        lngSpan = northEast.lng() - southWest.lng()
        latSpan = northEast.lat() - southWest.lat()

        for i in range(0, 5):
            location = LatLng(southWest.lat() + latSpan * random(),
                              southWest.lng() + lngSpan * random())

            options = MarkerOptions()
            options.position = location
            options.map = self.map

            marker = Marker(options)
            marker.setTitle(str(i + 1))

            self.attachSecretMessage(marker, i)