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 java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,
T_CONS extends Object, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MovingFeatureBuilder
Where 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 String
Identifier of the feature in process of being parsed.Fields inherited from class org.apache.sis.internal.storage.csv.FeatureIterator
converters, propertyNames, store, TRAJECTORY_COLUMN, values
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when a warning occurred while computing the geometry.private AbstractFeature
createMovingFeature
(String featureName, MovingFeatureBuilder mf, int np) Creates the moving feature of the given name.(package private) AbstractFeature[]
Creates all moving features.(package private) boolean
readMoving
(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 org.apache.sis.internal.storage.csv.FeatureIterator
characteristics, estimateSize, forEachRemaining, tryAdvance, trySplit
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.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 themfidref
change, ornull
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
Invoked when a warning occurred while computing the geometry.
-