Class 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 Detail

      • GEOTOOLS_GEOMETRY_ATTRIBUTE

        public static final String GEOTOOLS_GEOMETRY_ATTRIBUTE
        the geotools geometry attribute name used
        See Also:
        Constant Field Values
    • Constructor Detail

      • GeoIoFeatureTypeBuilder

        public GeoIoFeatureTypeBuilder()
    • 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 persisting
        layer - 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 persisting
        layer - used for these features
        networkIdMappers - 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 geometry
        Z - the type of zone
        Parameters:
        primaryIdMapper - to use for id conversion when persisting
        zoneClazz - class signature of the zone
        geometryType - 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 via createZoningZoneFeatureContext(ZoningIdMapper, Class, Class) because they have geometry dependent contexts.
        Parameters:
        primaryIdMapper - to use for id conversion when persisting
        networkIdMappers - 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 persisting
        layerMode - mode of the routed services with this mode to persist
        serviceNetworkIdMapper - 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 via createFeatureTypeSchemaName(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 layer
        layer - to create the simple features for
        destinationCoordinateReferenceSystem - to use
        planitEntityBaseFileNames - to use which gets prefixed with layer information and post fixed with extension
        layerPrefixProducer - 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 layer
        destinationCoordinateReferenceSystem - to use
        planitEntitySchemaNames - 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 context
        destinationCoordinateReferenceSystem - to use
        planitEntityFileName - 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 to
        layerPrefixProducer - to use to convert layer into a prefix
        baseFileName - to combine with
        Returns:
        created featureTypeSchemaName