Package org.goplanit.geoio.util
Class GeoIoFeatureTypeBuilder
- java.lang.Object
-
- org.goplanit.geoio.util.GeoIoFeatureTypeBuilder
-
public final class GeoIoFeatureTypeBuilder extends Object
Utility class that builds feature types for supported PLANit entities per layer and chosen destination CRS that the GeoIO writer supports- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static String
GEOTOOLS_GEOMETRY_ATTRIBUTE
the geotools geometry attribute name used
-
Constructor Summary
Constructors Constructor Description GeoIoFeatureTypeBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static String
createFeatureGeometrySridAddendum(org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem)
Create the addendum to each geometry entry to signify its srid based on the chosen destination CRSstatic String
createFeatureTypeSchemaName(UntypedDirectedGraphLayer<?,?,?> directedGraphlayer, Function<UntypedDirectedGraphLayer<?,?,?>,String> layerPrefixProducer, String baseFileName)
Construct consistent file path (with file name) based on desired output file name and settings configuration, taking the current layer into accountstatic Set<PlanitEntityFeatureTypeContext<? extends ManagedId>>
createNetworkLayerFeatureContexts(NetworkIdMapper primaryIdMapper, MacroscopicNetworkLayer layer)
Construct all PLANit entities that have an associated GIS feature context containing the information require for persistencestatic Set<PlanitEntityFeatureTypeContext<? extends ManagedId>>
createRoutedServicesLayerFeatureContexts(RoutedServicesIdMapper primaryIdMapper, Mode layerMode, ServiceNetworkIdMapper serviceNetworkIdMapper)
Construct all PLANit entities that have an associated GIS feature context containing the information required for persistence (for routed services entities).static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>>
createServiceNetworkLayerFeatureContexts(ServiceNetworkIdMapper primaryIdMapper, ServiceNetworkLayer layer, NetworkIdMapper networkIdMappers)
Construct all PLANit entities that have an associated GIS feature context containing the information required for persistencestatic List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>>
createSimpleFeatureTypes(Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> features, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, Map<Class<?>,String> planitEntitySchemaNames)
Initialise all known supported simple feature types for the given contexts.static List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>>
createSimpleFeatureTypesByLayer(Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> layerFeatures, UntypedDirectedGraphLayer<?,?,?> layer, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, Map<Class<?>,String> planitEntityBaseFileNames, Function<UntypedDirectedGraphLayer<?,?,?>,String> layerPrefixProducer)
Initialise all known supported simple feature types for the physical network (for the given layer).static org.opengis.feature.simple.SimpleFeatureType
createSimpleZoningFeatureType(PlanitEntityFeatureTypeContext<?> featureContext, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, String planitEntityFileName)
Create a simple feature for feature context providedstatic Set<PlanitEntityFeatureTypeContext<? extends ManagedId>>
createVirtualNetworkFeatureContexts(VirtualNetworkIdMapper primaryIdMapper)
Construct GIS feature contexts containing the information required for persistence of all virtual network entitiesstatic Set<PlanitEntityFeatureTypeContext<? extends ManagedId>>
createZoningFeatureContexts(ZoningIdMapper primaryIdMapper, NetworkIdMapper networkIdMappers)
Construct GIS feature contexts containing the information required for persistence of all Zoning entities (except the zone's which are serviced viacreateZoningZoneFeatureContext(ZoningIdMapper, Class, Class)
because they have geometry dependent contexts.static <Z extends Zone,T extends org.locationtech.jts.geom.Geometry>
PlanitZoneFeatureTypeContext<Z,T>createZoningZoneFeatureContext(ZoningIdMapper primaryIdMapper, Class<Z> zoneClazz, Class<T> geometryType)
Construct GIS feature context containing the information required for persistence of the given zone class and geometry type
-
-
-
Field Detail
-
GEOTOOLS_GEOMETRY_ATTRIBUTE
public static final String GEOTOOLS_GEOMETRY_ATTRIBUTE
the geotools geometry attribute name used- See Also:
- Constant Field Values
-
-
Method Detail
-
createFeatureGeometrySridAddendum
protected static String createFeatureGeometrySridAddendum(org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem)
Create the addendum to each geometry entry to signify its srid based on the chosen destination CRS- Parameters:
destinationCoordinateReferenceSystem
- destination CRS to use- Returns:
- Srid addencum string, e.g., srid=_code_ if found, otherwise empty string
-
createNetworkLayerFeatureContexts
public static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> createNetworkLayerFeatureContexts(NetworkIdMapper primaryIdMapper, MacroscopicNetworkLayer layer)
Construct all PLANit entities that have an associated GIS feature context containing the information require for persistence- Parameters:
primaryIdMapper
- to use for id conversion when persistinglayer
- used for these features- Returns:
- available network entity feature context information
-
createServiceNetworkLayerFeatureContexts
public static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> createServiceNetworkLayerFeatureContexts(ServiceNetworkIdMapper primaryIdMapper, ServiceNetworkLayer layer, NetworkIdMapper networkIdMappers)
Construct all PLANit entities that have an associated GIS feature context containing the information required for persistence- Parameters:
primaryIdMapper
- to use for id conversion when persistinglayer
- used for these featuresnetworkIdMappers
- used for parent ids related to the physical network- Returns:
- available service network entity feature context information
-
createZoningZoneFeatureContext
public static <Z extends Zone,T extends org.locationtech.jts.geom.Geometry> PlanitZoneFeatureTypeContext<Z,T> createZoningZoneFeatureContext(ZoningIdMapper primaryIdMapper, Class<Z> zoneClazz, Class<T> geometryType)
Construct GIS feature context containing the information required for persistence of the given zone class and geometry type- Type Parameters:
T
- the type of geometryZ
- the type of zone- Parameters:
primaryIdMapper
- to use for id conversion when persistingzoneClazz
- class signature of the zonegeometryType
- to apply- Returns:
- available service network entity feature context information
-
createZoningFeatureContexts
public static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> createZoningFeatureContexts(ZoningIdMapper primaryIdMapper, NetworkIdMapper networkIdMappers)
Construct GIS feature contexts containing the information required for persistence of all Zoning entities (except the zone's which are serviced viacreateZoningZoneFeatureContext(ZoningIdMapper, Class, Class)
because they have geometry dependent contexts.- Parameters:
primaryIdMapper
- to use for id conversion when persistingnetworkIdMappers
- used for parent ids related to the physical network- Returns:
- available zoning entity feature context information
-
createVirtualNetworkFeatureContexts
public static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> createVirtualNetworkFeatureContexts(VirtualNetworkIdMapper primaryIdMapper)
Construct GIS feature contexts containing the information required for persistence of all virtual network entities- Parameters:
primaryIdMapper
- to use for id conversion when persisting- Returns:
- available virtual network entity feature context information
-
createRoutedServicesLayerFeatureContexts
public static Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> createRoutedServicesLayerFeatureContexts(RoutedServicesIdMapper primaryIdMapper, Mode layerMode, ServiceNetworkIdMapper serviceNetworkIdMapper)
Construct all PLANit entities that have an associated GIS feature context containing the information required for persistence (for routed services entities).- Parameters:
primaryIdMapper
- to use for id conversion when persistinglayerMode
- mode of the routed services with this mode to persistserviceNetworkIdMapper
- used for parent ids related to the service network- Returns:
- available routed services entity feature context information
-
createSimpleFeatureTypesByLayer
public static List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>> createSimpleFeatureTypesByLayer(Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> layerFeatures, UntypedDirectedGraphLayer<?,?,?> layer, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, Map<Class<?>,String> planitEntityBaseFileNames, Function<UntypedDirectedGraphLayer<?,?,?>,String> layerPrefixProducer)
Initialise all known supported simple feature types for the physical network (for the given layer). Schema names for each feature are constructed viacreateFeatureTypeSchemaName(UntypedDirectedGraphLayer, Function, String)
. Hence, when registering on a datastore and then retrieving a feature writer for this feature, make sure to use the same schema name by using this method to retrieve the correct registered schema- Parameters:
layerFeatures
- write the provided supported features for the layerlayer
- to create the simple features fordestinationCoordinateReferenceSystem
- to useplanitEntityBaseFileNames
- to use which gets prefixed with layer information and post fixed with extensionlayerPrefixProducer
- function that provides a prefix to each layer created feature type's name (may be null)- Returns:
- the feature types that have been created by physical network layer and all supported PLANit entities
-
createSimpleFeatureTypes
public static List<Pair<org.opengis.feature.simple.SimpleFeatureType,PlanitEntityFeatureTypeContext<? extends ManagedId>>> createSimpleFeatureTypes(Set<PlanitEntityFeatureTypeContext<? extends ManagedId>> features, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, Map<Class<?>,String> planitEntitySchemaNames)
Initialise all known supported simple feature types for the given contexts. When registering on a datastore and then retrieving a feature writer for this feature, make sure to use the same schema name as provided here- Parameters:
features
- write the provided supported features for the layerdestinationCoordinateReferenceSystem
- to useplanitEntitySchemaNames
- to use for the feature- Returns:
- the feature types that have been created for each context
-
createSimpleZoningFeatureType
public static org.opengis.feature.simple.SimpleFeatureType createSimpleZoningFeatureType(PlanitEntityFeatureTypeContext<?> featureContext, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCoordinateReferenceSystem, String planitEntityFileName)
Create a simple feature for feature context provided- Parameters:
featureContext
- create feature for the given contextdestinationCoordinateReferenceSystem
- to useplanitEntityFileName
- the file name to use for the feature- Returns:
- the feature type that has been created
-
createFeatureTypeSchemaName
public static String createFeatureTypeSchemaName(UntypedDirectedGraphLayer<?,?,?> directedGraphlayer, Function<UntypedDirectedGraphLayer<?,?,?>,String> layerPrefixProducer, String baseFileName)
Construct consistent file path (with file name) based on desired output file name and settings configuration, taking the current layer into account- Parameters:
directedGraphlayer
- this applies tolayerPrefixProducer
- to use to convert layer into a prefixbaseFileName
- to combine with- Returns:
- created featureTypeSchemaName
-
-