當前位置: 首頁>>代碼示例>>Java>>正文


Java MapView.setTileSource方法代碼示例

本文整理匯總了Java中org.osmdroid.views.MapView.setTileSource方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.setTileSource方法的具體用法?Java MapView.setTileSource怎麽用?Java MapView.setTileSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.osmdroid.views.MapView的用法示例。


在下文中一共展示了MapView.setTileSource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mapSetup

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
private void mapSetup() {
    map = (MapView) getActivity().findViewById(R.id.createPoiMap);

    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(getActivity(), PreferenceManager.getDefaultSharedPreferences(getActivity()));

    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setTilesScaledToDpi(true);

    // add multi-touch capability
    map.setMultiTouchControls(true);

    // add compass to map
    CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
    compassOverlay.enableCompass();
    map.getOverlays().add(compassOverlay);

    // get map controller
    IMapController controller = map.getController();

    GeoPoint position = new GeoPoint(latitude, longitude);
    controller.setCenter(position);
    controller.setZoom(18);
    MapUtils.addMarker(getActivity(), map, latitude, longitude);
}
 
開發者ID:CityZenApp,項目名稱:Android-Development,代碼行數:26,代碼來源:CreatePoiFragment.java

示例2: mapSetup

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
private void mapSetup() {
    map = (MapView) getActivity().findViewById(R.id.map);  // create basic map
    mController = map.getController(); // get map controller
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setTilesScaledToDpi(true);
    map.setMultiTouchControls(true);

    // add compass to map
    CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
    compassOverlay.enableCompass();
    map.getOverlays().add(compassOverlay);

    //attach listeners
    MapEventsOverlay mapEventsOverlay = new MapEventsOverlay(this);
    map.getOverlays().add(0, mapEventsOverlay);
    setupMyLocation();
}
 
開發者ID:CityZenApp,項目名稱:Android-Development,代碼行數:18,代碼來源:MapFragment.java

示例3: setupMapPreview

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
private void setupMapPreview(double lat, double lon, String markerTitle) {
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(getDialog().getContext(), PreferenceManager.getDefaultSharedPreferences(getDialog().getContext()));

    map = (MapView) getDialog().findViewById(R.id.poiDialogMap);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setTilesScaledToDpi(true);
    map.setMultiTouchControls(true);

    // add compass to map
    CompassOverlay compassOverlay = new CompassOverlay(getDialog().getContext(), new InternalCompassOrientationProvider(getDialog().getContext()), map);
    compassOverlay.enableCompass();
    map.getOverlays().add(compassOverlay);

    // get map controller
    IMapController controller = map.getController();
    GeoPoint position = new GeoPoint(lat, lon);
    controller.setCenter(position);
    controller.setZoom(18);

    MapUtils.addMarker(getActivity(), map, lat, lon, markerTitle);
}
 
開發者ID:CityZenApp,項目名稱:Android-Development,代碼行數:23,代碼來源:PoiDetailsFragment.java

示例4: mapSetup

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
private void mapSetup() {
    map = (MapView) getActivity().findViewById(R.id.createPoiMap);
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(getActivity(), PreferenceManager.getDefaultSharedPreferences(getActivity()));
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setTilesScaledToDpi(true);
    map.setMultiTouchControls(true);

    CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
    compassOverlay.enableCompass();
    map.getOverlays().add(compassOverlay);

    IMapController controller = map.getController();
    GeoPoint position = new GeoPoint(POI.getLatitude(), POI.getLongitude());
    controller.setCenter(position);
    controller.setZoom(18);

    MapUtils.addMarker(getActivity(), map, POI.getLatitude(), POI.getLongitude());
}
 
開發者ID:CityZenApp,項目名稱:Android-Development,代碼行數:20,代碼來源:EditPoiFragment.java

