Creates a new TrajectoryPainter.
null
color to hide features.
// Create a painter, specify that we will filter on "airline" and "destination"
const trajectoryPainter = new TrajectoryPainter({
properties: ["airline", "destination"],
defaultColor: "rgb(255, 255, 255)"
});
// At runtime, immediately change styling and filtering
trajectoryPainter.propertyColorExpressions = [
{property: "destination", value: "Brussels", color: "rgb(255, 0, 0")}, // Destination Brussels = red
{property: "destination", value: "London", color: "rgb(0, 255, 0")} // Destination London = green
];
trajectoryPainter.defaultColor = null; // Hide all the rest
// At runtime, immediately change styling and filtering
trajectoryPainter.propertyColorExpressions = [
{property: "airline", value: "Brussels Airlines", color: "rgb(255, 0, 0")}, // Brussels Airlines = red
];
trajectoryPainter.defaultColor = "rgb(0, 0, 255)"; // All the rest = blue
// Create a painter, specify a provider that can calculate time per point of a line
const trajectoryPainter = new TrajectoryPainter({
lineWidth: 1,
timeProvider: function(feature, shape, pointIndex) {
return feature.properties.timestamps[pointIndex];
},
timeWindow: [0, 3600]
});
// Update the painter when the users updates the time window in the UI (e.g. on slider drag)
timeSlider.onChange(function(startTime, endTime) {
trajectoryPainter.timeWindow = [startTime, endTime];
});
An object literal containing the TrajectoryPainter's parameters.
Registers a callback function for the "InvalidateAll" event, that notifies a listener that the all features are invalidated.
Always set to "InvalidateAll" for this event type.
The callback function to be executed when the event is emitted
The context in which the function should be invoked.
Registers a callback function for the "Invalidate" event, that notifies a listener that a given feature is invalidated.
Always set to "Invalidate" for this event type.
The callback function to be executed when the event is emitted
The context in which the function should be invoked.
Registers a callback function for the "InvalidateById" event, that notifies a listener that a feature with the given id is invalidated.
Always set to "InvalidateById" for this event type.
The callback function to be executed when the event is emitted
The context in which the function should be invoked.
The default line color of trajectories, represented as a CSS color string.
If no color can be determined using the propertyColorExpressions, this color is used to paint the trajectory. Usenull
to hide features that do not match any propertyColorExpressions.
You can only use two different colors in propertyColorExpressions or defaultColor.
You can re-use the same color multiple times though.
The default line color of trajectories, represented as a CSS color string.
If no color can be determined using the propertyColorExpressions, this color is used to paint the trajectory. Usenull
to hide features that do not match any propertyColorExpressions.
You can only use two different colors in propertyColorExpressions or defaultColor.
You can re-use the same color multiple times though.
Do not override this property.
Do not override this property.
The weight of parts of lines that are outside of the configured time windows.
Use 0 to completely discard these parts, so that they don't count in the density. Use a number > 0 (for example 0.05) to let these parts add to the density. They will form a hazy image of all the lines, whether "active" or not. Note that numbers lower than 0.004 are treated as 0 (they map to 0 when representing it as a single byte).The weight of parts of lines that are outside of the configured time windows.
Use 0 to completely discard these parts, so that they don't count in the density. Use a number > 0 (for example 0.05) to let these parts add to the density. They will form a hazy image of all the lines, whether "active" or not. Note that numbers lower than 0.004 are treated as 0 (they map to 0 when representing it as a single byte).An array of objects describing a mapping of property values to colors.
Each object in the array describes a single entry in the map and has the following structure:null
to hide features.When multiple entries result in a color for a trajectory, the first entry of the possible entries in the array will be used.
Note that any property used in the expressions must be specified in the constructor parameter TrajectoryPainterConstructorOptions.properties.
You can only use two different colors in propertyColorExpressions or defaultColor. You can re-use the same color multiple times though.
An array of objects describing a mapping of property values to colors.
Each object in the array describes a single entry in the map and has the following structure:null
to hide features.When multiple entries result in a color for a trajectory, the first entry of the possible entries in the array will be used.
Note that any property used in the expressions must be specified in the constructor parameter TrajectoryPainterConstructorOptions.properties.
You can only use two different colors in propertyColorExpressions or defaultColor. You can re-use the same color multiple times though.
The color to paint selected trajectories with, represented as a CSS color string.
For selected objects, selectionColor overrides the color determined by the propertyColorExpressions.The color to paint selected trajectories with, represented as a CSS color string.
For selected objects, selectionColor overrides the color determined by the propertyColorExpressions.The start / end values for the window of the time filter.
This setting only has effect if you have set a timeProvider in the constructor. This must be an array with two values. The end value should be larger than the start value.The start / end values for the window of the time filter.
This setting only has effect if you have set a timeProvider in the constructor. This must be an array with two values. The end value should be larger than the start value.Returns an array of map scales that determine when this painter should switch from one level-of-detail to the next.
This can be used to advertise that this painter supports multiple level-of-details for a given object. The current
level-of-detail that is used is determined by the map and is passed back to this FeaturePainter via the state.level
property that is passed to the paint methods.
The default implementation of this method returns null
indicating the level-of-detail is not supported.
the layer for which the detail level scales are being requested
the map for which the detail level scales are being requested
the switch scales for each level of detail
Invalidates this painter for a specific feature. Call this method when any state that determines the rendering of
a specific feature has been changed. Calling this method refreshes this FeaturePainter
's
layer and guarantees that
paintBody() and
paintLabel()
will be called for the given feature during the next map render.
the model feature whose representation has changed
Invalidates this painter for all objects. Call this method when any state that determines the rendering of
objects has been changed. Calling this method refreshes the FeaturePainter
's
layer and guarantees that
paintBody() and
paintLabel() will be called for all objects in
the layer during the next map render.
Invalidates this painter for a specific object by id. Call this method when any state that determines the rendering of
a specific object has been changed. Calling this method refreshes this FeaturePainter
's
layer and guarantees that
paintBody() and
paintLabel()
will be called for the given object during the next map render.
The id of the feature. It corresponds to Feature.id.
Not applicable for TrajectoryPainter
Not applicable for TrajectoryPainter
Not applicable for TrajectoryPainter
TrajectoryPainter.
This painter uses the graphics hardware to efficiently switch styling and filtering.
Highlights
See also ParameterizedLinePainter for a painter with similar capabilities for more generic line datasets.
Limitations: