Class MovingFeatureIterator

java.lang.Object
org.apache.sis.internal.storage.csv.FeatureIterator
org.apache.sis.internal.storage.csv.MovingFeatureIterator
All Implemented Interfaces:
Consumer<LogRecord>, Spliterator<AbstractFeature>

final class MovingFeatureIterator extends FeatureIterator implements Consumer<LogRecord>
An extension of the feature iterator that merge the line segments in a single trajectory. Line segments can be specified on a single line in the CSV file. All lines for the same feature are combined together in a single trajectory. For example, iteration over the following file will produce 3 Feature instances instead of 4, because the two lines of features "a" will be merged in a single feature instance:
Since:
0.8
Version:
0.8
  • Field Details

    • identifier

      private String identifier
      Identifier of the feature in process of being parsed.
    • builder

      private MovingFeatureBuilder builder
      Where to store the property values and the trajectory of the feature in process of being parsed.
    • builders

      private final Map<String,MovingFeatureBuilder> builders
      All builders by feature name (not only the one being parsed).
  • Constructor Details

    • MovingFeatureIterator

      MovingFeatureIterator(Store store)
      Creates a new iterator.
  • Method Details

    • createMovingFeatures

      AbstractFeature[] createMovingFeatures()
      Creates all moving features. This method can only be invoked after readMoving(Consumer, boolean) completion. This method is ignored if the CSV file contains only static features.
    • createMovingFeature

      private AbstractFeature createMovingFeature(String featureName, MovingFeatureBuilder mf, int np)
      Creates the moving feature of the given name. This method can only be invoked after readMoving(Consumer, boolean).
      Parameters:
      featureName - name of the feature to create.
      np - number of properties, ignoring the ones before the trajectory column.
    • readMoving

      boolean readMoving(Consumer<? super AbstractFeature> action, boolean all) throws IOException
      Executes the given action for the next moving feature or for all remaining moving features. This method assumes that the 4 first columns are identifier, start time, end time and optional attributes in that order.
      Parameters:
      action - the action to execute as soon as the mfidref change, or null if none.
      all - true for executing the given action on all remaining features.
      Returns:
      false if there are no remaining features after this method call.
      Throws:
      IOException - if an I/O error occurred while reading a feature.
      IllegalArgumentException - if parsing of a number failed, or other error.
      DateTimeException - if parsing of a date failed.
    • accept

      public void accept(LogRecord warning)
      Invoked when a warning occurred while computing the geometry.
      Specified by:
      accept in interface Consumer<LogRecord>