示例5: onCreateView

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_map, container, false);
    Context ctx = getActivity().getApplicationContext();
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));
    Configuration.getInstance().setUserAgentValue(BuildConfig.APPLICATION_ID);

    if (ContextCompat.checkSelfPermission(getActivity(),
            Manifest.permission.WRITE_EXTERNAL_STORAGE)
            != PackageManager.PERMISSION_GRANTED) {

        // Should we show an explanation?
        if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity() ,Manifest.permission.WRITE_EXTERNAL_STORAGE)) {

            // Show an explanation to the user *asynchronously* -- don't block
            // this thread waiting for the user's response! After the user
            // sees the explanation, try again to request the permission.

        } else {

            // No explanation needed, we can request the permission.

            ActivityCompat.requestPermissions(getActivity(),
                    new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                    PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE);

            // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
            // app-defined int constant. The callback method gets the
            // result of the request.
        }
    }
    map = (MapView) v.findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    configMap();

    return v;
}
 
開發者ID:DecentralizedAmateurPagingNetwork,項目名稱:DAPNETApp,代碼行數:41,代碼來源:MapFragment.java

示例6: chooseBeautifulMapProvider

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
public static void chooseBeautifulMapProvider(Context context, MapView map)
{
    MapBoxTileSource tileSource = new MapBoxTileSource(context);
    map.setTilesScaledToDpi(true);
    tileSource.setMapboxMapid("mapbox.emerald");
    map.setTileSource(tileSource);
}
 
開發者ID:LenaShervarly,項目名稱:TreasureHunting,代碼行數:8,代碼來源:MapHelper.java

示例7: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    MapView mapView = (MapView) findViewById(R.id.map_view);
    mapView.setTileSource(TileSourceFactory.PUBLIC_TRANSPORT);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);

    IMapController mapController = mapView.getController();
    mapController.setZoom(9);
    GeoPoint location = new GeoPoint(27.7166667,85.3166667);
    mapController.setCenter(location);
}
 
開發者ID:SiyaOrg,項目名稱:buseto,代碼行數:17,代碼來源:MainActivity.java

示例8: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_request);
    write();
    move();

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    // initialize display map
    map = (MapView) findViewById(R.id.addRequestMap);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);
    startPoint = new GeoPoint(53.52676, -113.52715);
    IMapController mapController = map.getController();
    mapController.setZoom(10);
    mapController.setCenter(startPoint);

    getLocations();
}
 
開發者ID:CMPUT301F16T19,項目名稱:SeekARide,代碼行數:23,代碼來源:AddRequestActivity.java

示例9: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize map
    setContentView(R.layout.activity_map);
    MapView map = (MapView) findViewById(R.id.map_Map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);
    GeoPoint startPoint = new GeoPoint(53.52676, -113.52715);
    IMapController mapController = map.getController();
    mapController.setZoom(10);
    mapController.setCenter(startPoint);

    move();
}
 
開發者ID:CMPUT301F16T19,項目名稱:SeekARide,代碼行數:18,代碼來源:MapActivity.java

示例10: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_requests);
    write();
    move();

    // Initialize map
    map = (MapView) findViewById(R.id.Map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);
    startPoint = new GeoPoint(53.52676, -113.52715);
    IMapController mapController = map.getController();
    mapController.setZoom(10);
    mapController.setCenter(startPoint);

    getLocation();
}
 
開發者ID:CMPUT301F16T19,項目名稱:SeekARide,代碼行數:20,代碼來源:SearchRequestsActivity.java

示例11: onCreateView

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    mContext = inflater.getContext();
    mResourceProxy = new ResourceProxyImpl(mContext.getApplicationContext());
    mMapView = new MapView(inflater.getContext(), 256, mResourceProxy);
    mMapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);
    mMapView.setUseDataConnection(true);
    IMapController mapCtrl = mMapView.getController();
    mapCtrl.setCenter(new GeoPoint(43.5, -80.5));
    mapCtrl.setZoom(10);
    mMapView.invalidate();

    return mMapView;
}
 
開發者ID:TotalVerb,項目名稱:findr-android,代碼行數:18,代碼來源:FindrMapView.java

示例12: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	final ActionBar actionBar = getActionBar();
	if (actionBar != null) {
		actionBar.setDisplayHomeAsUpEnabled(true);
	}

	setContentView(R.layout.activity_show_location);

	// Get map view and configure it.
	map = (MapView) findViewById(R.id.map);
	map.setTileSource(Config.TILE_SOURCE_PROVIDER);
	map.setBuiltInZoomControls(false);
	map.setMultiTouchControls(true);

	this.mapController = map.getController();
	mapController.setZoom(Config.INITIAL_ZOOM_LEVEL);
	mapController.setCenter(this.loc);

	requestLocationUpdates();
}
 
開發者ID:kriztan,項目名稱:OpenShareLocationPlugin,代碼行數:24,代碼來源:ShowLocationActivity.java

示例13: onCreate

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rider_view_request);

    // unpacking the bundle to get the position of request
    Bundle bundle = getIntent().getExtras();

    int position = bundle.getInt("position");
    request = RequestController.getRiderInstance().get(position);

    setTitle("Request");

    map = (MapView) findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);

    startPoint = new GeoPoint(request.getStart());
    endPoint = new GeoPoint(request.getEnd());

    mapController = map.getController();
    mapController.setCenter(getCenter());
    zoomToBounds(getBoundingBox(startPoint, endPoint));

    ArrayList<OverlayItem> overlayItems = new ArrayList<>();
    overlayItems.add(new OverlayItem("Starting Point", "This is the starting point", startPoint));
    overlayItems.add(new OverlayItem("Destination", "This is the destination point", endPoint));

    setViews();
    setMarkers();
    getRoadAsync();
}
 
開發者ID:CMPUT301F16T01,項目名稱:Carrier,代碼行數:34,代碼來源:RiderRequestActivity.java

示例14: initContentView

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
    protected void initContentView() {
        mResourceProxy = new OsmResourceImpl(this);

        mapview = new MapView(this,mResourceProxy);
        OnlineTileSourceBase GoogleMap = GoogleTileSource.getDefultGoogleTileSource();
        mapview.setTileSource(GoogleMap);
        FrameLayout.LayoutParams mapParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        maplayout.addView(mapview, mapParams);
        mapview.setTilesScaledToDpi(true);
        mapview.setMinZoomLevel(3);
        mapview.setMultiTouchControls(true);
        mapview.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (!isTouchable){
                    return false;
                }
                if (ontouch(event)){
                    isClick = false;
                    v.postDelayed(cleanMarker,500);
                }
                return false;
            }
        });

        ivPath.setOnClickListener(this);
        poiMapPathBtn.setOnClickListener(this);
        poiMapLocationBar.setOnClickListener(this);
        llContent.setOnClickListener(this);
//        locationClient = new AMapLocationClient(getApplicationContext());
        locationUtil = JoyApplication.getLocationUtil();
        locationUtil.gettAccuracyLocation(this,2000);
//        MapUtil.initAccuracyLocation(locationClient, this);
    }
 
開發者ID:joy-inc,項目名稱:joy-app,代碼行數:37,代碼來源:MapActivity.java

示例15: onCreateView

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mMapView = new MapView(inflater.getContext());

    mMapView.setTileSource(UiUtils.GOOGLE_MAPS_TILE);
    mMapView.setMultiTouchControls(true);

    mOverlayItemList = new ArrayList<>();
    mLocationOverlay = new ItemizedIconOverlay<>(getContext(), mOverlayItemList, null);
    mMapView.getOverlays().add(mLocationOverlay);

    return mMapView;
}
 
開發者ID:Berlin-Vegan,項目名稱:berlin-vegan-guide,代碼行數:14,代碼來源:LocationMapFragment.java


注:本文中的org.osmdroid.views.MapView.setTileSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。