When it processes the query cursor, LuciadRIA doesn’t update features that already exist in the layer by default.
When you’re using the LoadSpatially
loading strategy on a FeatureLayer
, you can change that behavior. You can provide a custom implementation for the LoadSpatially.shouldUpdate
function predicate.
LuciadRIA calls this function whenever it can update an existing feature with a version that comes in the processed cursor.
Program: Controlling if features should be updated based on a property
const loadingStrategy = new LoadSpatially({queryProvider: queryProvider});
//Replace the shouldUpdate function with a custom implementation which checks the revision
//number stored in the Feature to decide whether or not the Feature should be updated
loadingStrategy.shouldUpdate = function(existingFeature: Feature, feature: Feature): boolean {
const properties = feature.properties as any;
return properties.revision &&
properties.revision > (existingFeature.properties as any).revision;
};