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>
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MovingFeatureBuilderWhere to store the property values and the trajectory of the feature in process of being parsed.private final Map<String, MovingFeatureBuilder> All builders by feature name (not only the one being parsed).private StringIdentifier of the feature in process of being parsed.Fields inherited from class FeatureIterator
converters, propertyNames, store, TRAJECTORY_COLUMN, valuesFields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when a warning occurred while computing the geometry.private AbstractFeaturecreateMovingFeature(String featureName, MovingFeatureBuilder mf, int np) Creates the moving feature of the given name.(package private) AbstractFeature[]Creates all moving features.(package private) booleanreadMoving(Consumer<? super AbstractFeature> action, boolean all) Executes the given action for the next moving feature or for all remaining moving features.Methods inherited from class FeatureIterator
characteristics, estimateSize, forEachRemaining, tryAdvance, trySplitMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
identifier
Identifier of the feature in process of being parsed. -
builder
Where to store the property values and the trajectory of the feature in process of being parsed. -
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 afterreadMoving(Consumer, boolean)completion. This method is ignored if the CSV file contains only static features. -
createMovingFeature
Creates the moving feature of the given name. This method can only be invoked afterreadMoving(Consumer, boolean).- Parameters:
featureName- name of the feature to create.np- number of properties, ignoring the ones before the trajectory column.
-
readMoving
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 themfidrefchange, ornullif none.all-truefor executing the given action on all remaining features.- Returns:
falseif 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
-