Skip to content

Commit ca68229

Browse files
Setting some more targets, removed GeographicPosition
1 parent 7a20bbf commit ca68229

40 files changed

Lines changed: 377 additions & 522 deletions

GeoJSON.Net.nuspec

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<metadata>
44
<id>GeoJSON.Net</id>
55
<version>$version$-alpha</version>
6-
<authors>Matt Hunt, Joerg Battermann</authors>
7-
<owners>Matt Hunt, Joerg Battermann and GeoJSON.Net contributors.</owners>
6+
<authors>Matt Hunt,Joerg Battermann</authors>
7+
<owners>Matt Hunt,Joerg Battermann and GeoJSON.Net contributors.</owners>
88
<licenseUrl>https://github.com/GeoJSON-Net/GeoJSON.Net/blob/master/LICENSE.md</licenseUrl>
99
<projectUrl>https://github.com/GeoJSON-Net/GeoJSON.Net</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@@ -13,11 +13,16 @@
1313
<language>en-US</language>
1414
<tags>geojson geo json geolocation</tags>
1515
<dependencies>
16-
<dependency id="Newtonsoft.Json" version="7.0.1" />
16+
<dependency id="Newtonsoft.Json" version="10.0.1" />
1717
</dependencies>
1818
</metadata>
1919
<files>
20-
<file src="src\GeoJSON.Net\bin\Release\GeoJSON.Net.dll" target="lib\portable-net40+sl5+wp80+win8+wpa81\GeoJSON.Net.dll" />
21-
<file src="src\GeoJSON.Net\bin\Release\GeoJSON.Net.XML" target="lib\portable-net40+sl5+wp80+win8+wpa81\GeoJSON.Net.XML" />
20+
<file src="src\GeoJSON.Net\bin\Release\net35\GeoJSON.Net.dll" target="lib\net35\GeoJSON.Net.dll" />
21+
<file src="src\GeoJSON.Net\bin\Release\net40\GeoJSON.Net.dll" target="lib\net40\GeoJSON.Net.dll" />
22+
<file src="src\GeoJSON.Net\bin\Release\net45\GeoJSON.Net.dll" target="lib\net45\GeoJSON.Net.dll" />
23+
<file src="src\GeoJSON.Net\bin\Release\netstandard1.0\GeoJSON.Net.dll" target="lib\netstandard1.0\GeoJSON.Net.dll" />
24+
<file src="src\GeoJSON.Net\bin\Release\netstandard1.1\GeoJSON.Net.dll" target="lib\netstandard1.1\GeoJSON.Net.dll" />
25+
<file src="LICENSE.md" target="LICENSE.md" />
26+
<file src="README.md" target="README.md" />
2227
</files>
2328
</package>

src/GeoJSON.Net.Tests/Geometry/GeometryTests.cs

Lines changed: 244 additions & 244 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
3+
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
44
<package id="NUnit" version="3.7.0" targetFramework="net461" />
55
</packages>

src/GeoJSON.Net/Converters/CrsConverter.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
using System;
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
2+
3+
using System;
4+
#if (!NET35 || !NET40)
25
using System.Reflection;
6+
#endif
37
using GeoJSON.Net.CoordinateReferenceSystem;
48
using Newtonsoft.Json;
59
using Newtonsoft.Json.Linq;
@@ -20,7 +24,11 @@ public class CrsConverter : JsonConverter
2024
/// </returns>
2125
public override bool CanConvert(Type objectType)
2226
{
27+
#if (NET35 || NET40)
28+
return typeof(ICRSObject).IsAssignableFrom(objectType);
29+
#else
2330
return typeof(ICRSObject).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
31+
#endif
2432
}
2533

2634
/// <summary>

src/GeoJSON.Net/Converters/GeoJsonConverter.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
using System;
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
2+
3+
using System;
24
using System.Collections.Generic;
35
using System.Linq;
6+
#if (!NET35 || !NET40)
47
using System.Reflection;
8+
#endif
59
using GeoJSON.Net.Feature;
610
using GeoJSON.Net.Geometry;
711
using Newtonsoft.Json;
@@ -23,7 +27,11 @@ public class GeoJsonConverter : JsonConverter
2327
/// </returns>
2428
public override bool CanConvert(Type objectType)
2529
{
30+
#if (NET35 || NET40)
31+
return typeof(IGeoJSONObject).IsAssignableFrom(objectType);
32+
#else
2633
return typeof(IGeoJSONObject).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
34+
#endif
2735
}
2836

