public final class ShapeWriter extends Object
This class defines the Shapefile's Coordinate Reference System to be the one
specified by the field sourceEpsgCode
. Coordinate transformation
is not performed.
Modifier and Type | Class and Description |
---|---|
static class |
ShapeWriter.DefaultDelegate
A
ShapeWriterDelegate defining no attributes by default. |
static class |
ShapeWriter.DefaultLineDelegate
A
ShapeWriterDelegate defining an output of
LineString s without attributes. |
static class |
ShapeWriter.DefaultPointDelegate
A
ShapeWriterDelegate defining an output of
Point s without attributes. |
Modifier and Type | Field and Description |
---|---|
(package private) GeometryFactory |
factory |
(package private) File |
file
The output Shapefile (will be overwritten or created).
|
(package private) static int |
sourceEpsgCode
The EPSG code of the CRS that the features provided are referred to.
|
Constructor and Description |
---|
ShapeWriter(File file) |
Modifier and Type | Method and Description |
---|---|
(package private) ShapefileDataStore |
createDataStore(File file) |
int |
epsgCode()
Gives the EPSG code of the projection to be used for the output files.
|
(package private) List<SimpleFeature> |
simpleFeaturesFromGeometries(Collection<? extends Geometry> geometries)
Converts JTS geometries to Geotools simple features.
|
Coordinate |
toCoordinate(PlaneCoordinates node) |
LineString |
toLineString(Line line) |
LineString |
toLineString(Node node1,
Node node2) |
LineString |
toLineString(Segment part) |
Node |
toNode(Geometry point) |
Point |
toPoint(PlaneCoordinates node) |
SourceSegment |
toSegment(Geometry lineString) |
Geometry |
userData(Geometry geometry,
Object userData) |
(package private) void |
writeFeaturesToDataStore(List<SimpleFeature> features,
DataStore dataStore) |
void |
writeGeometries(Collection<? extends Geometry> geometries,
ShapeWriterDelegate delegate)
Writes data to the Shapefile
file . |
final GeometryFactory factory
final File file
static final int sourceEpsgCode
public ShapeWriter(File file)
file
- the output Shapefile (will be overwritten or created)public void writeGeometries(Collection<? extends Geometry> geometries, ShapeWriterDelegate delegate)
file
.geometries
- the geometric features to write to the output filedelegate
- an instance providing definitions of the type of
features and the attribute data to include with the geometrypublic int epsgCode()
public Point toPoint(PlaneCoordinates node)
public Coordinate toCoordinate(PlaneCoordinates node)
public LineString toLineString(Segment part)
public LineString toLineString(Node node1, Node node2)
public LineString toLineString(Line line)
public SourceSegment toSegment(Geometry lineString)
List<SimpleFeature> simpleFeaturesFromGeometries(Collection<? extends Geometry> geometries) throws SchemaException
SchemaException
ShapefileDataStore createDataStore(File file) throws Exception
Exception
void writeFeaturesToDataStore(List<SimpleFeature> features, DataStore dataStore) throws Exception
Exception