Gis 旋转由Maperitive生成的平铺上的标签

Gis 旋转由Maperitive生成的平铺上的标签,gis,openstreetmap,openlayers,Gis,Openstreetmap,Openlayers,我在web地图上使用自定义生成的平铺(使用openlayers显示)。 瓷砖是由maperetive生成的,非常棒。然而,我的地图是旋转的-3/4Pi(openlayers有这个功能),许多标签都是颠倒的。 我相信maperitive没有相对于任意角度渲染标签的功能。可能还有其他解决方法吗 也许您可以使用maperetive中的导出位图命令生成位图。然后你旋转整个。希望这有帮助 也许您可以使用maperetive中的导出位图命令生成位图。然后你旋转整个。希望这有帮助 我能够解决(在某种程度上)使

我在web地图上使用自定义生成的平铺(使用openlayers显示)。 瓷砖是由maperetive生成的,非常棒。然而,我的地图是旋转的-3/4Pi(openlayers有这个功能),许多标签都是颠倒的。 我相信maperitive没有相对于任意角度渲染标签的功能。可能还有其他解决方法吗


也许您可以使用maperetive中的导出位图命令生成位图。然后你旋转整个。希望这有帮助

也许您可以使用maperetive中的导出位图命令生成位图。然后你旋转整个。希望这有帮助

我能够解决(在某种程度上)使用&改变Maperitive的dll的问题

如果有人感兴趣,可以通过
gdipainer.DrawText(string,IPointF2List,…)
方法(来自Karta.dll)来呈现标签。它使用
Brejc.Geometry.Algorithms.Polylines.Analysis.PolylineWalker
class(来自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");
    }
}
公共类PolylineWalker:IPolylineWalker
{
专用只读多段线分析多段线分析;
私有浮动电流补偿;
私营部门;
专用浮点数currentOffsetWithinSegment;
私人浮动长度;
公共浮动角度
{
得到
{
返回此.polylineAnalysis.SegmentAngles[此.currentSegment]+180f;
}
}
公共浮点数CurrentOffsetWithinSegment
{
得到
{
返回此.currentOffsetWithinSegment;
}
}
public Brejc.Geometry.PointF2 CurrentPoint
{
得到
{
浮点数;
浮点数m2;
this.polylineAnalysis.Points.GetPoint(this.currentSegment,out num,out num2);
浮点数m3;
浮动num4;
this.polylineAnalysis.Points.GetPoint(this.currentSegment+1,out num3,out num4);
float num5=this.currentOffsetWithinSegment/this.polylineAnalysis.SegmentLength[this.currentSegment];
浮点数x=(num-num3)*num5+num3;
浮动y=(num2-num4)*num5+num4;
返回新的Brejc.Geometry.PointF2(x,y);
}
}
公共浮动电流补偿
{
得到
{
返回此.currentOffset;
}
}
公共部分
{
得到
{
返回此.currentSegment;
}
}
公众浮标长度左顿段
{
得到
{
返回this.polylineAnalysis.segmentLength[this.currentSegment]-this.currentOffsetWithinSegment;
}
}
公共多段线行者(多段线分析多段线分析)
{
this.polylineAnalysis=polylineAnalysis;
this.polylineLength=polylineAnalysis.polylineLength;
}
公共空间移动人(浮动三角洲)
{
if(delta.IsZero())
{
返回;
}
如果(this.currentOffset+delta>this.polylineLength)
{
抛出新的System.ArgumentOutOfRangeException(“delta”);
}
if(this.currentOffset+delta==this.polylineLength)
{
int num=0;
num++;
}
float num2=此.currentOffset+增量;
this.currentOffset-=this.currentOffsetWithinSegment;
如果(增量>0f)
{
而(此.currentSegment>=0)
{
this.currentOffset+=this.polylineAnalysis.SegmentLength[this.currentSegment];
如果(this.currentOffset>=num2)
{
this.currentOffsetWithinSegment=num2-(this.currentOffset-this.polylineAnalysis.segmentLength[this.currentSegment]);
此.currentOffset=num2;
返回;
}
此.current段--;
}
抛出新System.InvalidOperationException(“算法中的错误”);
}
这是MoveTo(num2);
}
公共无效移动到(浮动偏移)
{
如果(偏移量<0f)
{
抛出新的System.ArgumentOutOfRangeException(“偏移量”);
}
如果(偏移>此.polylineLength)
{
抛出新的System.ArgumentOutOfRangeException(“偏移量”);
}
此.currentOffset=0f;
this.currentSegment=this.polylineAnalysis.SegmentsCount-1;
而(此.currentSegment>=0)
{
if(this.currentOffset+this.polylineAnalysis.SegmentLength[this.currentSegment]>=偏移量)
{
this.currentOffsetWithinSegment=偏移量-this.currentOffset;
此.currentOffset=偏移量;
返回;
}
this.currentOffset+=this.polylineAnalysis.SegmentLength[this.currentSegment];
此.current段--;
}
抛出新System.InvalidOperationException(“算法中的错误”);
}
}

我能够(在某种程度上)通过使用&来解决修改Maperitive的dll的问题

如果有人感兴趣,可以通过
gdipainer.DrawText(string,IPointF2List,…)
方法(来自Karta.dll)来呈现标签。它使用
Brejc.Geometry.Algorithms.Polylines.Analysis.PolylineWalker
class(来自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");
    }
}
公共类PolylineWalker:IPolylineWalker
{
专用只读多段线分析多段线分析;
私有浮动电流补偿;
私营部门;
专用浮点数currentOffsetWithinSegment;
私人浮动长度;
公共浮动角度
{
得到
{
返回此.polylineAnalysis.SegmentAngles[此.currentSegment]+18