mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
GeoApiProjection protected properties
This commit is contained in:
parent
544ac32ee3
commit
be0e06f581
|
|
@ -30,13 +30,14 @@ namespace MapControl.Projections
|
|||
private double scaleFactor;
|
||||
private string bboxFormat;
|
||||
|
||||
public GeoApiProjection(string wkt = null)
|
||||
protected GeoApiProjection()
|
||||
{
|
||||
if (wkt != null)
|
||||
}
|
||||
|
||||
public GeoApiProjection(string wkt)
|
||||
{
|
||||
WKT = wkt;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an OGC Well-known text representation of a coordinate system,
|
||||
|
|
@ -46,7 +47,7 @@ namespace MapControl.Projections
|
|||
public string WKT
|
||||
{
|
||||
get { return CoordinateSystem?.WKT; }
|
||||
set { CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value); }
|
||||
protected set { CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -55,7 +56,7 @@ namespace MapControl.Projections
|
|||
public ICoordinateSystem CoordinateSystem
|
||||
{
|
||||
get { return coordinateSystem; }
|
||||
set
|
||||
protected set
|
||||
{
|
||||
coordinateSystem = value ?? throw new ArgumentNullException(nameof(value));
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ namespace MapControl.Projections
|
|||
{
|
||||
public class UtmProjection : GeoApiProjection
|
||||
{
|
||||
public UtmProjection()
|
||||
{
|
||||
}
|
||||
|
||||
public UtmProjection(int zone, bool north)
|
||||
{
|
||||
SetZone(zone, north);
|
||||
|
|
@ -20,17 +16,12 @@ namespace MapControl.Projections
|
|||
|
||||
public UtmProjection(Location location)
|
||||
{
|
||||
SetZone(location);
|
||||
var zone = Math.Min((int)Math.Floor(Location.NormalizeLongitude(location.Longitude) + 180d) / 6 + 1, 60);
|
||||
|
||||
SetZone(zone, location.Latitude >= 0d);
|
||||
}
|
||||
|
||||
public void SetZone(Location location)
|
||||
{
|
||||
var zoneNumber = Math.Min((int)(Location.NormalizeLongitude(location.Longitude) + 180d) / 6 + 1, 60);
|
||||
|
||||
SetZone(zoneNumber, location.Latitude >= 0d);
|
||||
}
|
||||
|
||||
public void SetZone(int zone, bool north)
|
||||
protected void SetZone(int zone, bool north)
|
||||
{
|
||||
if (zone < 1 || zone > 60)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@ namespace ProjectionDemo
|
|||
{
|
||||
viewModel.Projections.Add(new MapControl.Projections.WebMercatorProjection());
|
||||
|
||||
viewModel.Projections.Add(new GeoApiProjection
|
||||
{
|
||||
WKT = await httpClient.GetStringAsync("https://epsg.io/25832.wkt") // ETRS89 / UTM zone 32N
|
||||
});
|
||||
viewModel.Projections.Add(new GeoApiProjection(await httpClient.GetStringAsync("https://epsg.io/25832.wkt"))); // ETRS89 / UTM zone 32N
|
||||
|
||||
viewModel.Layers.Add(
|
||||
"OpenStreetMap WMS",
|
||||
|
|
|
|||
Loading…
Reference in a new issue