public MapConfiguration createOsmMap ( int nrOfLevels ) { MapConfiguration configuration = new MapConfigurationImpl ( ) ; Bbox bounds = new Bbox ( - OSM_HALF_WIDTH , - OSM_HALF_WIDTH , 2 * OSM_HALF_WIDTH , 2 * OSM_HALF_WIDTH ) ; configuration . setCrs ( OSM_EPSG , CrsType . METRIC ) ; configuration . setHintValue ( MapConfiguration . INITIAL_BOUNDS , bounds ) ; configuration . setMaxBounds ( Bbox . ALL ) ; List < Double > resolutions = new ArrayList < Double > ( ) ; for ( int i = 0 ; i < nrOfLevels ; i ++ ) { resolutions . add ( OSM_HALF_WIDTH / ( OSM_TILE_SIZE * Math . pow ( 2 , i - 1 ) ) ) ; } configuration . setResolutions ( resolutions ) ; return configuration ; }
Create an OSM compliant map configuration with this number of zoom levels .