in src/graph/Graph.ts [484:528]
public cacheFill$(key: string): Observable<Graph> {
if (key in this._cachingFull$) {
throw new GraphMapillaryError(`Cannot fill node while caching full (${key}).`);
}
if (!this.hasNode(key)) {
throw new GraphMapillaryError(`Cannot fill node that does not exist in graph (${key}).`);
}
if (key in this._cachingFill$) {
return this._cachingFill$[key];
}
const node = this.getNode(key);
if (node.complete) {
throw new GraphMapillaryError(`Cannot fill node that is already full (${key}).`);
}
this._cachingFill$[key] = this._api.getSpatialImages$([key]).pipe(
tap(
(items: SpatialImagesContract): void => {
for (const item of items) {
if (!item.node) {
console.warn(`Image is empty ${item.node_id}`);
}
if (!node.complete) {
this._makeFull(node, item.node);
}
delete this._cachingFill$[item.node_id];
}
}),
map((): Graph => { return this; }),
finalize(
(): void => {
if (key in this._cachingFill$) {
delete this._cachingFill$[key];
}
this._changed$.next(this);
}),
publish(),
refCount());
return this._cachingFill$[key];
}