Version 4.10.0: Added MapProjections library project.

This commit is contained in:
ClemensF 2018-08-29 21:06:56 +02:00
parent 8c2cd92fe4
commit c9c656999b
2 changed files with 9 additions and 5 deletions

View file

@ -23,7 +23,6 @@ namespace MapControl.Projections
private ICoordinateTransformation coordinateTransform; private ICoordinateTransformation coordinateTransform;
private IMathTransform mathTransform; private IMathTransform mathTransform;
private IMathTransform inverseTransform; private IMathTransform inverseTransform;
private string wkt;
/// <summary> /// <summary>
/// Gets or sets the underlying ICoordinateTransformation instance. /// Gets or sets the underlying ICoordinateTransformation instance.
@ -52,16 +51,18 @@ namespace MapControl.Projections
/// e.g. a PROJCS[...] string as used by https://epsg.io or http://spatialreference.org. /// e.g. a PROJCS[...] string as used by https://epsg.io or http://spatialreference.org.
/// Setting this property updates the CoordinateTransform property. /// Setting this property updates the CoordinateTransform property.
/// </summary> /// </summary>
public string Wkt public string WKT
{ {
get { return wkt; } get
{
return coordinateTransform?.TargetCS?.WKT;
}
set set
{ {
var sourceCs = GeographicCoordinateSystem.WGS84; var sourceCs = GeographicCoordinateSystem.WGS84;
var targetCs = (ICoordinateSystem)CoordinateSystemWktReader.Parse(value, Encoding.UTF8); var targetCs = (ICoordinateSystem)CoordinateSystemWktReader.Parse(value, Encoding.UTF8);
CoordinateTransform = new CoordinateTransformationFactory().CreateFromCoordinateSystems(sourceCs, targetCs); CoordinateTransform = new CoordinateTransformationFactory().CreateFromCoordinateSystems(sourceCs, targetCs);
wkt = value;
} }
} }

View file

@ -46,9 +46,12 @@ namespace MapControl.Projections
zoneName = value; zoneName = value;
epsgCode += zoneNumber; epsgCode += zoneNumber;
var centralMeridian = 6 * zoneNumber - 183;
Wkt = string.Format(wktFormat, zoneName, 6 * zoneNumber - 183, falseNorthing, epsgCode); WKT = string.Format(wktFormat, zoneName, centralMeridian, falseNorthing, epsgCode);
TrueScale = 0.9996 * MetersPerDegree; TrueScale = 0.9996 * MetersPerDegree;
System.Diagnostics.Debug.WriteLine(WKT);
} }
} }
} }