Exemplo n.º 1
0
 def __init__( self ):
     SimplePanel.__init__( self )
     self.setSize( W_FRAME, 600 )
     options = MapOptions()
     options.zoom = 4
     options.mapTypeId = MapTypeId.ROADMAP
     self.map = Map( self.getElement(), options )
     southWest = LatLng( 37.887, -122.3 );
     northEast = LatLng( 37.855, -122.22 );
     self.map.fitBounds( LatLngBounds( southWest, northEast ) )
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 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)
Exemplo n.º 5
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)
Exemplo n.º 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)
Exemplo n.º 7
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)