本文整理汇总了Java中org.osmdroid.views.MapView.setBuiltInZoomControls方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.setBuiltInZoomControls方法的具体用法?Java MapView.setBuiltInZoomControls怎么用?Java MapView.setBuiltInZoomControls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osmdroid.views.MapView
的用法示例。
在下文中一共展示了MapView.setBuiltInZoomControls方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: 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;
}
示例6: 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();
}
示例7: 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();
}
示例8: onCreateView
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
fragmentView = (LinearLayout) inflater.inflate(R.layout.main, container, false);
layout1 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout1);
layout2 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout2);
layout4 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout4);
layout5 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout5);
defineWidgets(fragmentView);
if (savedInstanceState != null)
chrono.setBase(chronoBaseValue);
chrono.setOnChronometerTickListener(new OnChronometerTickListener() {
public void onChronometerTick(Chronometer arg0) {
showCalculatedData(arg0);
if (prefs.getInt("practice_display5", TypesOfPractices.BASIC_PRACTICE.getTypes()) == TypesOfPractices.HIIT_PRACTICE
.getTypes())
showHiitTrainingDataInDisplay(arg0);
}
});
mapView = (MapView) fragmentView.findViewById(R.id.practice_mapview);
mapView.getOverlays().clear();
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.setUseSafeCanvas(true);
setHardwareAccelerationOff();
mapController = (MapController) mapView.getController();
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(mContext);
mapView.getOverlays().add(mScaleBarOverlay);
pathOverlay = new PathOverlay(Color.BLUE, mContext);
pathOverlay.getPaint().setStyle(Style.STROKE);
pathOverlay.getPaint().setStrokeWidth(3);
pathOverlay.getPaint().setAntiAlias(true);
mapView.getOverlays().add(pathOverlay);
this.mCompassOverlay = new CompassOverlay(mContext, new InternalCompassOrientationProvider(mContext),
mapView);
mCompassOverlay.setEnabled(true);
mapView.getOverlays().add(mCompassOverlay);
this.mLocationOverlay = new MyLocationNewOverlay(mContext, new GpsMyLocationProvider(mContext),
mapView);
mLocationOverlay.setDrawAccuracyEnabled(true);
mapView.getOverlays().add(mLocationOverlay);
MapOverlay touchOverlay = new MapOverlay(mContext);
mapView.getOverlays().add(touchOverlay);
mLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
if (centerPoint == null)
centerPoint = mLocationOverlay.getMyLocation();
centerMyLocation(centerPoint);
}
});
mapView.postInvalidate();
return fragmentView;
}
示例9: populatesMap
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
private void populatesMap(LinearLayout fragmentView) {
mapView = (MapView) fragmentView.findViewById(R.id.summary_mapview);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
getTileSource(Integer.valueOf(prefs.getString("map_tile_type", "0")));
draw_practice_in_map(true);
}
示例10: onCreate
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myOpenMapView = (MapView) findViewById(R.id.openmapview);
myOpenMapView.setBuiltInZoomControls(true);
myMapController = myOpenMapView.getController();
myMapController.setZoom(18);
context = getApplicationContext();
overlayItemArray = new ArrayList<OverlayItem>();
new LongRunningGetIO().execute();
// Add Scale Bar
ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(this);
myOpenMapView.getOverlays().add(myScaleBarOverlay);
// Add MyLocationOverlay
// myLocationOverlay = new MyLocationNewOverlay(this, myOpenMapView);
// myLocationOverlay.enableMyLocation();
// myOpenMapView.getOverlays().add(myLocationOverlay);
// myOpenMapView.postInvalidate();
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location lastLocation = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
firtLocation = true;
if (lastLocation != null) {
updateLoc(lastLocation);
}
}
示例11: onCreate
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_view_request);
setTitle("Request");
//getting the request controller to get a list of requests
loggedInUser = UserController.getLoggedInUser();
// unpacking the bundle to get the position of request
Bundle bundle = getIntent().getExtras();
int pos = bundle.getInt( "position" );
if (pos == -1) {
// signal that the request was searched and has not been related to the user yet
request = new Gson().fromJson( bundle.getString( "request" ), Request.class );
} else {
// else we can grab it from the request controller.
request = RequestController.getOffersInstance().get(pos);
// They have already made an offer, so we can turn off "make offer" button
Button makeOfferButton = (Button) findViewById( R.id.button_makeOffer );
makeOfferButton.setEnabled( false ); // Make the button un-clickable
makeOfferButton.setAlpha((float) 0.5); // Set transparency to 50%
}
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));
if ((request != null) && (loggedInUser != null)) {
setViews();
setMarkers();
getRoadAsync();
}
}
示例12: onCreate
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
/**
* Init method for instanciate all variables
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
//region initVars
double dLat = getIntent().getDoubleExtra("xtra_destination_lat", 0);
double dLong = getIntent().getDoubleExtra("xtra_destination_long",0);
busDeparture = (Departure)getIntent().getSerializableExtra("xtra_bus_depart") ;
distGoal = (TextView) findViewById(R.id.tV_distance_goal);
timeLeft = (TextView) findViewById(R.id.tV_time_left);
timeToBus = (TextView) findViewById(R.id.tV_time_left_to_bus);
destinationLocation = new GeoPoint(dLat, dLong);
//endregion
//region GPS Location init
if (!MainActivity.demomode) {
// get GPS manager -> GPS longitude, latitude in onLocationChanged
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
String locationProvider = LocationManager.GPS_PROVIDER;
try {
locationManager.requestLocationUpdates(locationProvider, 0, 0, Activity2.this);
}
catch(final SecurityException ex) {
Toast.makeText(this, "Leider können wir ohne GPS keine Route berechnen", Toast.LENGTH_SHORT).show();
}
}
else {
android.os.Handler handler = new android.os.Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Location location = new Location("");
location.setLatitude(48.4224);//your coords of course
location.setLongitude(9.9579);
onLocationChanged(location);
}
},1000);
}
//endregion
//Map view init
// MapView integration
mMapView = (MapView) findViewById(R.id.mapview_calculated);
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
mMapController = (MapController) mMapView.getController();
mMapController.setZoom(17);
//endregion
//road manager init
roadManager = new MapQuestRoadManager("DIGIF2BiDrtD1Xbi28SXrkd9Ap2h73Vn");
roadManager.addRequestOption("routeType=pedestrian");
}
示例13: write
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
/**
* fills in the blank text views with the relavent information from the request.
*/
public void write() {
description = (TextView) findViewById(R.id.view_Description_Text);
startLocationText = (TextView) findViewById(R.id.view_Slocation_Text);
destinationText = (TextView) findViewById(R.id.view_Elocation_Text);
fare = (TextView) findViewById(R.id.view_Fare_Text);
riderInfo = (TextView) findViewById(R.id.view_Info_Text);
description.setText("Description: " + request.getDescription());
startLocationText.setText("From: " + request.getStart().getAddress());
destinationText.setText("To: " + request.getDestination().getAddress());
fare.setText("Fare: $" + ((Double) request.getPrice()).toString());
riderInfo.setText("Rider: " + request.getRiderProfile().getUsername());
riderInfo.setPaintFlags(riderInfo.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
// Initialize map
MapView map = (MapView) findViewById(R.id.view_Offer_Map);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setBuiltInZoomControls(true);
map.setMultiTouchControls(true);
IMapController mapController = map.getController();
mapController.setZoom(10);
// Draw start location marker
Location start = request.getStart();
Marker startMarker = new Marker(map);
startMarker.setPosition(start.getGeoLocation());
startMarker.setTitle(start.getAddress());
startMarker.setIcon(getResources().getDrawable(R.drawable.person));
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
map.getOverlays().add(startMarker);
mapController.setCenter(start.getGeoLocation());
// Draw destination marker
Location end = request.getDestination();
Marker endMarker = new Marker(map);
endMarker.setPosition(end.getGeoLocation());
endMarker.setTitle(end.getAddress());
endMarker.setIcon(getResources().getDrawable(R.drawable.marker_default));
endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
map.getOverlays().add(endMarker);
// Draw the route in between start and destination
RoadManager roadManager = new OSRMRoadManager(this);
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
waypoints.add(start.getGeoLocation());
waypoints.add(end.getGeoLocation());
Road road = roadManager.getRoad(waypoints);
Polyline roadOverlay = RoadManager.buildRoadOverlay(road);
map.getOverlays().add(roadOverlay);
}
示例14: onCreate
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rcomplete);
isRider = getIntent().getBooleanExtra("isRider", false);
//requestIndex = getIntent().getIntExtra("requestIndex", -1);
if (isRider) {
//request = Rider.getInstance().getOpenRequests().get(requestIndex);
request = Rider.getInstance().getRequestInProgress();
}
else {
//request = Driver.getInstance().getAcceptedRequests().get(requestIndex);
request = Driver.getInstance().getRequestInProgress();
}
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
// Initialize map
final MapView map = (MapView) findViewById(R.id.rCompleteMap);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setBuiltInZoomControls(true);
map.setMultiTouchControls(true);
IMapController mapController = map.getController();
mapController.setZoom(11);
// Draw start marker
Location start = request.getStart();
Marker startMarker = new Marker(map);
startMarker.setPosition(start.getGeoLocation());
startMarker.setTitle(start.getAddress());
startMarker.setIcon(getResources().getDrawable(R.drawable.person));
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
map.getOverlays().add(startMarker);
mapController.setCenter(start.getGeoLocation());
// Draw destination marker
Location end = request.getDestination();
Marker endMarker = new Marker(map);
endMarker.setPosition(end.getGeoLocation());
endMarker.setTitle(end.getAddress());
endMarker.setIcon(getResources().getDrawable(R.drawable.marker_default));
endMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
map.getOverlays().add(endMarker);
// Draw the route between start and destination
RoadManager roadManager = new OSRMRoadManager(this);
ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
waypoints.add(start.getGeoLocation());
waypoints.add(end.getGeoLocation());
Road road = roadManager.getRoad(waypoints);
Polyline roadOverlay = RoadManager.buildRoadOverlay(road);
map.getOverlays().add(roadOverlay);
move();
}
示例15: onCreateView
import org.osmdroid.views.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mFragmentView = inflater.inflate(R.layout.map_layout, container, false);
mLocationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
Log.d(TAG, "Checking for providers");
if (mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_UPDATE_FREQUENCY, GPS_UPDATE_DISTANCE, this);
Log.d(TAG, "Requesting updates from GPS_PROVIDER");
mCurrentLocation = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
} else {
if (mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_UPDATE_FREQUENCY, GPS_UPDATE_DISTANCE, this);
Log.d(TAG, "Requesting updates from NETWORK_PROVIDER");
mCurrentLocation = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
} else {
Log.d(TAG, "Unable to receive updates from any provider");
}
}
Log.d(TAG, "Current location:" + mCurrentLocation);
mMapView = (MapView) mFragmentView.findViewById(R.id.map);
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
IMapController mapController = mMapView.getController();
mapController.setZoom(9);
if (mCurrentLocation == null) {
//hardcoding a loc in the middle of Bangalore
mCurrentLocation = new Location(LocationManager.GPS_PROVIDER);
mCurrentLocation.setLatitude(12.976844);
mCurrentLocation.setLongitude(77.599614);
}
GeoPoint here = new GeoPoint(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
mUserMarker = new Marker(mMapView);
mUserMarker.setPosition(here);
mUserMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mUserMarker.setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.toilet, null));
mUserMarker.setTitle("Start");
mMapView.getOverlays().add(mUserMarker);
mapController.setCenter(here);
return mFragmentView;
}