Skip to content

Commit

Permalink
scenario template layout tweaks (#6129)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored Jan 17, 2025
1 parent f4d1109 commit 1c0b1cf
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,15 @@ export class CalibrateEnsembleScenario extends BaseScenario {
// Model Config Simulate Calibrate
// Model Config Simulate Calibrate EnsmbleCalibrate
// Model Config Simulate Calibrate
datasetNode.x = 100;
datasetNode.y = 200;

const anchorX = 100;
const anchorY = 100;
const nodeGapHorizontal = 400;
const nodeGapVertical = 400;
const modelNodes = wf.getNodes().filter((d) => d.operationType === ModelOp.name);

const modelNodes = wf.getNodes().filter((d) => d.operationType === ModelOp.name);
modelNodes.forEach((modelNode, modelNodeIdx) => {
modelNode.x = datasetNode.x + nodeGapHorizontal;
modelNode.y = datasetNode.y + (modelNodeIdx + 1) * nodeGapVertical;
modelNode.x = anchorX + nodeGapHorizontal;
modelNode.y = anchorY + (modelNodeIdx + 1) * nodeGapVertical;

const modelNeighbours = wf.getNeighborNodes(modelNode.id);
const modelConfigNode = modelNeighbours.downstreamNodes[0];
Expand All @@ -343,10 +342,11 @@ export class CalibrateEnsembleScenario extends BaseScenario {
}
});

calibrateEnsembleNode.x = datasetNode.x + 5 * nodeGapHorizontal;
calibrateEnsembleNode.y = 200;
datasetNode.x = anchorX + 3 * nodeGapHorizontal;
datasetNode.y = anchorY;

// wf.runDagreLayout();
calibrateEnsembleNode.x = anchorX + 5 * nodeGapHorizontal;
calibrateEnsembleNode.y = anchorY;

return wf.dump();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,38 @@ export class ModelFromLiteratureScenario extends BaseScenario {
}

// Run layout
wf.runDagreLayout();
// The schematics for model-from-literature
//
// Document -> Model -> ModelConfig -> Simulate
// Document -> Model -> ModelConfig -> Simulate ModelComparison
// Document -> Model -> ModelConfig -> Simulate
const anchorX = 100;
const anchorY = 100;
const nodeGapHorizontal = 400;
const nodeGapVertical = 400;

const documentNodes = wf.getNodes().filter((d) => d.operationType === DocumentOp.name);
documentNodes.forEach((documentNode, documentIdx) => {
documentNode.x = anchorX;
documentNode.y = anchorY + documentIdx * nodeGapVertical;

const modelNode = wf.getNeighborNodes(documentNode.id).downstreamNodes[0];
modelNode.x = documentNode.x + nodeGapHorizontal;
modelNode.y = documentNode.y;

const modelConfigNode = wf.getNeighborNodes(modelNode.id).downstreamNodes[0];
modelConfigNode.x = modelNode.x + nodeGapHorizontal;
modelConfigNode.y = modelNode.y;

const simulateNode = wf.getNeighborNodes(modelConfigNode.id).downstreamNodes[0];
simulateNode.x = modelConfigNode.x + nodeGapHorizontal;
simulateNode.y = modelConfigNode.y;
});

if (compareModelsNode) {
compareModelsNode.x = anchorX + 4 * nodeGapHorizontal;
compareModelsNode.y = anchorY + Math.floor(0.5 * documentNodes.length) * nodeGapVertical;
}

return wf.dump();
}
Expand Down

0 comments on commit 1c0b1cf

Please sign in to comment.