mil.nga.sf.wkb.GeometryCodes Java Examples
The following examples show how to use
mil.nga.sf.wkb.GeometryCodes.
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: GeoPackageGeometryDataUtils.java From geopackage-android with MIT License | 5 votes |
/** * Compare to the base attribiutes of two geometries * * @param expected * @param actual */ private static void compareBaseGeometryAttributes(Geometry expected, Geometry actual) { TestCase.assertEquals(expected.getGeometryType(), actual.getGeometryType()); TestCase.assertEquals(expected.hasZ(), actual.hasZ()); TestCase.assertEquals(expected.hasM(), actual.hasM()); TestCase.assertEquals(GeometryCodes.getCode(expected), GeometryCodes.getCode(actual)); }
Example #2
Source File: GeoPackageGeometryDataUtils.java From geopackage-java with MIT License | 5 votes |
/** * Compare to the base attributes of two geometries * * @param expected * @param actual */ private static void compareBaseGeometryAttributes(Geometry expected, Geometry actual) { TestCase.assertEquals(expected.getGeometryType(), actual.getGeometryType()); TestCase.assertEquals(expected.hasZ(), actual.hasZ()); TestCase.assertEquals(expected.hasM(), actual.hasM()); TestCase.assertEquals(GeometryCodes.getCode(expected), GeometryCodes.getCode(actual)); }
Example #3
Source File: GeoPackageExample.java From geopackage-android with MIT License | 4 votes |
private static void createNonLinearGeometryTypesExtension( GeoPackage geoPackage) throws SQLException { SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); SpatialReferenceSystem srs = srsDao.getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, (long) ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); GeometryExtensions extensions = new GeometryExtensions(geoPackage); String tableName = "non_linear_geometries"; List<Geometry> geometries = new ArrayList<>(); List<String> geometryNames = new ArrayList<>(); CircularString circularString = new CircularString(); circularString.addPoint(new Point(-122.358, 47.653)); circularString.addPoint(new Point(-122.348, 47.649)); circularString.addPoint(new Point(-122.348, 47.658)); circularString.addPoint(new Point(-122.358, 47.658)); circularString.addPoint(new Point(-122.358, 47.653)); for (int i = GeometryCodes.getCode(GeometryType.CIRCULARSTRING); i <= GeometryCodes.getCode(GeometryType.SURFACE); i++) { GeometryType geometryType = GeometryCodes.getGeometryType(i); extensions.getOrCreate(tableName, GEOMETRY_COLUMN, geometryType); Geometry geometry = null; String name = geometryType.getName().toLowerCase(); switch (geometryType) { case CIRCULARSTRING: geometry = circularString; break; case COMPOUNDCURVE: CompoundCurve compoundCurve = new CompoundCurve(); compoundCurve.addLineString(circularString); geometry = compoundCurve; break; case CURVEPOLYGON: CurvePolygon<CircularString> curvePolygon = new CurvePolygon<>(); curvePolygon.addRing(circularString); geometry = curvePolygon; break; case MULTICURVE: MultiLineString multiCurve = new MultiLineString(); multiCurve.addLineString(circularString); geometry = multiCurve; break; case MULTISURFACE: MultiPolygon multiSurface = new MultiPolygon(); Polygon polygon = new Polygon(); polygon.addRing(circularString); multiSurface.addPolygon(polygon); geometry = multiSurface; break; case CURVE: CompoundCurve curve = new CompoundCurve(); curve.addLineString(circularString); geometry = curve; break; case SURFACE: CurvePolygon<CircularString> surface = new CurvePolygon<>(); surface.addRing(circularString); geometry = surface; break; default: throw new GeoPackageException("Unexpected Geometry Type: " + geometryType); } geometries.add(geometry); geometryNames.add(name); } createFeatures(geoPackage, srs, tableName, GeometryType.GEOMETRY, geometries, geometryNames); }
Example #4
Source File: GeometryColumnsSfSql.java From geopackage-core-java with MIT License | 4 votes |
public GeometryType getGeometryType() { return GeometryCodes.getGeometryType(geometryType); }
Example #5
Source File: GeometryColumnsSfSql.java From geopackage-core-java with MIT License | 4 votes |
public void setGeometryType(GeometryType geometryType) { this.geometryType = GeometryCodes.getCode(geometryType); }
Example #6
Source File: GeoPackageExample.java From geopackage-java with MIT License | 4 votes |
private static void createNonLinearGeometryTypesExtension( GeoPackage geoPackage) throws SQLException { SpatialReferenceSystemDao srsDao = geoPackage .getSpatialReferenceSystemDao(); SpatialReferenceSystem srs = srsDao.getOrCreateCode( ProjectionConstants.AUTHORITY_EPSG, (long) ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); GeometryExtensions extensions = new GeometryExtensions(geoPackage); String tableName = "non_linear_geometries"; List<Geometry> geometries = new ArrayList<>(); List<String> geometryNames = new ArrayList<>(); CircularString circularString = new CircularString(); circularString.addPoint(new Point(-122.358, 47.653)); circularString.addPoint(new Point(-122.348, 47.649)); circularString.addPoint(new Point(-122.348, 47.658)); circularString.addPoint(new Point(-122.358, 47.658)); circularString.addPoint(new Point(-122.358, 47.653)); for (int i = GeometryCodes .getCode(GeometryType.CIRCULARSTRING); i <= GeometryCodes .getCode(GeometryType.SURFACE); i++) { GeometryType geometryType = GeometryCodes.getGeometryType(i); extensions.getOrCreate(tableName, GEOMETRY_COLUMN, geometryType); Geometry geometry = null; String name = geometryType.getName().toLowerCase(); switch (geometryType) { case CIRCULARSTRING: geometry = circularString; break; case COMPOUNDCURVE: CompoundCurve compoundCurve = new CompoundCurve(); compoundCurve.addLineString(circularString); geometry = compoundCurve; break; case CURVEPOLYGON: CurvePolygon<CircularString> curvePolygon = new CurvePolygon<>(); curvePolygon.addRing(circularString); geometry = curvePolygon; break; case MULTICURVE: MultiLineString multiCurve = new MultiLineString(); multiCurve.addLineString(circularString); geometry = multiCurve; break; case MULTISURFACE: MultiPolygon multiSurface = new MultiPolygon(); Polygon polygon = new Polygon(); polygon.addRing(circularString); multiSurface.addPolygon(polygon); geometry = multiSurface; break; case CURVE: CompoundCurve curve = new CompoundCurve(); curve.addLineString(circularString); geometry = curve; break; case SURFACE: CurvePolygon<CircularString> surface = new CurvePolygon<>(); surface.addRing(circularString); geometry = surface; break; default: throw new GeoPackageException( "Unexpected Geometry Type: " + geometryType); } geometries.add(geometry); geometryNames.add(name); } createFeatures(geoPackage, srs, tableName, GeometryType.GEOMETRY, geometries, geometryNames); }
Example #7
Source File: GeometryExtensions.java From geopackage-core-java with MIT License | 3 votes |
/** * Determine if the geometry type is a GeoPackage extension * * @param geometryType * geometry type * @return true if a GeoPackage extension, false if user-defined */ public static boolean isGeoPackageExtension(GeometryType geometryType) { return GeometryCodes.getCode(geometryType) >= GeometryCodes .getCode(GeometryType.CIRCULARSTRING) && GeometryCodes.getCode(geometryType) <= GeometryCodes .getCode(GeometryType.SURFACE); }
Example #8
Source File: GeometryExtensions.java From geopackage-core-java with MIT License | 2 votes |
/** * Determine if the geometry type is an extension * * @param geometryType * geometry type * @return true if extension */ public static boolean isExtension(GeometryType geometryType) { return GeometryCodes.getCode(geometryType) > GeometryCodes .getCode(GeometryType.GEOMETRYCOLLECTION); }
Example #9
Source File: GeometryExtensions.java From geopackage-core-java with MIT License | 2 votes |
/** * Determine if the geometry type is non standard * * @param geometryType * geometry type * @return true if non standard * @since 2.0.1 */ public static boolean isNonStandard(GeometryType geometryType) { return GeometryCodes.getCode(geometryType) > GeometryCodes .getCode(GeometryType.SURFACE); }