Skip to content

Commit 408cabb

Browse files
committed
updated to last dotspatial.projections package
1 parent 7e06818 commit 408cabb

24 files changed

Lines changed: 121 additions & 359 deletions

File tree

Examples/DemoWinForm/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using NetTopologySuite;
1919
using ProjNet.CoordinateSystems;
2020
using ProjNet.CoordinateSystems.Transformations;
21+
using SharpMap.CoordinateSystems;
2122
using System;
2223
using System.Windows.Forms;
2324

@@ -32,7 +33,7 @@ internal static class Program
3233
private static void Main()
3334
{
3435
var gss = NtsGeometryServices.Instance;
35-
var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
36+
var css = new CoordinateSystemServices(
3637
new CoordinateSystemFactory(),
3738
new CoordinateTransformationFactory(),
3839
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

Examples/ExampleCodeSnippets/ExampleCodeSession.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
namespace ExampleCodeSnippets
1+
using SharpMap.CoordinateSystems;
2+
3+
namespace ExampleCodeSnippets
24
{
35
public class ExampleCodeSession
46
{
57
[NUnit.Framework.OneTimeSetUp]
68
public void SetUp()
79
{
810
var gss = NetTopologySuite.NtsGeometryServices.Instance;
9-
var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
11+
var css = new CoordinateSystemServices(
1012
new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
1113
new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
1214
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

Examples/ExampleCodeSnippets/PolygonSymbolizerTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using SharpMap.CoordinateSystems;
12
using System.IO;
23

34
namespace ExampleCodeSnippets
@@ -32,7 +33,7 @@ public override void End(System.Drawing.Graphics g, SharpMap.MapViewport map)
3233
public void OneTimeSetUp()
3334
{
3435
var gss = NetTopologySuite.NtsGeometryServices.Instance;
35-
var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
36+
var css = new CoordinateSystemServices(
3637
new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
3738
new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
3839
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

Examples/SharpMap.Demo.Wms/Global.asax.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace SharpMap.Demo.Wms
22
{
3+
using SharpMap.CoordinateSystems;
34
using System.Web;
45
using System.Web.Mvc;
56
using System.Web.Routing;
@@ -15,11 +16,15 @@ public static void RegisterRoutes(RouteCollection routes)
1516

1617
protected void Application_Start()
1718
{
19+
var gss = NetTopologySuite.NtsGeometryServices.Instance;
20+
var css = new CoordinateSystemServices(
21+
new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
22+
new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
23+
Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());
1824
SharpMap.Session.Instance
19-
.SetGeometryServices(NetTopologySuite.NtsGeometryServices.Instance)
20-
.SetCoordinateSystemServices(CoordinateSystems.CoordinateSystemServices
21-
.FromSpatialRefSys(new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
22-
new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory()));
25+
.SetGeometryServices(gss)
26+
.SetCoordinateSystemServices(css)
27+
.SetCoordinateSystemRepository(css);
2328

2429
AreaRegistration.RegisterAllAreas();
2530
RegisterRoutes(RouteTable.Routes);

Examples/WPFSamples/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using NetTopologySuite.Geometries;
2+
using SharpMap.CoordinateSystems;
23
using System.Globalization;
34
using System.Linq;
45
using System.Windows;
@@ -18,7 +19,7 @@ public MainWindow()
1819
InitializeComponent();
1920

2021
var gss = NetTopologySuite.NtsGeometryServices.Instance;
21-
var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
22+
var css = new CoordinateSystemServices(
2223
new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
2324
new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
2425
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

Examples/WinFormSamples/FormMapBox.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using ProjNet.CoordinateSystems;
2-
using ProjNet.CoordinateSystems.Transformations;
3-
using SharpMap;
1+
using SharpMap;
42
using SharpMap.CoordinateSystems;
53
using SharpMap.CoordinateSystems.Transformations;
64
using SharpMap.Data;
@@ -33,12 +31,7 @@ public static bool UseDotSpatial
3331
if (value == UseDotSpatial) return;
3432

3533
var s = (Session)Session.Instance;
36-
var css = !value
37-
? new CoordinateSystemServices(
38-
new CoordinateSystemFactory(),
39-
new CoordinateTransformationFactory(),
40-
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems())
41-
: new CoordinateSystemServices(
34+
var css = new CoordinateSystemServices(
4235
new DotSpatialCoordinateSystemFactory(),
4336
new DotSpatialCoordinateTransformationFactory(),
4437
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

Examples/WinFormSamples/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using NetTopologySuite;
22
using ProjNet.CoordinateSystems;
33
using ProjNet.CoordinateSystems.Transformations;
4+
using SharpMap.CoordinateSystems;
45
using System;
56
using System.Windows.Forms;
67

@@ -15,14 +16,14 @@ internal static class Program
1516
private static void Main()
1617
{
1718
var gss = NtsGeometryServices.Instance;
18-
var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
19+
var css = new CoordinateSystemServices(
1920
new CoordinateSystemFactory(),
2021
new CoordinateTransformationFactory(),
2122
SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());
2223

2324
// plug-in WebMercator so that correct spherical definition is directly available to Layer Transformations using SRID
24-
var pcs = (ProjectedCoordinateSystem)ProjectedCoordinateSystem.WebMercator;
25-
css.AddCoordinateSystem((int)pcs.AuthorityCode, pcs);
25+
var pcs = ProjectedCoordinateSystem.WebMercator;
26+
((ICoordinateSystemRepository)css).AddCoordinateSystem((int)pcs.AuthorityCode, pcs);
2627

2728
SharpMap.Session.Instance
2829
.SetGeometryServices(gss)

SharpMap.CoordinateSystems.DotSpatial/DotSpatialCoordinateSystem.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ public class DotSpatialCoordinateSystem
4747
/// <param name="projectionInfo">The projection info</param>
4848
public DotSpatialCoordinateSystem(ProjectionInfo projectionInfo)
4949
{
50-
if (projectionInfo == null)
51-
throw new ArgumentNullException("projecionInfo");
52-
53-
_projectionInfo = projectionInfo;
50+
_projectionInfo = projectionInfo ?? throw new ArgumentNullException("projectionInfo");
5451
}
5552

5653
/// <summary>
@@ -89,10 +86,10 @@ public ProjectionInfo ProjectionInfo
8986
/// <returns></returns>
9087
public bool EqualParams(object obj)
9188
{
92-
if (obj is DotSpatialCoordinateSystem)
93-
return _projectionInfo.Matches(((DotSpatialCoordinateSystem)obj)._projectionInfo);
94-
if (obj is ProjectionInfo)
95-
return _projectionInfo.Matches((ProjectionInfo)obj);
89+
if (obj is DotSpatialCoordinateSystem dcs)
90+
return _projectionInfo.Matches(dcs._projectionInfo);
91+
if (obj is ProjectionInfo pi)
92+
return _projectionInfo.Matches(pi);
9693
return false;
9794
}
9895

@@ -191,9 +188,9 @@ private static IUnit ToUnit(ProjectionInfo projDescriptor)
191188

192189
private abstract class UnitWrapper : IUnit
193190
{
194-
protected readonly IProjDescriptor Descriptor;
191+
protected readonly ProjDescriptor Descriptor;
195192

196-
protected UnitWrapper(IProjDescriptor descriptor)
193+
protected UnitWrapper(ProjDescriptor descriptor)
197194
{
198195
Descriptor = descriptor;
199196
}
@@ -231,8 +228,8 @@ public AngularUnitWrapper(DotSpatial.Projections.AngularUnit angularUnit)
231228
public override bool EqualParams(object obj)
232229
{
233230
if (obj == null) return false;
234-
if (obj is AngularUnitWrapper)
235-
return ((AngularUnitWrapper)obj).RadiansPerUnit == RadiansPerUnit;
231+
if (obj is AngularUnitWrapper auw)
232+
return auw.RadiansPerUnit == RadiansPerUnit;
236233
return false;
237234
}
238235

@@ -263,8 +260,8 @@ public LinearUnitWrapper(DotSpatial.Projections.LinearUnit linearUnit)
263260
public override bool EqualParams(object obj)
264261
{
265262
if (obj == null) return false;
266-
if (obj is LinearUnitWrapper)
267-
return ((LinearUnitWrapper)obj).MetersPerUnit == MetersPerUnit;
263+
if (obj is LinearUnitWrapper luw)
264+
return luw.MetersPerUnit == MetersPerUnit;
268265
return false;
269266
}
270267

SharpMap.CoordinateSystems.DotSpatial/DotSpatialCoordinateSystemFactory.cs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
using DotSpatial.Projections;
22
using ProjNet.CoordinateSystems;
33
using System;
4-
using System.Collections.Generic;
54
using System.Globalization;
6-
using AngularUnit = ProjNet.CoordinateSystems.AngularUnit;
7-
using DatumType = ProjNet.CoordinateSystems.DatumType;
8-
using LinearUnit = ProjNet.CoordinateSystems.LinearUnit;
95

106
namespace SharpMap.CoordinateSystems
117
{
@@ -30,6 +26,7 @@ public ICompoundCoordinateSystem CreateCompoundCoordinateSystem(string name, ICo
3026
}
3127
*/
3228

29+
/*
3330
/// <summary>
3431
/// Creates an <see cref="T:NetTopologySuite.CoordinateSystems.IEllipsoid" /> from radius values.
3532
/// </summary>
@@ -44,7 +41,9 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
4441
{
4542
throw new NotSupportedException();
4643
}
44+
*/
4745

46+
/*
4847
/// <summary>
4948
/// Creates a <see cref="T:NetTopologySuite.CoordinateSystems.IFittedCoordinateSystem" />.
5049
/// </summary>
@@ -60,12 +59,14 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
6059
/// <param name="arAxes"></param>
6160
/// <returns>Fitted coordinate system</returns>
6261
/// <exception cref="NotSupportedException"></exception>
63-
public new FittedCoordinateSystem CreateFittedCoordinateSystem(string name, CoordinateSystem baseCoordinateSystem,
62+
public FittedCoordinateSystem CreateFittedCoordinateSystem(string name, CoordinateSystem baseCoordinateSystem,
6463
string toBaseWkt, List<AxisInfo> arAxes)
6564
{
6665
throw new NotSupportedException();
6766
}
67+
*/
6868

69+
/*
6970
/// <summary>
7071
/// Creates an <see cref="T:NetTopologySuite.CoordinateSystems.IEllipsoid" /> from an major radius, and inverse flattening.
7172
/// </summary>
@@ -76,21 +77,24 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
7677
/// <param name="linearUnit">Linear unit</param>
7778
/// <returns>Ellipsoid</returns>
7879
/// <exception cref="NotSupportedException"></exception>
79-
public new Ellipsoid CreateFlattenedSphere(string name, double semiMajorAxis, double inverseFlattening, LinearUnit linearUnit)
80+
public Ellipsoid CreateFlattenedSphere(string name, double semiMajorAxis, double inverseFlattening, LinearUnit linearUnit)
8081
{
8182
throw new NotSupportedException();
8283
}
84+
*/
8385

86+
/*
8487
/// <summary>
8588
/// Creates a coordinate system object from an XML string.
8689
/// </summary>
8790
/// <param name="xml">XML representation for the spatial reference</param>
8891
/// <returns>The resulting spatial reference object</returns>
8992
/// <exception cref="NotSupportedException"></exception>
90-
public new CoordinateSystem CreateFromXml(string xml)
93+
public CoordinateSystem CreateFromXml(string xml)
9194
{
9295
throw new NotSupportedException();
9396
}
97+
*/
9498

9599
/// <summary>
96100
/// Creates a spatial reference object given its Well-known text representation.
@@ -139,6 +143,7 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
139143
return new DotSpatialCoordinateSystem(pi);
140144
}
141145

146+
/*
142147
/// <summary>
143148
/// Creates a <see cref="T:NetTopologySuite.CoordinateSystems.IGeographicCoordinateSystem" />, which could be Lat/Lon or Lon/Lat.
144149
/// </summary>
@@ -150,12 +155,14 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
150155
/// <param name="axis1">Second axis</param>
151156
/// <returns>Geographic coordinate system</returns>
152157
/// <exception cref="NotSupportedException"></exception>
153-
public new GeographicCoordinateSystem CreateGeographicCoordinateSystem(string name, AngularUnit angularUnit,
158+
public GeographicCoordinateSystem CreateGeographicCoordinateSystem(string name, AngularUnit angularUnit,
154159
HorizontalDatum datum, PrimeMeridian primeMeridian, AxisInfo axis0, AxisInfo axis1)
155160
{
156161
throw new NotSupportedException();
157162
}
163+
*/
158164

165+
/*
159166
/// <summary>
160167
/// Creates <see cref="T:NetTopologySuite.CoordinateSystems.IHorizontalDatum" /> from ellipsoid and Bursa-World parameters.
161168
/// </summary>
@@ -171,11 +178,12 @@ public Ellipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiM
171178
/// <param name="toWgs84">Wgs84 conversion parameters</param>
172179
/// <returns>Horizontal datum</returns>
173180
/// <exception cref="NotSupportedException"></exception>
174-
public new HorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, Ellipsoid ellipsoid,
181+
public HorizontalDatum CreateHorizontalDatum(string name, DatumType datumType, Ellipsoid ellipsoid,
175182
Wgs84ConversionInfo toWgs84)
176183
{
177184
throw new NotSupportedException();
178185
}
186+
*/
179187

180188
/*
181189
/// <summary>
@@ -213,6 +221,7 @@ public ILocalDatum CreateLocalDatum(string name, DatumType datumType)
213221
}
214222
*/
215223

224+
/*
216225
/// <summary>
217226
/// Creates a <see cref="T:NetTopologySuite.CoordinateSystems.IPrimeMeridian" />, relative to Greenwich.
218227
/// </summary>
@@ -221,11 +230,13 @@ public ILocalDatum CreateLocalDatum(string name, DatumType datumType)
221230
/// <param name="longitude">Longitude</param>
222231
/// <returns>Prime meridian</returns>
223232
/// <exception cref="NotSupportedException"></exception>
224-
public new PrimeMeridian CreatePrimeMeridian(string name, AngularUnit angularUnit, double longitude)
233+
public PrimeMeridian CreatePrimeMeridian(string name, AngularUnit angularUnit, double longitude)
225234
{
226235
throw new NotSupportedException();
227236
}
237+
*/
228238

239+
/*
229240
/// <summary>
230241
/// Creates a <see cref="T:NetTopologySuite.CoordinateSystems.IProjectedCoordinateSystem" /> using a projection object.
231242
/// </summary>
@@ -237,12 +248,14 @@ public ILocalDatum CreateLocalDatum(string name, DatumType datumType)
237248
/// <param name="axis1">Secondary axis</param>
238249
/// <returns>Projected coordinate system</returns>
239250
/// <exception cref="NotSupportedException"></exception>
240-
public new ProjectedCoordinateSystem CreateProjectedCoordinateSystem(string name, GeographicCoordinateSystem gcs,
251+
public ProjectedCoordinateSystem CreateProjectedCoordinateSystem(string name, GeographicCoordinateSystem gcs,
241252
IProjection projection, LinearUnit linearUnit, AxisInfo axis0, AxisInfo axis1)
242253
{
243254
throw new NotSupportedException();
244255
}
256+
*/
245257

258+
/*
246259
/// <summary>
247260
/// Creates a <see cref="T:NetTopologySuite.CoordinateSystems.IProjection" />.
248261
/// </summary>
@@ -251,10 +264,11 @@ public ILocalDatum CreateLocalDatum(string name, DatumType datumType)
251264
/// <param name="parameters">Projection parameters</param>
252265
/// <returns>Projection</returns>
253266
/// <exception cref="NotSupportedException"></exception>
254-
public new IProjection CreateProjection(string name, string wktProjectionClass, List<ProjectionParameter> parameters)
267+
public IProjection CreateProjection(string name, string wktProjectionClass, List<ProjectionParameter> parameters)
255268
{
256269
throw new NotSupportedException();
257270
}
271+
*/
258272

259273
/*
260274
/// <summary>

SharpMap.CoordinateSystems.DotSpatial/SharpMap.CoordinateSystems.DotSpatial.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="DotSpatial.Projections" Version="1.9.0.0" />
15+
<PackageReference Include="DotSpatial.Projections" Version="4.0.656" />
1616
<PackageReference Include="ProjNet" Version="2.0.0" />
1717
</ItemGroup>
1818

0 commit comments

Comments
 (0)