A simple Rectangle implementation that also supports a longitudinal wrap-around. When minX > maxX, this will assume it is world coordinates that cross the date line using degrees. Immutable & threadsafe.
Inheritance: Rectangle
			public override float FloatVal(int doc)
			{
				// make sure it has minX and area
				if (validMinX.Get(doc) && validMaxX.Get(doc))
				{
					Rectangle rect = new RectangleImpl(
						minX[doc], maxX[doc],
						minY[doc], maxY[doc]);
					return (float)_enclosingInstance.similarity.Score(rect, null);
				}
				return 0;
			}
			public override Explanation Explain(int doc)
			{
				// make sure it has minX and area
				if (validMinX.Get(doc) && validMaxX.Get(doc))
				{
					Rectangle rect = new RectangleImpl(
						minX[doc], maxX[doc],
						minY[doc], maxY[doc]);
					var exp = new Explanation();
					_enclosingInstance.similarity.Score(rect, exp);
					return exp;
				}
				return new Explanation(0, "No BBox");
			}
Exemple #3
0
 static SpatialContext()
 {
     const double v = Double.MaxValue;
     MAX_WORLDBOUNDS = new RectangleImpl(-v, v, -v, v);
 }