/** * Creates the map option. * * @param isGoogle * the is google */ private void createMapOption(boolean isGoogle) { // TODO Auto-generated method stub OpenLayers.setProxyHost("gwtOpenLayersProxy?targetURL="); this.defaultMapOptions = new MapOptions(); this.defaultMapOptions.setNumZoomLevels(18); if (isGoogle) { this.defaultMapOptions.setProjection("EPSG:900913"); this.defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); this.defaultMapOptions.setUnits(MapUnits.METERS); this.defaultMapOptions.setMaxExtent(new Bounds(-20037508, -20037508, 20037508, 20037508.34)); this.defaultMapOptions.setMaxResolution(new Double(156543.0339).floatValue()); } else { this.defaultMapOptions.setProjection("EPSG:4326"); } initMapWidget(this.defaultMapOptions, isGoogle); }
/** * * See also setMaxResolutionToAuto. * * From the OpenLayers docs: * Default max is 360 deg / 256 px (or 1,40625), which corresponds to * zoom level 0 on gmaps. */ public void setMaxResolution(float maxResolution){ getJSObject().setProperty("maxResolution", maxResolution); }
/** * By default, OpenLayers 2.7 adds Attribution, ArgParser, Navigation and PanZoom Controls. * * This method removes these default controls from the Map. */ public void removeDefaultControls(){ this.setControls(new JObjectArray(new JSObject[] {})); }
private void initializeDefaultMapOptions() { defaultMapOptions.setMaxResolutionToAuto(); defaultMapOptions.setNumZoomLevels(18); defaultMapOptions.setUnits(MapUnits.DEGREES); defaultMapOptions.setDisplayProjection(new Projection(DISPLAY_PROJECTION)); }
var mapOptions = new MapOptions() ..mapTypeId = MapTypeId.ROADMAP ..center = new LatLng(60.987097,25.767059)
private OSM initializeOSMLayer() { defaultMapOptions.setProjection(GOOGLE_PROJECTION); currentMapProjection = GOOGLE_PROJECTION; // google's mercartor prj // osm = OSM.Osmarender("Osmarender"); osm = OSM.Mapnik("Mapnik"); osm.setDisplayInLayerSwitcher(true); osm.setIsBaseLayer(true); LayerOptions layerOptions = new LayerOptions(); layerOptions.setProjection(spatialReference); osm.addOptions(layerOptions); return osm; }
/** * Override, if you want custom controls on the map. Per default the {@link Navigation} control is added * only. * * @param mapOptions * the map options where to set the map controls */ protected void addMapControls(MapOptions mapOptions) { mapOptions.removeDefaultControls(); map.addControl(new Navigation()); }
public void onModuleLoad() { MapOptions mapOptions = new MapOptions(); MapWidget mapWidget = new MapWidget( "400px", "300px", mapOptions ); OSM osm_1 = OSM.Mapnik( "Mapnik" ); OSM osm_2 = OSM.CycleMap( "CycleMap" ); osm_1.setIsBaseLayer( true ); osm_2.setIsBaseLayer( true ); LonLat lonLat = new LonLat( 6.95, 50.94 ); lonLat.transform( "EPSG:4326", "EPSG:900913" ); Map map = mapWidget.getMap(); map.addLayer( osm_1 ); map.addLayer( osm_2 ); map.addControl( new LayerSwitcher() ); map.addControl( new MousePosition() ); map.setCenter( lonLat, 12 ); RootPanel.get().add( mapWidget ); }
private WMS initializeWMSLayer(String url) { PropertiesManager properties = getPropertiesManager(); defaultMapOptions.setProjection(DISPLAY_PROJECTION); currentMapProjection = DISPLAY_PROJECTION; String format = properties.getParameterAsString("wmsFormat"); String styles = properties.getParameterAsString("wmsStyles"); String layer = properties.getParameterAsString("wmsLayerName"); String bgColor = properties.getParameterAsString("wmsBGColor"); String isTransparent = properties.getParameterAsString("wmsIsTransparent"); WMSParams wmsParameters = new WMSParams(); wmsParameters.setFormat(format); wmsParameters.setLayers(layer); wmsParameters.setStyles(styles); wmsParameters.setIsTransparent(new Boolean(isTransparent)); wmsParameters.getJSObject().setProperty("BGCOLOR", bgColor); WMSOptions wmsOptions = new WMSOptions(); wmsOptions.setProjection(spatialReference); wmsOptions.setDisplayInLayerSwitcher(true); wmsOptions.setIsBaseLayer(true); return new WMS(layer, url, wmsParameters, wmsOptions); }
@Override protected void addMapControls(MapOptions mapOptions) { // FIXME does not work .. navigation panel is still drawn mapOptions.removeDefaultControls(); map.addControl(new ZoomIn()); map.addControl(new ZoomOut()); }
/** * Allow the map to function with OverLays only (no BaseLayer). * * @param allOverlays */ public void setAllOverlays(boolean allOverlays){ getJSObject().setProperty("allOverlays", allOverlays); }
MapOptions options = new MapOptions() .center(center) .mapMarker(true)
/** * By default, OpenLayers 2.7 adds Attribution, ArgParser, Navigation and PanZoom Controls. * * This method removes these default controls from the Map. */ public void removeDefaultControls(){ this.setControls(new JObjectArray(new JSObject[] {})); }
/** * Convenience method for setting max resolution to auto. * * ???Best option when the map can be resized? * */ public void setMaxResolutionToAuto(){ getJSObject().setProperty("maxResolution", "auto"); }
/** * Allow the map to function with OverLays only (no BaseLayer). * * @param allOverlays */ public void setAllOverlays(boolean allOverlays){ getJSObject().setProperty("allOverlays", allOverlays); }
/** * Convenience method for setting max resolution to auto. * * ???Best option when the map can be resized? * */ public void setMaxResolutionToAuto(){ getJSObject().setProperty("maxResolution", "auto"); }
/** * * See also setMaxResolutionToAuto. * * From the OpenLayers docs: * Default max is 360 deg / 256 px (or 1,40625), which corresponds to * zoom level 0 on gmaps. */ public void setMaxResolution(float maxResolution){ getJSObject().setProperty("maxResolution", maxResolution); }
Map(Element e, MapOptions options) { super(MapImpl.create(e, options.getJSObject())); }
public void setNumZoomLevels(int numZoomLevels) { getJSObject().setProperty("numZoomLevels", numZoomLevels); }
public void setMaxScale(float maxScale){ getJSObject().setProperty("maxScale", maxScale); }