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

Java Polyline类代码示例

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

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



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

示例1: drawRoute

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
public static void drawRoute(Context context, MapView map, List<Point> points) {
    Polyline line = new Polyline(context);

    line.setSubDescription(Polyline.class.getCanonicalName());
    line.setWidth(15f);
    line.setColor(ContextCompat.getColor(context, R.color.orange_partially_transparent));

    List<GeoPoint> geoPoints = new ArrayList<>();

    for(Point point : points) {

        geoPoints.add(point.Position);
    }

    line.setPoints(geoPoints);
    line.setGeodesic(true);
    map.getOverlayManager().add(line);
}
 
开发者ID:LenaShervarly,项目名称:TreasureHunting,代码行数:19,代码来源:MapHelper.java


示例2: addOverlay

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/** 
 * Converts the overlay to a KmlFeature and add it inside this. 
 * Conversion from Overlay subclasses to KML Features is as follow: <br>
 *   FolderOverlay, MarkerClusterer => Folder<br>
 *   Marker => Point<br>
 *   Polygon => Polygon<br>
 *   Polyline => LineString<br>
 *   GroundOverlay => GroundOverlay<br>
 *   Else, add nothing. 
 * @param overlay to convert and add
 * @param kmlDoc for style handling. 
 * @return true if OK, false if the overlay has not been added. 
 */
