com.vividsolutions.jts.io.ParseException Java Examples

The following examples show how to use com.vividsolutions.jts.io.ParseException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoWaveGeoIndexer.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void storeStatements(final Collection<RyaStatement> ryaStatements) throws IOException {
    // create a feature collection
    final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    for (final RyaStatement ryaStatement : ryaStatements) {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // if the predicate list is empty, accept all predicates.
        // Otherwise, make sure the predicate is on the "valid" list
        final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate());

        if (isValidPredicate && (statement.getObject() instanceof Literal)) {
            try {
                final SimpleFeature feature = createFeature(featureType, statement);
                featureCollection.add(feature);
            } catch (final ParseException e) {
                logger.warn("Error getting geo from statement: " + statement.toString(), e);
            }
        }
    }

    // write this feature collection to the store
    if (!featureCollection.isEmpty()) {
        featureStore.addFeatures(featureCollection);
    }
}
 
Example #2
Source File: FilterServiceTest.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testIntersectsFilter() throws GeomajasException, ParseException {
	Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
	Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
	Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
	Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
	Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
	Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
	Filter filter = filterService.createIntersectsFilter(poly1, "geometry");
	TestFeature f = new TestFeature();
	f.expectAndReturn("geometry", touching);
	Assert.assertTrue(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", disjoint);
	Assert.assertFalse(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", overlapping);
	Assert.assertTrue(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", within);
	Assert.assertTrue(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", contains);
	Assert.assertTrue(filter.evaluate(f));
}
 
Example #3
Source File: FilterServiceTest.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testTouchesFilter() throws GeomajasException, ParseException {
	Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
	Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
	Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
	Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
	Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
	Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
	Filter filter = filterService.createTouchesFilter(poly1, "geometry");
	TestFeature f = new TestFeature();
	f.expectAndReturn("geometry", touching);
	Assert.assertTrue(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", disjoint);
	Assert.assertFalse(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", overlapping);
	Assert.assertFalse(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", within);
	Assert.assertFalse(filter.evaluate(f));
	f.clear();
	f.expectAndReturn("geometry", contains);
	Assert.assertFalse(filter.evaluate(f));
}
 
Example #4
Source File: IsSimpleTest.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void runIsSimpleTest(String wkt, BoundaryNodeRule bnRule, boolean expectedResult,
                             Coordinate expectedLocation)
    throws ParseException
{
  Geometry g = rdr.read(wkt);
  IsSimpleOp op = new IsSimpleOp(g, bnRule);
  boolean isSimple = false;
  isSimple = op.isSimple();
  Coordinate nonSimpleLoc = op.getNonSimpleLocation();

  // if geom is not simple, should have a valid location
  assertTrue(isSimple || nonSimpleLoc != null);

  assertTrue(expectedResult == isSimple);

  if (! isSimple && expectedLocation != null) {
    assertTrue(expectedLocation.distance(nonSimpleLoc) < TOLERANCE);
  }
}
 
Example #5
Source File: WKTReader.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
  * Returns the next array of <code>Coordinate</code>s in the stream.
  *
  *@param  tokenizer        tokenizer over a stream of text in Well-known Text
  *      format. The next element returned by the stream should be L_PAREN (the
  *      beginning of "(x1 y1, x2 y2, ..., xn yn)") or EMPTY.
  *@return                  the next array of <code>Coordinate</code>s in the
  *      stream, or an empty array if EMPTY is the next element returned by
  *      the stream.
  *@throws  IOException     if an I/O error occurs
  *@throws  ParseException  if an unexpected token was encountered
  */
 private Coordinate[] getCoordinates() throws IOException, ParseException {
	String nextToken = getNextEmptyOrOpener();
	if (nextToken.equals(EMPTY)) {
		return new Coordinate[] {};
	}
	List<Coordinate> coordinates = new ArrayList<Coordinate>();
	coordinates.add(getPreciseCoordinate());
	nextToken = getNextCloserOrComma();
	while (nextToken.equals(COMMA)) {
		coordinates.add(getPreciseCoordinate());
		nextToken = getNextCloserOrComma();
	}
	Coordinate[] array = new Coordinate[coordinates.size()];
	return coordinates.toArray(array);
}
 
Example #6
Source File: GeometryFactoryTest.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * CoordinateArraySequences default their dimension to 3 unless explicitly told otherwise.
   * This test ensures that GeometryFactory.createGeometry() recreates the input dimension properly.
 * 
 * @throws ParseException
 */
public void testCopyGeometryWithNonDefaultDimension() throws ParseException
{
  GeometryFactory gf = new GeometryFactory(CoordinateArraySequenceFactory.instance());
  CoordinateSequence mpSeq = gf.getCoordinateSequenceFactory().create(1, 2);
  mpSeq.setOrdinate(0, 0, 50);
  mpSeq.setOrdinate(0, 1, -2);
  
  Point g = gf.createPoint(mpSeq);
  CoordinateSequence pSeq = ((Point) g.getGeometryN(0)).getCoordinateSequence();
  assertEquals(2, pSeq.getDimension());
  
  Point g2 = (Point) geometryFactory.createGeometry(g);
  assertEquals(2, g2.getCoordinateSequence().getDimension());

}
 
Example #7
Source File: WKTReader.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 *  Creates a <code>Polygon</code> using the next token in the stream.
 *
 *@param  tokenizer        tokenizer over a stream of text in Well-known Text
 *      format. The next tokens must form a &lt;Polygon Text&gt;.
 *@return                  a <code>Polygon</code> specified by the next token
 *      in the stream
 *@throws  ParseException  if the coordinates used to create the <code>Polygon</code>
 *      shell and holes do not form closed linestrings, or if an unexpected
 *      token was encountered.
 *@throws  IOException     if an I/O error occurs
 */
private Polygon readPolygonText() throws IOException, ParseException {
  String nextToken = getNextEmptyOrOpener();
  if (nextToken.equals(EMPTY)) {
      return geometryFactory.createPolygon(geometryFactory.createLinearRing(
          new Coordinate[]{}), new LinearRing[]{});
  }
  List<LinearRing> holes = new ArrayList<LinearRing>();
  LinearRing shell = readLinearRingText();
  nextToken = getNextCloserOrComma();
  while (nextToken.equals(COMMA)) {
    LinearRing hole = readLinearRingText();
    holes.add(hole);
    nextToken = getNextCloserOrComma();
  }
  LinearRing[] array = new LinearRing[holes.size()];
  return geometryFactory.createPolygon(shell, holes.toArray(array));
}
 
Example #8
Source File: GeoMongoDBStorageStrategy.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public Document serialize(final RyaStatement ryaStatement) {
    // if the object is wkt, then try to index it
    // write the statement data to the fields
    try {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        final Geometry geo = GeoParseUtils.getGeometry(statement, new GmlParser());
        if(geo == null) {
            LOG.error("Failed to parse geo statement: " + statement.toString());
            return null;
        }
        final Document base = super.serialize(ryaStatement);
        if (geo.getNumPoints() > 1) {
            base.append(GEO, getCorrespondingPoints(geo));
        } else {
            base.append(GEO, getDBPoint(geo));
        }
        return base;
    } catch(final ParseException e) {
        LOG.error("Could not create geometry for statement " + ryaStatement, e);
        return null;
    }
}
 
Example #9
Source File: GeoJsonReader.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
private Geometry createMultiPoint(Map<String, Object> geometryMap,
    GeometryFactory geometryFactory) throws ParseException {

  Geometry result = null;

  try {

    @SuppressWarnings("unchecked")
    List<List<Number>> coordinatesList = (List<List<Number>>) geometryMap
        .get(GeoJsonConstants.NAME_COORDINATES);

    CoordinateSequence coordinates = this
        .createCoordinateSequence(coordinatesList);

    result = geometryFactory.createMultiPoint(coordinates);

  } catch (RuntimeException e) {
    throw new ParseException(
        "Could not parse MultiPoint from GeoJson string.", e);
  }

  return result;
}
 
Example #10
Source File: FilterServiceTest.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testLikeFilter() throws GeomajasException, ParseException {
	Filter fid = filterService.createLikeFilter("a", "a*b");
	TestFeature f = new TestFeature();
	f.expectAndReturn("a", "adgxgxggb");
	Assert.assertTrue(fid.evaluate(f));
	f.expectAndReturn("a", "ac");
	Assert.assertFalse(fid.evaluate(f));
	f.expectAndReturn("a", "a123b");
	Assert.assertTrue(fid.evaluate(f));
	fid = filterService.createLikeFilter("a", "12??A*f");
	f.expectAndReturn("a", "1234Af");
	Assert.assertTrue(fid.evaluate(f));
	f.expectAndReturn("a", "12345Af");
	Assert.assertFalse(fid.evaluate(f));
	f.expectAndReturn("a", "12cdAkhkgkf");
	Assert.assertTrue(fid.evaluate(f));
}
 
Example #11
Source File: GeoMesaGeoIndexer.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void storeStatements(final Collection<RyaStatement> ryaStatements) throws IOException {
    // create a feature collection
    final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    for (final RyaStatement ryaStatement : ryaStatements) {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // if the predicate list is empty, accept all predicates.
        // Otherwise, make sure the predicate is on the "valid" list
        final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate());

        if (isValidPredicate && (statement.getObject() instanceof Literal)) {
            try {
                final SimpleFeature feature = createFeature(featureType, statement);
                featureCollection.add(feature);
            } catch (final ParseException e) {
                logger.warn("Error getting geo from statement: " + statement.toString(), e);
            }
        }
    }

    // write this feature collection to the store
    if (!featureCollection.isEmpty()) {
        featureStore.addFeatures(featureCollection);
    }
}
 
Example #12
Source File: GeoTemporalMongoDBStorageStrategy.java    From rya with Apache License 2.0 6 votes vote down vote up
private Document[] getGeoObjs(final Collection<IndexingExpr> geoFilters) {
    final List<Document> objs = new ArrayList<>();
    geoFilters.forEach(filter -> {
        final GeoPolicy policy = GeoPolicy.fromURI(filter.getFunction());
        final WKTReader reader = new WKTReader();
        final String geoStr = ((Value) filter.getArguments()[0]).stringValue();
        try {
            //This method is what is used in the GeoIndexer.
            final Geometry geo = reader.read(geoStr);
            objs.add(getGeoObject(geo, policy));
        } catch (final GeoTemporalIndexException | UnsupportedOperationException | ParseException e) {
            LOG.error("Unable to parse '" + geoStr + "'.", e);
        }
    });
    return objs.toArray(new Document[]{});
}
 
Example #13
Source File: IOUtil.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Geometry readGMLString(String gml, GeometryFactory geomFact)
throws ParseException, IOException, SAXException, ParserConfigurationException 
{
  GMLReader reader = new GMLReader();
  Geometry geom = reader.read(gml, geomFact);
  return geom;
}
 
Example #14
Source File: RelateTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
void runRelateTest(String wkt1, String wkt2, String expectedIM)
    throws ParseException
{
  Geometry g1 = rdr.read(wkt1);
  Geometry g2 = rdr.read(wkt2);
  IntersectionMatrix im = RelateOp.relate(g1, g2);
  String imStr = im.toString();
  System.out.println(imStr);
  assertTrue(im.matches(expectedIM));
}
 
Example #15
Source File: GeometryTestCase.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected Geometry read(String wkt) {
  try {
     return reader.read(wkt);
  } catch (ParseException e) {
    throw new RuntimeException(e.getMessage());
  }
}
 
Example #16
Source File: MongoGeoTemporalIndexer.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void storeStatement(final RyaStatement ryaStatement) throws IOException {
    requireNonNull(ryaStatement);

    try {
        updateEvent(ryaStatement.getSubject(), ryaStatement);
    } catch (IndexingException | ParseException e) {
        throw new IOException("Failed to update the Entity index.", e);
    }
}
 
Example #17
Source File: BufferValidator.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String supplement(String message) throws ParseException {
  String newMessage = "\n" + message + "\n";
  newMessage += "Original: " + wktWriter.writeFormatted(getOriginal()) + "\n";
  newMessage += "Buffer Distance: " + bufferDistance + "\n";
  newMessage += "Buffer: " + wktWriter.writeFormatted(getBuffer()) + "\n";
  return newMessage.substring(0, newMessage.length() - 1);
}
 
Example #18
Source File: BoundaryTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void runBoundaryTest(String wkt, BoundaryNodeRule bnRule, String wktExpected)
      throws ParseException
  {
    Geometry g = rdr.read(wkt);
    Geometry expected = rdr.read(wktExpected);

    BoundaryOp op = new BoundaryOp(g, bnRule);
    Geometry boundary = op.getBoundary();
    boundary.normalize();
//    System.out.println("Computed Boundary = " + boundary);
    assertTrue(boundary.equalsExact(expected));
  }
 
Example #19
Source File: GeometryFactoryTest.java    From mrgeo with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
@Category(UnitTest.class)
public void wierdMultiPolygon() throws ParseException
{
  String wkt = "MULTIPOLYGON (((-126.2499876 59.1526579,-126.25 59.1526234,-126.2499876 59.1526579)))";

  WKTReader wktReader = new WKTReader();

  com.vividsolutions.jts.geom.Geometry jtsGeom = wktReader.read(wkt);

  Geometry feature = GeometryFactory.fromJTS(jtsGeom, null);
}
 
Example #20
Source File: MongoGeoTupleSet.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public CloseableIteration<Statement, QueryEvaluationException> performSearch(String queryText,
        StatementConstraints contraints) throws QueryEvaluationException {
    try {
        WKTReader reader = new WKTReader();
        Geometry geometry = reader.read(queryText);
        CloseableIteration<Statement, QueryEvaluationException> statements = geoIndexer.queryWithin(
                geometry, contraints);
        return statements;
    } catch (ParseException e) {
        throw new QueryEvaluationException(e);
    }
}
 
Example #21
Source File: WKTReader.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 *  Creates a <code>MultiPoint</code> using the next tokens in the stream.
 *
 *@param  tokenizer        tokenizer over a stream of text in Well-known Text
 *      format. The next tokens must form a &lt;MultiPoint Text&gt;.
 *@return                  a <code>MultiPoint</code> specified by the next
 *      token in the stream
 *@throws  IOException     if an I/O error occurs
 *@throws  ParseException  if an unexpected token was encountered
 */
private MultiPoint readMultiPointText() throws IOException, ParseException 
{
  String nextToken = getNextEmptyOrOpener();
  if (nextToken.equals(EMPTY)) {
    return geometryFactory.createMultiPoint(new Point[0]);
  }
  
  // check for old-style JTS syntax and parse it if present
	// MD 2009-02-21 - this is only provided for backwards compatibility for a few versions
	if (ALLOW_OLD_JTS_MULTIPOINT_SYNTAX) {
		String nextWord = lookaheadWord();
		if (nextWord != L_PAREN) {
			return geometryFactory.createMultiPoint(toPoints(getCoordinatesNoLeftParen()));
		}
	}
	
  List<Point> points = new ArrayList<Point>();
  Point point = readPointText();
  points.add(point);
  nextToken = getNextCloserOrComma();
  while (nextToken.equals(COMMA)) {
    point = readPointText();
    points.add(point);
    nextToken = getNextCloserOrComma();
  }
  Point[] array = new Point[points.size()];
  return geometryFactory.createMultiPoint(points.toArray(array));
}
 
Example #22
Source File: OpenMappingImporter.java    From TomboloDigitalConnector with MIT License 5 votes vote down vote up
public Geometry getShape(String wtk) throws FactoryException, TransformException {
    GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), Subject.SRID);
    WKTReader reader = new WKTReader(geometryFactory);
    MathTransform crsTransform = GeotoolsDataStoreUtils.makeCrsTransform("EPSG:27700");

    try {
        LineString line = (LineString) reader.read(wtk);
        Geometry transformedGeom = JTS.transform(line, crsTransform);
        return transformedGeom;
    } catch (ParseException e) {
        e.printStackTrace();
        log.error("Not a valid geometry");
        return null;
    }
}
 
Example #23
Source File: GeoTupleSet.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public CloseableIteration<Statement, QueryEvaluationException> performSearch(final String queryText,
        final StatementConstraints contraints) throws QueryEvaluationException {
    try {
        final WKTReader reader = new WKTReader();
        final Geometry geometry = reader.read(queryText);
        final CloseableIteration<Statement, QueryEvaluationException> statements = geoIndexer.queryEquals(
                geometry, contraints);
        return statements;
    } catch (final ParseException e) {
        throw new QueryEvaluationException(e);
    }
}
 
Example #24
Source File: GeoTupleSet.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public CloseableIteration<Statement, QueryEvaluationException> performSearch(final String queryText,
        final StatementConstraints contraints) throws QueryEvaluationException {
    try {
        final WKTReader reader = new WKTReader();
        final Geometry geometry = reader.read(queryText);
        final CloseableIteration<Statement, QueryEvaluationException> statements = geoIndexer.queryDisjoint(
                geometry, contraints);
        return statements;
    } catch (final ParseException e) {
        throw new QueryEvaluationException(e);
    }
}
 
Example #25
Source File: VWSimplifierTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Geometry[] getResult(String wkt, double tolerance)
  throws ParseException
{
  Geometry[] ioGeom = new Geometry[2];
  ioGeom[0] = rdr.read(wkt);
  ioGeom[1] = VWSimplifier.simplify(ioGeom[0], tolerance);
  //System.out.println(ioGeom[1]);
  return ioGeom;
}
 
Example #26
Source File: GeoTupleSet.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public CloseableIteration<Statement, QueryEvaluationException> performSearch(final String queryText,
        final StatementConstraints contraints) throws QueryEvaluationException {
    try {
        final WKTReader reader = new WKTReader();
        final Geometry geometry = reader.read(queryText);
        final CloseableIteration<Statement, QueryEvaluationException> statements = geoIndexer.queryOverlaps(
                geometry, contraints);
        return statements;
    } catch (final ParseException e) {
        throw new QueryEvaluationException(e);
    }
}
 
Example #27
Source File: GeoMesaGeoIndexer.java    From rya with Apache License 2.0 5 votes vote down vote up
private static SimpleFeature createFeature(final SimpleFeatureType featureType, final Statement statement) throws ParseException {
    final String subject = StatementSerializer.writeSubject(statement);
    final String predicate = StatementSerializer.writePredicate(statement);
    final String object = StatementSerializer.writeObject(statement);
    final String context = StatementSerializer.writeContext(statement);

    // create the feature
    final Object[] noValues = {};

    // create the hash
    final String statementId = Md5Hash.md5Base64(StatementSerializer.writeStatement(statement));
    final SimpleFeature newFeature = SimpleFeatureBuilder.build(featureType, noValues, statementId);

    // write the statement data to the fields
    final Geometry geom = GeoParseUtils.getGeometry(statement, new GmlParser());
    if(geom == null || geom.isEmpty() || !geom.isValid()) {
        throw new ParseException("Could not create geometry for statement " + statement);
    }
    newFeature.setDefaultGeometry(geom);

    newFeature.setAttribute(SUBJECT_ATTRIBUTE, subject);
    newFeature.setAttribute(PREDICATE_ATTRIBUTE, predicate);
    newFeature.setAttribute(OBJECT_ATTRIBUTE, object);
    newFeature.setAttribute(CONTEXT_ATTRIBUTE, context);

    // preserve the ID that we created for this feature
    // (set the hint to FALSE to have GeoTools generate IDs)
    newFeature.getUserData().put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE);

    return newFeature;
}
 
Example #28
Source File: KMLWriterTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void checkEqual(KMLWriter kmlWriter, String wkt, String expectedKML) {
  try {
    Geometry geom = rdr.read(wkt);
    checkEqual(kmlWriter, geom, expectedKML);
  } catch (ParseException e) {
    throw new RuntimeException("ParseException: " + e.getMessage());
  }
}
 
Example #29
Source File: LineSequencerTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void runIsSequenced(String inputWKT, boolean expected)
    throws ParseException
{
  Geometry g = rdr.read(inputWKT);
  boolean isSequenced = LineSequencer.isSequenced(g);
  assertTrue(isSequenced == expected);
}
 
Example #30
Source File: BufferValidator.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BufferValidator(double bufferDistance, String wkt, boolean addContainsTest)
throws ParseException {
  // SRID = 888 is to test that SRID is preserved in computed buffers
  setFactory(new PrecisionModel(), 888);
  this.bufferDistance = bufferDistance;
  this.wkt = wkt;
  if (addContainsTest) addContainsTest();
  //addBufferResultValidatorTest();
}