本文整理汇总了Java中org.osmdroid.views.MapController类的典型用法代码示例。如果您正苦于以下问题:Java MapController类的具体用法?Java MapController怎么用?Java MapController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapController类属于org.osmdroid.views包,在下文中一共展示了MapController类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: openStreetMapInit
import org.osmdroid.views.MapController; //导入依赖的package包/类
private void openStreetMapInit() {
setContentView(R.layout.activity_openstreetmapgpsmanager);
mMapView = (MapView) findViewById(R.id.OSMGPSmanager);
MapController mController = mMapView.getController();
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
imageUri = (Uri) getIntent().getExtras().get("imageUri");
try {
String degreeGPS = new ConvertLatlng().convertToDegreeForm(imageUri.getPath());
String[] position = degreeGPS.split(";");
GeoPoint center = new GeoPoint(Double.parseDouble(position[0]), Double.parseDouble(position[1]));
mController.setCenter(center);
mController.setZoom(13);
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:phimpme,项目名称:phimpme-android-v1,代码行数:21,代码来源:GeographicalLocationActivity.java
示例2: createMapView
import org.osmdroid.views.MapController; //导入依赖的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
示例3: onCreateView
import org.osmdroid.views.MapController; //导入依赖的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;
}
开发者ID:scintero,项目名称:moveon,代码行数:70,代码来源:Main.java
示例4: setupMapView
import org.osmdroid.views.MapController; //导入依赖的package包/类
private void setupMapView() {
mMapView.setMultiTouchControls(true);
mMapView.setUseDataConnection(true);
mMapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
mMapController = (MapController) mMapView.getController();
mMapController.setZoom(13);
mMapController.setCenter(BERLIN);
fetchPois();
}
开发者ID:refugeehackathon,项目名称:refugeetransit-android,代码行数:12,代码来源:MapFragment.java
示例5: init_mapView
import org.osmdroid.views.MapController; //导入依赖的package包/类
private void init_mapView() {
mMapView = (MapView) findViewById(R.id.myOSMmapview);
MapController mController = mMapView.getController();
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
LatLng latLng = getCurrentLocation();
GeoPoint center = new GeoPoint(latLng.latitude, latLng.longitude);
mController.setCenter(center);
mController.setZoom(13);
}
开发者ID:phimpme,项目名称:phimpme-android-v1,代码行数:14,代码来源:OpenStreetMapActivity.java
示例6: onCreate
import org.osmdroid.views.MapController; //导入依赖的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");
}
开发者ID:flbbr,项目名称:Run2Stop,代码行数:72,代码来源:Activity2.java
注:本文中的org.osmdroid.views.MapController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论