lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1375260 - in /incubator/lucene.net/trunk/src/contrib/Spatial: BBox/AreaSimilarity.cs Prefix/Tree/SpatialPrefixTree.cs
Date Mon, 20 Aug 2012 21:52:57 GMT
Author: synhershko
Date: Mon Aug 20 21:52:57 2012
New Revision: 1375260

URL: http://svn.apache.org/viewvc?rev=1375260&view=rev
Log:
GetArea is expecting a Context

This is divergence from the Java origin, apparently spatial4j hasn't been updated there yet

Modified:
    incubator/lucene.net/trunk/src/contrib/Spatial/BBox/AreaSimilarity.cs
    incubator/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTree.cs

Modified: incubator/lucene.net/trunk/src/contrib/Spatial/BBox/AreaSimilarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/Spatial/BBox/AreaSimilarity.cs?rev=1375260&r1=1375259&r2=1375260&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/Spatial/BBox/AreaSimilarity.cs (original)
+++ incubator/lucene.net/trunk/src/contrib/Spatial/BBox/AreaSimilarity.cs Mon Aug 20 21:52:57
2012
@@ -17,6 +17,7 @@
 
 using System;
 using Lucene.Net.Search;
+using Spatial4n.Core.Context;
 using Spatial4n.Core.Shapes;
 
 namespace Lucene.Net.Spatial.BBox
@@ -53,16 +54,18 @@ namespace Lucene.Net.Spatial.BBox
 	   /**
 		* Properties associated with the query envelope
 		*/
+		private readonly SpatialContext ctx;
 		private readonly Rectangle queryExtent;
 		private readonly double queryArea;
 
 		private readonly double targetPower;
 		private readonly double queryPower;
 
-		public AreaSimilarity(Rectangle queryExtent, double queryPower, double targetPower)
+		public AreaSimilarity(SpatialContext ctx, Rectangle queryExtent, double queryPower, double
targetPower)
 		{
+			this.ctx = ctx;
 			this.queryExtent = queryExtent;
-			this.queryArea = queryExtent.GetArea();
+			this.queryArea = queryExtent.GetArea(ctx);
 
 			this.queryPower = queryPower;
 			this.targetPower = targetPower;
@@ -75,7 +78,8 @@ namespace Lucene.Net.Spatial.BBox
 			//  }
 		}
 
-		public AreaSimilarity(Rectangle queryExtent) : this(queryExtent, 2.0, 0.5)
+		public AreaSimilarity(SpatialContext ctx, Rectangle queryExtent)
+			: this(ctx, queryExtent, 2.0, 0.5)
 		{
 		}
 
@@ -90,7 +94,7 @@ namespace Lucene.Net.Spatial.BBox
 			{
 				return 0;
 			}
-			double targetArea = target.GetArea();
+			double targetArea = target.GetArea(ctx);
 			if (targetArea <= 0)
 			{
 				return 0;

Modified: incubator/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTree.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTree.cs?rev=1375260&r1=1375259&r2=1375260&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTree.cs (original)
+++ incubator/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTree.cs Mon Aug
20 21:52:57 2012
@@ -77,7 +77,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
 			{
 				return maxLevels;
 			}
-			double bboxArea = shape.GetBoundingBox().GetArea();
+			double bboxArea = shape.GetBoundingBox().GetArea(ctx);
 			if (bboxArea == 0)
 			{
 				return maxLevels;



Mime
View raw message