Skip to content
Snippets Groups Projects
Commit 021e6ffe authored by Michal Malý's avatar Michal Malý Committed by Michal Malý
Browse files

Implement DNATCO Confal Pyramids location iterator

parent 4080c1e0
No related branches found
No related tags found
No related merge requests found
...@@ -50,25 +50,21 @@ const ConfalPyramidsMeshParams = { ...@@ -50,25 +50,21 @@ const ConfalPyramidsMeshParams = {
type ConfalPyramidsMeshParams = typeof ConfalPyramidsMeshParams; type ConfalPyramidsMeshParams = typeof ConfalPyramidsMeshParams;
function createConfalPyramidsIterator(structureGroup: StructureGroup): LocationIterator { function createConfalPyramidsIterator(structureGroup: StructureGroup): LocationIterator {
const { structure } = structureGroup; const { structure, group } = structureGroup;
const unit = structureGroup.group.units[0]; const instanceCount = group.units.length;
if (!Unit.isAtomic(unit)) {
// Noop
return LocationIterator(0, 1, () => NullLocation);
}
const prop = ConfalPyramidsProvider.get(structure.model).value; const prop = ConfalPyramidsProvider.get(structure.model).value;
if (prop === undefined || prop.data === undefined) { if (prop === undefined || prop.data === undefined) {
return LocationIterator(0, 1, (groupIndex: number, instanceIndex: number) => { return LocationIterator(0, 1, () => NullLocation);
return NullLocation;
});
} }
const { locations } = prop.data;
const getLocation = (groupIndex: number, instanceIndex: number) => { const getLocation = (groupIndex: number, instanceIndex: number) => {
return NullLocation; // TODO: Implement me if (locations.length <= groupIndex) return NullLocation;
return locations[groupIndex];
}; };
return LocationIterator(prop.data.locations.length, 1, getLocation); // TODO: Implement me return LocationIterator(locations.length, instanceCount, getLocation);
} }
function createConfalPyramidsMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<ConfalPyramidsMeshParams>, mesh?: Mesh) { function createConfalPyramidsMesh(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<ConfalPyramidsMeshParams>, mesh?: Mesh) {
......
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