本文整理汇总了Java中org.osmdroid.tileprovider.tilesource.TileSourceFactory类的典型用法代码示例。如果您正苦于以下问题:Java TileSourceFactory类的具体用法?Java TileSourceFactory怎么用?Java TileSourceFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileSourceFactory类属于org.osmdroid.tileprovider.tilesource包,在下文中一共展示了TileSourceFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initMap
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
/**
* Initialize the map configurations such as MapCamera, zoom values
* and interface aspects.
*/
private void initMap(){
// Map camera configuration
GeoPoint startCameraPoint = new GeoPoint
(defaultPlace.getLatitude(), defaultPlace.getLongitude());
mapCamera = mapView.getController();
mapCamera.setZoom(DEFAULT_ZOOM);
mapCamera.animateTo(startCameraPoint);
// Map configuration
mapView.setTilesScaledToDpi(true);
mapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
mapView.setBuiltInZoomControls(false);
mapView.setMinZoomLevel(MIN_ZOOM);
mapView.setMaxZoomLevel(MAX_ZOOM);
mapView.setMultiTouchControls(true);
mapView.setUseDataConnection(true);
// Limits the map area to the region set
mapView.setScrollableAreaLimitDouble(mapRegion);
mCopyrightOverlay = new CopyrightOverlay(context);
mapView.addOverlay(mCopyrightOverlay, OverlayTags.COPYRIGHT);
}
示例2: onCreateOptionsMenu
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu pMenu, final int pMenuIdOffset,
final MapView pMapView) {
final SubMenu mapMenu = pMenu.addSubMenu(0, MENU_MAP_MODE + pMenuIdOffset, Menu.NONE,
R.string.map_mode).setIcon(R.drawable.ic_menu_mapmode);
for (int a = 0; a < TileSourceFactory.getTileSources().size(); a++) {
final ITileSource tileSource = TileSourceFactory.getTileSources().get(a);
mapMenu.add(MENU_MAP_MODE + pMenuIdOffset, MENU_TILE_SOURCE_STARTING_ID + a
+ pMenuIdOffset, Menu.NONE, tileSource.name());
}
mapMenu.setGroupCheckable(MENU_MAP_MODE + pMenuIdOffset, true, true);
if (ctx!=null) {
final String title = ctx.getString(
pMapView.useDataConnection() ? R.string.set_mode_offline
: R.string.set_mode_online);
final Drawable icon = ctx.getResources().getDrawable(R.drawable.ic_menu_offline);
pMenu.add(0, MENU_OFFLINE + pMenuIdOffset, Menu.NONE, title).setIcon(icon);
}
return true;
}
示例3: onCreateOptionsMenu
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu pMenu) {
pMenu.add(0, MENU_ZOOMIN_ID, Menu.NONE, "ZoomIn");
pMenu.add(0, MENU_ZOOMOUT_ID, Menu.NONE, "ZoomOut");
final SubMenu subMenu = pMenu.addSubMenu(0, MENU_TILE_SOURCE_ID, Menu.NONE,
"Choose Tile Source");
{
for (final ITileSource tileSource : TileSourceFactory.getTileSources()) {
subMenu.add(0, 1000 + tileSource.ordinal(), Menu.NONE,
tileSource.name());
}
}
pMenu.add(0, MENU_ANIMATION_ID, Menu.NONE, "Run Animation");
pMenu.add(0, MENU_MINIMAP_ID, Menu.NONE, "Toggle Minimap");
return true;
}
示例4: onOptionsItemSelected
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final String tileSource;
switch (item.getItemId()) {
case R.id.menu_map_mode_osm:
tileSource = TileSourceFactory.MAPNIK.name();
break;
case R.id.menu_map_mode_bing_aerial:
tileSource = MAP_MODE_BING_AERIAL;
break;
case R.id.menu_map_mode_bing_road:
tileSource = MAP_MODE_BING_ROAD;
break;
default:
return super.onOptionsItemSelected(item);
}
setTileSource(tileSource);
return true;
}
示例5: mapSetup
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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);
}
示例6: mapSetup
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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();
}
示例7: setupMapPreview
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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);
}
示例8: mapSetup
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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());
}
示例9: setupMapType
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
private void setupMapType(int mapType) {
mMap.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
// There are two other map types (hybrid and satellite), but we don't use them
// as they are redundant (hybrid) and broken (satellite).
switch (mapType) {
case 0:
mMap.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
break;
case 1:
mMap.setTileSource(TileSourceFactory.CYCLEMAP);
break;
default:
mMap.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
break;
}
}
示例10: onCreateView
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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;
}
示例11: tileSource
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
public MapView tileSource(String type) {
OnlineTileSourceBase source;
if (type.equals("hikebikemap")) {
source = TileSourceFactory.HIKEBIKEMAP;
} else {
source = TileSourceFactory.MAPNIK;
}
mapView.setTileSource(source);
return mapView;
}
示例12: onCreate
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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);
}
示例13: successGetUser
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
@Override
public void successGetUser(User user) {
Timber.d("MAP TYPE: %s", user.getMap());
// init map
switch (user.getMap()) {
case "bingAerial":
bing.setStyle(BingMapTileSource.IMAGERYSET_AERIAL);
mMapView.setTileSource(bing);
break;
case "bingRoad":
bing.setStyle(BingMapTileSource.IMAGERYSET_ROAD);
mMapView.setTileSource(bing);
break;
case "custom":
default:
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
}
mMapView.invalidate();
}
示例14: initMap
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的package包/类
public void initMap() {
org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID);
map.setMultiTouchControls(true);
map.setClickable(true);
map.setMultiTouchControls(true);
map.setBuiltInZoomControls(true);
map.setUseDataConnection(true);
map.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
map.setTilesScaledToDpi(true);
map.setMinZoomLevel(10);
placeMarkers = new ArrayList<>();
refreshLocationsOnMap();
}
示例15: onCreate
import org.osmdroid.tileprovider.tilesource.TileSourceFactory; //导入依赖的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();
}