Class MovingFeatureBuilder
java.lang.Object
org.apache.sis.internal.feature.MovingFeatures
org.apache.sis.internal.storage.csv.MovingFeatureBuilder
Builder of feature where the geometry is a trajectory and some property values may change with time.
- Since:
- 0.8
- Version:
- 1.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
A dynamic property value together with the period of time in which this property is valid. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
Number ofProperty
instances added for each index of theproperties
table.private final MovingFeatureBuilder.Period[]
The properties having values that may change in time.private long
Overall start and end time over all properties.private long
Overall start and end time over all properties.Fields inherited from class org.apache.sis.internal.feature.MovingFeatures
TIME_AS_INSTANTS
-
Constructor Summary
ConstructorsConstructorDescriptionMovingFeatureBuilder
(MovingFeatureBuilder share, int numProperties) Creates a new moving feature. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addTimeRange
(long startTime, long endTime) Adds a time range.final void
Adds a dynamic property value.private static boolean
Returnstrue
if the last coordinate of theprevious
vector is equal to the first coordinate of thenext
vector.final <V> void
storeAttribute
(int index, AbstractAttribute<V> dest) Sets the values of the given attribute to the values collected by thisMovingFeatures
.final <G> void
storeGeometry
(String featureName, int index, int dimension, Geometries<G> factory, AbstractAttribute<G> dest, Consumer<LogRecord> warningListener) Sets the geometry of the given attribute to the values collected by thisMovingFeatures
.final void
storeTimeRange
(String startTime, String endTime, AbstractFeature dest) Stores the start time and end time in the given feature.Methods inherited from class org.apache.sis.internal.feature.MovingFeatures
characteristic, setInstants, setTimes
-
Field Details
-
properties
The properties having values that may change in time. May contain the values of arbitrary properties (e.g. asString
instances), or may contain the coordinates of part of a trajectory as array of primitive type likefloat[]
. Trajectories may be specified in many parts if for example, the different parts are given on different lines of a CSV file. -
count
private final int[] countNumber ofProperty
instances added for each index of theproperties
table. -
tmin
private long tminOverall start and end time over all properties. -
tmax
private long tmaxOverall start and end time over all properties.
-
-
Constructor Details
-
MovingFeatureBuilder
Creates a new moving feature.- Parameters:
share
- other builder that may share time vectors, ornull
if none.numProperties
- maximal number of dynamic properties.
-
-
Method Details
-
addTimeRange
public final void addTimeRange(long startTime, long endTime) Adds a time range. The minimal and maximal values will be used bystoreTimeRange(String, String, AbstractFeature)
.- Parameters:
startTime
- beginning in milliseconds since Java epoch of the period when the property value is valid.endTime
- end in milliseconds since Java epoch of the period when the the property value is valid.
-
addValue
Adds a dynamic property value. This method shall be invoked with time periods in chronological order.- Parameters:
index
- the property index.startTime
- beginning in milliseconds since Java epoch of the period when the property value is valid.endTime
- end in milliseconds since Java epoch of the period when the the property value is valid.value
- the property value which is valid during the given period.
-
storeTimeRange
Stores the start time and end time in the given feature.- Parameters:
startTime
- name of the property where to store the start time.endTime
- name of the property where to store the end time.dest
- feature where to store the start time and end time.
-
storeAttribute
Sets the values of the given attribute to the values collected by thisMovingFeatures
. This method sets also the"datetimes"
characteristic.- Type Parameters:
V
- the type of values in the given attribute.- Parameters:
index
- index of the property for which values are desired.dest
- attribute where to store the value.
-
storeGeometry
public final <G> void storeGeometry(String featureName, int index, int dimension, Geometries<G> factory, AbstractAttribute<G> dest, Consumer<LogRecord> warningListener) Sets the geometry of the given attribute to the values collected by thisMovingFeatures
. This method sets also the"datetimes"
characteristic.- Type Parameters:
G
- the type of the geometry value.- Parameters:
featureName
- the name of the feature containing the attribute to update, for logging purpose.index
- index of the property for which geometry value is desired.dimension
- number of dimensions for all coordinates.factory
- the factory to use for creating the geometry object.dest
- attribute where to store the geometry value.warningListener
- where to report warnings. Implementation should set the source class name, source method name and logger name, then forward to aWarningListener
.
-
equals
Returnstrue
if the last coordinate of theprevious
vector is equal to the first coordinate of thenext
vector.- Parameters:
previous
- the previous vector.next
- the next vector.dimension
- number of dimension in each coordinate.
-