mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Improved MapProjection.Center handling
This commit is contained in:
parent
f52281ba85
commit
123a9916eb
5 changed files with 32 additions and 11 deletions
|
|
@ -137,20 +137,30 @@ namespace MapControl
|
|||
var latPoints = latSegments * interpolationCount;
|
||||
|
||||
var centerLon = Math.Round(ParentMap.Center.Longitude / lineDistance) * lineDistance;
|
||||
var westLimit = centerLon - 180d;
|
||||
var eastLimit = centerLon + 180d;
|
||||
|
||||
if (ParentMap.MapProjection.Type == MapProjectionType.TransverseCylindrical)
|
||||
{
|
||||
westLimit = ParentMap.MapProjection.Center.Longitude - 15d;
|
||||
eastLimit = ParentMap.MapProjection.Center.Longitude + 15d;
|
||||
westLimit = Math.Floor(westLimit / lineDistance) * lineDistance;
|
||||
eastLimit = Math.Ceiling(eastLimit / lineDistance) * lineDistance;
|
||||
}
|
||||
|
||||
var minLon = centerLon - lineDistance;
|
||||
var maxLon = centerLon + lineDistance;
|
||||
var lonRange = ParentMap.MapProjection.Type == MapProjectionType.TransverseCylindrical ? 15d : 180d;
|
||||
|
||||
if (DrawMeridian(path.Figures, centerLon, minLat, interpolationDistance, latPoints))
|
||||
{
|
||||
while (DrawMeridian(path.Figures, minLon, minLat, interpolationDistance, latPoints) &&
|
||||
minLon > centerLon - lonRange)
|
||||
minLon > westLimit)
|
||||
{
|
||||
minLon -= lineDistance;
|
||||
}
|
||||
|
||||
while (DrawMeridian(path.Figures, maxLon, minLat, interpolationDistance, latPoints) &&
|
||||
maxLon <= centerLon + lonRange)
|
||||
maxLon < eastLimit)
|
||||
{
|
||||
maxLon += lineDistance;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue