@ngageoint/mage.arcgis.service
Version:
A mage service plugin that synchronizes mage observations to a configured ArcGIS feature layer.
33 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventLayerProcessorOrganizer = void 0;
const EventToLayerProcessor_1 = require("./EventToLayerProcessor");
/**
* Organizes the active events and groups them with the FeatureLayerProcessors that the events are configured to sync.
*/
class EventLayerProcessorOrganizer {
/**
* Organizes the events with the layer processors they are configured to sync.
* @param {MageEventAttrs[]} events The events to organize.
* @param {FeatureLayerProcessor[]} layerProcessors The layer processors.
* @returns {EventToLayerProcessor} An array of events mapped to their processors.
*/
organize(events, layerProcessors) {
const eventsAndProcessors = new Array;
for (const event of events) {
const syncProcessors = new Array();
for (const layerProcessor of layerProcessors) {
if (layerProcessor.layerInfo.hasEvent(event.id)) {
syncProcessors.push(layerProcessor);
}
}
if (syncProcessors.length > 0) {
const eventToProcessors = new EventToLayerProcessor_1.EventToLayerProcessor(event, syncProcessors);
eventsAndProcessors.push(eventToProcessors);
}
}
return eventsAndProcessors;
}
}
exports.EventLayerProcessorOrganizer = EventLayerProcessorOrganizer;
//# sourceMappingURL=EventLayerProcessorOrganizer.js.map