Skip to content
Snippets Groups Projects
Commit 38f51e0f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

provide info about entries when returning list of visible data overlays

parent 64605b1b
No related branches found
No related tags found
2 merge requests!341Resolve "Export graphics - add "Current view"",!334Resolve "plugin does not provide info about overlays"
Pipeline #99135 passed
minerva-front (18.0.7) stable; urgency=medium
* Bug fix: export to image did not include overlays (#326)
* Bug fix: missing logos added (#329)
* Bug fix: plugin API did not provide overlay entries when returning list of
visible overlays (#332)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 11 Dec 2024 13:00:00 +0200
......
import { activeOverlaysSelector } from '@/redux/overlayBioEntity/overlayBioEntity.selector';
import {
activeOverlaysSelector,
overlayBioEntityDataSelector,
} from '@/redux/overlayBioEntity/overlayBioEntity.selector';
import { store } from '@/redux/store';
import { MapOverlay } from '@/types/models';
import { DataOverlay } from '@/services/pluginsManager/map/overlays/types/DataOverlay';
import { modelsDataSelector } from '@/redux/models/models.selectors';
import { DataOverlayEntry } from '@/services/pluginsManager/map/overlays/types/DataOverlayEntry';
export const getVisibleDataOverlays = (): MapOverlay[] => {
const activeOverlays = activeOverlaysSelector(store.getState());
const overlayData = overlayBioEntityDataSelector(store.getState());
const models = modelsDataSelector(store.getState());
const dataOverlays = activeOverlays.map(mapOverlay => new DataOverlay(mapOverlay));
dataOverlays.forEach(dataOverlay => {
const mapOverlayData = overlayData[dataOverlay.id];
if (mapOverlayData) {
models.forEach(model => {
const entries = mapOverlayData[model.idObject];
if (entries) {
entries.forEach(dataEntry => {
if (dataEntry.type === 'submap-link') {
dataOverlay.addEntry(
new DataOverlayEntry(
Number(dataEntry.id),
'ALIAS',
dataEntry.modelId,
dataEntry.color,
dataEntry.value,
),
);
} else {
// eslint-disable-next-line no-console
console.log(`${dataEntry.type} not supported`);
}
});
}
});
}
});
return activeOverlays;
};
import { MapOverlay } from '@/types/models';
import { DataOverlayEntry } from '@/services/pluginsManager/map/overlays/types/DataOverlayEntry';
export class DataOverlay {
id: number;
idObject: number;
name: string;
order: number;
creator: string;
description: string;
genomeType: string | null;
genomeVersion: string | null;
publicOverlay: boolean;
type: string;
entries: DataOverlayEntry[];
constructor(mapOverlay: MapOverlay) {
this.id = mapOverlay.idObject;
this.idObject = mapOverlay.idObject;
this.name = mapOverlay.name;
this.order = mapOverlay.order;
this.creator = mapOverlay.creator;
this.description = mapOverlay.description;
this.genomeType = mapOverlay.genomeType;
this.genomeVersion = mapOverlay.genomeVersion;
this.publicOverlay = mapOverlay.publicOverlay;
this.type = mapOverlay.type;
this.entries = [];
}
public addEntry(entry: DataOverlayEntry): void {
this.entries.push(entry);
}
}
import { Color } from '@/types/models';
export class DataOverlayEntry {
bioEntityId: number;
bioEntityType: string;
bioEntityModelId: number;
color: Color | null;
value: number | null;
constructor(
bioEntityId: number,
bioEntityType: string,
bioEntityModelId: number,
color: Color | null,
value: number | null,
) {
this.bioEntityId = bioEntityId;
this.color = color;
this.value = value;
this.bioEntityType = bioEntityType;
this.bioEntityModelId = bioEntityModelId;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment