mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Fixed MapProjection.Center
This commit is contained in:
parent
eb5b76d78a
commit
f841e42e39
|
|
@ -734,10 +734,7 @@ namespace MapControl
|
|||
var viewScale = ViewTransform.ZoomLevelToScale(ZoomLevel);
|
||||
var projection = MapProjection;
|
||||
|
||||
if (projection.Type == MapProjectionType.Azimuthal)
|
||||
{
|
||||
projection.Center = ProjectionCenter ?? Center;
|
||||
}
|
||||
projection.Center = ProjectionCenter ?? Center;
|
||||
|
||||
var mapCenter = projection.LocationToMap(transformCenter ?? Center);
|
||||
|
||||
|
|
@ -770,10 +767,7 @@ namespace MapControl
|
|||
{
|
||||
ResetTransformCenter();
|
||||
|
||||
if (projection.Type == MapProjectionType.Azimuthal)
|
||||
{
|
||||
projection.Center = ProjectionCenter ?? Center;
|
||||
}
|
||||
projection.Center = ProjectionCenter ?? Center;
|
||||
|
||||
mapCenter = projection.LocationToMap(center);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ namespace MapControl.Projections
|
|||
public override Point LocationToMap(Location location)
|
||||
{
|
||||
UpdateZone();
|
||||
|
||||
return base.LocationToMap(location);
|
||||
}
|
||||
|
||||
public override Location MapToLocation(Point point)
|
||||
{
|
||||
UpdateZone();
|
||||
|
||||
return base.MapToLocation(point);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ namespace MapControl.Projections
|
|||
public class GeoApiProjection : MapProjection
|
||||
{
|
||||
private ICoordinateSystem coordinateSystem;
|
||||
private Location center;
|
||||
private double scaleFactor;
|
||||
private string bboxFormat;
|
||||
|
||||
|
|
@ -101,10 +100,6 @@ namespace MapControl.Projections
|
|||
Type = MapProjectionType.TransverseCylindrical;
|
||||
}
|
||||
|
||||
Center = new Location(
|
||||
centralParallel != null ? centralParallel.Value : 0d,
|
||||
centralMeridian != null ? centralMeridian.Value : 0d);
|
||||
|
||||
scaleFactor = 1d;
|
||||
bboxFormat = "{0},{1},{2},{3}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,15 @@ namespace MapControl.Projections
|
|||
private const double ConvergenceTolerance = 1e-6;
|
||||
private const int MaxIterations = 10;
|
||||
|
||||
public bool IsNorth { get; }
|
||||
public double ScaleFactor { get; }
|
||||
public double FalseEasting { get; }
|
||||
public double FalseNorthing { get; }
|
||||
|
||||
public PolarStereographicProjection(string crsId, bool isNorth, double scaleFactor, double falseEasting, double falseNorthing)
|
||||
public PolarStereographicProjection(bool isNorth, double scaleFactor, double falseEasting, double falseNorthing)
|
||||
{
|
||||
CrsId = crsId;
|
||||
Center = new Location(isNorth ? 90d : -90d, 0d);
|
||||
Type = MapProjectionType.Azimuthal;
|
||||
IsNorth = isNorth;
|
||||
ScaleFactor = scaleFactor;
|
||||
FalseEasting = falseEasting;
|
||||
FalseNorthing = falseNorthing;
|
||||
|
|
@ -34,7 +35,7 @@ namespace MapControl.Projections
|
|||
|
||||
public override Vector GetRelativeScale(Location location)
|
||||
{
|
||||
var lat = Math.Sign(Center.Latitude) * location.Latitude * Math.PI / 180d;
|
||||
var lat = (IsNorth ? location.Latitude : -location.Latitude) * Math.PI / 180d;
|
||||
var a = Wgs84EquatorialRadius;
|
||||
var e = Wgs84Eccentricity;
|
||||
var s = Math.Sqrt(Math.Pow(1 + e, 1 + e) * Math.Pow(1 - e, 1 - e));
|
||||
|
|
@ -52,7 +53,7 @@ namespace MapControl.Projections
|
|||
var lat = location.Latitude * Math.PI / 180d;
|
||||
var lon = location.Longitude * Math.PI / 180d;
|
||||
|
||||
if (Center.Latitude > 0d)
|
||||
if (IsNorth)
|
||||
{
|
||||
lon = Math.PI - lon;
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ namespace MapControl.Projections
|
|||
lat = newLat;
|
||||
}
|
||||
|
||||
if (Center.Latitude > 0d)
|
||||
if (IsNorth)
|
||||
{
|
||||
lon = Math.PI - lon;
|
||||
}
|
||||
|
|
@ -119,8 +120,9 @@ namespace MapControl.Projections
|
|||
public const string DefaultCrsId = "EPSG:32661";
|
||||
|
||||
public UpsNorthProjection()
|
||||
: base(DefaultCrsId, true, 0.994, 2e6, 2e6)
|
||||
: base(true, 0.994, 2e6, 2e6)
|
||||
{
|
||||
CrsId = DefaultCrsId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,8 +134,9 @@ namespace MapControl.Projections
|
|||
public const string DefaultCrsId = "EPSG:32761";
|
||||
|
||||
public UpsSouthProjection()
|
||||
: base(DefaultCrsId, false, 0.994, 2e6, 2e6)
|
||||
: base(false, 0.994, 2e6, 2e6)
|
||||
{
|
||||
CrsId = DefaultCrsId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue