1
AS3에서 Adobe Flash Pro로 AIR 응용 프로그램을 만들고 있습니다.사용자 지점에 가장 가까운 것을 감지합니다.
내가 그런 식으로 자신의 좌표를 여러 POI 점을 넣어했습니다 사용자가 나는 점을 배치하기 위해 위치 정보 기능을 넣었습니다
var myIcon2:MapIcon = new MapIcon();
myIcon2.setImage(new pizzaImg(),22,32);
embeddedIconPoi = new Poi(new LatLng(-50.231838, 194.023561));
embeddedIconPoi.rolloverAndInfoTitleText = "Pizza";
embeddedIconPoi.icon = myIcon2;
PoiColl.add(embeddedIconPoi);
(나는지도가 사용하고) 어디든지 :
if (Geolocation.isSupported){
my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
}
function onGeoUpdate(e:GeolocationEvent):void{
embeddedIconPoi.latLng = new LatLng(e.latitude, e.longitude);
}
이제 버튼을 클릭 할 때 사용자에게 가장 가까운 지점을 보여주는 함수를 만드는 방법이 있습니까? 같은
뭔가 :
buttonClosest.addEventListener(MouseEvent.CLICK, goClosest, false, 0, true);
function goClosest(event:MouseEvent):void{
// Don't know what should I put here....
}
귀하의 답변을 주셔서 감사합니다,
스테파니
하버 사인 공식 ( http://en.wikipedia.org/wiki/Haversine_formula)는 위도와 경도에 의해 정의 된 두 점 사이의 거리를 확인하는 데 사용할 수 있습니다