ctx.getDistCalc());
}
@Test
public void testJtsContextFactory() {
JtsSpatialContext ctx = (JtsSpatialContext) call(
"spatialContextFactory", JtsSpatialContextFactory.class.getName(),
"geo", "true",
"normWrapLongitude", "true",
"precisionScale", "2.0",
"wktShapeParserClass", CustomWktShapeParser.class.getName(),
"datelineRule", "ccwRect",
"validationRule", "repairConvexHull",
"autoIndex", "true");
assertTrue(ctx.isNormWrapLongitude());
assertEquals(2.0, ctx.getGeometryFactory().getPrecisionModel().getScale(), 0.0);
assertTrue(CustomWktShapeParser.once);//cheap way to test it was created
assertEquals(JtsWktShapeParser.DatelineRule.ccwRect,
((JtsWktShapeParser)ctx.getWktShapeParser()).getDatelineRule());
assertEquals(JtsWktShapeParser.ValidationRule.repairConvexHull,
((JtsWktShapeParser)ctx.getWktShapeParser()).getValidationRule());
//ensure geo=false with worldbounds works -- fixes #72
ctx = (JtsSpatialContext) call(
"spatialContextFactory", JtsSpatialContextFactory.class.getName(),
"geo", "false",//set to false
"worldBounds", "ENVELOPE(-500,500,300,-300)",
"normWrapLongitude", "true",
"precisionScale", "2.0",
"wktShapeParserClass", CustomWktShapeParser.class.getName(),
"datelineRule", "ccwRect",
"validationRule", "repairConvexHull",
"autoIndex", "true");
assertEquals(300, ctx.getWorldBounds().getMaxY(), 0.0);
}