2937
/// <summary>
@@ -89,13 +97,23 @@ private static IGeoJSONObject ReadGeoJson(JObject value)
8997
}
9098

9199
GeoJSONObjectType geoJsonType;
92-
93-
if (!Enum.TryParse(token.Value<string>(), true, out geoJsonType))
100+
#if (NET35)
101+
try
102+
{
103+
geoJsonType = (GeoJSONObjectType)Enum.Parse(typeof(GeoJSONObjectType), token.Value<string>(), true);
104+
}
105+
catch(Exception)
106+
{
107+
throw new JsonReaderException("Type must be a valid geojson object type");
108+
}
109+
#else
110+
if (!Enum.TryParse(token.Value<string>(), true, out geoJsonType))
94111
{
95112
throw new JsonReaderException("type must be a valid geojson object type");
96113
}
114+
#endif
97115

98-
switch (geoJsonType)
116+
switch (geoJsonType)
99117
{
100118
case GeoJSONObjectType.Point:
101119
return value.ToObject<Point>();

src/GeoJSON.Net/Converters/GeometryConverter.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="GeometryConverter.cs" company="Joerg Battermann">
3-
// Copyright © Joerg Battermann 2014
4-
// </copyright>
5-
// --------------------------------------------------------------------------------------------------------------------
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
62

73
using System;
84
using System.Collections.Generic;
95
using System.Linq;
6+
#if (!NET35 || !NET40)
107
using System.Reflection;
8+
#endif
119
using GeoJSON.Net.Geometry;
1210
using Newtonsoft.Json;
1311
using Newtonsoft.Json.Linq;
@@ -28,7 +26,11 @@ public class GeometryConverter : JsonConverter
2826
/// </returns>
2927
public override bool CanConvert(Type objectType)
3028
{
29+
#if (NET35 || NET40)
30+
return typeof(IGeometryObject).IsAssignableFrom(objectType);
31+
#else
3132
return typeof(IGeometryObject).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
33+
#endif
3234
}
3335

3436
/// <summary>
@@ -95,10 +97,21 @@ private static IGeometryObject ReadGeoJson(JObject value)
9597

9698
GeoJSONObjectType geoJsonType;
9799

100+
#if (NET35)
101+
try
102+
{
103+
geoJsonType = (GeoJSONObjectType)Enum.Parse(typeof(GeoJSONObjectType), token.Value<string>(), true);
104+
}
105+
catch (Exception)
106+
{
107+
throw new JsonReaderException("Type must be a valid geojson object type");
108+
}
109+
#else
98110
if (!Enum.TryParse(token.Value<string>(), true, out geoJsonType))
99111
{
100112
throw new JsonReaderException("type must be a valid geojson geometry object type");
101113
}
114+
#endif
102115

103116
switch (geoJsonType)
104117
{

src/GeoJSON.Net/Converters/LineStringConverter.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="PolygonConverter.cs" company="Joerg Battermann">
3-
// Copyright © Joerg Battermann 2014
4-
// </copyright>
5-
// --------------------------------------------------------------------------------------------------------------------
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
62

73
using System;
84
using System.Collections.Generic;

src/GeoJSON.Net/Converters/MultiPointConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
2+
13
using System;
24
using System.Collections.Generic;
35
using System.Linq;

src/GeoJSON.Net/Converters/MultiPolygonConverter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System;
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
2+
3+
using System;
24
using System.Collections.Generic;
35
using System.Linq;
46
using GeoJSON.Net.Geometry;

src/GeoJSON.Net/Converters/PointConverter.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="PositionConverter.cs" company="Joerg Battermann">
3-
// Copyright © Joerg Battermann 2014
4-
// </copyright>
5-
// --------------------------------------------------------------------------------------------------------------------
1+
// Copyright © Joerg Battermann 2014, Matt Hunt 2017
62

73
using System;
4+
#if (!NET35 || !NET40)
85
using System.Reflection;
6+
#endif
97
using GeoJSON.Net.Geometry;
108
using Newtonsoft.Json;
119

@@ -25,7 +23,11 @@ public class PointConverter : JsonConverter
2523
/// </returns>
2624
public override bool CanConvert(Type objectType)
2725
{
26+
#if (NET35 || NET40)
27+
return typeof(Point).IsAssignableFrom(objectType);
28+
#else
2829
return typeof(Position).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
30+
#endif
2931
}
3032

3133
/// <summary>

0 commit comments

Comments
 (0)