Updated MapProjections

This commit is contained in:
Clemens 2022-01-21 00:17:01 +01:00
parent c6c597a142
commit 544ac32ee3
5 changed files with 129 additions and 112 deletions

View file

@ -30,8 +30,24 @@ namespace MapControl.Projections
private double scaleFactor;
private string bboxFormat;
public IMathTransform LocationToMapTransform { get; private set; }
public IMathTransform MapToLocationTransform { get; private set; }
public GeoApiProjection(string wkt = null)
{
if (wkt != null)
{
WKT = wkt;
}
}
/// <summary>
/// Gets or sets an OGC Well-known text representation of a coordinate system,
/// i.e. a PROJCS[...] or GEOGCS[...] string as used by https://epsg.io or http://spatialreference.org.
/// Setting this property updates the CoordinateSystem property with an ICoordinateSystem created from the WKT string.
/// </summary>
public string WKT
{
get { return CoordinateSystem?.WKT; }
set { CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value); }
}
/// <summary>
/// Gets or sets the ICoordinateSystem of the MapProjection.
@ -85,16 +101,9 @@ namespace MapControl.Projections
}
}
/// <summary>
/// Gets or sets an OGC Well-known text representation of a coordinate system,
/// i.e. a PROJCS[...] or GEOGCS[...] string as used by https://epsg.io or http://spatialreference.org.
/// Setting this property updates the CoordinateSystem property with an ICoordinateSystem created from the WKT string.
/// </summary>
public string WKT
{
get { return CoordinateSystem?.WKT; }
set { CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value); }
}
public IMathTransform LocationToMapTransform { get; private set; }
public IMathTransform MapToLocationTransform { get; private set; }
public override bool IsNormalCylindrical
{
@ -106,15 +115,6 @@ namespace MapControl.Projections
get { return isWebMercator; }
}
public GeoApiProjection(string wkt = null)
{
if (wkt != null)
{
WKT = wkt;
}
}
public override Point LocationToMap(Location location)
{
if (LocationToMapTransform == null)