CoordinateSequences extends com.vividsolutions.jts.geom.CoordinateSequences { public static int coordinateDimension(Geometry g) { if (g instanceof CurvedGeometry<?>) { return ((CurvedGeometry<?>) g).getCoordinatesDimension(); } if (g instanceof Point) return coordinateDimension(((Point) g).getCoordinateSequence()); if (g instanceof LineString) return coordinateDimension(((LineString) g).getCoordinateSequence()); if (g instanceof Polygon) return coordinateDimension(((Polygon) g).getExteriorRing() .getCoordinateSequence()); CoordinateSequence cs = CoordinateSequenceFinder.find(g); return coordinateDimension(cs); }  static boolean isCCW(CoordinateSequence ring); static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q); static int coordinateDimension(Geometry g); static int coordinateDimension(CoordinateSequence seq);  }
@Test public void testCoordinateDimensionPointLite1D() { Geometry geom = geomBuilder.point(1); assertEquals(1, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPointLite2D() { Geometry geom = liteGF.createPoint(new LiteCoordinateSequence(new double[] { 1, 2 }, 2)); assertEquals(2, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPointLite3D() { Geometry geom = liteGF .createPoint(new LiteCoordinateSequence(new double[] { 1, 2, 99 }, 3)); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionLineString1D() { Geometry geom = gf.createLineString(new Coordinate[] { new Coordinate(1, Coordinate.NULL_ORDINATE), new Coordinate(3, Coordinate.NULL_ORDINATE) }); assertEquals(1, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionLineString2D() { Geometry geom = gf.createLineString(new Coordinate[] { new Coordinate(1, 2), new Coordinate(3, 4) }); assertEquals(2, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionLineStringLite3D() { Geometry geom = liteGF.createLineString(liteCSF.create( new double[] { 1, 2, 100, 3, 4, 200 }, 3)); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPolygonLite2D() { Geometry geom = liteGF.createPolygon(liteGF.createLinearRing(liteCSF.create(new double[] { 1, 1, 2, 1, 2, 2, 1, 2, 1, 1 }, 2)), null); assertEquals(2, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPolygonLite3D() { Geometry geom = liteGF.createPolygon( liteGF.createLinearRing(liteCSF.create(new double[] { 1, 1, 100, 2, 1, 99, 2, 2, 98, 1, 2, 97, 1, 1, 100 }, 3)), null); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPolygonEmpty() { Geometry geom = gf.createPolygon(gf.createLinearRing((Coordinate[]) null), null); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPolygonEmptyLite2D() { Geometry geom = liteGF.createPolygon( liteGF.createLinearRing(liteCSF.create(new double[0], 2)), null); assertEquals(2, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionPolygonEmptyLite3D() { Geometry geom = liteGF.createPolygon( liteGF.createLinearRing(liteCSF.create(new double[0], 3)), null); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionGeometryCollectionEmptyLite3D() { Geometry geom = liteGF.createGeometryCollection(new Geometry[0]); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }
@Test public void testCoordinateDimensionGeometryCollectionEmpty() { Geometry geom = gf.createGeometryCollection(new Geometry[0]); assertEquals(3, CoordinateSequences.coordinateDimension(geom)); }