import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
private Button removeVisualisationTemplateButton;
- private Button applyButton;
-
public DynamicVisualisationsUI(Composite parent, int style) {
super(parent, style);
// ScrolledComposite scrolledComposite = new ScrolledComposite(this, SWT.V_SCROLL);
}
});
- applyButton = new Button(buttonBarsComposite, SWT.NONE);
- applyButton.setText("Apply");
- applyButton.setEnabled(visualisation != null);
- applyButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
- } catch (Exception e1) {
- LOGGER.error("Could not persist visualisation template", e1);
- ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
- }
- }
- });
-
removeVisualisationTemplateButton = new Button(buttonBarsComposite, SWT.NONE);
removeVisualisationTemplateButton.setText("Remove");
removeVisualisationTemplateButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
Button usedButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(usedButton);
+ addSelectionListener(usedButton);
Combo variableCombo = new Combo(parent, SWT.READ_ONLY);
variableCombo.setItems(colorContributions.keySet().toArray(new String[colorContributions.size()]));
+ addSelectionListener(variableCombo);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
Text minText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).hint(150, SWT.DEFAULT).align(SWT.CENTER, SWT.CENTER).applyTo(minText);
+ addSelectionListener(minText);
Text maxText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).hint(150, SWT.DEFAULT).align(SWT.CENTER, SWT.CENTER).applyTo(maxText);
+ addSelectionListener(maxText);
Text unit = new Text(parent, SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(unit);
Combo colorMapCombo = new Combo(parent, SWT.READ_ONLY);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(colorMapCombo);
colorMapCombo.setItems(colorMaps.keySet().toArray(new String[colorMaps.keySet().size()]));
+ addSelectionListener(colorMapCombo);
Button defaultButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
+ addSelectionListener(defaultButton);
defaultButton.addSelectionListener(new SelectionAdapter() {
@Override
Button usedButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(usedButton);
+ addSelectionListener(usedButton);
Combo variableCombo = new Combo(parent, SWT.READ_ONLY);
variableCombo.setItems(sizeContributions.keySet().toArray(new String[sizeContributions.size()]));
+ addSelectionListener(variableCombo);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
Text minText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(minText);
+ addSelectionListener(minText);
Text maxText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(maxText);
+ addSelectionListener(maxText);
Label unit = new Label(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(unit);
Combo sizeMapCombo = new Combo(parent, SWT.READ_ONLY);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(sizeMapCombo);
sizeMapCombo.setItems(sizeMaps.keySet().toArray(new String[sizeMaps.keySet().size()]));
+ addSelectionListener(sizeMapCombo);
Button defaultButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
+ addSelectionListener(defaultButton);
defaultButton.addSelectionListener(new SelectionAdapter() {
@Override
showColorButton = new Button(parent, SWT.CHECK);
showColorButton.setText("Show");
+ addSelectionListener(showColorButton);
colorTicksButton = new Button(parent, SWT.CHECK);
colorTicksButton.setText("Ticks");
+ addSelectionListener(colorTicksButton);
colorGradientButton = new Button(parent, SWT.CHECK);
colorGradientButton.setText("Gradients");
+ addSelectionListener(colorGradientButton);
Label label = new Label(parent, SWT.NONE);
label.setText("Location");
if (colorLocationItems.length > 0) {
colorLocationCombo.select(0);
}
+ addSelectionListener(colorLocationCombo);
label = new Label(parent, SWT.NONE);
label.setText("Size");
if (colorSizeItems.length > 0) {
colorSizeCombo.select(0);
}
+ addSelectionListener(colorSizeCombo);
}
private void initializeObjectSizes(Composite parent) {
private void createSizeBars(Composite parent) {
showSizeButton = new Button(parent, SWT.CHECK);
showSizeButton.setText("Show");
+ addSelectionListener(showSizeButton);
sizeTicksButton = new Button(parent, SWT.CHECK);
sizeTicksButton.setText("Ticks");
+ addSelectionListener(sizeTicksButton);
sizeGradientButton = new Button(parent, SWT.CHECK);
sizeGradientButton.setText("Gradient");
+ addSelectionListener(sizeGradientButton);
Label label = new Label(parent, SWT.NONE);
label.setText("Location");
if (sizeLocationItems.length > 0) {
sizeLocationCombo.select(0);
}
+ addSelectionListener(sizeLocationCombo);
label = new Label(parent, SWT.NONE);
label.setText("Size");
if (sizeSizeItems.length > 0) {
sizeSizeCombo.select(0);
}
+ addSelectionListener(sizeSizeCombo);
+ }
+
+ private void addSelectionListener(Widget widget) {
+ if (widget instanceof Button) {
+ ((Button) widget).addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ } catch (Exception e1) {
+ LOGGER.error("Could not persist visualisation template", e1);
+ ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
+ }
+ }
+ });
+ } else if (widget instanceof Combo) {
+ ((Combo) widget).addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ } catch (Exception e1) {
+ LOGGER.error("Could not persist visualisation template", e1);
+ ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
+ }
+ }
+ });
+ } else if (widget instanceof Text) {
+ ((Text) widget).addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ try {
+ persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ } catch (Exception e1) {
+ LOGGER.error("Could not persist visualisation template", e1);
+ ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
+ }
+ }
+ });
+ ((Text) widget).addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if(e.keyCode == SWT.CR || e.keyCode == SWT.LF) {
+ try {
+ persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ } catch (Exception e1) {
+ LOGGER.error("Could not persist visualisation template", e1);
+ ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
+ }
+ }
+ }
+ });
+ }
}
public void setParentResource(Resource parentResource) {
if (getParent().isDisposed())
return;
- applyButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
removeVisualisationTemplateButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
if (visualisation != null) {
graph.claimLiteral(colorContribution, L0.HasName, coll.first);
DynamicColorContribution contr = coll.second;
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, coll.first);
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, contr.getLabel());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, contr.getModuleName());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, contr.getAttributeName());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, contr.getUnit());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, contr.getVariableGain());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, contr.getVariableBias());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, contr.getDefaultColorMap().getLabel());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, contr.getDefaultMin());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, contr.getDefaultMax());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, contr.isUsed());
- graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, contr.isUseDefault());
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, coll.first, Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, contr.getLabel(), Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, contr.getModuleName(), Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, contr.getUnit(), Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, contr.getVariableGain(), Bindings.DOUBLE);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, contr.getVariableBias(), Bindings.DOUBLE);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, contr.getDefaultColorMap().getLabel(), Bindings.STRING);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, contr.getDefaultMin(), Bindings.DOUBLE);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, contr.getDefaultMax(), Bindings.DOUBLE);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
+ graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
graph.claim(visualisation, DN.Diagram_Visualisations_colorContributions, colorContribution);
}
graph.claimLiteral(sizeContribution, L0.HasName, coll.first);
DynamicSizeContribution contr = coll.second;
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, coll.first);
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, contr.getLabel());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, contr.getModuleName());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, contr.getAttributeName());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, contr.getUnit());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, contr.getVariableGain());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, contr.getVariableBias());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, contr.getDefaultSizeMap().getLabel());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, contr.getDefaultMin());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, contr.getDefaultMax());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, contr.isUsed());
- graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, contr.isUseDefault());
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, coll.first, Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, contr.getLabel(), Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, contr.getModuleName(), Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, contr.getUnit(), Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, contr.getVariableGain(), Bindings.DOUBLE);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, contr.getVariableBias(), Bindings.DOUBLE);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, contr.getDefaultSizeMap().getLabel(), Bindings.STRING);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, contr.getDefaultMin(), Bindings.DOUBLE);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, contr.getDefaultMax(), Bindings.DOUBLE);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
+ graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
graph.claim(visualisation, DN.Diagram_Visualisations_sizeContributions, sizeContribution);
}
package org.simantics.district.network.profile;
+import java.util.Collection;
import java.util.Map;
+import java.util.stream.Collectors;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.exception.DatabaseException;
import org.simantics.district.network.DistrictNetworkUtil;
import org.simantics.district.network.ontology.DistrictNetworkResource;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
import org.simantics.district.network.visualisations.model.ColorBarOptions;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
Resource visualisationResource = graph.getPossibleObject(visualisationFolder, DN.Diagram_hasActiveVisualisation);
if (visualisationResource != null) {
String name = graph.getRelatedValue(visualisationResource, Layer0.getInstance(graph).HasName);
+
+ Collection<DynamicColoringObject> dynamicColoringObjects = DynamicVisualisationsContributions.dynamicColoringObjects(graph);
+ Map<String, DynamicColoringObject> defaultColoringObjects = dynamicColoringObjects.stream().collect(Collectors.toMap(dcc -> dcc.getColoringObject().getName(), dcc -> dcc));
+
+ Collection<DynamicSizingObject> dynamicSizingObjects = DynamicVisualisationsContributions.dynamicSizingObjects(graph);
+ Map<String, DynamicSizingObject> defaultSizingObjects = dynamicSizingObjects.stream().collect(Collectors.toMap(dcc -> dcc.getSizingObject().getName(), dcc -> dcc));
+
Map<String, DynamicColorContribution> colorContributions = DistrictNetworkUtil.colorContributions(graph, visualisationResource);
ColorBarOptions colorBarOptions = DistrictNetworkUtil.colorBarOptions(graph, visualisationResource);
Map<String, DynamicSizeContribution> sizeContributions = DistrictNetworkUtil.sizeContributions(graph, visualisationResource);
SizeBarOptions sizeBarOptions = DistrictNetworkUtil.sizeBarOptions(graph, visualisationResource);
- DynamicVisualisation visualisation = new DynamicVisualisation(name, visualisationResource, colorContributions, colorBarOptions, sizeContributions, sizeBarOptions);
+ DynamicVisualisation visualisation = new DynamicVisualisation(name, visualisationResource, colorContributions, defaultColoringObjects, colorBarOptions, sizeContributions, defaultSizingObjects, sizeBarOptions);
return visualisation;
}
}
import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.layer0.variable.Variables;
import org.simantics.district.network.ontology.DistrictNetworkResource;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicColorMap;
import org.simantics.district.network.visualisations.model.DynamicVisualisation;
import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
import org.simantics.scenegraph.profile.EvaluationContext;
import org.simantics.scenegraph.profile.common.ProfileVariables;
+import org.simantics.scl.runtime.SCLContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if (attribute != null) {
Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
if (possibleValue != null) {
+
+ double minValue;
+ double maxValue;
+ if (dcc.isUseDefault()) {
+ DynamicColoringObject dynamicColoringObject = dv.getDefaultColorContributions().get(mappingName);
+
+ // This is required if ontology module needs to be compiled
+ Object currentGraph = SCLContext.getCurrent().get("graph");
+ try {
+ SCLContext.getCurrent().put("graph", graph);
+
+ DynamicColorContribution ddcc = dynamicColoringObject.getColorContributions().get(dcc.getLabel());
+ minValue = ddcc.getDefaultMin();
+ maxValue = ddcc.getDefaultMax();
+ } finally {
+ SCLContext.getCurrent().put("graph", currentGraph);
+ }
+ } else {
+ minValue = dcc.getDefaultMin();
+ maxValue = dcc.getDefaultMax();
+ }
// here we do the adjusting according to spec in #15038
double adjustedValue = possibleValue.doubleValue() * dcc.getVariableGain() + dcc.getVariableBias();
DynamicColorMap defaultColorMap = dcc.getDefaultColorMap();
- Color color = defaultColorMap.getColor(adjustedValue, dv.getColorBarOptions().isUseGradients(), dcc.getDefaultMin(), dcc.getDefaultMax());
+ Color color = defaultColorMap.getColor(adjustedValue, dv.getColorBarOptions().isUseGradients(), minValue, maxValue);
return color;
} else {
LOGGER.warn("No value for {}", attribute.getURI(graph));
import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.layer0.variable.Variables;
import org.simantics.district.network.ontology.DistrictNetworkResource;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
+import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
import org.simantics.district.network.visualisations.model.DynamicSizeMap;
import org.simantics.district.network.visualisations.model.DynamicVisualisation;
import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
import org.simantics.scenegraph.profile.EvaluationContext;
import org.simantics.scenegraph.profile.common.ProfileVariables;
+import org.simantics.scl.runtime.SCLContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if (attribute != null) {
Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
if (possibleValue != null) {
+
+
+ double minValue;
+ double maxValue;
+ if (dsc.isUseDefault()) {
+ DynamicSizingObject dynamicSizingObject = dv.getDefaultSizeContributions().get(mappingName);
+
+ // This is required if ontology module needs to be compiled
+ Object currentGraph = SCLContext.getCurrent().get("graph");
+ try {
+ SCLContext.getCurrent().put("graph", graph);
+
+ DynamicSizeContribution ddcc = dynamicSizingObject.getSizeContributions().get(dsc.getLabel());
+ minValue = ddcc.getDefaultMin();
+ maxValue = ddcc.getDefaultMax();
+ } finally {
+ SCLContext.getCurrent().put("graph", currentGraph);
+ }
+ } else {
+ minValue = dsc.getDefaultMin();
+ maxValue = dsc.getDefaultMax();
+ }
// here we do the adjusting according to spec in #15038
double adjustedValue = possibleValue.doubleValue() * dsc.getVariableGain() + dsc.getVariableBias();
DynamicSizeMap defaultSizeMap = dsc.getDefaultSizeMap();
- double size = defaultSizeMap.getSize(adjustedValue, dv.getSizeBarOptions().isUseGradients(), dsc.getDefaultMin(), dsc.getDefaultMax());
+ double size = defaultSizeMap.getSize(adjustedValue, dv.getSizeBarOptions().isUseGradients(), minValue, maxValue);
return size;
} else {
LOGGER.warn("No value for {}", attribute.getURI(graph));
import java.util.Map;
import org.simantics.db.Resource;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
public class DynamicVisualisation {
private Resource visualisationResource;
private Map<String, DynamicColorContribution> colorContributions;
+ private Map<String, DynamicColoringObject> defaultColorContributions;
private ColorBarOptions colorBarOptions;
private Map<String, DynamicSizeContribution> sizeContributions;
+ private Map<String, DynamicSizingObject> defaultSizeContributions;
private SizeBarOptions sizeBarOptions;
- public DynamicVisualisation(String name, Resource visualisationResource, Map<String, DynamicColorContribution> colorContributions, ColorBarOptions colorBarOptions, Map<String, DynamicSizeContribution> sizeContributions, SizeBarOptions sizeBarOptions) {
+ public DynamicVisualisation(String name, Resource visualisationResource, Map<String, DynamicColorContribution> colorContributions, Map<String, DynamicColoringObject> defaultColoringObjects, ColorBarOptions colorBarOptions, Map<String, DynamicSizeContribution> sizeContributions, Map<String, DynamicSizingObject> defaultSizingObjects, SizeBarOptions sizeBarOptions) {
this.name = name;
this.visualisationResource = visualisationResource;
this.colorContributions = colorContributions;
+ this.defaultColorContributions = defaultColoringObjects;
this.colorBarOptions = colorBarOptions;
this.sizeContributions = sizeContributions;
+ this.defaultSizeContributions = defaultSizingObjects;
this.sizeBarOptions = sizeBarOptions;
}
public Map<String, DynamicColorContribution> getColorContributions() {
return colorContributions;
}
+
+ public Map<String, DynamicColoringObject> getDefaultColorContributions() {
+ return defaultColorContributions;
+ }
public ColorBarOptions getColorBarOptions() {
return colorBarOptions;
public Map<String, DynamicSizeContribution> getSizeContributions() {
return sizeContributions;
}
+
+ public Map<String, DynamicSizingObject> getDefaultSizeContributions() {
+ return defaultSizeContributions;
+ }
public SizeBarOptions getSizeBarOptions() {
return sizeBarOptions;