Java Code Examples for org.postgis.Geometry#LINESTRING

The following examples show how to use org.postgis.Geometry#LINESTRING . 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: GeometryConverterAdapter.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
@Override
public GeometryObject getMultiCurve(Object geomObj) throws SQLException {
	GeometryObject multiCurve = null;

	if (geomObj instanceof PGgeometry) {
		Geometry geometry = ((PGgeometry)geomObj).getGeometry();
		if (geometry.getType() == Geometry.MULTILINESTRING) {
			multiCurve = getMultiCurve((MultiLineString)geometry);
		}

		else if (geometry.getType() == Geometry.LINESTRING) {
			LineString lineStringObj = (LineString)geometry;
			double[][] coordiantes = new double[1][];
			coordiantes[0] = getCurveCoordinates(lineStringObj);

			multiCurve = GeometryObject.createMultiPoint(coordiantes, lineStringObj.getDimension(), lineStringObj.getSrid());
		}
	}

	return multiCurve;
}
 
Example 2
Source File: GeometryConverterAdapter.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
@Override
public GeometryObject getGeometry(Object geomObj) throws SQLException {
	if (geomObj instanceof PGgeometry) {
		Geometry geometry = ((PGgeometry)geomObj).getGeometry();
		switch (geometry.getType()) {
		case Geometry.POINT:
			return getPoint((Point)geometry);
		case Geometry.MULTIPOINT:
			return getMultiPoint((MultiPoint)geometry);
		case Geometry.LINESTRING:
			return getCurve((LineString)geometry);
		case Geometry.MULTILINESTRING:
			return getMultiCurve((MultiLineString)geometry);
		case Geometry.POLYGON:
			return getPolygon((Polygon)geometry);
		case Geometry.MULTIPOLYGON:
			return getMultiPolygon((MultiPolygon)geometry);
		default:
			throw new SQLException("Cannot convert PostGIS geometry type '" + geometry.getType() + "' to internal representation: Unsupported type.");
		}
	}

	return null;
}
 
Example 3
Source File: GeometryConverterAdapter.java    From importer-exporter with Apache License 2.0 5 votes vote down vote up
@Override
public GeometryObject getCurve(Object geomObj) throws SQLException {
	GeometryObject curve = null;

	if (geomObj instanceof PGgeometry) {
		Geometry geometry = ((PGgeometry)geomObj).getGeometry();
		if (geometry.getType() != Geometry.LINESTRING)
			return null;

		curve = getCurve((LineString)geometry);
	}

	return curve;
}