当前位置: 首页>>代码示例>>Java>>正文


Java XYTileSource类代码示例

本文整理汇总了Java中org.osmdroid.tileprovider.tilesource.XYTileSource的典型用法代码示例。如果您正苦于以下问题:Java XYTileSource类的具体用法?Java XYTileSource怎么用?Java XYTileSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XYTileSource类属于org.osmdroid.tileprovider.tilesource包,在下文中一共展示了XYTileSource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMapView

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
private void createMapView() {
	Log.d("Alain", "coucou");
	mMapView = (MapView) findViewById(R.id.mapview);
	// mMapView.setTileSource(TileSourceFactory.MAPNIK);
	final ITileSource tileSource = new XYTileSource("Mapnik",
			ResourceProxy.string.mapnik, 0, 18, 258, ".png",
			"http://tile.openstreetmap.org/");
	mMapView.setTileSource(tileSource);
	mMapView.setBuiltInZoomControls(true);
	mMapView.setMultiTouchControls(true);
	mMapController = (MapController) mMapView.getController();

	reinitLocation();
	mMapView.postDelayed(waitForMapTimeTask, TIME_TO_WAIT_IN_MS);

	addPoiOverlay();
}
 
开发者ID:alain75007,项目名称:androidschool,代码行数:18,代码来源:GameActivity.java

示例2: onCreate

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
@Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

    ButterKnife.bind(this);

    if (Build.VERSION.SDK_INT >= 23) {
       new Permission(this);
    }

    final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
    final ITileSource tileSource = new XYTileSource("Mapnik", 3, 19, 256, ".png",
            new String[] {Constants.TILE_SOURCE});
    //mapView.setTileSource((new XYTileSource("localMapnik", Resource, 0, 18, 256, ".png",
    //  "http://tile.openstreetmap.org/")));
    tileProvider.setTileSource(tileSource);
    map.setTileProvider(tileProvider);

    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);

    mapController = map.getController();
    mapController.setZoom(15);

    poiMarkers = new RadiusMarkerClusterer(this);
    map.getOverlays().add(poiMarkers);

    Drawable poiIcon = ResourcesCompat.getDrawable(getResources(), R.drawable.marker_male, null);
    myMarker = new Marker(map);
    poiMarkers.add(myMarker);

    snackbar = Snackbar
            .make(findViewById(android.R.id.content), getString(R.string.chargement_en_cours), Snackbar.LENGTH_INDEFINITE);

    presenter.onCreate();



    setupLocationManager();
}
 
开发者ID:BackPackerDz,项目名称:Android-Tariki.dz,代码行数:41,代码来源:MapsActivity.java

示例3: onCreateView

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_osm, container, false);
    mUnbinder = ButterKnife.bind(this, view);

    GeoPoint startPoint = new GeoPoint(mLat, mLng);

    mapView.setTileSource(TileSourceFactory.MAPNIK);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);
    mapView.setMaxZoomLevel(17);

    //create the second one
    final MapTileProviderBasic ofmTileProvider = new MapTileProviderBasic(getContext());
    final ITileSource ofmTileSource = new XYTileSource("OpenFireMap", 10, 17, 256, ".png",
            new String[]{"http://openfiremap.org/hytiles/"});
    ofmTileProvider.setTileSource(ofmTileSource);
    final TilesOverlay ofmTilesOverlay = new TilesOverlay(ofmTileProvider, getContext());
    ofmTilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
    mapView.getOverlays().add(ofmTilesOverlay);

    //Alarm Marker
    Marker startMarker = new Marker(mapView);
    startMarker.setPosition(startPoint);
    startMarker.setTitle(getString(R.string.operation_base));
    startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    mapView.getOverlays().add(startMarker);

    IMapController mapController = mapView.getController();
    mapController.setZoom(startZoomLevel);
    mapController.setCenter(startPoint);

    return view;
}
 
开发者ID:ForrestFalcon,项目名称:fAlarm,代码行数:37,代码来源:OsmMapFragment.java

