Я использую пользовательские плитки на веб-карте (отображается с использованием openlayers). Плитки генерируются maperetive, и это здорово. Однако моя карта повернута на -3/4Pi (у openlayers есть эта функция), и многие метки перевернуты вверх ногами. Я верю, что maperitive не имеет возможности визуализировать метки относительно произвольного угла. Может быть, есть другие варианты исправить это?Поворот меток на плитки, сгенерированных Maperitive
0
A
ответ
0
Может быть, вы можете создать растровое изображение с помощью команды экспорта-растровый в maperetive. Затем вы вращаете целое. Надеюсь, эта помощь!
0
Я смог решить проблему (в некоторой степени), изменяющую dll's Maperitive, используя ILSpy & Reflexil.
Если кому-то это интересно, то предоставление меток производится методом GdiPainter.DrawText(string, IPointF2List, ...)
(from 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");
}
}
Попробуйте повторно задать этот вопрос по адресу http://gis.stackexchange.com или http://help.openstreetmap.org/. – scai