Package org.goplanit.geoio.converter
Class GeometryIoWriter<T>
- java.lang.Object
-
- org.goplanit.converter.BaseWriterImpl<T>
-
- org.goplanit.converter.CrsWriterImpl<T>
-
- org.goplanit.geoio.converter.GeometryIoWriter<T>
-
- All Implemented Interfaces:
ConverterEntity,ConverterWriter<T>
- Direct Known Subclasses:
GeometryNetworkWriter,GeometryRoutedServicesWriter,GeometryServiceNetworkWriter,GeometryZoningWriter
public abstract class GeometryIoWriter<T> extends CrsWriterImpl<T>
Writer to persist a PLANit network to disk in a geometry centric format such as Shape files. Id mapping default is set to XML ids by default- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.converter.BaseWriterImpl
idMapper
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGeometryIoWriter()ConstructorprotectedGeometryIoWriter(String networkPath)ConstructorprotectedGeometryIoWriter(String networkPath, String countryName)ConstructorprotectedGeometryIoWriter(GeoIoWriterSettings settings)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <TT extends ManagedId>
org.geotools.data.DataStorefindDataStore(PlanitEntityFeatureTypeContext<TT> featureContext, Path fullOutputPath)Find data store to use, if not present, create it if possibleprotected <TT extends ExternalIdAble>
Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<TT>>findFeature(Class<TT> clazz, Map<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ExternalIdAble>> geoFeatureTypes)find feature and context based on the class present in contextprotected Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>findFeaturePairForPlanitEntity(Class<? extends ManagedId> planitEntityClass, List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>> geoFeatureTypesByPlanitEntity)Given the feature contexts for the available GIS features, find the one where the context matches a given PLANit entity classGeoIoWriterSettingsgetSettings()any settings to configure the writer can be configured by collecting these settingsvoidreset()reset the reader to allow for marking unnecessary resources for garbage collectionprotected <TT extends ManagedId>
voidwriteGeometryLayerForEntity(org.opengis.feature.simple.SimpleFeatureType featureType, PlanitEntityFeatureTypeContext<TT> planitEntityFeatureContext, String loggingPrefix, org.geotools.data.DataStore entityDataStore, String featureSchemaName, Iterable<TT> planitEntities)Writer the geometry layer with the PLANit entities available in the containerprotected <TT extends ManagedId>
voidwriteGeometryLayerForEntity(org.opengis.feature.simple.SimpleFeatureType featureType, PlanitEntityFeatureTypeContext<TT> planitEntityFeatureContext, org.geotools.data.DataStore entityDataStore, String featureSchemaName, Iterable<TT> planitEntities)-
Methods inherited from class org.goplanit.converter.CrsWriterImpl
createTransformedCoordinate, extractSrsName, getDestinationCoordinateReferenceSystem, getDestinationCrsTransformer, getGeoUtils, getTransformedCoordinates, prepareCoordinateReferenceSystem
-
Methods inherited from class org.goplanit.converter.BaseWriterImpl
getComponentIdMappers, getIdMapperType, getPrimaryIdMapper, setIdMapperType, setParentIdMappers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.converter.ConverterEntity
getTypeDescription
-
Methods inherited from interface org.goplanit.converter.ConverterWriter
write
-
-
-
-
Constructor Detail
-
GeometryIoWriter
protected GeometryIoWriter()
Constructor
-
GeometryIoWriter
protected GeometryIoWriter(String networkPath)
Constructor- Parameters:
networkPath- to persist network on
-
GeometryIoWriter
protected GeometryIoWriter(String networkPath, String countryName)
Constructor- Parameters:
networkPath- to persist network oncountryName- to optimise projection for (if available, otherwise ignore)
-
GeometryIoWriter
protected GeometryIoWriter(GeoIoWriterSettings settings)
Constructor- Parameters:
settings- to use
-
-
Method Detail
-
findFeaturePairForPlanitEntity
protected Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>> findFeaturePairForPlanitEntity(Class<? extends ManagedId> planitEntityClass, List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>> geoFeatureTypesByPlanitEntity)
Given the feature contexts for the available GIS features, find the one where the context matches a given PLANit entity class- Parameters:
planitEntityClass- to find entry forgeoFeatureTypesByPlanitEntity- available entries to search in- Returns:
- found entry or throw run time exception
-
findFeature
protected <TT extends ExternalIdAble> Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<TT>> findFeature(Class<TT> clazz, Map<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ExternalIdAble>> geoFeatureTypes)
find feature and context based on the class present in context- Type Parameters:
TT- the type of geometry- Parameters:
clazz- to find feature forgeoFeatureTypes- to find from- Returns:
- found entry, null if not present
-
writeGeometryLayerForEntity
protected <TT extends ManagedId> void writeGeometryLayerForEntity(org.opengis.feature.simple.SimpleFeatureType featureType, PlanitEntityFeatureTypeContext<TT> planitEntityFeatureContext, String loggingPrefix, org.geotools.data.DataStore entityDataStore, String featureSchemaName, Iterable<TT> planitEntities)
Writer the geometry layer with the PLANit entities available in the container- Type Parameters:
TT- type of PLANit entity to write- Parameters:
featureType- to useplanitEntityFeatureContext- the context to convert instances to featuresloggingPrefix- to useentityDataStore- to use for persistencefeatureSchemaName- the feature lives under on the datastoreplanitEntities- container to persist
-
writeGeometryLayerForEntity
protected <TT extends ManagedId> void writeGeometryLayerForEntity(org.opengis.feature.simple.SimpleFeatureType featureType, PlanitEntityFeatureTypeContext<TT> planitEntityFeatureContext, org.geotools.data.DataStore entityDataStore, String featureSchemaName, Iterable<TT> planitEntities)
- Type Parameters:
TT- type of planit entity- Parameters:
featureType- to writeplanitEntityFeatureContext- contextual information on feature typeentityDataStore- datastore to usefeatureSchemaName- to useplanitEntities- to persist
-
findDataStore
protected <TT extends ManagedId> org.geotools.data.DataStore findDataStore(PlanitEntityFeatureTypeContext<TT> featureContext, Path fullOutputPath)
Find data store to use, if not present, create it if possible- Type Parameters:
TT- type of PLANit entity the data store is to be used for- Parameters:
featureContext- to create data store for and register on GeoIODataStoreManagerfullOutputPath- on where to store results- Returns:
- dataStore to use
-
reset
public void reset()
reset the reader to allow for marking unnecessary resources for garbage collection
-
getSettings
public GeoIoWriterSettings getSettings()
any settings to configure the writer can be configured by collecting these settings- Returns:
- the settings to configure the writer
-
-