mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
New TransverseMercatorProjection implementation
This commit is contained in:
parent
caa25cb471
commit
9c69deb782
9 changed files with 357 additions and 23 deletions
|
|
@ -100,6 +100,13 @@ namespace MapControl.Projections
|
|||
|
||||
public IMathTransform MapToLocationTransform { get; private set; }
|
||||
|
||||
public override Point GetRelativeScale(Location location)
|
||||
{
|
||||
var k = coordinateSystem?.Projection?.GetParameter("scale_factor")?.Value ?? 1d;
|
||||
|
||||
return new Point(k, k);
|
||||
}
|
||||
|
||||
public override Point? LocationToMap(Location location)
|
||||
{
|
||||
if (LocationToMapTransform == null)
|
||||
|
|
|
|||
|
|
@ -21,36 +21,23 @@ namespace MapControl.Projections
|
|||
|
||||
public override MapProjection GetProjection(string crsId)
|
||||
{
|
||||
MapProjection projection = null;
|
||||
|
||||
switch (crsId)
|
||||
{
|
||||
case MapControl.WebMercatorProjection.DefaultCrsId:
|
||||
projection = new WebMercatorProjection();
|
||||
break;
|
||||
return new WebMercatorProjection();
|
||||
|
||||
case MapControl.WorldMercatorProjection.DefaultCrsId:
|
||||
projection = new WorldMercatorProjection();
|
||||
break;
|
||||
return new WorldMercatorProjection();
|
||||
|
||||
case Wgs84AutoUtmProjection.DefaultCrsId:
|
||||
projection = new Wgs84AutoUtmProjection();
|
||||
break;
|
||||
case MapControl.Wgs84AutoUtmProjection.DefaultCrsId:
|
||||
return new Wgs84AutoUtmProjection();
|
||||
|
||||
default:
|
||||
projection = base.GetProjection(crsId);
|
||||
break;
|
||||
return base.GetProjection(crsId);
|
||||
}
|
||||
|
||||
if (projection == null && crsId.StartsWith("EPSG:") && int.TryParse(crsId.Substring(5), out int epsgCode))
|
||||
{
|
||||
projection = GetProjection(epsgCode);
|
||||
}
|
||||
|
||||
return projection;
|
||||
}
|
||||
|
||||
public virtual MapProjection GetProjection(int epsgCode)
|
||||
public override MapProjection GetProjection(int epsgCode)
|
||||
{
|
||||
switch (epsgCode)
|
||||
{
|
||||
|
|
@ -75,7 +62,7 @@ namespace MapControl.Projections
|
|||
default:
|
||||
return CoordinateSystemWkts.TryGetValue(epsgCode, out string wkt)
|
||||
? new GeoApiProjection(wkt)
|
||||
: null;
|
||||
: base.GetProjection(epsgCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,9 @@ namespace MapControl.Projections
|
|||
/// </summary>
|
||||
public class Wgs84AutoUtmProjection : Wgs84UtmProjection
|
||||
{
|
||||
public const string DefaultCrsId = "AUTO2:42001";
|
||||
|
||||
private readonly string autoCrsId;
|
||||
|
||||
public Wgs84AutoUtmProjection(string crsId = DefaultCrsId)
|
||||
public Wgs84AutoUtmProjection(string crsId = MapControl.Wgs84AutoUtmProjection.DefaultCrsId)
|
||||
: base(31, true)
|
||||
{
|
||||
autoCrsId = crsId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue