You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2016/11/25 11:07:31 UTC
[26/26] lucenenet git commit: Spatial: Updated to use the Spatial4n
0.4.1-beta NuGet package (closes #174)
Spatial: Updated to use the Spatial4n 0.4.1-beta NuGet package (closes #174)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e8735ed9
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e8735ed9
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e8735ed9
Branch: refs/heads/master
Commit: e8735ed9622ab56eaf86bae6394f93f3fb058d30
Parents: 8219d87
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Nov 25 17:56:37 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Nov 25 17:58:43 2016 +0700
----------------------------------------------------------------------
.../Lucene.Net.Spatial.csproj | 8 ++++----
.../Prefix/ContainsPrefixTreeFilter.cs | 2 +-
src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs | 4 ++--
.../Prefix/WithinPrefixTreeFilter.cs | 6 +++---
.../Serialized/SerializedDVStrategy.cs | 2 +-
src/Lucene.Net.Spatial/packages.config | 2 +-
.../Lucene.Net.Tests.Spatial.csproj | 20 ++++++++++++--------
.../Prefix/SpatialOpRecursivePrefixTreeTest.cs | 15 ++++++++++++++-
src/Lucene.Net.Tests.Spatial/packages.config | 4 ++++
9 files changed, 42 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
index 28c3e51..fdb56ba 100644
--- a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
+++ b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
@@ -57,10 +57,6 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
- <Reference Include="Spatial4n.Core.NTS">
- <HintPath>..\..\packages\Spatial4n.Core.NTS.0.4.1\lib\net40\Spatial4n.Core.NTS.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="GeoAPI, Version=1.7.4.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<HintPath>..\..\packages\GeoAPI.1.7.4\lib\net45\GeoAPI.dll</HintPath>
<Private>True</Private>
@@ -73,6 +69,10 @@
<HintPath>..\..\packages\NetTopologySuite.1.14\lib\net45\PowerCollections.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="Spatial4n.Core, Version=0.4.1.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Spatial4n.Core.0.4.1-beta\lib\net40\Spatial4n.Core.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
index 30bcba0..44da4c6 100644
--- a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
@@ -97,7 +97,7 @@ namespace Lucene.Net.Spatial.Prefix
SmallDocSet combinedSubResults = null;
// Optimization: use null subCellsFilter when we know cell is within the query shape.
IShape subCellsFilter = outerInstance.queryShape;
- if (cell.Level != 0 && ((cell.ShapeRel == SpatialRelation.NULL_VALUE || cell.ShapeRel == SpatialRelation.WITHIN)))
+ if (cell.Level != 0 && ((cell.ShapeRel == SpatialRelation.NOT_SET || cell.ShapeRel == SpatialRelation.WITHIN)))
{
subCellsFilter = null;
Debug.Assert(cell.Shape.Relate(outerInstance.queryShape) == SpatialRelation.WITHIN);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
index 91db4d5..2232185 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// When set via <see cref="GetSubCells(IShape)">GetSubCells(filter)</see>, it is the relationship between this cell
/// and the given shape filter.
/// </summary>
- protected internal SpatialRelation shapeRel = SpatialRelation.NULL_VALUE;//set in GetSubCells(filter), and via SetLeaf().
+ protected internal SpatialRelation shapeRel;//set in GetSubCells(filter), and via SetLeaf().
/// <summary>Always false for points.</summary>
/// <remarks>
@@ -105,7 +105,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
Debug.Assert(Level != 0);
token = null;
- shapeRel = SpatialRelation.NULL_VALUE;
+ shapeRel = SpatialRelation.NOT_SET;
this.bytes = bytes;
b_off = off;
b_len = len;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
index 0cf7b6e..6a7a8f0 100644
--- a/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
@@ -219,7 +219,7 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
private bool AllCellsIntersectQuery(Cell cell, SpatialRelation relate/*cell to query*/)
{
- if (relate == SpatialRelation.NULL_VALUE)
+ if (relate == SpatialRelation.NOT_SET)
{
relate = cell.Shape.Relate(outerInstance.queryShape);
}
@@ -241,7 +241,7 @@ namespace Lucene.Net.Spatial.Prefix
ICollection<Cell> subCells = cell.GetSubCells(null);
foreach (Cell subCell in subCells)
{
- if (!AllCellsIntersectQuery(subCell, SpatialRelation.NULL_VALUE))
+ if (!AllCellsIntersectQuery(subCell, SpatialRelation.NOT_SET))
{
//recursion
return false;
@@ -253,7 +253,7 @@ namespace Lucene.Net.Spatial.Prefix
/// <exception cref="System.IO.IOException"></exception>
protected internal override void VisitScanned(Cell cell)
{
- if (AllCellsIntersectQuery(cell, SpatialRelation.NULL_VALUE))
+ if (AllCellsIntersectQuery(cell, SpatialRelation.NOT_SET))
{
CollectDocs(inside);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
index e401c34..6d6e185 100644
--- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
+++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
@@ -7,7 +7,7 @@ using Lucene.Net.Spatial.Util;
using Lucene.Net.Support;
using Lucene.Net.Util;
using Spatial4n.Core.Context;
-using Spatial4n.Core.Io;
+using Spatial4n.Core.IO;
using Spatial4n.Core.Shapes;
using System;
using System.Collections;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Spatial/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/packages.config b/src/Lucene.Net.Spatial/packages.config
index 16ef20c..b55d4fc 100644
--- a/src/Lucene.Net.Spatial/packages.config
+++ b/src/Lucene.Net.Spatial/packages.config
@@ -1,6 +1,6 @@
\ufeff<?xml version="1.0" encoding="utf-8"?>
<packages>
- <!--<package id="Spatial4n.Core.NTS" version="0.4.1" targetFramework="net451" />-->
<package id="GeoAPI" version="1.7.4" targetFramework="net451" />
<package id="NetTopologySuite" version="1.14" targetFramework="net451" />
+ <package id="Spatial4n.Core" version="0.4.1-beta" targetFramework="net451" />
</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj b/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj
index d74a255..95a21f6 100644
--- a/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj
+++ b/src/Lucene.Net.Tests.Spatial/Lucene.Net.Tests.Spatial.csproj
@@ -30,14 +30,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
- <Private>True</Private>
- </Reference>
- <Reference Include="Spatial4n.Core.NTS">
- <HintPath>..\..\packages\Spatial4n.Core.NTS.0.4.1\lib\net40\Spatial4n.Core.NTS.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="GeoAPI, Version=1.7.4.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<HintPath>..\..\packages\GeoAPI.1.7.4\lib\net45\GeoAPI.dll</HintPath>
<Private>True</Private>
@@ -46,10 +38,22 @@
<HintPath>..\..\packages\NetTopologySuite.1.14\lib\net45\NetTopologySuite.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="PowerCollections, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2573bf8a1bdddcd5, processorArchitecture=MSIL">
<HintPath>..\..\packages\NetTopologySuite.1.14\lib\net45\PowerCollections.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="Spatial4n.Core, Version=0.4.1.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Spatial4n.Core.0.4.1-beta\lib\net40\Spatial4n.Core.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Spatial4n.Core.NTS, Version=0.4.1.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Spatial4n.Core.NTS.0.4.1-beta\lib\net40\Spatial4n.Core.NTS.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
index d53f4a8..7bf6041 100644
--- a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
+++ b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Spatial.Prefix
{
//non-geospatial makes this test a little easier (in gridSnap), and using boundary values 2^X raises
// the prospect of edge conditions we want to test, plus makes for simpler numbers (no decimals).
- SpatialContextFactory factory = new SpatialContextFactory();
+ FakeSpatialContextFactory factory = new FakeSpatialContextFactory();
factory.geo = false;
factory.worldBounds = new Rectangle(0, 256, -128, 128, null);
this.ctx = factory.NewSpatialContext();
@@ -69,6 +69,19 @@ namespace Lucene.Net.Spatial.Prefix
this.strategy = new RecursivePrefixTreeStrategy(grid, GetType().Name);
}
+ /// <summary>
+ /// LUCENENET specific class used to gain access to protected internal
+ /// member NewSpatialContext(), since we are not strong-named and
+ /// InternalsVisibleTo is not an option from a strong-named class.
+ /// </summary>
+ private class FakeSpatialContextFactory : SpatialContextFactory
+ {
+ new public SpatialContext NewSpatialContext()
+ {
+ return base.NewSpatialContext();
+ }
+ }
+
public virtual void SetupGeohashGrid(int maxLevels)
{
this.ctx = SpatialContext.GEO;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8735ed9/src/Lucene.Net.Tests.Spatial/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Spatial/packages.config b/src/Lucene.Net.Tests.Spatial/packages.config
index 139d513..b28dff1 100644
--- a/src/Lucene.Net.Tests.Spatial/packages.config
+++ b/src/Lucene.Net.Tests.Spatial/packages.config
@@ -1,4 +1,8 @@
\ufeff<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="GeoAPI" version="1.7.4" targetFramework="net451" />
+ <package id="NetTopologySuite" version="1.14" targetFramework="net451" />
<package id="NUnit" version="2.6.3" targetFramework="net451" />
+ <package id="Spatial4n.Core" version="0.4.1-beta" targetFramework="net451" />
+ <package id="Spatial4n.Core.NTS" version="0.4.1-beta" targetFramework="net451" />
</packages>
\ No newline at end of file