public boolean addOverlay(Overlay overlay, KmlDocument kmlDoc){
	if (overlay == null)
		return false;
	KmlFeature kmlItem;
	if (overlay instanceof GroundOverlay){
		kmlItem = new KmlGroundOverlay((GroundOverlay)overlay);
	} else if (overlay instanceof FolderOverlay){
		kmlItem = new KmlFolder((FolderOverlay)overlay, kmlDoc);
	} else if (overlay instanceof MarkerClusterer){
		kmlItem = new KmlFolder((MarkerClusterer)overlay, kmlDoc);
	} else if (overlay instanceof Marker){
		Marker marker = (Marker)overlay;
		kmlItem = new KmlPlacemark(marker);
	} else if (overlay instanceof Polygon){
		Polygon polygon = (Polygon)overlay;
		kmlItem = new KmlPlacemark(polygon, kmlDoc);
	} else if (overlay instanceof Polyline){
		Polyline polyline = (Polyline)overlay;
		kmlItem = new KmlPlacemark(polyline, kmlDoc);
	} else {
		return false;
	}
	mItems.add(kmlItem);
	return true;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:39,代码来源:KmlFolder.java


示例3: applyDefaultStyling

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
public void applyDefaultStyling(Polyline lineStringOverlay, Style defaultStyle, KmlPlacemark kmlPlacemark,
		KmlDocument kmlDocument, MapView map){
	Context context = map.getContext();
	Style style = kmlDocument.getStyle(kmlPlacemark.mStyle);
	if (style != null){
		lineStringOverlay.setColor(style.getOutlinePaint().getColor());
		lineStringOverlay.setWidth(style.getOutlinePaint().getStrokeWidth());
	} else if (defaultStyle!=null && defaultStyle.mLineStyle!=null){ 
		lineStringOverlay.setColor(defaultStyle.getOutlinePaint().getColor());
		lineStringOverlay.setWidth(defaultStyle.getOutlinePaint().getStrokeWidth());
	}
	if ((kmlPlacemark.mName!=null && !"".equals(kmlPlacemark.mName)) 
			|| (kmlPlacemark.mDescription!=null && !"".equals(kmlPlacemark.mDescription))
			|| (lineStringOverlay.getSubDescription()!=null && !"".equals(lineStringOverlay.getSubDescription()))
			){
		if (mDefaultLayoutResId == BonusPackHelper.UNDEFINED_RES_ID){
			String packageName = context.getPackageName();
			mDefaultLayoutResId = context.getResources().getIdentifier("layout/bonuspack_bubble", null, packageName);
		}
		lineStringOverlay.setInfoWindow(new BasicInfoWindow(mDefaultLayoutResId, map));
	}
	lineStringOverlay.setEnabled(kmlPlacemark.mVisibility);
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:24,代码来源:KmlLineString.java


示例4: buildOverlay

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/** Build the corresponding Polyline overlay */	
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, 
		KmlDocument kmlDocument){
	Context context = map.getContext();
	Polyline lineStringOverlay = new Polyline(context);
	lineStringOverlay.setPoints(mCoordinates);
	lineStringOverlay.setTitle(kmlPlacemark.mName);
	lineStringOverlay.setSnippet(kmlPlacemark.mDescription);
	lineStringOverlay.setSubDescription(kmlPlacemark.getExtendedDataAsText());
	if (styler != null)
		styler.onLineString(lineStringOverlay, kmlPlacemark, this);
	else {
		applyDefaultStyling(lineStringOverlay, defaultStyle, kmlPlacemark, kmlDocument, map);
	}
	return lineStringOverlay;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:17,代码来源:KmlLineString.java


示例5: drawDirections

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
public static void drawDirections(Context context, MapView map, List<AudioPoint> points) {
    for(AudioPoint point : points) {
        Polyline line = new Polyline(context);
        line.setSubDescription(Polyline.class.getCanonicalName());
        line.setWidth(3f);
        line.setColor(0xFFFF0050);
        ArrayList<GeoPoint> tmp = new ArrayList<>();
        tmp.add(point.Position);
        tmp.add(new Vector2(point.Position).add(point.Direction.mult(0.0005)).toGeoPoint());
        line.setPoints(tmp);
        map.getOverlayManager().add(line);
    }
}
 
开发者ID:LenaShervarly,项目名称:TreasureHunting,代码行数:14,代码来源:MapHelper.java


示例6: buildRoadOverlay

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
public static Polyline buildRoadOverlay(Road road, int color, float width, Context context){
    Polyline roadOverlay = new Polyline(context);
    roadOverlay.setColor(color);
    roadOverlay.setWidth(width);

    if (road != null) {
        ArrayList<GeoPoint> polyline = road.mRouteHigh;
        roadOverlay.setPoints(polyline);
    }
    return roadOverlay;
}
 
开发者ID:Arman92,项目名称:Mapsforge-OsmDroid-GraphHopper,代码行数:12,代码来源:MFMapView.java


示例7: buildRoadOverlay

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/**
 * Using the road high definition shape, builds and returns a Polyline. 
 * @param road
 * @param color
 * @param width
 * @param context
 */
public static Polyline buildRoadOverlay(Road road, int color, float width, Context context){
	Polyline roadOverlay = new Polyline(context);
	roadOverlay.setColor(color);
	roadOverlay.setWidth(width);
	if (road != null) {
		ArrayList<GeoPoint> polyline = road.mRouteHigh;
		roadOverlay.setPoints(polyline);
	}
	return roadOverlay;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:18,代码来源:RoadManager.java


示例8: KmlPlacemark

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/** constructs a Placemark from a Polyline overlay, as a KML LineString */
public KmlPlacemark(Polyline polyline, KmlDocument kmlDoc){
	this();
	mName = polyline.getTitle();
	mDescription = polyline.getSnippet();
	mGeometry = new KmlLineString();
	mGeometry.mCoordinates = (ArrayList<GeoPoint>)polyline.getPoints();
	mVisibility = polyline.isEnabled();
	//Style:
	Style style = new Style();
	style.mLineStyle = new LineStyle(polyline.getColor(), polyline.getWidth());
	mStyle = kmlDoc.addStyle(style);
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:14,代码来源:KmlPlacemark.java


示例9: onPostExecute

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
@Override
protected void onPostExecute(Object result){
    mapView.getOverlays().clear();
    drawMarkers();
    final Road road = (Road) result;
    final Polyline routeOverlay = RoadManager.buildRoadOverlay(road, getActivity());
    initRouteInstructions(road);
    final TextView lblDistance = (TextView)getView().findViewById(R.id.lblDistance);
    lblDistance.setText(String.format("%.2f", road.mLength)  + "km");
    final TextView lblTime = (TextView)getView().findViewById(R.id.lblTime);
    lblTime.setText(String.format("%.0f",(road.mDuration / 60)) + " " + getResources().getString(R.string.minutes)); //set estimated time in minutes
    mapView.getOverlays().add(routeOverlay);
    mapView.invalidate();
}
 
开发者ID:oSoc14,项目名称:Artoria,代码行数:15,代码来源:MapFragment.java


示例10: onCreate

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent in = getIntent();
    // getting attached intent data
    Bundle extras = in.getExtras();
    double lat = Double.parseDouble(extras.getString("lat"));
    double lon = Double.parseDouble(extras.getString("lon"));

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_routing);

    LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
    Criteria criteria = new Criteria();
    Location locationNet = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    Location locationGPS = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

    //GeoPoint gp = new GeoPoint(48.416312, -4.466546);
    GeoPoint gp = null;
    if(locationGPS != null) {
        gp = new GeoPoint(locationGPS.getLatitude(), locationGPS.getLongitude());
    }
    else if(locationNet != null){
        gp = new GeoPoint(locationNet.getLatitude(), locationNet.getLongitude());
    } else {
        return;
    }

    MapView mMap = (MapView) findViewById(R.id.mapRoute);
    IMapController mapController = mMap.getController();
    RoadManager roadManager = new OSRMRoadManager();

    ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
    waypoints.add(gp);
    GeoPoint endPoint = new GeoPoint(lat, lon);
    waypoints.add(endPoint);
    Road road = roadManager.getRoad(waypoints);
    Polyline roadOverlay = RoadManager.buildRoadOverlay(road, this);
    mMap.getOverlays().add(roadOverlay);
    //mMap.invalidate();

    /*NominatimPOIProvider poiProvider = new NominatimPOIProvider();
    ArrayList<POI> pois = poiProvider.getPOICloseTo(gp, "garage", 50, 0.1);
    FolderOverlay poiMarkers = new FolderOverlay(this);
    mMap.getOverlays().add(poiMarkers);*/

    mapController.setCenter(endPoint);
    mapController.setZoom(13);
    mMap.setMultiTouchControls(true);
}
 
开发者ID:Darkitty,项目名称:BTB,代码行数:51,代码来源:Routing.java


示例11: updateRoadOverlay

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
private void updateRoadOverlay(Polyline roadOverlay){
    clearRoad();
    currentRoadOverlay = roadOverlay;
    addOverlay(roadOverlay);
}
 
开发者ID:OpenISDM,项目名称:madapp,代码行数:6,代码来源:MapFragment.java


示例12: onLineString

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/** called on each KmlPoint */
abstract void onLineString(Polyline polyline, KmlPlacemark kmlPlacemark, KmlLineString kmlLineString);
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:3,代码来源:KmlFeature.java


示例13: drawPolyline

import org.osmdroid.bonuspack.overlays.Polyline; //导入依赖的package包/类
/**
 * Creates Polyline to bind nodes of the route, and draw it
 * @param route The Road calcuated between each GeoPoint
 * @param map The MapView to draw the Road on
 * @param context Needed to draw the Road, should be the Activity containing the MapView
 */
public void drawPolyline(Road route, MapView map, Context context) {
    Polyline roadOverlay = RoadManager.buildRoadOverlay(route, context);
    map.getOverlays().add(roadOverlay);
    map.invalidate();
}
 
开发者ID:WikiJourney,项目名称:wikijourney_app,代码行数:12,代码来源:Routing.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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