mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 4.10.0: Simplified MapProjection.
This commit is contained in:
parent
bbd952b955
commit
b06c9065af
11 changed files with 41 additions and 101 deletions
|
|
@ -19,12 +19,6 @@ namespace MapControl
|
|||
{
|
||||
public Location ProjectionCenter { get; private set; } = new Location();
|
||||
|
||||
public AzimuthalProjection()
|
||||
{
|
||||
IsContinuous = false;
|
||||
IsAzimuthal = true;
|
||||
}
|
||||
|
||||
public override Vector GetMapScale(Location location)
|
||||
{
|
||||
return new Vector(ViewportScale, ViewportScale);
|
||||
|
|
|
|||
|
|
@ -18,12 +18,13 @@ namespace MapControl
|
|||
public EquirectangularProjection()
|
||||
: this("EPSG:4326")
|
||||
{
|
||||
TrueScale = 1;
|
||||
}
|
||||
|
||||
public EquirectangularProjection(string crsId)
|
||||
{
|
||||
CrsId = crsId;
|
||||
IsCylindrical = true;
|
||||
TrueScale = 1;
|
||||
}
|
||||
|
||||
public override Vector GetMapScale(Location location)
|
||||
|
|
|
|||
|
|
@ -338,16 +338,7 @@ namespace MapControl
|
|||
if (TargetZoomLevel != zoomLevel)
|
||||
{
|
||||
SetTransformCenter(center);
|
||||
|
||||
if (MapProjection.IsAzimuthal)
|
||||
{
|
||||
ZoomLevel = zoomLevel;
|
||||
ResetTransformCenter();
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetZoomLevel = zoomLevel;
|
||||
}
|
||||
TargetZoomLevel = zoomLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -417,11 +408,8 @@ namespace MapControl
|
|||
|
||||
private void ProjectionCenterPropertyChanged()
|
||||
{
|
||||
if (MapProjection.IsAzimuthal)
|
||||
{
|
||||
ResetTransformCenter();
|
||||
UpdateTransform();
|
||||
}
|
||||
ResetTransformCenter();
|
||||
UpdateTransform();
|
||||
}
|
||||
|
||||
private void AdjustCenterProperty(DependencyProperty property, ref Location center)
|
||||
|
|
@ -463,7 +451,7 @@ namespace MapControl
|
|||
|
||||
if (!targetCenter.Equals(Center))
|
||||
{
|
||||
var targetCenterLongitude = MapProjection.IsContinuous
|
||||
var targetCenterLongitude = MapProjection.IsCylindrical
|
||||
? Location.NearestLongitude(targetCenter.Longitude, Center.Longitude)
|
||||
: targetCenter.Longitude;
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ namespace MapControl
|
|||
{
|
||||
pos = parentMap.MapProjection.LocationToViewportPoint(location);
|
||||
|
||||
if (parentMap.MapProjection.IsContinuous &&
|
||||
if (parentMap.MapProjection.IsCylindrical &&
|
||||
(pos.X < 0d || pos.X > parentMap.RenderSize.Width ||
|
||||
pos.Y < 0d || pos.Y > parentMap.RenderSize.Height))
|
||||
{
|
||||
|
|
@ -310,7 +310,7 @@ namespace MapControl
|
|||
var center = new Point(rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
||||
var pos = projection.ViewportTransform.Transform(center);
|
||||
|
||||
if (parentMap.MapProjection.IsContinuous &&
|
||||
if (parentMap.MapProjection.IsCylindrical &&
|
||||
(pos.X < 0d || pos.X > parentMap.RenderSize.Width ||
|
||||
pos.Y < 0d || pos.Y > parentMap.RenderSize.Height))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,19 +28,14 @@ namespace MapControl
|
|||
private Matrix inverseViewportTransformMatrix;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WMS 1.3.0 CRS Identifier.
|
||||
/// Gets the WMS 1.3.0 CRS Identifier.
|
||||
/// </summary>
|
||||
public string CrsId { get; set; }
|
||||
public string CrsId { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the map can be moved infinitely in longitudinal direction.
|
||||
/// Indicates if this is a normal cylindrical projection.
|
||||
/// </summary>
|
||||
public bool IsContinuous { get; protected set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if this is an azimuthal projection.
|
||||
/// </summary>
|
||||
public bool IsAzimuthal { get; protected set; } = false;
|
||||
public bool IsCylindrical { get; protected set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if this is a web mercator projection, i.e. compatible with MapTileLayer.
|
||||
|
|
@ -48,8 +43,8 @@ namespace MapControl
|
|||
public bool IsWebMercator { get; protected set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scale factor from geographic to cartesian coordinates, on the line of true scale
|
||||
/// of a cylindrical projection, or at the projection center of an azimuthal projection.
|
||||
/// Gets the scale factor from geographic to cartesian coordinates, on the line of true scale of a
|
||||
/// cylindrical projection (usually the equator), or at the projection center of an azimuthal projection.
|
||||
/// </summary>
|
||||
public double TrueScale { get; protected set; } = MetersPerDegree;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace MapControl
|
|||
{
|
||||
var longitudeOffset = 0d;
|
||||
|
||||
if (parentMap.MapProjection.IsContinuous && Location != null)
|
||||
if (parentMap.MapProjection.IsCylindrical && Location != null)
|
||||
{
|
||||
var viewportPosition = LocationToViewportPoint(Location);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace MapControl
|
|||
public WebMercatorProjection(string crsId)
|
||||
{
|
||||
CrsId = crsId;
|
||||
IsCylindrical = true;
|
||||
IsWebMercator = true;
|
||||
MaxLatitude = YToLatitude(180d);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace MapControl
|
|||
public WorldMercatorProjection(string crsId)
|
||||
{
|
||||
CrsId = crsId;
|
||||
IsCylindrical = true;
|
||||
MaxLatitude = YToLatitude(180d);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue