Skip to content

Commit e8756eb

Browse files
committed
[trunk]
- introducing GeoAPI/NTS Geometries to Trunk Note: To update your code: - replace 'using SharpMap.Geometries;' with 'using GeoAPI.Geometries;' - Add 'using Geometry = GeoAPI.Geometries.IGeometry;' - replace 'using [Geo]Point = SharpMap.Geometries.Point;' with 'using [Geo]Point = GeoAPI.Geometries.Coordinate;' - Add 'using BoundingBox = GeoAPI.Geometries.Envelope;' (Note: Envelope is constructed with (xmin, xmax, ymin, ymax) so either use new Envelope(new Coordinate(xmin, ymin), new Coordinate(xmax, ymax)) or adjust the order! - THIS IS WORK IN PROGRESS git-tfs-id: [https://tfs.codeplex.com/tfs/TFS01]$/SharpMap/Trunk;C97623
1 parent 3e2d0d1 commit e8756eb

172 files changed

Lines changed: 6359 additions & 4661 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DemoWebSite/Ajax.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Drawing;
33
using System.Web.UI;
4-
using Point=SharpMap.Geometries.Point;
4+
using Point=GeoAPI.Geometries.Coordinate;
55

66
public partial class Ajax : Page
77
{

DemoWebSite/App_Code/MapHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using SharpMap.Rendering.Thematics;
1212
using SharpMap.Styles;
1313
using ColorBlend=SharpMap.Rendering.Thematics.ColorBlend;
14-
using Point=SharpMap.Geometries.Point;
14+
using Point=GeoAPI.Geometries.Coordinate;
1515

1616
/// <summary>
1717
/// Summary description for CreateMap
@@ -516,7 +516,7 @@ public static Map InitializeMapPostGis(Size size)
516516
map.BackColor = Color.LightBlue;
517517

518518
map.Zoom = 360;
519-
map.Center = new SharpMap.Geometries.Point(0, 0);
519+
map.Center = new Point(0, 0);
520520

521521
HttpContext.Current.Trace.Write("Map initialized");
522522
return map;

DemoWebSite/Bins.aspx.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using System.Drawing;
33
using System.Web;
44
using System.Web.UI;
5+
using GeoAPI.Geometries;
56
using SharpMap;
67
using SharpMap.Data;
7-
using SharpMap.Geometries;
8+
//using SharpMap.Geometries;
89
using SharpMap.Layers;
910
using SharpMap.Rendering.Thematics;
1011
using SharpMap.Styles;
1112
using SharpMap.Web;
12-
using Point=SharpMap.Geometries.Point;
13+
using Point = GeoAPI.Geometries.Coordinate;
1314

1415
public partial class Bins : Page
1516
{
@@ -46,8 +47,8 @@ private VectorStyle GetCountryStyle(FeatureDataRow row)
4647
return style;
4748
}
4849
// If geometry is a (multi)polygon and the area of the polygon is less than 30, make it cyan
49-
else if (row.Geometry.GetType() == typeof (MultiPolygon) && (row.Geometry as MultiPolygon).Area < 30 ||
50-
row.Geometry.GetType() == typeof (Polygon) && (row.Geometry as Polygon).Area < 30)
50+
else if (row.Geometry is IMultiPolygon && (row.Geometry as IMultiPolygon).Area < 30 ||
51+
row.Geometry is IPolygon && (row.Geometry as IPolygon).Area < 30)
5152
{
5253
style.Fill = Brushes.Cyan;
5354
return style;

DemoWebSite/Gdal.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Web.UI;
55
using SharpMap;
66
using SharpMap.Web;
7-
using Point = SharpMap.Geometries.Point;
7+
using Point = GeoAPI.Geometries.Coordinate;
88

99
public partial class Gdal : Page
1010
{

DemoWebSite/GeometryFeature.aspx.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,28 @@
66
using SharpMap;
77
using SharpMap.Data;
88
using SharpMap.Data.Providers;
9-
using SharpMap.Geometries;
9+
using GeoAPI.Geometries;
1010
using SharpMap.Layers;
1111
using SharpMap.Styles;
1212
using SharpMap.Web;
13-
using Point=SharpMap.Geometries.Point;
13+
using Point=GeoAPI.Geometries.Coordinate;
1414

1515
public partial class GeometryFeature : Page
1616
{
1717
private Map myMap;
1818

1919
public VectorLayer CreateGeometryLayer()
2020
{
21-
FeatureDataTable fdt = new FeatureDataTable();
21+
var gf = new NetTopologySuite.Geometries.GeometryFactory();
22+
var fdt = new FeatureDataTable();
2223
fdt.Columns.Add(new DataColumn("Name", typeof (String)));
2324

24-
FeatureDataRow fdr;
25+
fdt.BeginLoadData();
26+
var fdr = (FeatureDataRow)fdt.LoadDataRow(new[] {(object) "Mayence"}, true);
27+
fdr.Geometry = gf.CreatePoint(new Point(8.1, 50.0));
28+
fdt.EndLoadData();
2529

26-
fdr = fdt.NewRow();
27-
28-
fdr["Name"] = "Mayence";
29-
fdr.Geometry = (Geometry) new Point(8.1, 50.0);
30-
31-
fdt.AddRow(fdr);
32-
33-
34-
VectorLayer vLayer = new VectorLayer("GeometryProvider");
30+
var vLayer = new VectorLayer("GeometryProvider");
3531
vLayer.DataSource = new GeometryFeatureProvider(fdt);
3632
vLayer.SRID = 4326;
3733

DemoWebSite/Gradient.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Globalization;
44
using System.Web.UI;
55
using SharpMap;
6-
using Point=SharpMap.Geometries.Point;
6+
using Point=GeoAPI.Geometries.Coordinate;
77

88
public partial class Gradient : Page
99
{

DemoWebSite/MapHandler.ashx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using System.Globalization;
77
using System.IO;
88
using System.Web;
99
using SharpMap;
10-
using Point=SharpMap.Geometries.Point;
10+
using Point=GeoAPI.Geometries.Coordinate;
1111

1212
/// <summary>
1313
/// The maphandler class takes a set of GET or POST parameters and returns a map as PNG (this reminds in many ways of the way a WMS server work).

DemoWebSite/MapInfo.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Web.UI;
55
using SharpMap;
66
using SharpMap.Web;
7-
using Point=SharpMap.Geometries.Point;
7+
using Point=GeoAPI.Geometries.Coordinate;
88

99
public partial class MapInfo : Page
1010
{

DemoWebSite/PieCharts.aspx.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using SharpMap.Rendering.Thematics;
99
using SharpMap.Styles;
1010
using SharpMap.Web;
11-
using Point=SharpMap.Geometries.Point;
11+
using Point=GeoAPI.Geometries.Coordinate;
1212

1313
public partial class Bins : Page
1414
{
@@ -76,7 +76,7 @@ private VectorStyle GetCountryStyle(FeatureDataRow row)
7676
private static Bitmap GetPieChart(FeatureDataRow row)
7777
{
7878
// Replace polygon with a center point (this is where we place the symbol
79-
row.Geometry = row.Geometry.GetBoundingBox().GetCentroid();
79+
row.Geometry = row.Geometry.Centroid;
8080

8181
// Just for the example I use random values
8282
int size = rand.Next(20, 35);

DemoWebSite/Simple.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Web.UI;
55
using SharpMap;
66
using SharpMap.Web;
7-
using Point=SharpMap.Geometries.Point;
7+
using Point=GeoAPI.Geometries.Coordinate;
88

99
public partial class Simple : Page
1010
{

0 commit comments

Comments
 (0)