mirror of https://github.com/apache/lucene.git
LUCENE-7170: move BaseGeoPointTestCase to test-framework
This commit is contained in:
parent
35e0e92bb3
commit
72cb73c6b9
|
@ -48,13 +48,6 @@
|
||||||
<artifactId>lucene-test-framework</artifactId>
|
<artifactId>lucene-test-framework</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.lucene</groupId>
|
|
||||||
<artifactId>lucene-spatial</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
@lucene-sandbox.internal.dependencies@
|
@lucene-sandbox.internal.dependencies@
|
||||||
@lucene-sandbox.external.dependencies@
|
@lucene-sandbox.external.dependencies@
|
||||||
@lucene-sandbox.internal.test.dependencies@
|
@lucene-sandbox.internal.test.dependencies@
|
||||||
|
|
|
@ -23,39 +23,4 @@
|
||||||
|
|
||||||
<import file="../module-build.xml"/>
|
<import file="../module-build.xml"/>
|
||||||
|
|
||||||
<target name="compile-test-spatial" depends="init" if="module.has.tests">
|
|
||||||
<ant dir="${common.dir}/spatial" target="compile-test" inheritAll="false"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<path id="classpath">
|
|
||||||
<path refid="base.classpath"/>
|
|
||||||
<pathelement path="${spatial.jar}"/>
|
|
||||||
</path>
|
|
||||||
<target name="compile-core" depends="jar-spatial,common.compile-core" />
|
|
||||||
|
|
||||||
<path id="test.classpath">
|
|
||||||
<pathelement location="${build.dir}/classes/java"/>
|
|
||||||
<pathelement location="${build.dir}/classes/test"/>
|
|
||||||
<pathelement location="${common.dir}/build/spatial/classes/test"/>
|
|
||||||
<path refid="test.base.classpath"/>
|
|
||||||
<pathelement path="${spatial.jar}"/>
|
|
||||||
<path refid="junit-path"/>
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<path id="junit.classpath">
|
|
||||||
<path refid="test.classpath"/>
|
|
||||||
<pathelement path="${java.class.path}"/>
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<target name="javadocs" depends="javadocs-spatial,compile-core,check-javadocs-uptodate"
|
|
||||||
unless="javadocs-uptodate-${name}">
|
|
||||||
<invoke-module-javadoc>
|
|
||||||
<links>
|
|
||||||
<link href="../spatial"/>
|
|
||||||
</links>
|
|
||||||
</invoke-module-javadoc>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="compile-test" depends="jar-spatial,compile-test-spatial,common.compile-test" />
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
||||||
|
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.LatLonPoint;
|
import org.apache.lucene.document.LatLonPoint;
|
||||||
import org.apache.lucene.spatial.util.BaseGeoPointTestCase;
|
import org.apache.lucene.geo.BaseGeoPointTestCase;
|
||||||
import org.apache.lucene.geo.Polygon;
|
import org.apache.lucene.geo.Polygon;
|
||||||
import org.apache.lucene.geo.GeoEncodingUtils;
|
import org.apache.lucene.geo.GeoEncodingUtils;
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.lucene.spatial.geopoint.search;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.spatial.util.GeoEncodingUtils;
|
import org.apache.lucene.spatial.util.GeoEncodingUtils;
|
||||||
|
import org.apache.lucene.geo.BaseGeoPointTestCase;
|
||||||
import org.apache.lucene.geo.Polygon;
|
import org.apache.lucene.geo.Polygon;
|
||||||
import org.apache.lucene.geo.Rectangle;
|
import org.apache.lucene.geo.Rectangle;
|
||||||
import org.apache.lucene.spatial.geopoint.document.GeoPointField;
|
import org.apache.lucene.spatial.geopoint.document.GeoPointField;
|
||||||
import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
|
import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
|
||||||
import org.apache.lucene.spatial.util.BaseGeoPointTestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* random testing for GeoPoint query logic
|
* random testing for GeoPoint query logic
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.lucene.spatial.geopoint.search;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.spatial.util.GeoEncodingUtils;
|
import org.apache.lucene.spatial.util.GeoEncodingUtils;
|
||||||
|
import org.apache.lucene.geo.BaseGeoPointTestCase;
|
||||||
import org.apache.lucene.geo.Polygon;
|
import org.apache.lucene.geo.Polygon;
|
||||||
import org.apache.lucene.geo.Rectangle;
|
import org.apache.lucene.geo.Rectangle;
|
||||||
import org.apache.lucene.spatial.geopoint.document.GeoPointField;
|
import org.apache.lucene.spatial.geopoint.document.GeoPointField;
|
||||||
import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
|
import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding;
|
||||||
import org.apache.lucene.spatial.util.BaseGeoPointTestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* random testing for GeoPoint query logic (with deprecated numeric encoding)
|
* random testing for GeoPoint query logic (with deprecated numeric encoding)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.lucene.spatial.util;
|
package org.apache.lucene.geo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
@ -771,13 +771,16 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
|
||||||
|
|
||||||
static final boolean rectContainsPoint(Rectangle rect, double pointLat, double pointLon) {
|
static final boolean rectContainsPoint(Rectangle rect, double pointLat, double pointLon) {
|
||||||
assert Double.isNaN(pointLat) == false;
|
assert Double.isNaN(pointLat) == false;
|
||||||
|
|
||||||
|
if (pointLat < rect.minLat || pointLat > rect.maxLat) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (rect.minLon <= rect.maxLon) {
|
if (rect.minLon <= rect.maxLon) {
|
||||||
return GeoRelationUtils.pointInRectPrecise(pointLat, pointLon, rect.minLat, rect.maxLat, rect.minLon, rect.maxLon);
|
return pointLon >= rect.minLon && pointLon <= rect.maxLon;
|
||||||
} else {
|
} else {
|
||||||
// Rect crosses dateline:
|
// Rect crosses dateline:
|
||||||
return GeoRelationUtils.pointInRectPrecise(pointLat, pointLon, rect.minLat, rect.maxLat, -180.0, rect.maxLon)
|
return pointLon <= rect.maxLon || pointLon >= rect.minLon;
|
||||||
|| GeoRelationUtils.pointInRectPrecise(pointLat, pointLon, rect.minLat, rect.maxLat, rect.minLon, 180.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue