use of org.openlca.core.math.data_quality.DQResult in project olca-app by GreenDelta.
the class ProcessFigure method drawDqBar.
private void drawDqBar(Graphics g) {
DQResult dqResult = node.parent.editor.dqResult;
if (!DQUI.displayProcessQuality(dqResult))
return;
Point loc = getLocation();
Dimension size = getSize();
Color fColor = g.getForegroundColor();
Color bColor = g.getBackgroundColor();
g.setForegroundColor(Colors.white());
g.setBackgroundColor(Colors.white());
int x = loc.x + size.width - 30;
int y = loc.y + 10;
int w = 20;
DQSystem system = dqResult.setup.processSystem;
int h = (size.height - 20) / system.indicators.size();
int[] values = dqResult.get(node.product);
for (int value : values) {
Color color = DQUI.getColor(value, system.getScoreCount());
g.setBackgroundColor(color);
g.drawRectangle(x, y, w, h);
g.fillRectangle(x + 1, y + 1, w - 1, h - 1);
y += h;
}
g.setForegroundColor(fColor);
g.setBackgroundColor(bColor);
}
use of org.openlca.core.math.data_quality.DQResult in project olca-app by GreenDelta.
the class CalculationWizard method runCalculation.
private void runCalculation() {
// for MC simulations, just open the simulation editor
if (setup.hasType(CalculationType.MONTE_CARLO_SIMULATION)) {
SimulationEditor.open(setup.calcSetup);
return;
}
boolean upstream = setup.hasType(CalculationType.UPSTREAM_ANALYSIS);
// run the calculation
log.trace("run calculation");
var calc = new SystemCalculator(Database.get());
var result = upstream ? calc.calculateFull(setup.calcSetup) : calc.calculateContributions(setup.calcSetup);
// check storage and DQ calculation
DQResult dqResult = null;
if (setup.withDataQuality) {
log.trace("calculate data quality result");
dqResult = DQResult.of(Database.get(), setup.dqSetup, result);
}
// sort and open the editor
log.trace("sort result items");
Sort.sort(result);
log.trace("calculation done; open editor");
ResultEditor.open(setup.calcSetup, result, dqResult);
}
use of org.openlca.core.math.data_quality.DQResult in project olca-app by GreenDelta.
the class QuickResultEditor method init.
@Override
public void init(IEditorSite site, IEditorInput iInput) throws PartInitException {
super.init(site, iInput);
try {
var input = (ResultEditorInput) iInput;
setup = Cache.getAppCache().remove(input.setupKey, CalculationSetup.class);
result = Cache.getAppCache().remove(input.resultKey, ContributionResult.class);
resultItems = ResultItemView.of(result);
Sort.sort(resultItems);
if (input.dqResultKey != null) {
dqResult = Cache.getAppCache().remove(input.dqResultKey, DQResult.class);
}
} catch (Exception e) {
log.error("failed to load inventory result", e);
throw new PartInitException("failed to load inventory result", e);
}
}
Aggregations