2017-01-31 2 views
0

ウェブマップ上でカスタム生成タイルを使用しています(openlayersを使用して表示されます)。 タイルはmaperetiveによって生成され、素晴らしいです。しかし、私の地図は-3/4Pi(openlayersはこの機能を持っています)を回転させ、多くのラベルは上下逆さまにレンダリングされます。 私はbelent maperitiveに任意の角度に対してラベルを表示する機能がありません。これを修正する他のオプションがあるかもしれませんか?Maperitiveによって生成されたタイルのラベルを回転させます。

Example of rotated label

+1

http://gis.stackexchange.comまたはhttp://help.openstreetmap.org/でこの質問を再度お試しください。 – scai

答えて

0

たぶん、あなたはmaperetiveに輸出ビットマップのコマンドを使用してビットマップを生成することができます。次に全体を回転させます。このヘルプが欲しい!

0

ILSpy & Reflexilを使用して、Maperitiveのdllを変更する問題(ある程度)を解決できました。

誰かが興味を持っている場合、ラベルのレンダリングはGdiPainter.DrawText(string, IPointF2List, ...)メソッド(Karta.dllから)によって行われます。それはBrejc.Geometry.Algorithms.Polylines.Analysis.PolylineWalkerクラス(Brejc.Geospatial.dllから)を使用します。このクラスは、ポリライン全体の個々の文字の配置を制御します。私はこのクラスを変えてポリラインに沿って反対方向に歩くようにしました。

public class PolylineWalker : IPolylineWalker 
{ 
    private readonly PolylineAnalysis polylineAnalysis; 

    private float currentOffset; 

    private int currentSegment; 

    private float currentOffsetWithinSegment; 

    private float polylineLength; 

    public float CurrentAngle 
    { 
     get 
     { 
      return this.polylineAnalysis.SegmentAngles[this.currentSegment] + 180f; 
     } 
    } 

    public float CurrentOffsetWithinSegment 
    { 
     get 
     { 
      return this.currentOffsetWithinSegment; 
     } 
    } 

    public Brejc.Geometry.PointF2 CurrentPoint 
    { 
     get 
     { 
      float num; 
      float num2; 
      this.polylineAnalysis.Points.GetPoint(this.currentSegment, out num, out num2); 
      float num3; 
      float num4; 
      this.polylineAnalysis.Points.GetPoint(this.currentSegment + 1, out num3, out num4); 
      float num5 = this.currentOffsetWithinSegment/this.polylineAnalysis.SegmentLengths[this.currentSegment]; 
      float x = (num - num3) * num5 + num3; 
      float y = (num2 - num4) * num5 + num4; 
      return new Brejc.Geometry.PointF2(x, y); 
     } 
    } 

    public float CurrentOffset 
    { 
     get 
     { 
      return this.currentOffset; 
     } 
    } 

    public int CurrentSegment 
    { 
     get 
     { 
      return this.currentSegment; 
     } 
    } 

    public float LengthLeftOnSegment 
    { 
     get 
     { 
      return this.polylineAnalysis.SegmentLengths[this.currentSegment] - this.currentOffsetWithinSegment; 
     } 
    } 

    public PolylineWalker(PolylineAnalysis polylineAnalysis) 
    { 
     this.polylineAnalysis = polylineAnalysis; 
     this.polylineLength = polylineAnalysis.PolylineLength; 
    } 

    public void MoveBy(float delta) 
    { 
     if (delta.IsZero()) 
     { 
      return; 
     } 
     if (this.currentOffset + delta > this.polylineLength) 
     { 
      throw new System.ArgumentOutOfRangeException("delta"); 
     } 
     if (this.currentOffset + delta == this.polylineLength) 
     { 
      int num = 0; 
      num++; 
     } 
     float num2 = this.currentOffset + delta; 
     this.currentOffset -= this.currentOffsetWithinSegment; 
     if (delta > 0f) 
     { 
      while (this.currentSegment >= 0) 
      { 
       this.currentOffset += this.polylineAnalysis.SegmentLengths[this.currentSegment]; 
       if (this.currentOffset >= num2) 
       { 
        this.currentOffsetWithinSegment = num2 - (this.currentOffset - this.polylineAnalysis.SegmentLengths[this.currentSegment]); 
        this.currentOffset = num2; 
        return; 
       } 
       this.currentSegment--; 
      } 
      throw new System.InvalidOperationException("Bug in the algorithm"); 
     } 
     this.MoveTo(num2); 
    } 

    public void MoveTo(float offset) 
    { 
     if (offset < 0f) 
     { 
      throw new System.ArgumentOutOfRangeException("offset"); 
     } 
     if (offset > this.polylineLength) 
     { 
      throw new System.ArgumentOutOfRangeException("offset"); 
     } 
     this.currentOffset = 0f; 
     this.currentSegment = this.polylineAnalysis.SegmentsCount - 1; 
     while (this.currentSegment >= 0) 
     { 
      if (this.currentOffset + this.polylineAnalysis.SegmentLengths[this.currentSegment] >= offset) 
      { 
       this.currentOffsetWithinSegment = offset - this.currentOffset; 
       this.currentOffset = offset; 
       return; 
      } 
      this.currentOffset += this.polylineAnalysis.SegmentLengths[this.currentSegment]; 
      this.currentSegment--; 
     } 
     throw new System.InvalidOperationException("Bug in the algorithm"); 
    } 
} 
関連する問題