Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to NTS 2.0 and removed use of GeoAPI where required. Also Fixed 4 Bugs and Fixed most of the Unit Tests #302

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d570549
Updated to NTS 2.0
Mar 6, 2020
e7165e8
Added GetTestRandomRoutesParallel to list of tests to run
Mar 6, 2020
e613e4e
Added Locomotive and Train, Enhanced tests to run on all profiles.
Mar 6, 2020
ac863da
Enhaced RouterDb to consider Train and Locomotive during testing
Mar 6, 2020
5a185e8
Enhanced tests to run on all profiles
Mar 6, 2020
e5e2012
WeightMatrixTests now test all profiles
Mar 6, 2020
74ccc08
Added parallel test in Resolving which also does routing.
Mar 6, 2020
4790d0d
Updated STRM, Fixed multithreading issue in ProfileFactorAndSpeedCach…
juliusfriedman Mar 7, 2020
ad6c728
Updated packages in ItineroTest
juliusfriedman Mar 7, 2020
6688ba5
Removed duplicate test
Mar 9, 2020
78c4758
Updated OSM Sharp References
Mar 9, 2020
722d2d3
Fixed local references to use nuget
Mar 9, 2020
f954b1b
Updated InstructionTest to use ParallelEnumerable as indicated.
Mar 9, 2020
abaf11b
Enhanced ShapeFileWriterTests to use all profiles.
Mar 9, 2020
a96dc7b
Removed new field which hides base member. Ensured all tests are pass…
Mar 10, 2020
431becf
Used compound assignment in TestFactorAndSpeed and made TestFactorAnd…
Mar 10, 2020
f193ea0
Added test for edge based contractions and their weight matrixes
Mar 10, 2020
d309b08
Changed float.MaxValue to _weightHandler.Infinite as in other Algorit…
Mar 10, 2020
cf9efe6
Removed buggy code which was causing different weights for contracted…
Mar 10, 2020
2fe7e3d
Fixed Coordinate.DistanceEstimateInMeter added TestGeoCoordinateDista…
Mar 10, 2020
fc55f3d
Renamed TestEdgeBasedContractions to TestEdgeBasedContractionsMinimal…
Mar 11, 2020
4129ea9
Added comments for clarify in TestEdgeBasedContractions
Mar 11, 2020
62f4c08
Changed usaged of WasFound to inline expression.
Mar 11, 2020
264ef4c
Simplified calulcation in Coordinate by using a const DegreesToRadians
Mar 11, 2020
11fe52e
Fixed bug in other test case by using `ManyToMany` instead of `Calcul…
Mar 11, 2020
d8eb734
Added Parallel test
Mar 12, 2020
34e1347
Addressed https://github.com/itinero/routing/issues/306
juliusfriedman Apr 2, 2020
229fc58
Added osm.pbf files used in tests for https://github.com/itinero/rout…
juliusfriedman Apr 3, 2020
204265a
Everything passes except RouterTests.TestBicycleWithCyclenetwork
May 17, 2020
21c634d
Revised Math.Pow 2 calls to X * X, even though the later JIT's optomi…
May 17, 2020
82d4049
netcoreapp 3.1 x64 and corrected nugets and references
Jul 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions Itinero.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2009
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4B330D21-2EE5-4C34-B716-0DB1FBC58E29}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C142786B-F60E-4B6B-B9F2-1D25C3A3D7B5}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
build.sh = build.sh
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE.md = LICENSE.md
NOTICE.md = NOTICE.md
README.md = README.md
SharedAssemblyVersion.cs = SharedAssemblyVersion.cs
test.sh = test.sh
build.sh = build.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7E594B3F-4CA9-4198-B90D-DD16972D0481}"
Expand Down Expand Up @@ -47,13 +47,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Itinero.Test", "test\Itiner
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Itinero.Test.Functional", "test\Itinero.Test.Functional\Itinero.Test.Functional.csproj", "{9D719B37-42DD-486A-9FFC-CD8B0230D114}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Itinero.Geo", "src\Itinero.Geo\Itinero.Geo.csproj", "{87E5FF87-E75F-4462-937F-538AB570EE1F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Itinero.Geo", "src\Itinero.Geo\Itinero.Geo.csproj", "{87E5FF87-E75F-4462-937F-538AB570EE1F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Itinero.IO.Shape", "src\Itinero.IO.Shape\Itinero.IO.Shape.csproj", "{C18E5106-ECC6-4C7B-A611-7D8514B0D3BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Itinero.IO.Shape", "src\Itinero.IO.Shape\Itinero.IO.Shape.csproj", "{C18E5106-ECC6-4C7B-A611-7D8514B0D3BD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Shape", "samples\Sample.Shape\Sample.Shape.csproj", "{EB6A7F79-3540-4E31-A1A8-3ADA0F232E67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Shape", "samples\Sample.Shape\Sample.Shape.csproj", "{EB6A7F79-3540-4E31-A1A8-3ADA0F232E67}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.DynamicProfiles", "samples\Sample.DynamicProfiles\Sample.DynamicProfiles.csproj", "{8DED4253-89E6-4333-9750-E830DB789B2D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.DynamicProfiles", "samples\Sample.DynamicProfiles\Sample.DynamicProfiles.csproj", "{8DED4253-89E6-4333-9750-E830DB789B2D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OsmSharp", "..\AmstedDigital.OperationalTwins\osmsharp\core-develop\src\OsmSharp\OsmSharp.csproj", "{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OsmSharp.Geo", "..\AmstedDigital.OperationalTwins\osmsharp\core-develop\src\OsmSharp.Geo\OsmSharp.Geo.csproj", "{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -151,6 +155,22 @@ Global
{8DED4253-89E6-4333-9750-E830DB789B2D}.Release|Any CPU.Build.0 = Release|Any CPU
{8DED4253-89E6-4333-9750-E830DB789B2D}.Release|x64.ActiveCfg = Release|Any CPU
{8DED4253-89E6-4333-9750-E830DB789B2D}.Release|x64.Build.0 = Release|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Debug|x64.ActiveCfg = Debug|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Debug|x64.Build.0 = Debug|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Release|Any CPU.Build.0 = Release|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Release|x64.ActiveCfg = Release|Any CPU
{4E4348CD-2E8E-4FC9-996F-95DBFD37AE1A}.Release|x64.Build.0 = Release|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Debug|x64.ActiveCfg = Debug|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Debug|x64.Build.0 = Debug|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Release|Any CPU.Build.0 = Release|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Release|x64.ActiveCfg = Release|Any CPU
{FF50E1A3-80F2-41D0-AACA-A8D7DBD34C22}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -168,9 +188,6 @@ Global
{EB6A7F79-3540-4E31-A1A8-3ADA0F232E67} = {77BC0AC3-41A6-4672-A3AB-9C27710756BE}
{8DED4253-89E6-4333-9750-E830DB789B2D} = {77BC0AC3-41A6-4672-A3AB-9C27710756BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {647068E9-BC76-4E51-B225-D6BBD4689F76}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9A2B2E1-FE8E-4F87-80E2-1A3F620ED1E8}
EndGlobalSection
Expand Down
1 change: 1 addition & 0 deletions samples/Sample.Basic/Sample.Basic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Sample.Elevation/Sample.Elevation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Sample.Matrix/Sample.Matrix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions samples/Sample.Shape/Sample.Shape.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Itinero.IO.Shape\Itinero.IO.Shape.csproj" />
Expand Down
28 changes: 14 additions & 14 deletions src/Itinero.Geo/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ public static class Extensions
/// <summary>
/// Converts the coordinate to a geoapi coordinate.
/// </summary>
public static GeoAPI.Geometries.Coordinate ToCoordinate(this LocalGeo.Coordinate coordinate)
public static NetTopologySuite.Geometries.Coordinate ToCoordinate(this LocalGeo.Coordinate coordinate)
{
return new GeoAPI.Geometries.Coordinate(coordinate.Longitude, coordinate.Latitude);
return new NetTopologySuite.Geometries.Coordinate(coordinate.Longitude, coordinate.Latitude);
}

/// <summary>
/// Converts a geoapi coordinate to a coordinate.
/// </summary>
public static LocalGeo.Coordinate FromCoordinate(this GeoAPI.Geometries.Coordinate coordinate)
public static LocalGeo.Coordinate FromCoordinate(this NetTopologySuite.Geometries.Coordinate coordinate)
{
return new LocalGeo.Coordinate((float)coordinate.Y, (float)coordinate.X);
}

/// <summary>
/// Converts a list of coordinates to geoapi coordinates.
/// </summary>
public static List<GeoAPI.Geometries.Coordinate> ToCoordinates(this List<LocalGeo.Coordinate> coordinates)
public static List<NetTopologySuite.Geometries.Coordinate> ToCoordinates(this List<LocalGeo.Coordinate> coordinates)
{
if (coordinates == null)
{
return null;
}

var geoApiCoordinates = new List<GeoAPI.Geometries.Coordinate>(coordinates.Count);
var geoApiCoordinates = new List<NetTopologySuite.Geometries.Coordinate>(coordinates.Count);
for (var i = 0; i < coordinates.Count; i++)
{
geoApiCoordinates.Add(coordinates[i].ToCoordinate());
Expand All @@ -63,14 +63,14 @@ public static LocalGeo.Coordinate FromCoordinate(this GeoAPI.Geometries.Coordina
/// <summary>
/// Converts a list of coordinates to geoapi coordinates.
/// </summary>
public static GeoAPI.Geometries.Coordinate[] ToCoordinatesArray(this List<LocalGeo.Coordinate> coordinates)
public static NetTopologySuite.Geometries.Coordinate[] ToCoordinatesArray(this List<LocalGeo.Coordinate> coordinates)
{
if (coordinates == null)
{
return null;
}

var geoApiCoordinates = new GeoAPI.Geometries.Coordinate[coordinates.Count];
var geoApiCoordinates = new NetTopologySuite.Geometries.Coordinate[coordinates.Count];
for (var i = 0; i < coordinates.Count; i++)
{
geoApiCoordinates[i] = coordinates[i].ToCoordinate();
Expand All @@ -81,14 +81,14 @@ public static GeoAPI.Geometries.Coordinate[] ToCoordinatesArray(this List<LocalG
/// <summary>
/// Converts a list of coordinates to geoapi coordinates.
/// </summary>
public static List<GeoAPI.Geometries.Coordinate> ToCoordinates(this LocalGeo.Coordinate[] coordinates)
public static List<NetTopologySuite.Geometries.Coordinate> ToCoordinates(this LocalGeo.Coordinate[] coordinates)
{
if (coordinates == null)
{
return null;
}

var geoApiCoordinates = new List<GeoAPI.Geometries.Coordinate>(coordinates.Length);
var geoApiCoordinates = new List<NetTopologySuite.Geometries.Coordinate>(coordinates.Length);
for (var i = 0; i < coordinates.Length; i++)
{
geoApiCoordinates.Add(coordinates[i].ToCoordinate());
Expand All @@ -99,14 +99,14 @@ public static GeoAPI.Geometries.Coordinate[] ToCoordinatesArray(this List<LocalG
/// <summary>
/// Converts an array of coordinates to an array of geoapi coordinates.
/// </summary>
public static GeoAPI.Geometries.Coordinate[] ToCoordinatesArray(this LocalGeo.Coordinate[] coordinates)
public static NetTopologySuite.Geometries.Coordinate[] ToCoordinatesArray(this LocalGeo.Coordinate[] coordinates)
{
if (coordinates == null)
{
return null;
}

var geoApiCoordinates = new GeoAPI.Geometries.Coordinate[coordinates.Length];
var geoApiCoordinates = new NetTopologySuite.Geometries.Coordinate[coordinates.Length];
for (var i = 0; i < coordinates.Length; i++)
{
geoApiCoordinates[i] = coordinates[i].ToCoordinate();
Expand Down Expand Up @@ -163,10 +163,10 @@ public static NetTopologySuite.Features.FeatureCollection ToFeatureCollection(th
/// </summary>
public static NetTopologySuite.Geometries.LineString ToLineString(this Algorithms.Networks.Analytics.Trees.Models.TreeEdge edge)
{
var coordinates = new GeoAPI.Geometries.Coordinate[edge.Shape.Length];
var coordinates = new NetTopologySuite.Geometries.Coordinate[edge.Shape.Length];
for(var i = 0; i < coordinates.Length; i++)
{
coordinates[i] = new GeoAPI.Geometries.Coordinate(edge.Shape[i][0], edge.Shape[i][1]);
coordinates[i] = new NetTopologySuite.Geometries.Coordinate(edge.Shape[i][0], edge.Shape[i][1]);
}
return new NetTopologySuite.Geometries.LineString(coordinates);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public static NetTopologySuite.Features.FeatureCollection ToFeatures(this IEnume
/// </summary>
public static void Add(this NetTopologySuite.Features.FeatureCollection features, NetTopologySuite.Features.FeatureCollection featuresToAdd)
{
foreach(var feature in featuresToAdd.Features)
foreach(var feature in featuresToAdd)
{
features.Add(feature);
}
Expand Down
13 changes: 10 additions & 3 deletions src/Itinero.Geo/Itinero.Geo.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<AssemblyName>Itinero.Geo</AssemblyName>
<PackageId>Itinero.Geo</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
Expand All @@ -18,10 +18,17 @@
<PackageIconUrl>http://www.itinero.tech/logos/itinero_logo_notext.svg.128.png</PackageIconUrl>
<RepositoryUrl>https://github.com/itinero/routing/</RepositoryUrl>
<RepositoryType>osm, openstreetmap, routing, mapping</RepositoryType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp3.1|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp3.1|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NetTopologySuite" Version="1.15.1" />
<PackageReference Include="NetTopologySuite.Features" Version="1.15.1" />
<PackageReference Include="NetTopologySuite.Core" Version="1.15.3" />
<PackageReference Include="NetTopologySuite.Features" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Itinero\Itinero.csproj" />
Expand Down
1 change: 0 additions & 1 deletion src/Itinero.Geo/Navigation/InstructionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* limitations under the License.
*/

using GeoAPI.Geometries;
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using Itinero.Navigation;
Expand Down
17 changes: 9 additions & 8 deletions src/Itinero.Geo/RouteExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,27 @@ public static class RouteExtensions
/// <summary>
/// Returns the bounding box around this route.
/// </summary>
public static GeoAPI.Geometries.Envelope GetBox(this Route route)
public static Envelope GetBox(this Route route)
{
if (route == null) { throw new ArgumentNullException("route"); }

if (route.Shape == null)
{
return null;
}

if (route.Shape.Length == 1)
{
return new GeoAPI.Geometries.Envelope(
route.Shape[0].ToCoordinate(), route.Shape[0].ToCoordinate());
return new Envelope(route.Shape[0].ToCoordinate(), route.Shape[0].ToCoordinate());
}

var envelope = new GeoAPI.Geometries.Envelope(
route.Shape[0].ToCoordinate(), route.Shape[1].ToCoordinate());
for(var i = 2; i < route.Shape.Length; i++)
var envelope = new Envelope(route.Shape[0].ToCoordinate(), route.Shape[1].ToCoordinate());

for (var i = 2; i < route.Shape.Length; i++)
{
envelope.ExpandToInclude(route.Shape[i].ToCoordinate());
}

return envelope;
}

Expand Down Expand Up @@ -96,7 +97,7 @@ public static FeatureCollection ToFeatureCollection(this Route route)
Logging.Logger.Log("RouteExtensions", Logging.TraceEventType.Warning,
"Invalid meta-data detected on route. One of the meta-description has a shape index smaller than the previous one.");
}
var shape = new GeoAPI.Geometries.Coordinate[current.Shape - previous.Shape + 1];
var shape = new Coordinate[current.Shape - previous.Shape + 1];
for(var s = previous.Shape; s <= current.Shape; s++)
{
if (s < 0 || s >= route.Shape.Length)
Expand All @@ -116,7 +117,7 @@ public static FeatureCollection ToFeatureCollection(this Route route)
for (var i = 0; i < route.Stops.Length; i++)
{
featureCollection.Add(new Feature(
new Point(new GeoAPI.Geometries.Coordinate(
new Point(new Coordinate(
route.Stops[i].Coordinate.ToCoordinate())),
route.Stops[i].Attributes.ToAttributesTable()));
}
Expand Down
1 change: 0 additions & 1 deletion src/Itinero.Geo/RouterDbExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* limitations under the License.
*/

using GeoAPI.Geometries;
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using Itinero.Data.Network;
Expand Down
Loading