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

Java Polyline类代码示例

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

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



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

示例1: onCreate

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
@Override
public final void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setHasOptionsMenu(true);

	// get shared preferences
	prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

	// Register our gps broadcast mReceiver
	registerReceiver();

	catalogObjects = new ArrayList<Layer>();
	sessionObjects = new ArrayList<Layer>();
	gpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), STROKE_GPX_WIDTH,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:17,代码来源:MapViewActivity.java


示例2: createPolyline

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
/**
 * draws a connected series of line segments specified by a list of LatLongs.
 *
 * @param pointList
 * @param color:       the color of the polyline
 * @param strokeWidth: the stroke width of the polyline
 * @return Polyline
 */
public Polyline createPolyline(PointList pointList, int color, int strokeWidth) {
    Paint paintStroke = AndroidGraphicFactory.INSTANCE.createPaint();

    paintStroke.setStyle(Style.STROKE);
    paintStroke.setStrokeJoin(Join.ROUND);
    paintStroke.setStrokeCap(Cap.ROUND);
    paintStroke.setColor(color);
    //        paintStroke.setDashPathEffect(new float[]{25, 25});
    paintStroke.setStrokeWidth(strokeWidth);

    // TODO: new mapsforge version wants an mapsforge-paint, not an android paint.
    // This doesn't seem to support transparceny
    //paintStroke.setAlpha(128);
    Polyline line = new Polyline((Paint) paintStroke, AndroidGraphicFactory.INSTANCE);
    List<LatLong> geoPoints = line.getLatLongs();
    PointList tmp = pointList;
    for (int i = 0; i < pointList.getSize(); i++) {
        geoPoints.add(new LatLong(tmp.getLatitude(i), tmp.getLongitude(i)));
    }
    return line;
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:30,代码来源:MapHandler.java


示例3: getBoundingBox

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
static BoundingBox getBoundingBox(Polyline pl) {
	List<LatLong> latlongs = pl.getLatLongs();
	double minLat = latlongs.get(0).latitude;
	double minLon = latlongs.get(0).longitude;
	double maxLat = latlongs.get(0).latitude;
	double maxLon = latlongs.get(0).longitude;
	for (int i = 0; i < latlongs.size(); i++) {
		minLat = Math.min(minLat, latlongs.get(i).latitude);
		minLon = Math.min(minLon, latlongs.get(i).longitude);
		maxLat = Math.max(maxLat, latlongs.get(i).latitude);
		maxLon = Math.max(maxLon, latlongs.get(i).longitude);
	}

	BoundingBox bbox = new BoundingBox(minLat, minLon, maxLat, minLon);
	return bbox;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:17,代码来源:MapView.java


示例4: onGpxLoaded

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
/**
 * Callback function for loadGpxObjects()
 */
@Override
public final void onGpxLoaded(final List<LatLong> points) {
    Log.d(TAG, "Loading " + points.size() + " gpx objects");

    clearGpxLayer();

    if (mMapView == null) {
        return;
    }

    mGpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.GREEN), STROKE_GPX_WIDTH,
            Style.STROKE), AndroidGraphicFactory.INSTANCE);

    for (final LatLong point : points) {
        mGpxObjects.getLatLongs().add(point);
    }

    synchronized (this) {
        mMapView.getLayerManager().getLayers().add(mGpxObjects);
    }

    mRefreshGpxPending = false;
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:27,代码来源:MapViewActivity.java


示例5: createPolyline

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
/**
   * Draws a polyline on the map view.
   * @param coordinates
   * @param color
   * @param strokeWidth
   * @return identifier for the object.
   */
  public int createPolyline(List<LatLong> coordinates, Color color, float strokeWidth) {
Paint paintStroke = mGraphicFactory.createPaint();
paintStroke.setStyle(Style.STROKE);
paintStroke.setColor(color);
paintStroke.setStrokeWidth(strokeWidth);

Polyline pl = new Polyline(paintStroke,mGraphicFactory);
pl.getLatLongs().addAll(coordinates);
MapView mapView = (MapView) getNativeView();
mapView.getLayerManager().getLayers().add(pl);
mLayers.put(Integer.toString(pl.hashCode()), pl);
mapView.getLayerManager().redrawLayers();

return pl.hashCode();
  }
 
开发者ID:snowciety,项目名称:sc.mapsforge,代码行数:23,代码来源:MapsforgeView.java


示例6: loadTrack

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
private Polyline loadTrack(List<GeoPoint> list) {
	Polyline pl = new Polyline(MainFrame.CALPAINT,
			MainFrame.GRAPHIC_FACTORY, true);
	List<LatLong> coordinateList = pl.getLatLongs();

	// add points into polyline
	for (int j = 0; j < list.size(); j++) {
		LatLong position = new LatLong(list.get(j).lat, list.get(j).lon);
		coordinateList.add(position);
	}
	return pl;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:13,代码来源:LocalizationWorker.java


示例7: loadTrack

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
private Polyline loadTrack(AccumulatedMotion list) {
	Polyline pl = new Polyline(MainFrame.IMUPAINT,
			MainFrame.GRAPHIC_FACTORY, true);
	List<LatLong> coordinateList = pl.getLatLongs();

	// add points into polyline
	for (int j = 0; j < list.size(); j++) {
		LatLong position = new LatLong(list.get(j).lat, list.get(j).lon);
		coordinateList.add(position);
	}
	return pl;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:13,代码来源:IMUWorker.java


示例8: onCreate

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    // get shared preferences
    prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

    mCatalogObjects = new ArrayList<>();
    mSessionObjects = new ArrayList<>();
    mGpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), STROKE_GPX_WIDTH,
            Style.STROKE), AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:14,代码来源:MapViewActivity.java


示例9: addOverlayLayers

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
@Override
protected void addOverlayLayers(Layers layers) {
	Polyline polyline = new Polyline(Utils.createPaint(
			AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), 8,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
	List<LatLong> latLongs = polyline.getLatLongs();
	latLongs.add(latLong2);
	latLongs.add(latLong3);
	layers.add(polyline);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:11,代码来源:ZoomToBounds.java


示例10: addOverlayLayers

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
protected void addOverlayLayers(Layers layers) {
	marker_start = Utils.createMarker(this, R.drawable.marker_departure,
			gpsStartPoint);
	marker_destination = Utils.createMarker(this,
			R.drawable.marker_destination, gpsEndPoint);
	marker_set_start = Utils.createMarker(this,
			R.drawable.marker_departure, departurePoint);
	marker_set_destination = Utils.createMarker(this,
			R.drawable.marker_destination, destinationPoint);
	for (int i = 0; i < marker_viapoints.size(); i++) {
		marker_viapoints.set(i, Utils.createTappableMarker(this,
				R.drawable.marker_via, viaPoints.get(i)));
		layers.add(marker_viapoints.get(i));
	}

	layers.add(marker_start);
	layers.add(marker_destination);
	layers.add(marker_set_start);
	layers.add(marker_set_destination);

	polyline_track = new Polyline(Utils.createPaint(
			AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), 8,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
	latLongs_track = polyline_track.getLatLongs();
	if (tmpLatLongs_track != null) {
		for (int i = 0; i < tmpLatLongs_track.size(); i++) {

			latLongs_track.add(tmpLatLongs_track.get(i));

		}
	}
	Log.i("LatLongs in Overlay", String.valueOf(latLongs_track));

	layers.add(polyline_track);

}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:37,代码来源:OfflineMapActivity.java


示例11: createMapViews

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
@Override
protected void createMapViews() {
	super.createMapViews();

	this.mapView2.getModel().mapViewPosition.setZoomLevel((byte) 12);

	this.observer = new MapViewPositionObserver(this.mapView.getModel().mapViewPosition,
			this.mapView2.getModel().mapViewPosition) {
		Polyline lastLine;

		@Override
		protected void setCenter() {
			super.setCenter();
			BoundingBox bbox = MapPositionUtil.getBoundingBox(DualOverviewMapViewer.this.mapView.getModel().mapViewPosition.getMapPosition(),
							DualOverviewMapViewer.this.mapView.getDimension(),
							DualOverviewMapViewer.this.mapView.getModel().displayModel.getTileSize());
			Paint paintStroke = Utils.createPaint(
					AndroidGraphicFactory.INSTANCE.createColor(Color.RED),
					2, Style.STROKE);
			Polyline polygon = new Polyline(paintStroke,
					AndroidGraphicFactory.INSTANCE);
			polygon.getLatLongs().add(
					new LatLong(bbox.minLatitude, bbox.minLongitude));
			polygon.getLatLongs().add(
					new LatLong(bbox.minLatitude, bbox.maxLongitude));
			polygon.getLatLongs().add(
					new LatLong(bbox.maxLatitude, bbox.maxLongitude));
			polygon.getLatLongs().add(
					new LatLong(bbox.maxLatitude, bbox.minLongitude));
			polygon.getLatLongs().add(
					new LatLong(bbox.minLatitude, bbox.minLongitude));
			if (this.lastLine != null) {
				DualOverviewMapViewer.this.mapView2.getLayerManager().getLayers()
						.remove(this.lastLine);
			}
			DualOverviewMapViewer.this.mapView2.getLayerManager()
					.getLayers().add(polygon);
			this.lastLine = polygon;
		}

		@Override
		protected void setZoom() {
			// do not change zoom, the overview stays zoomed out
		}
	};
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:47,代码来源:DualOverviewMapViewer.java


示例12: addTrackPoint

import org.mapsforge.map.layer.overlay.Polyline; //导入依赖的package包/类
/**
 * add a tracking point
 *
 * @param point
 */
public void addTrackPoint(LatLong point) {
    int i = mapView.getLayerManager().getLayers().indexOf(polylineTrack);
    ((Polyline) mapView.getLayerManager().getLayers().get(i)).getLatLongs().add(point);
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:10,代码来源:MapHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FastVectorHighlighter类代码示例发布时间:2022-05-22
下一篇:
Java IndexRoutingTable类代码示例发布时间: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