1 package org.simantics.district.network.visualisations.model;
3 import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
4 import org.simantics.scl.runtime.SCLContext;
6 public class DynamicSizeContribution {
9 private String moduleName;
10 private String attributeName;
12 private double variableGain;
13 private double variableBias;
14 private DynamicSizeMap defaultSizeMap;
15 private double defaultMin;
16 private double defaultMax;
18 // for graph persistence only
20 private boolean useDefault;
22 public DynamicSizeContribution(String label, String moduleName, String attributeName, String unit,
23 double variableGain, double variableBias, DynamicSizeMap defaultSizeMap, double defaultMin, double defaultMax) {
25 this.moduleName = moduleName;
26 this.attributeName = attributeName;
28 this.variableGain = variableGain;
29 this.variableBias = variableBias;
30 this.defaultSizeMap = defaultSizeMap;
31 this.defaultMin = defaultMin;
32 this.defaultMax = defaultMax;
35 public String getLabel() {
39 public String getModuleName() {
43 public String getAttributeName() {
47 public String getUnit() {
51 public double getVariableGain() {
55 public double getVariableBias() {
59 public DynamicSizeMap getDefaultSizeMap() {
60 return defaultSizeMap;
63 public double getDefaultMin() {
67 public double getDefaultMax() {
71 public boolean isUsed() {
75 public void setUsed(boolean used) {
79 public boolean isUseDefault() {
83 public void setUseDefault(boolean useDefault) {
84 this.useDefault = useDefault;
87 public double adjustedValue(double value) {
88 // here we do the adjusting according to spec in #15038
89 return value * getVariableGain() + getVariableBias();