• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InternalCompassOrientationProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mapSetup

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的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.overlay.compass.InternalCompassOrientationProvider; //导入依赖的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.overlay.compass.InternalCompassOrientationProvider; //导入依赖的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.overlay.compass.InternalCompassOrientationProvider; //导入依赖的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: onResume

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onResume() {
     super.onResume();
     final String tileSourceName = mPrefs.getString(PREFS_TILE_SOURCE,
             TileSourceFactory.DEFAULT_TILE_SOURCE.name());
     try {
          final ITileSource tileSource = TileSourceFactory.getTileSource(tileSourceName);
          mMapView.setTileSource(tileSource);
     } catch (final IllegalArgumentException e) {
          mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
     }
     if (mPrefs.getBoolean(PREFS_SHOW_LOCATION, false)) {
          this.mLocationOverlay.enableMyLocation();
     }

    //sorry for the spaghetti code this is to filter out the compass on api 8
    //Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
     if (mPrefs.getBoolean(PREFS_SHOW_COMPASS, false)) {
         if (mCompassOverlay!=null) {
             //this call is needed because onPause, the orientation provider is destroyed to prevent context leaks
             this.mCompassOverlay.setOrientationProvider(new InternalCompassOrientationProvider(getActivity()));
             this.mCompassOverlay.enableCompass();
         }
     }
    mMapView.onResume();
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:27,代码来源:StarterMapFragment.java


示例6: setUpMapIfNeeded

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
 * Description:     Initialises the Map and sets initial options such as:
 * Zoom levels and controls
 * Compass
 * ScaleBar
 * Cluster Pin colors
 * Location update settings
 */
private void setUpMapIfNeeded() {

    // Check if we were successful in obtaining the map.
    mMap.setBuiltInZoomControls(true);
    mMap.setMultiTouchControls(true);
    mMap.setMinZoomLevel(3);
    mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
    mMap.getTileProvider().createTileCache();
    mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);

    ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
    mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
    mScaleBarOverlay.setCentred(true);

    // Sets cluster pin color
    mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
    //BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
    BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(),R.drawable.ic_map_pin_orange, null);

    mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());

    GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
    gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);   // [ms] // Set the minimum time interval for location updates
    mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
    mMyLocationOverlay.setDrawAccuracyEnabled(true);

    mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
    mMap.getOverlays().add(mMyLocationOverlay);
    mMap.getOverlays().add(mCompassOverlay);
    mMap.getOverlays().add(mScaleBarOverlay);
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:41,代码来源:MapViewerOsmDroid.java


示例7: setUpMapIfNeeded

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
 * Description:     Initialises the Map and sets initial options such as:
 * Zoom levels and controls
 * Compass
 * ScaleBar
 * Cluster Pin colors
 * Location update settings
 */
private void setUpMapIfNeeded() {

    // Check if we were successful in obtaining the map.
    mMap.setBuiltInZoomControls(true);
    mMap.setMultiTouchControls(true);
    mMap.setMinZoomLevel(3);
    mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
    mMap.getTileProvider().createTileCache();
    mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);

    ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
    mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
    mScaleBarOverlay.setCentred(true);

    // Sets cluster pin color
    mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
    BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
    mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());

    GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
    gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);   // [ms] // Set the minimum time interval for location updates
    mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
    mMyLocationOverlay.setDrawAccuracyEnabled(true);

    mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
    mMap.getOverlays().add(mMyLocationOverlay);
    mMap.getOverlays().add(mCompassOverlay);
    mMap.getOverlays().add(mScaleBarOverlay);
}
 
开发者ID:anticomarley,项目名称:Android-IMSI-Catcher-Detector,代码行数:39,代码来源:MapFragment.java


示例8: setUpMapIfNeeded

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
 * Description:     Initialises the Map and sets initial options such as:
 * Zoom levels and controls
 * Compass
 * ScaleBar
 * Cluster Pin colors
 * Location update settings
 */
