2016-12-07 7 views
0

私は私に苦しんでいて、仮想円弧上PointLatLngの一覧を取得しますGMAP-アプリケーション与えられた3点(中央部、開始、終了)

GMAP.NETライブラリを使用して、私は満たされたARC-を描画しようとしていますポリゴン3座標:center_coordinate,start_coordinateおよびend_coordinate(すべてがDD,MM.MMMの形式)。

円弧を適切な解像度で地図上にポリゴンとして描画することを知っているので、私はさらに多くのセグメントと時計回り/反時計回りの方向情報を定義します。

GMAP.NETを使用してポリゴン(List of PointLatLngによって生成)をマップに描画する方法は、一般的にわかっています。それはうまく動作するので、私はPointLatLngのリストを取得することを決めた。

私の問題は、理想的な弧の各点をどのように計算するかについて具体的な考え方がないことです。私はこれまで

Public Function list_of_points_on_arc(point_center As PointLatLng, point_arc_start As PointLatLng, point_arc_end As PointLatLng, direction As String) As List(Of PointLatLng) 

     'direction: CW - clockwise/CC - Counter Clockwise 

     Const radiusEarthKilometres As Double = 6371.01 

     'sets the resolution of arc 
     Dim elements As Integer = 20 

     'unknown point on arc, each ...element 
     Dim point_on_arc As PointLatLng 

     'List collects all points aon arc 
     Dim gpollist As List(Of PointLatLng) = New List(Of PointLatLng) 

     For i As Integer = 0 To elements 
      ' ????????????????????????????????????????????????????????? 
      'calculates new point_on_arc based on following information 
      ' - elements, point_center, point_arc_start, point_arc_end 
      ' ... 
      ' 
      ' ... 
      ' 
      ' point_on_arc = New PointLatLng(on_arc_lat, on_arc_lon) 
      ' ????????????????????????????????????????????????????????? 

      'adds point_on_arc to list 
      gpollist.Add(point_on_arc) 
     Next 

     'returns list of pointsLatLon 
     Return gpollist 
    End Function 

正しい方向に私をプッシュするすべてのヘルプをやった

が高く評価されています。ありがとう。 、rは半径である

x = cx + r * cos(a) 
y = cy + r * sin(a) 

、CX起源をCY、aはラジアン単位の角度です:

答えて

0

さて、あなたはサークル(https://en.wikipedia.org/wiki/Circle#Equations)のためのパラメトリック方程式を使用することができます。あなたのケースでは、あなたは、単にインクリメント値を取得することにより、総円周(2PI)を分割する、何かのように:

あなたはGMAPで円をたくさん描画しようとしている場合は
double a_part = 2 * PI/elements; 
for(i = 1; i <= elements; i++) 
{ 
    x = cx + r * cos(i * a_part); 
    y = cy + r * sin(i * a_part); 
} 

、あなただけの最高のオフですGMapMarkerを継承し、DrawEllipse関数を使用して半径を持つ円を描画することで、新しいマーカータイプを作成します。これについては、How to draw circle on the MAP using GMAP.NET in C#で説明します。

関連する問題