DimensionInfo implements Serializable { public static DimensionInfo find(Coordinate coordinate, Geometry geometry) { CoordinateSequenceDimensions coordDims = CoordinateSequenceDimensions.find(coordinate); return new DimensionInfo(coordDims, geometry.getDimension()); } DimensionInfo(CoordinateSequenceDimensions coordinateSequenceDimensions, int topological);  DimensionInfo(int coordinate, int spatial, int topological); static int findSpatialDimension(CoordinateSequenceDimensions dims); static int findCoordinateDimension(CoordinateSequenceDimensions dims); static DimensionInfo find(Coordinate coordinate, Geometry geometry); static DimensionInfo find(Coordinate[] coordinates, Geometry geometry); static DimensionInfo find(List<Coordinate> coordinates, Geometry geometry); static DimensionInfo findCollection(List<? extends Geometry> geometries, Geometry geometry); int getCoordinate(); int getSpatial(); int getTopological(); boolean isPoint(); boolean isLine(); boolean isArea(); CoordinateSequenceDimensions getDimensions(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static DimensionInfo XY_POINT; static DimensionInfo XYZ_POINT; static DimensionInfo XYM_POINT; static DimensionInfo XYZM_POINT; static DimensionInfo XY_LINESTRING; static DimensionInfo XYZ_LINESTRING; static DimensionInfo XYM_LINESTRING; static DimensionInfo XYZM_LINESTRING; static DimensionInfo XY_POLYGON; static DimensionInfo XYZ_POLYGON; static DimensionInfo XYM_POLYGON; static DimensionInfo XYZM_POLYGON; }
@Test public void testFind_Coordinate_Geometry() { Coordinate coordinate = new CoordinateXY(1.0, 2.0); GeometryFactory factory = new GeometryFactory(); Geometry geometry = factory.createPoint(coordinate); DimensionInfo expResult = DimensionInfo.XY_POINT; DimensionInfo result = DimensionInfo.find(coordinate, geometry); assertEquals(expResult, result); }
@Test public void testFind_List_Geometry() { List<Coordinate> coordinates = Arrays.asList(new CoordinateXY(1.0, 2.0), new CoordinateXY(10.0, 20.0)); GeometryFactory factory = new GeometryFactory(); Geometry geometry = factory.createLineString(coordinates.toArray(new Coordinate[coordinates.size()])); DimensionInfo expResult = DimensionInfo.XY_LINESTRING; DimensionInfo result = DimensionInfo.find(coordinates, geometry); assertEquals(expResult, result); }