private void setUpMapIfNeeded() {

    // Check if we were successful in obtaining the map.
    mMap.setBuiltInZoomControls(true);
    mMap.setMultiTouchControls(true);
    mMap.setMinZoomLevel(3);
    mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
    mMap.getTileProvider().createTileCache();
    mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);

    ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
    mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
    mScaleBarOverlay.setCentred(true);

    // Sets cluster pin color
    mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
    BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
    mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());

    GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
    gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);   // [ms] // Set the minimum time interval for location updates
    mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
    mMyLocationOverlay.setDrawAccuracyEnabled(true);

    mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
    mMap.getOverlays().add(mMyLocationOverlay);
    mMap.getOverlays().add(mCompassOverlay);
    mMap.getOverlays().add(mScaleBarOverlay);
}
 
开发者ID:anticomarley,项目名称:Android-IMSI-Catcher-Detector,代码行数:39,代码来源:MapViewerOsmDroid.java


示例9: onCreateView

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的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


示例10: addOverlays

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
protected void addOverlays() {
    //sorry for the spaghetti code this is to filter out the compass on api 8
    //Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
        mCompassOverlay = new CompassOverlay(getContext(), new InternalCompassOrientationProvider(getContext()),
                mMapView);
        mCompassOverlay.enableCompass();
        mMapView.getOverlays().add(this.mCompassOverlay);
    }
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:11,代码来源:SampleTester.java


示例11: onResume

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    //sorry for the spaghetti code this is to filter out the compass on api 8
    //Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218

    if (mCompassOverlay != null) {
        //this call is needed because onPause, the orientation provider is destroyed to prevent context leaks
        this.mCompassOverlay.setOrientationProvider(new InternalCompassOrientationProvider(getActivity()));
        this.mCompassOverlay.enableCompass();
    }

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:14,代码来源:SampleTester.java


示例12: onCreate

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_starter_mapview);

    Intent intent = getIntent();
    //if (intent)
    final double lat1 = 25.633;
    final double long1 = 71.094;

    //super important. Many tile servers, including open street maps, will BAN applications by user
    //agent. Do not use the sample application's user agent for your app! Use your own setting, such
    //as the app id.
    Configuration.getInstance().setUserAgentValue(getPackageName());

    mMapView = (MapView) findViewById(R.id.mapview);
    mMapView.setTileSource(TileSourceFactory.MAPNIK);


    mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this),
            mMapView);
    mCompassOverlay.enableCompass();
    mMapView.getOverlays().add(this.mCompassOverlay);

    addOverlays();

    GeoPoint startPoint = new GeoPoint(lat1, long1);
    IMapController mapController = mMapView.getController();
    mapController.setZoom(9);
    mapController.setCenter(startPoint);
    Marker startMarker = new Marker(mMapView);
    startMarker.setPosition(startPoint);
    startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    mMapView.getOverlays().add(startMarker);


    mMapView.invalidate();

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:40,代码来源:WeathForceActivity.java


示例13: setUpMapIfNeeded

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
 * Description:     Initialises the Map and sets initial options such as:
 *                      Zoom levels and controls
 *                      Compass
 *                      ScaleBar
 *                      Cluster Pin colors
 *                      Location update settings
 */
private void setUpMapIfNeeded() {

    // Check if we were successful in obtaining the map.
    mMap.setBuiltInZoomControls(true);
    mMap.setMultiTouchControls(true);
    mMap.setMinZoomLevel(3);
    mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
    mMap.getTileProvider().createTileCache();
    mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);

    ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
    mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
    mScaleBarOverlay.setCentred(true);

    // Sets cluster pin color
    mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
    //BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
    BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_pin_orange, null);
    mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());

    GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
    gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);   // [ms] // Set the minimum time interval for location updates
    mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
    mMyLocationOverlay.setDrawAccuracyEnabled(true);

    mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
    mMap.getOverlays().add(mMyLocationOverlay);
    mMap.getOverlays().add(mCompassOverlay);
    mMap.getOverlays().add(mScaleBarOverlay);
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:40,代码来源:MapFragment.java


