내가 사용하는 라인의 끝을 계산하려면
SphericalUtil.computeOffset(LatLng,lenght,heading);
미터에 폭을 계산하기 I 이것을 사용하십시오 :
public Double calcw(GoogleMap map,int ancho,LatLng p) {
float tilt = map.getCameraPosition().tilt;
CameraPosition old=map.getCameraPosition();
if(tilt!=0){
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(old.target) // Sets the center of the map to Mountain View
.zoom(old.zoom) // Sets the zoom
.bearing(old.bearing) // Sets the orientation of the camera to east
.tilt(0) // Sets the tilt of the camera to 30 degrees
.build();
map.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
Point g1 =map.getProjection().toScreenLocation(p);
Point g2=map.getProjection().toScreenLocation(SphericalUtil.computeOffset(p,ancho/10,0));
Double result=(distance(g1,g2));
//Log.e("PROJ1",Double.toString(distance(g1,g2)));
map.moveCamera(CameraUpdateFactory.newCameraPosition(old));
return result;
}
public double distance(Point a, Point b)
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return Math.sqrt(dx * dx + dy * dy);
}
방향을 지정하면 ... 그릴 선이 하나뿐입니다. 한 점, 길이 및 방향 (도) ... 나는 제안 페이지를 시도 할 것입니다 – jion
문제는 : 어떻게 1 미터를 지정할 수 있습니까? 예 : LatLng2.longitude = r x cos (a); 및 LatLng2.latitude = r × sin (a); 하지만 "r"이 1 미터라고 Google지도에 어떻게 설명 할 수 있습니까? – jion
많이 고마워요. 사용했지만 문제가 있습니다. 여기에서 설명했습니다. http://stackoverflow.com/questions/28321738/android-google-map-heading-is-drawn-wrongly-when-i-draw-a-line-with-specific – jion