From 23c2b16118046dd1f63426a6597febdd9b0583a5 Mon Sep 17 00:00:00 2001 From: devildog Date: Tue, 2 Jul 2013 07:58:06 -0400 Subject: [PATCH 1/2] Remove json.net attributes --- .../CoordinateReferenceSystem/CRSBase.cs | 9 ++++----- src/GeoJSON.Net/Feature/Feature.cs | 19 +++++++++++-------- src/GeoJSON.Net/Feature/FeatureCollection.cs | 13 +++++++++---- src/GeoJSON.Net/GeoJSON.Net.csproj | 19 ++++++------------- src/GeoJSON.Net/GeoJSONObject.cs | 10 +++++----- .../Geometry/GeometryCollection.cs | 8 ++------ src/GeoJSON.Net/Geometry/LineString.cs | 15 ++++++++------- src/GeoJSON.Net/Geometry/MultiLineString.cs | 4 ++-- src/GeoJSON.Net/Geometry/MultiPoint.cs | 4 ++-- src/GeoJSON.Net/Geometry/MultiPolygon.cs | 14 ++++++++------ src/GeoJSON.Net/Geometry/Point.cs | 7 ++----- src/GeoJSON.Net/Geometry/Polygon.cs | 12 ++++++++---- 12 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/GeoJSON.Net/CoordinateReferenceSystem/CRSBase.cs b/src/GeoJSON.Net/CoordinateReferenceSystem/CRSBase.cs index b58a0a5b..efda8be5 100644 --- a/src/GeoJSON.Net/CoordinateReferenceSystem/CRSBase.cs +++ b/src/GeoJSON.Net/CoordinateReferenceSystem/CRSBase.cs @@ -10,25 +10,24 @@ namespace GeoJSON.Net.CoordinateReferenceSystem { using System.Collections.Generic; - - using Newtonsoft.Json; + /// /// Base class for all IGeometryObject implementing types /// - [JsonObject(MemberSerialization.OptIn)] + public abstract class CRSBase { /// /// Gets the type of the GeometryObject object. /// - [JsonProperty(PropertyName = "type", Required = Required.Always)] + public CRSType Type { get; internal set; } /// /// Gets the properties. /// - [JsonProperty(PropertyName = "properties", Required = Required.Always)] + public Dictionary Properties { get; internal set; } } } diff --git a/src/GeoJSON.Net/Feature/Feature.cs b/src/GeoJSON.Net/Feature/Feature.cs index 4a2e818b..f26f6d5b 100644 --- a/src/GeoJSON.Net/Feature/Feature.cs +++ b/src/GeoJSON.Net/Feature/Feature.cs @@ -10,11 +10,10 @@ namespace GeoJSON.Net.Feature { using System.Collections.Generic; - - using GeoJSON.Net.Converters; + using GeoJSON.Net.Geometry; - using Newtonsoft.Json; + /// /// A GeoJSON Feature Object. @@ -26,6 +25,11 @@ public class Feature : GeoJSONObject /// /// The Geometry Object. /// The properties. + /// + public Feature() + { + this.Type = GeoJSONObjectType.Feature; + } public Feature(IGeometryObject geometry, Dictionary properties = null) { this.Geometry = geometry; @@ -38,7 +42,7 @@ public Feature(IGeometryObject geometry, Dictionary properties = /// Gets or sets the id. /// /// The handle. - [JsonProperty(PropertyName = "id")] + public string Id { get; set; } /// @@ -47,15 +51,14 @@ public Feature(IGeometryObject geometry, Dictionary properties = /// /// The geometry. /// - [JsonProperty(PropertyName = "geometry", Required = Required.AllowNull)] - [JsonConverter(typeof(GeometryConverter))] + public IGeometryObject Geometry { get; set; } /// /// Gets the properties. /// /// The properties. - [JsonProperty(PropertyName = "properties", Required = Required.AllowNull)] - public Dictionary Properties { get; private set; } + + public Dictionary Properties { get; set; } } } diff --git a/src/GeoJSON.Net/Feature/FeatureCollection.cs b/src/GeoJSON.Net/Feature/FeatureCollection.cs index 97b3d916..26672ee8 100644 --- a/src/GeoJSON.Net/Feature/FeatureCollection.cs +++ b/src/GeoJSON.Net/Feature/FeatureCollection.cs @@ -10,8 +10,7 @@ namespace GeoJSON.Net.Feature { using System.Collections.Generic; - - using Newtonsoft.Json; + /// /// Defines the FeatureCollection type. @@ -22,6 +21,12 @@ public class FeatureCollection : GeoJSONObject /// Initializes a new instance of the class. /// /// The features. + /// + public FeatureCollection() + { + this.Type = GeoJSONObjectType.FeatureCollection; + this.Features = new List(); + } public FeatureCollection(List features) { this.Features = features; @@ -33,7 +38,7 @@ public FeatureCollection(List features) /// Gets the features. /// /// The features. - [JsonProperty(PropertyName = "features", Required = Required.Always)] - public List Features { get; private set; } + + public List Features { get; set; } } } diff --git a/src/GeoJSON.Net/GeoJSON.Net.csproj b/src/GeoJSON.Net/GeoJSON.Net.csproj index 061d3212..0f05fccd 100644 --- a/src/GeoJSON.Net/GeoJSON.Net.csproj +++ b/src/GeoJSON.Net/GeoJSON.Net.csproj @@ -8,8 +8,8 @@ {7C0D45ED-681E-4DEC-9910-BAE1211E4889} Library Properties - GeoJSON.Net - GeoJSON.Net + MGeoJSON.Net + MGeoJSON.Net v4.0 512 @@ -21,7 +21,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\GeoJSON.Net.XML + bin\Debug\MGeoJSON.Net.xml pdbonly @@ -30,21 +30,14 @@ TRACE prompt 4 - bin\Release\GeoJSON.Net.XML + bin\Release\MGeoJSON.Net.xml - - False - ..\packages\Newtonsoft.Json.4.0.5\lib\net40\Newtonsoft.Json.dll - - - - @@ -75,8 +68,8 @@ - copy $(SolutionDir)$(ProjectName)\$(OutDir)$(TargetName).xml $(SolutionDir)..\lib -copy $(SolutionDir)$(ProjectName)\$(OutDir)$(TargetName).dll $(SolutionDir)..\lib + +