本文整理汇总了Java中org.osmdroid.views.overlay.PathOverlay类的典型用法代码示例。如果您正苦于以下问题:Java PathOverlay类的具体用法?Java PathOverlay怎么用?Java PathOverlay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathOverlay类属于org.osmdroid.views.overlay包,在下文中一共展示了PathOverlay类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPolyline
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
@Override
public int addPolyline(final Polyline aPolyline) {
if (mPolylines == null) {
mPolylines = new HashMap<Integer, PathOverlay>();
}
final PathOverlay overlay = new PathOverlay(aPolyline.color, aPolyline.width, mMapView.getContext());
overlay.addPoints(aPolyline.points);
mMapView.getOverlays().add(0, overlay); // add polyline overlay below markers, etc
final int id = random.nextInt();
mPolylines.put(id, overlay);
return id;
}
示例2: getPolyline
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
private PathOverlay getPolyline(final int id) {
if (mPolylines == null) {
throw new IllegalArgumentException("No such id");
}
final PathOverlay polyline = mPolylines.get(id);
if (polyline == null) {
throw new IllegalArgumentException("No such id");
}
return polyline;
}
示例3: clear
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
@Override
public void clear() {
if (mItemizedOverlay != null) {
mItemizedOverlay.removeAllItems();
}
if (mPolylines != null) {
for(final PathOverlay polyline : mPolylines.values()) {
mMapView.getOverlays().remove(mPolylines.remove(polyline));
}
mPolylines.clear();
}
}
示例4: onCreateView
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的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;
}
示例5: addPathOverlay
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
private void addPathOverlay() {
pathOverlay = new PathOverlay(Color.BLUE, mContext);
pathOverlay.getPaint().setStyle(Style.STROKE);
pathOverlay.getPaint().setStrokeWidth(3);
pathOverlay.getPaint().setAntiAlias(true);
mapView.getOverlays().add(pathOverlay);
}
示例6: setupTrackToView
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
private void setupTrackToView() {
// simulate flight Track
if (flightLog.size() == 0)
simulateTrack();
// Info Table
gpsData = (ListView) findViewById(R.id.fm_table);
gpsListAdapterView = new GpsListAdapter(this);
gpsData.setAdapter(gpsListAdapterView);
for (int j = 0; j < flightLog.size(); j++)
gpsListAdapterView.add(flightLog.get(j));
gpsData.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
map.getController().setCenter(
new GeoPoint(flightLog.get(position).getLatitude(),
flightLog.get(position).getLongitude()));
}
public void onNothingSelected(AdapterView parentView) {
}
});
double speedMax = 0.;
double heightMin = 0., heightMax = 0.;
for (int k = 0; k < flightLog.size(); k++) {
double speed = flightLog.get(k).getSpeedValue(SPEED.ms);
if (speedMax < speed)
speedMax = speed;
double height = flightLog.get(k).getAltitude();
if (heightMin > height)
heightMin = height;
if (heightMax < height)
heightMax = height;
}
StringBuilder flightInfo = new StringBuilder();
flightInfo.append("max. Speed " + speedMax + " m/s\n");
flightInfo.append("min. Height " + heightMin + ", max. Height "
+ heightMax);
tv_info.setText(flightInfo.toString());
// Overlay Path
PathOverlay myPath = new PathOverlay(Color.RED, this);
for (int i = 0; i < flightLog.size(); i++) {
myPath.addPoint(new GeoPoint(flightLog.get(i).getLatitude(),
flightLog.get(i).getLongitude()));
}
map.getOverlays().add(myPath);
// Special Points
map.getController().setCenter(getCenterPoint());
resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
poi = new ArrayList<>();
OverlayItem start = new OverlayItem("Start", "Position",
new GeoPoint(flightLog.get(0).getLatitude(), flightLog.get(0)
.getLongitude()));
Drawable blkMarker = getResources().getDrawable(
R.drawable.map_blk_marker_small);
start.setMarker(blkMarker);
poi.add(start);
OverlayItem end = new OverlayItem("End", "Position", new GeoPoint(
flightLog.get(flightLog.size() - 1).getLatitude(), flightLog
.get(flightLog.size() - 1).getLongitude()));
Drawable blueMarker = getResources().getDrawable(
R.drawable.map_blue_marker_small);
end.setMarker(blueMarker);
poi.add(end);
POIItemizedOverlay overlay = new POIItemizedOverlay(this, poi);
map.getOverlays().add(overlay);
}
示例7: createOverlays
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
/**
* Creates overlays over the OSM view
*/
private void createOverlays() {
pathOverlay = new PathOverlay(Color.BLUE, this);
// pathOverlay.
osmView.getOverlays().add(pathOverlay);
// osmView.set
myLocationOverlay = new SimpleLocationOverlay(this);
osmView.getOverlays().add(myLocationOverlay);
wayPointsOverlay = new WayPointsOverlay(this, currentTrackId);
osmView.getOverlays().add(wayPointsOverlay);
}
示例8: clearPolyline
import org.osmdroid.views.overlay.PathOverlay; //导入依赖的package包/类
@Override
public void clearPolyline(final int id) {
final PathOverlay polyline = getPolyline(id);
mMapView.getOverlays().remove(polyline);
mPolylines.remove(id);
}