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 ) )
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)
def __init__(self): SimplePanel.__init__(self) self.setSize('100%', '100%') options = MapOptions( zoom=4, center=LatLng(-25.363882, 131.044922), mapTypeId=MapTypeId.ROADMAP, mapTypeControl=True, mapTypeControlOptions=MapTypeControlOptions( style=MapTypeControlStyle.DROPDOWN_MENU), navigationControl=True, navigationControlOptions=NavigationControlOptions( style=NavigationControlStyle.SMALL)) # the same, in a extensive way: #options = MapOptions() #options.zoom = 4 #options.center = LatLng(-25.363882, 131.044922) #options.mapTypeId = MapTypeId.ROADMAP #options.mapTypeControl = True #options.mapTypeControlOptions = MapTypeControlOptions() #options.mapTypeControlOptions.style = # MapTypeControlStyle.DROPDOWN_MENU #options.navigationControl = True #options.navigationControlOptions = NavigationControlOptions() #options.navigationControlOptions.style = \ # NavigationControlStyle.SMALL self.map = Map(self.getElement(), options)
def __init__(self): DockPanel.__init__(self) self.setSize('100%', '100%') self.geocoder = Geocoder() # widgets topPanel = HorizontalPanel() self.add(topPanel, DockPanel.NORTH) self.address = TextBox() self.address.setText("Sydney, NSW") self.address.addChangeListener(self.codeAddress) topPanel.add(self.address) button = Button("Geocode") button.addClickListener(self.codeAddress) topPanel.add(button) # now, the map mapPanel = SimplePanel() mapPanel.setSize('600', '400') self.add(mapPanel, DockPanel.CENTER) options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644), mapTypeId=MapTypeId.ROADMAP) self.map = Map(mapPanel.getElement(), options)
def __init__(self): DockPanel.__init__(self) self.setSize('100%', '100%') # widgets topPanel = HorizontalPanel() self.add(topPanel, DockPanel.NORTH) places = { "chicago, il": "Chicago", "st louis, mo": "St Louis", "joplin, mo": "Joplin, MO", "oklahoma city, ok": "Oklahoma City", "amarillo, tx": "Amarillo", "gallup, nm": "Gallup, NM", "flagstaff, az": "Flagstaff, AZ", "winona, az": "Winona", "kingman, az": "Kingman", "barstow, ca": "Barstow", "san bernardino, ca": "San Bernardino", "los angeles, ca": "Los Angeles" } self.start = ListBox() self.end = ListBox() for value in places: self.start.addItem(places[value], value) self.end.addItem(places[value], value) self.start.addChangeListener(self.calcRoute) self.end.addChangeListener(self.calcRoute) topPanel.add(self.start) topPanel.add(self.end) # now, the map mapPanel = SimplePanel() mapPanel.setSize('800', '500') self.add(mapPanel, DockPanel.CENTER) chigado = LatLng(41.850033, -87.6500523) options = MapOptions(zoom=7, center=chigado, mapTypeId=MapTypeId.ROADMAP) self.map = Map(mapPanel.getElement(), options) # initialize the renderer self.directionsDisplay = DirectionsRenderer() self.directionsDisplay.setMap(self.map) self.directionsService = DirectionsService()
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.navigationControl = False #options.scaleControl = True options = MapOptions(zoom=4, center=LatLng(-33, 151), mapTypeId=MapTypeId.ROADMAP, navigationControl=False, scaleControl=True) self.map = Map(self.getElement(), options)
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)
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)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from pyjamas.ui.RootPanel import RootPanel, RootPanelCls from pyjamas.ui.SimplePanel import SimplePanel from pyjamas import DOM from pyjamas.gmaps.Map import Map, MapTypeId, MapOptions from pyjamas.gmaps.Base import LatLng if __name__ == '__main__': mapPanel = SimplePanel() mapPanel.setSize('100%', '100%') options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644), mapTypeId=MapTypeId.ROADMAP) #options = MapOptions() #options.zoom = 8 #options.center = LatLng(-34.397, 150.644) #options.mapTypeId = MapTypeId.ROADMAP map = Map(mapPanel.getElement(), options) #root = RootPanelCls(DOM.getElementById("here")) root = RootPanel() root.add(mapPanel)
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)
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)