示例4: addOverlays

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
@Override
public void addOverlays() {
    mMapView.setUseDataConnection(false);

    final ScaleBarOverlay scaleBarOverlay = new ScaleBarOverlay(mMapView);
    scaleBarOverlay.setCentred(true);
    scaleBarOverlay.setScaleBarOffset(200, 10);
    mMapView.getOverlays().add(scaleBarOverlay);

    final ITileSource tileSource = new XYTileSource(
            "Abstract", 0, 29, 256, ".png", new String[]{"http://localhost/"}, "abstract data");
    mMapView.setUseDataConnection(false);

    final MapTileAssetsProvider assetsProvider = new MapTileAssetsProvider(new SimpleRegisterReceiver(getContext()), getActivity().getAssets(), tileSource);

    final MapTileApproximater approximationProvider = new MapTileApproximater();
    approximationProvider.addProvider(assetsProvider);

    final MapTileProviderArray array = new MapTileProviderArray(
            tileSource, new SimpleRegisterReceiver(getContext()),
            new MapTileModuleProviderBase[]{assetsProvider, approximationProvider});

    mMapView.setTileProvider(array);

    mMapView.getController().setZoom(29.);
    // cf. https://fr.wikipedia.org/wiki/Point_z%C3%A9ro_des_routes_de_France
    // In English: starting point of all French roads
    mMapView.setExpectedCenter(new GeoPoint(48.85340215825712, 2.348784611094743));
    mMapView.invalidate();
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:31,代码来源:SampleVeryHighZoomLevel.java

示例5: onCreate

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Setup base map
	final RelativeLayout rl = new RelativeLayout(this);

	mMapView = new MapView(this);
	mMapView.setTilesScaledToDpi(true);
	rl.addView(mMapView, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
			LayoutParams.FILL_PARENT));
	mMapView.setBuiltInZoomControls(true);

	// zoom to the netherlands
	mMapView.getController().setZoom(7);
	mMapView.getController().setCenter(new GeoPoint(51500000, 5400000));

	// Add tiles layer with custom tile source
	final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
	final ITileSource tileSource = new XYTileSource("FietsRegionaal",  3, 18, 256, ".png",
			new String[] { "http://overlay.openstreetmap.nl/openfietskaart-rcn/" });
	tileProvider.setTileSource(tileSource);
	final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext());
	tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
	mMapView.getOverlays().add(tilesOverlay);

	this.setContentView(rl);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:30,代码来源:SampleWithTilesOverlayAndCustomTileSource.java

示例6: createMapOBSO

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
private void createMapOBSO() {
	final Context context = this;
	final Context applicationContext = context.getApplicationContext();
	final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(applicationContext);

	// Create a custom tile source
	final ITileSource tileSource = new XYTileSource("Mapnik", ResourceProxy.string.mapnik, 1, 18, 256, ".png", "http://tile.openstreetmap.org/");

	// Create a file cache modular provider
	final TileWriter tileWriter = new TileWriter();
	final MapTileFilesystemProvider fileSystemProvider = new MapTileFilesystemProvider(registerReceiver, tileSource);

	// Create an archive file modular tile provider
	//GEMFFileArchive gemfFileArchive = GEMFFileArchive.getGEMFFileArchive(mGemfArchiveFilename ); // Requires try/catch
	//MapTileFileArchiveProvider fileArchiveProvider = new MapTileFileArchiveProvider(registerReceiver, tileSource, new IArchiveFile[] { gemfFileArchive });

	// Create a download modular tile provider
	final NetworkAvailabliltyCheck networkAvailabliltyCheck = new NetworkAvailabliltyCheck(context);
	final MapTileDownloader downloaderProvider = new MapTileDownloader(tileSource, tileWriter, networkAvailabliltyCheck);

	// Create a custom tile provider array with the custom tile source and the custom tile providers
	//final MapTileProviderArray tileProviderArray = new MapTileProviderArray(tileSource, registerReceiver, new MapTileModuleProviderBase[] { fileSystemProvider, fileArchiveProvider, downloaderProvider });
	final MapTileProviderArray tileProviderArray = new MapTileProviderArray(tileSource, registerReceiver, new MapTileModuleProviderBase[] { fileSystemProvider, downloaderProvider });
	//final MapTileProviderArray tileProviderArray = new MapTileProviderArray(tileSource, registerReceiver, new MapTileModuleProviderBase[] { downloaderProvider });

	// Create the mapview with the custom tile provider array
	//mMapView = new MapView(context, 256, new DefaultResourceProxyImpl(context), tileProviderArray);
       MapView mMapView = (MapView) findViewById(R.id.mapview);
       mMapView.setTileSource(tileSource);        

}
 
开发者ID:alain75007,项目名称:androidschool,代码行数:32,代码来源:GameActivity.java

示例7: createStandardTileSource

import org.osmdroid.tileprovider.tilesource.XYTileSource; //导入依赖的package包/类
public static ITileSource createStandardTileSource(final String name, final ResourceProxy.string aResourceId, final String... baseUrls) {
  return new XYTileSource(name,
      aResourceId, 0, 17, 256, ".png",
      baseUrls);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:6,代码来源:TileSource.java


注:本文中的org.osmdroid.tileprovider.tilesource.XYTileSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。