MCPcopy Create free account
hub / github.com/facebook/Rapid / _gatherSources

Method _gatherSources

modules/core/EditSystem.js:1268–1294  ·  view source on GitHub ↗

* _gatherSources * Get the sources used to make the `staging` edit. * @param {string|Object?} annotation - Rapid edits may optionally use an annotation that includes the data source used * @return {Object} sources Object containing `imagery`, `photos`, `data` properties

(annotation)

Source from the content-addressed store, hash-verified

1266 * @return {Object} sources Object containing `imagery`, `photos`, `data` properties
1267 */
1268 _gatherSources(annotation) {
1269 const context = this.context;
1270 const gfx = context.systems.gfx;
1271 const imagery = context.systems.imagery;
1272 const photos = context.systems.photos;
1273
1274 const sources = {};
1275 const imageryUsed = imagery.imageryUsed();
1276 if (imageryUsed.length) {
1277 sources.imagery = imageryUsed;
1278 }
1279
1280 const photosUsed = photos.photosUsed();
1281 if (photosUsed.length) {
1282 sources.photos = photosUsed;
1283 }
1284
1285 const customLayer = gfx.scene.layers.get('custom-data');
1286 const customDataUsed = customLayer?.dataUsed() ?? [];
1287 const rapidDataUsed = annotation?.dataUsed ?? [];
1288 const dataUsed = [...rapidDataUsed, ...customDataUsed];
1289 if (dataUsed.length) {
1290 sources.data = dataUsed;
1291 }
1292
1293 return sources;
1294 }
1295
1296
1297 /**

Callers 2

commitMethod · 0.95
commitAppendMethod · 0.95

Calls 4

getMethod · 0.80
dataUsedMethod · 0.80
imageryUsedMethod · 0.45
photosUsedMethod · 0.45

Tested by

no test coverage detected