示例14: refreshLocationsOnMap

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
public void refreshLocationsOnMap(){
    map.getOverlays().clear();
    map.invalidate();

    placeMarkers.clear();
    allPlaces = Place.getAll();


    for(Place place: allPlaces){
        OverlayItem placeOverlayItem = new OverlayItem(
                place.getAddress(), place.getDescription(), new GeoPoint(place.getLatitude(), place.getLongitude()));
        Drawable myCurrentLocationMarker = this.getResources().getDrawable(R.drawable.marker_cloud);
        placeOverlayItem.setMarker(myCurrentLocationMarker);
        placeMarkers.add(placeOverlayItem);
    }


    // add my current location overlay
    if(currentLocation != null){
        OverlayItem myLocationOverlayItem = new OverlayItem("Here", "Current location",
                new GeoPoint(currentLocation.getLatitude(), currentLocation.getLongitude()));
        myLocationOverlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
        placeMarkers.add(myLocationOverlayItem);
    }


    ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay
            = new ItemizedIconOverlay<OverlayItem>(
            getActivity(), placeMarkers, null);
    map.getOverlays().add(anotherItemizedIconOverlay);


    ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(map);
    map.getOverlays().add(myScaleBarOverlay);

    MyLocationNewOverlay mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(getActivity()), map);
    map.getOverlays().add(mLocationOverlay);

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

    /*RotationGestureOverlay mRotationGestureOverlay = new RotationGestureOverlay(getActivity(), map);
    mRotationGestureOverlay.setEnabled(true);
    map.setMultiTouchControls(true);
    map.getOverlays().add(mRotationGestureOverlay);*/


    setBoundingBox();

}
 
开发者ID:hamzux,项目名称:cosi,代码行数:51,代码来源:PlacesFragment.java


示例15: onActivityCreated

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
     super.onActivityCreated(savedInstanceState);

     final Context context = this.getActivity();
     final DisplayMetrics dm = context.getResources().getDisplayMetrics();
     // mResourceProxy = new ResourceProxyImpl(getActivity().getApplicationContext());

     mPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);

     this.mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(context),
          mMapView);

     mMinimapOverlay = new MinimapOverlay(context, mMapView.getTileRequestCompleteHandler());
     mMinimapOverlay.setWidth(dm.widthPixels / 5);
     mMinimapOverlay.setHeight(dm.heightPixels / 5);


     mCopyrightOverlay = new CopyrightOverlay(context);

    //i hate this very much, but it seems as if certain versions of android and/or
    //device types handle screen offsets differently
    if (Build.VERSION.SDK_INT <= 10)
        mCopyrightOverlay.setOffset(0,(int)(55*dm.density));

     mScaleBarOverlay = new ScaleBarOverlay(mMapView);
     mScaleBarOverlay.setCentred(true);
     mScaleBarOverlay.setScaleBarOffset(dm.widthPixels / 2, 10);

     mRotationGestureOverlay = new RotationGestureOverlay(mMapView);
     mRotationGestureOverlay.setEnabled(true);

     mMapView.setBuiltInZoomControls(true);
     mMapView.setMultiTouchControls(true);

     mMapView.setTilesScaledToDpi(false);
     mMapView.getOverlays().add(this.mLocationOverlay);
     mMapView.getOverlays().add(this.mCopyrightOverlay);

     mMapView.getOverlays().add(this.mMinimapOverlay);
     mMapView.getOverlays().add(this.mScaleBarOverlay);
     mMapView.getOverlays().add(this.mRotationGestureOverlay);

     final float zoomLevel = mPrefs.getFloat(PREFS_ZOOM_LEVEL_DOUBLE, mPrefs.getInt(PREFS_ZOOM_LEVEL, 1));
     mMapView.getController().setZoom(zoomLevel);
     final float orientation = mPrefs.getFloat(PREFS_ORIENTATION, 0);
     mMapView.setMapOrientation(orientation, false);
     final String latitudeString = mPrefs.getString(PREFS_LATITUDE_STRING, null);
     final String longitudeString = mPrefs.getString(PREFS_LONGITUDE_STRING, null);
     if (latitudeString == null || longitudeString == null) { // case handled for historical reasons only
         final int scrollX = mPrefs.getInt(PREFS_SCROLL_X, 0);
         final int scrollY = mPrefs.getInt(PREFS_SCROLL_Y, 0);
         mMapView.scrollTo(scrollX, scrollY);
     } else {
         final double latitude = Double.valueOf(latitudeString);
         final double longitude = Double.valueOf(longitudeString);
         mMapView.setExpectedCenter(new GeoPoint(latitude, longitude));
     }

     mLocationOverlay.enableMyLocation();

    //sorry for the spaghetti code this is to filter out the compass on api 8
    //Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
     if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
         mCompassOverlay = new CompassOverlay(context, new InternalCompassOrientationProvider(context),
                 mMapView);
         mCompassOverlay.enableCompass();
         mMapView.getOverlays().add(this.mCompassOverlay);
     }

     setHasOptionsMenu(true);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:73,代码来源:StarterMapFragment.java


示例16: onResume

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    //lock the device in current screen orientation
    int orientation;
    int rotation = ((WindowManager) this.getSystemService(
            Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
    switch (rotation) {
        case Surface.ROTATION_0:
            orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
            this.deviceOrientation = 0;
            break;
        case Surface.ROTATION_90:
            this.deviceOrientation = 90;
            orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
            break;
        case Surface.ROTATION_180:
            this.deviceOrientation = 180;
            orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
            break;
        default:
            this.deviceOrientation = 270;
            orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
            break;
    }

    this.setRequestedOrientation(orientation);


    LocationManager lm = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    try {
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {

            return;
        }
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, (LocationListener) this);
        lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, (LocationListener) this);
    } catch (Exception ex) {
    }
    compass = new InternalCompassOrientationProvider(this);
    compass.startOrientationProvider(this);
    mMapView.getController().zoomTo(14);

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:46,代码来源:WeathForceActivity.java


示例17: onCreateView

import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    final Context context;
    final DisplayMetrics dm;

    View v = inflater.inflate(R.layout.fragment_map, container, false);
    Views.inject(this, v);

    context = inflater.getContext();
    dm = context.getResources().getDisplayMetrics();

    final int actionBarHeight;
    TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
    {
        actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
    }else {
        actionBarHeight = 48;
    }

    mMapView = new MapView(inflater.getContext(), 256, mResourceProxy);
    mMapView.setUseSafeCanvas(true);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);
    mMapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    mPathOverlay = new SolutionPathOverlay(mResourceProxy);
    mMyLocationOverlay = new MyLocationNewOverlay(context, mMyLocationProvider,
            mMapView, mResourceProxy);

    mCompassOverlay = new CompassOverlay(context, new InternalCompassOrientationProvider(context),
            mMapView, mResourceProxy);
    mCompassOverlay.setCompassCenter(25.0f * dm.density, actionBarHeight + 5.0f * dm.density);

    mScaleBarOverlay = new ScaleBarOverlay(context);
    mScaleBarOverlay.setCentred(true);
    mScaleBarOverlay.setScaleBarOffset(dm.widthPixels/2, actionBarHeight + 5.0f * dm.density);

    mMapView.getOverlays().add(mPathOverlay);
    mMapView.getOverlays().add(mScaleBarOverlay);
    mMapView.getOverlays().add(mMyLocationOverlay);
    mMapView.getOverlays().add(mCompassOverlay);

    mMapViewContainer.addView(mMapView, 0);

    return v;
}
 
开发者ID:illarionov,项目名称:RtkGps,代码行数:49,代码来源:MapFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KolmogorovSmirnovTest类代码示例发布时间:2022-05-22
下一篇:
Java PathFilterGroup类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap