【发布时间】:2017-09-07 19:20:50
【问题描述】:
我必须编写一个演示,它应该像在飞行中移动地图一样工作,并且需要像你一样绘制相同的曲线Polyline between two geo points / locations可以在下面的图片中看到。
甚至,我 would not mind switching 到其他一些 SDK,例如 Mapbox SDK(如果你们中的某个人可以 really help me in getting 我实际上需要什么)
要在两点之间绘制折线,我使用的是:
private void polyLine() {
LatLng starting = new LatLng(##.######, ##.######);
LatLng ending = new LatLng(##.######, ##.######);
PolylineOptions line = new PolylineOptions().add(starting, ending);
mGoogleMap.addMarker(new MarkerOptions().position(starting).title("Start"));
mGoogleMap.addMarker(new MarkerOptions().position(ending).title("End"));
mGoogleMap.addPolyline(line);
}
为了更新位置和动画标记,我正在使用:
@Override
public void onLocationChanged(Location location)
{
Toast.makeText(this, "Location Changed " + location.getLatitude()
+ location.getLongitude(), Toast.LENGTH_LONG).show();
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if(ourGlobalMarker == null) { // First time adding marker to map
ourGlobalMarker = mGoogleMap.addMarker(new MarkerOptions().position(latLng)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ROSE)));
MarkerAnimation.animateMarkerToICS(ourGlobalMarker, latLng, new LatLngInterpolator.Spherical());
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
} else {
MarkerAnimation.animateMarkerToICS(ourGlobalMarker, latLng, new LatLngInterpolator.Spherical());
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
}
}
我的要求:
折线
1. I have to create a Polyline the same you can see in attached image (curved one)
1.1. Dotted curved (if area not started yet)
1.2. Regular curved (in case area already covered)
当前标记
2. Showing current Location marker at right side of Polyline
(whereas, I want to show Animate marker on Polyline path)
【问题讨论】:
-
首先你必须将你的标记显示到当前位置。然后在 2 点之间绘制折线并在位置更改时不断更改标记的位置。
-
我可以知道你为什么要关闭它...我已经做了很好的尝试,为相同的程序编写了很多次...我什至有人在这里问过他们曾经得到的直接问题解决方案,但在我的情况下,您不会认为我已经为最后 7 个付出了一切。
-
@yash786 看看这个:stackoverflow.com/questions/46082918/…
-
您还没有发布一行代码,但您希望我们为您编写一些...您应该阅读stackoverflow.com/help/on-topic stackoverflow.com/help/dont-ask 尝试访问元站点以解决此类问题@ 987654325@
-
@JonGoodwin 我相信你还没有访问过我在上面分享的链接......请检查它们......
标签: android google-maps google-maps-api-3 android-maps-v2