私m having little trouble finding a relation between the movement at centre and edge of a circle, I
世界地図のパンを行う場合、私の地図の範囲は 180,89:-180,-89 です。私の地図は、中央ではなくその範囲に change(dx,dY) を追加することによってパンします。地図を特定の中心に移動しなければならない状況が発生しました。経度の変化を計算するのは非常に簡単で簡単ですが、緯度の変化が問題を引き起こしています。マップの centerY の変化は mapY の端の変化よりも大きいようです。または単にマップの中心を 0long,0lat から 73long,33lat に移動する必要がある場合、dX の場合は単純に 73 になりますが、dY の場合は明らかに33 に見えますが、89 であるマップの上部に 33 を追加すると、緯度が 90 と -90 の間にあるため、122 になります。2D 平面上の円の射影では、円の端が角度によって後方に移動しているため、変化が少なく、中心がより変化している場合のようです。これら2つの要因の間に関係はありますか?OriginY と destinationY の差をラジアンに変換してから Map の Top と Bottom に追加しようとしましたが、うまくいきませんでした。マップは、幅が 256 から始まり 256*2^z ずつ増加する仮想キャンバス上に投影されていることに注意してください。z=0 がデフォルトであり、キャンバスのその範囲で全世界が表示されます。
public void moveMapTo(double destinationLongitude,double destinationLattitude) // moves map to the new centre
{
double dXLong=destinationLongitude-centreLongitude; // centreLongitude and centreLattitude are centre of current map position
double atanhsinO = atanh(Math.sin(destinationLattitude * Math.PI / 180.00));
double atanhsinD = atanh(Math.sin(centreLatitude * Math.PI / 180.00));
double atanhCentre = (atanhsinD + atanhsinO) / 2;
double latitudeSpan =destinationLattitude - centreLatitude;
double radianOfCentreLatitude = Math.atan(Math.sinh(atanhCentre));
double dXLat=latitudeSpan / Math.cos(radianOfCentreLatitude);
dXLat*=getLattitudeSpan()*(Math.PI/180); //<--- HERE IS THE PORBLEM
System.out.println("dxLong:"+dXLong+"_dxLat:"+dXLat);
//map left.right.top,bottom are current extents of map
mapLeft+=dXLong;
mapRight+=dXLong;
mapTop+=dXLat;
mapBottom+=dXLat;
}
private double getLattitudeSpan()
{
double latitudeSpan = mapTop - mapBottom;
latitudeSpan = latitudeSpan / Math.cos(radianOfCentreLatitude);
return Math.abs(latitudeSpan);
}