Skip to content

Commit d6a4c82

Browse files
committed
Merge branch 'additions_2' into additions_merge
Conflicts: GeoJSON4EntityFramework/Elements/FeatureEF6.vb GeoJSON4EntityFramework/Elements/Polygon.vb GeoJSON4EntityFramework/Elements/PolygonEF6.vb GeoJSON4EntityFramework/GeoJSON4EntityFramework.vbproj GeoJSON4EntityFramework5/Elements/PolygonEF5.vb
2 parents 6f25399 + 8586e8c commit d6a4c82

Some content is hidden

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

49 files changed

+270681
-17
lines changed

GeoJSON4EntityFramework.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30110.0
4+
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GeoJSON4EntityFramework", "GeoJSON4EntityFramework\GeoJSON4EntityFramework.vbproj", "{7B0F6694-A109-4F3F-84A0-9FA49193AF31}"
77
EndProject
@@ -17,12 +17,12 @@ Global
1717
Release|Any CPU = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20-
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Debug|Any CPU.ActiveCfg = Release|Any CPU
21-
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Debug|Any CPU.Build.0 = Release|Any CPU
20+
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Debug|Any CPU.Build.0 = Debug|Any CPU
2222
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Release|Any CPU.ActiveCfg = Release|Any CPU
2323
{7B0F6694-A109-4F3F-84A0-9FA49193AF31}.Release|Any CPU.Build.0 = Release|Any CPU
24-
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Debug|Any CPU.ActiveCfg = Release|Any CPU
25-
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Debug|Any CPU.Build.0 = Release|Any CPU
24+
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Debug|Any CPU.Build.0 = Debug|Any CPU
2626
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Release|Any CPU.ActiveCfg = Release|Any CPU
2727
{3AA1813C-601C-4FFF-8F7A-7070649CAF65}.Release|Any CPU.Build.0 = Release|Any CPU
2828
{3622D159-0C66-4208-89FD-8DCD782B96F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

GeoJSON4EntityFramework/Elements/Coordinate.vb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Public Class Coordinate
1+
<JsonConverter(GetType(CoordinateConverter))>
2+
Public Class Coordinate
23
Sub New()
34
MyBase.New()
45
End Sub
@@ -14,8 +15,10 @@
1415
End Get
1516
End Property
1617

18+
<JsonIgnore()>
1719
Public Property X As Double
1820

21+
<JsonIgnore()>
1922
Public Property Y As Double
2023

2124
End Class
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Public Class FeatureCollection
22
Inherits GeoJsonElement(Of FeatureCollection)
33

4-
<JsonConverter(GetType(GenericListConverter(Of Feature)))>
54
<JsonProperty(PropertyName:="features")>
65
Public Property Features As New List(Of Feature)
76
End Class

GeoJSON4EntityFramework/Elements/FeatureEF6.vb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
f.Geometry.Add(Point.FromDbGeometry(inp))
1313
Case "MultPoint"
1414
f.Geometry.Add(MultiPoint.FromDbGeometry(inp))
15+
<<<<<<< HEAD
1516
Case "LineString"
1617
f.Geometry.Add(LineString.FromDbGeometry(inp))
1718
Case "MultiLineString"
1819
f.Geometry.Add(MultiLineString.FromDbGeometry(inp))
1920
Case Else
2021
Throw New NotImplementedException
22+
=======
23+
Case "GeometryCollection"
24+
f.Geometry.Add(GeometryCollection.FromDbGeometry(inp))
25+
>>>>>>> additions_2
2126
End Select
2227

2328
Return f
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Partial Public Class GeometryCollection
2+
Inherits GeoJsonElement(Of GeometryCollection)
3+
Implements IGeoJsonGeometry
4+
5+
<JsonProperty(PropertyName:="geometries")>
6+
Public Property Geometries As New List(Of IGeoJsonGeometry)
7+
8+
Shared Function FromDbGeometry(inp As Entity.Spatial.DbGeometry) As IGeoJsonGeometry
9+
Dim obj As New GeometryCollection()
10+
obj.CreateFromDbGeometry(inp)
11+
Return obj
12+
End Function
13+
14+
End Class
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Partial Public Class GeometryCollection
2+
Public Sub CreateFromDbGeometry(inp As Entity.Spatial.DbGeometry)
3+
If inp.SpatialTypeName <> "GeometryCollection" Then Throw New ArgumentException
4+
Geometries.Clear()
5+
6+
For i As Integer = 1 To inp.ElementCount
7+
Dim element = inp.ElementAt(i)
8+
Select Case element.SpatialTypeName
9+
Case "MultiPolygon"
10+
Geometries.Add(MultiPolygon.FromDbGeometry(element))
11+
Case "Polygon"
12+
Geometries.Add(Polygon.FromDbGeometry(element))
13+
Case "Point"
14+
Geometries.Add(Point.FromDbGeometry(element))
15+
Case "MultiPoint"
16+
Geometries.Add(MultiPoint.FromDbGeometry(element))
17+
End Select
18+
Next
19+
End Sub
20+
End Class

GeoJSON4EntityFramework/Elements/MultiPolygon.vb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@
77

88
Public Overrides ReadOnly Property Coordinates As Object
99
Get
10-
If Polygons.Count = 0 Then
11-
Return New Double() {}
12-
Else
13-
Dim out(Polygons.Count - 1)()()() As Double
14-
15-
Parallel.For(0, Polygons.Count, Sub(i)
16-
out(i) = Polygons(i).Coordinates
17-
End Sub)
18-
Return out
19-
End If
10+
Dim result As New List(Of Object)()
11+
For Each poly In Polygons
12+
result.Add(poly.Coordinates)
13+
Next
14+
Return result
2015
End Get
2116
End Property
2217
End Class

GeoJSON4EntityFramework/Elements/Polygon.vb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Implements IGeoJsonGeometry
44

55
<Newtonsoft.Json.JsonIgnore()>
6+
<<<<<<< HEAD
67
Public Property PointsList As New List(Of CoordinateList)
78

89
Public Overrides ReadOnly Property Coordinates()
@@ -34,6 +35,13 @@
3435
Catch ex As Exception
3536
Return New Double() {}
3637
End Try
38+
=======
39+
Public Property Rings As New List(Of CoordinateList)
40+
41+
Public Overrides ReadOnly Property Coordinates()
42+
Get
43+
Return Rings
44+
>>>>>>> additions_2
3745
End Get
3846
End Property
3947

GeoJSON4EntityFramework/Elements/PolygonEF6.vb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Partial Class Polygon
2+
<<<<<<< HEAD
23
Public Overrides Sub CreateFromDbGeometry(inp As Data.Entity.Spatial.DbGeometry)
34
If inp.SpatialTypeName <> MyBase.TypeName Then Throw New ArgumentException
45
PointsList.Clear()
@@ -20,6 +21,33 @@
2021
Points.AddNew(point.XCoordinate, point.YCoordinate)
2122
Next
2223
PointsList.Add(Points)
24+
=======
25+
26+
Private Function RingToCoordinateList(ring As Entity.Spatial.DbGeometry) As CoordinateList
27+
Dim extRingCoords As New CoordinateList()
28+
For i = 1 To ring.PointCount
29+
Dim pt = ring.PointAt(i)
30+
extRingCoords.Add(New Coordinate(pt.XCoordinate, pt.YCoordinate))
31+
Next
32+
Return extRingCoords
33+
End Function
34+
35+
Public Overrides Sub CreateFromDbGeometry(inp As Entity.Spatial.DbGeometry)
36+
If inp.SpatialTypeName <> MyBase.TypeName Then Throw New ArgumentException
37+
Rings.Clear()
38+
39+
' Process exterior ring
40+
Dim extRing = inp.ExteriorRing
41+
Rings.Add(RingToCoordinateList(extRing))
42+
43+
' Process interior rings (ie. holes)
44+
If inp.InteriorRingCount > 0 Then
45+
For i = 1 To inp.InteriorRingCount
46+
Dim intRing = inp.InteriorRingAt(i)
47+
Rings.Add(RingToCoordinateList(intRing))
48+
Next
49+
End If
50+
>>>>>>> additions_2
2351
End Sub
2452

2553
End Class

GeoJSON4EntityFramework/GeoJSON4EntityFramework.vbproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,19 @@
8181
<ItemGroup>
8282
<Compile Include="Base\GeoJsonGeometryEF6.vb" />
8383
<Compile Include="Elements\FeatureEF6.vb" />
84+
<<<<<<< HEAD
8485
<Compile Include="Elements\LineString.vb" />
8586
<Compile Include="Elements\LineStringEF6.vb" />
8687
<Compile Include="Elements\MultiLineStringEF6.vb" />
88+
=======
89+
<Compile Include="Elements\GeometryCollection.vb" />
90+
>>>>>>> additions_2
8791
<Compile Include="Elements\MultiPointEF6.vb" />
8892
<Compile Include="Elements\MultiPolygonEF6.vb" />
8993
<Compile Include="Elements\MultiLineString.vb" />
9094
<Compile Include="Elements\PointEF6.vb" />
9195
<Compile Include="Elements\PolygonEF6.vb" />
96+
<Compile Include="JsonNET\CoordinateConverter.vb" />
9297
<Compile Include="JsonNET\GeoJsonSerializer.vb" />
9398
<Compile Include="Elements\Coordinate.vb" />
9499
<Compile Include="Elements\CoordinateList.vb" />
@@ -129,6 +134,7 @@
129134
</ItemGroup>
130135
<ItemGroup>
131136
<None Include="App.config" />
137+
<Compile Include="Elements\GeometryCollectionEF6.vb" />
132138
<None Include="My Project\Application.myapp">
133139
<Generator>MyApplicationCodeGenerator</Generator>
134140
<LastGenOutput>Application.Designer.vb</LastGenOutput>

0 commit comments

Comments
 (0)