1 package org.simantics.district.network.visualisations;
3 import java.util.Collection;
4 import java.util.Collections;
5 import java.util.HashMap;
10 import org.simantics.databoard.Bindings;
11 import org.simantics.db.ReadGraph;
12 import org.simantics.db.Resource;
13 import org.simantics.db.WriteGraph;
14 import org.simantics.db.exception.DatabaseException;
15 import org.simantics.db.layer0.QueryIndexUtils;
16 import org.simantics.district.network.ontology.DistrictNetworkResource;
17 import org.simantics.district.network.visualisations.model.ColorBarOptions;
18 import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
19 import org.simantics.district.network.visualisations.model.DynamicColorContribution;
20 import org.simantics.district.network.visualisations.model.DynamicColorMap;
21 import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
22 import org.simantics.district.network.visualisations.model.DynamicSizeMap;
23 import org.simantics.district.network.visualisations.model.SizeBarOptions;
24 import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsLocation;
25 import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsSize;
26 import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsLocation;
27 import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsSize;
28 import org.simantics.layer0.Layer0;
29 import org.simantics.utils.datastructures.Pair;
31 public class DynamicVisualisations {
33 public static ColorBarOptions colorBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
34 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
35 if (visualisation != null) {
36 String colorBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarLocation, Bindings.STRING);
37 String colorBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarSize, Bindings.STRING);
38 Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBars, Bindings.BOOLEAN);
39 Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, Bindings.BOOLEAN);
40 Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, Bindings.BOOLEAN);
41 if (colorBarLocation != null) {
42 return new ColorBarOptions()
43 .showColorBars(show != null ? show : false)
44 .showColorBarsTicks(showTicks != null ? showTicks : false)
45 .useGradients(useGradients != null ? useGradients : false)
46 .withLocation(ColorBarsLocation.valueOf(colorBarLocation))
47 .withSize(ColorBarsSize.valueOf(colorBarSize));
50 return ColorBarOptions.useDefault();
53 public static void setColorBarOptions(WriteGraph graph, Resource visualisation, ColorBarOptions options) throws DatabaseException {
54 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
55 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarLocation, options.getLocation().toString(), Bindings.STRING);
56 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarSize, options.getSize().toString(), Bindings.STRING);
57 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBars, options.isShowColorBars(), Bindings.BOOLEAN);
58 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, options.isShowColorBarsTicks(), Bindings.BOOLEAN);
59 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
62 public static Resource createVisualisation(WriteGraph graph, Resource parent, String visualisationName) throws DatabaseException {
63 Resource vf = getOrCreateVisualisationsFolder(graph, parent);
64 Layer0 L0 = Layer0.getInstance(graph);
65 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
66 Resource visualisation = graph.newResource();
67 graph.claim(visualisation, L0.InstanceOf, DN.Diagram_Visualisations);
68 graph.claimLiteral(visualisation, L0.HasName, visualisationName);
69 graph.claim(vf, DN.Diagram_hasVisualisation, visualisation);
73 public static Resource getOrCreateVisualisationsFolder(WriteGraph graph, Resource model) throws DatabaseException {
74 Resource rf = getVisualisationFolder(graph, model);
76 Layer0 L0 = Layer0.getInstance(graph);
77 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
78 rf = graph.newResource();
79 graph.claim(rf, L0.InstanceOf, null, DN.VisualisationsFolder);
80 graph.claimLiteral(rf, L0.HasName, L0.NameOf, L0.String, UUID.randomUUID().toString(), Bindings.STRING);
81 graph.claim(model, L0.ConsistsOf, L0.PartOf, rf);
86 public static Resource getVisualisationFolder(ReadGraph graph, Resource model) throws DatabaseException {
87 List<Resource> visualisationsFolders = QueryIndexUtils.searchByType(graph, model, DistrictNetworkResource.getInstance(graph).VisualisationsFolder);
88 if (visualisationsFolders.size() > 0)
89 return visualisationsFolders.get(0);
93 public static SizeBarOptions sizeBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
94 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
95 if (visualisation != null) {
96 String sizeBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarLocation, Bindings.STRING);
97 String sizeBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarSize, Bindings.STRING);
98 Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBars, Bindings.BOOLEAN);
99 Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, Bindings.BOOLEAN);
100 Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, Bindings.BOOLEAN);
101 if (sizeBarLocation != null) {
102 return new SizeBarOptions()
103 .showSizeBars(show != null ? show : false)
104 .showSizeBarsTicks(showTicks != null ? showTicks : false)
105 .useGradients(useGradients != null ? useGradients : false)
106 .withLocation(SizeBarsLocation.valueOf(sizeBarLocation))
107 .withSize(SizeBarsSize.valueOf(sizeBarSize));
110 return SizeBarOptions.useDefault();
113 public static void setSizeBarOptions(WriteGraph graph, Resource visualisation, SizeBarOptions options) throws DatabaseException {
114 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
115 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarLocation, options.getLocation().toString(), Bindings.STRING);
116 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarSize, options.getSize().toString(), Bindings.STRING);
117 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBars, options.isShowSizeBars(), Bindings.BOOLEAN);
118 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, options.isShowSizeBarsTicks(), Bindings.BOOLEAN);
119 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
122 public static Map<String, DynamicColorContribution> colorContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
123 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
124 if (visualisation == null) {
125 return Collections.emptyMap();
127 Map<String, DynamicColorContribution> contributions = new HashMap<>();
129 Map<String, DynamicColorMap> colorMaps = DynamicVisualisationsContributions.dynamicColorMaps(graph);
131 Collection<Resource> colorContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_colorContributions);
132 for (Resource colorContribution : colorContributions) {
133 String ucName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, Bindings.STRING);
134 String label = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, Bindings.STRING);
135 String moduleName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, Bindings.STRING);
136 String attributeName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, Bindings.STRING);
137 String unit = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, Bindings.STRING);
138 Double variableGain = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, Bindings.DOUBLE);
139 Double variableBias = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, Bindings.DOUBLE);
140 String dynamicColorMap = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, Bindings.STRING);
141 Double defaultMin = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, Bindings.DOUBLE);
142 Double defaultMax = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, Bindings.DOUBLE);
143 Boolean used = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, Bindings.BOOLEAN);
144 Boolean useDefault = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, Bindings.BOOLEAN);
145 DynamicColorContribution dynamicColorContribution = new DynamicColorContribution(label, moduleName, attributeName, unit, variableGain, variableBias, colorMaps.get(dynamicColorMap), defaultMin, defaultMax);
146 dynamicColorContribution.setUsed(used != null ? used : false);
147 dynamicColorContribution.setUseDefault(useDefault != null ? useDefault : false);
148 contributions.put(ucName, dynamicColorContribution);
150 return contributions;
153 public static void setColorContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicColorContribution>> collect) throws DatabaseException {
154 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
155 Layer0 L0 = Layer0.getInstance(graph);
157 graph.deny(visualisation, DN.Diagram_Visualisations_colorContributions);
158 for (Pair<String, DynamicColorContribution> coll : collect) {
159 Resource colorContribution = graph.newResource();
160 graph.claim(colorContribution, L0.InstanceOf, DN.Diagram_Visualisations_ColorContribution);
161 graph.claimLiteral(colorContribution, L0.HasName, coll.first);
163 DynamicColorContribution contr = coll.second;
164 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, coll.first, Bindings.STRING);
165 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, contr.getLabel(), Bindings.STRING);
166 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, contr.getModuleName(), Bindings.STRING);
167 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
168 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, contr.getUnit(), Bindings.STRING);
169 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, contr.getVariableGain(), Bindings.DOUBLE);
170 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, contr.getVariableBias(), Bindings.DOUBLE);
171 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, contr.getDefaultColorMap().getLabel(), Bindings.STRING);
172 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, contr.getDefaultMin(), Bindings.DOUBLE);
173 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, contr.getDefaultMax(), Bindings.DOUBLE);
174 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
175 graph.claimLiteral(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
177 graph.claim(visualisation, DN.Diagram_Visualisations_colorContributions, colorContribution);
181 public static void setEdgeArrowContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicArrowContribution>> edgeArrowCollect) throws DatabaseException {
182 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
183 Layer0 L0 = Layer0.getInstance(graph);
185 graph.deny(visualisation, DN.Diagram_Visualisations_arrowContributions);
186 for (Pair<String, DynamicArrowContribution> coll : edgeArrowCollect) {
187 Resource arrowContribution = graph.newResource();
188 graph.claim(arrowContribution, L0.InstanceOf, DN.Diagram_Visualisations_ArrowContribution);
189 graph.claimLiteral(arrowContribution, L0.HasName, coll.first);
191 DynamicArrowContribution contr = coll.second;
192 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionContributorName, coll.first, Bindings.STRING);
193 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionLabel, contr.getLabel(), Bindings.STRING);
194 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionModuleName, contr.getModuleName(), Bindings.STRING);
195 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
196 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionVariableGain, contr.getDefaultGain(), Bindings.DOUBLE);
197 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionVariableBias, contr.getDefaultBias(), Bindings.DOUBLE);
198 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
199 graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
201 graph.claim(visualisation, DN.Diagram_Visualisations_arrowContributions, arrowContribution);
205 public static Map<String, DynamicSizeContribution> sizeContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
206 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
207 if (visualisation == null) {
208 return Collections.emptyMap();
210 Map<String, DynamicSizeContribution> contributions = new HashMap<>();
212 Map<String, DynamicSizeMap> sizeMaps = DynamicVisualisationsContributions.dynamicSizeMaps(graph);
214 Collection<Resource> sizeContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_sizeContributions);
215 for (Resource sizeContribution : sizeContributions) {
216 String ucName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, Bindings.STRING);
217 String label = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, Bindings.STRING);
218 String moduleName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, Bindings.STRING);
219 String attributeName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, Bindings.STRING);
220 String unit = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, Bindings.STRING);
221 Double variableGain = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, Bindings.DOUBLE);
222 Double variableBias = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, Bindings.DOUBLE);
223 String dynamicSizeMap = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, Bindings.STRING);
224 Double defaultMin = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, Bindings.DOUBLE);
225 Double defaultMax = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, Bindings.DOUBLE);
226 Boolean used = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, Bindings.BOOLEAN);
227 Boolean useDefault = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, Bindings.BOOLEAN);
228 DynamicSizeContribution dsc = new DynamicSizeContribution(label, moduleName, attributeName, unit, variableGain, variableBias, sizeMaps.get(dynamicSizeMap), defaultMin, defaultMax);
229 dsc.setUsed(used != null ? used : false);
230 dsc.setUseDefault(useDefault != null ? useDefault : false);
231 contributions.put(ucName, dsc);
233 return contributions;
236 public static Map<String, DynamicArrowContribution> arrowContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
237 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
238 if (visualisation == null) {
239 return Collections.emptyMap();
241 Map<String, DynamicArrowContribution> contributions = new HashMap<>();
243 Collection<Resource> sizeContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_arrowContributions);
244 for (Resource sizeContribution : sizeContributions) {
245 String ucName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionContributorName, Bindings.STRING);
246 String label = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionLabel, Bindings.STRING);
247 String moduleName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionModuleName, Bindings.STRING);
248 String attributeName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionModuleAttribute, Bindings.STRING);
249 Double variableGain = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionVariableGain, Bindings.DOUBLE);
250 Double variableBias = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionVariableBias, Bindings.DOUBLE);
251 Boolean used = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionUsed, Bindings.BOOLEAN);
252 Boolean useDefault = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionUseDefault, Bindings.BOOLEAN);
253 DynamicArrowContribution dac = new DynamicArrowContribution(label, moduleName, attributeName, variableGain, variableBias);
254 dac.setUsed(used != null ? used : false);
255 dac.setUseDefault(useDefault != null ? useDefault : false);
256 contributions.put(ucName, dac);
258 return contributions;
261 public static void setSizeContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicSizeContribution>> collect) throws DatabaseException {
262 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
263 Layer0 L0 = Layer0.getInstance(graph);
265 graph.deny(visualisation, DN.Diagram_Visualisations_sizeContributions);
266 for (Pair<String, DynamicSizeContribution> coll : collect) {
267 Resource sizeContribution = graph.newResource();
268 graph.claim(sizeContribution, L0.InstanceOf, DN.Diagram_Visualisations_SizeContribution);
269 graph.claimLiteral(sizeContribution, L0.HasName, coll.first);
271 DynamicSizeContribution contr = coll.second;
272 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, coll.first, Bindings.STRING);
273 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, contr.getLabel(), Bindings.STRING);
274 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, contr.getModuleName(), Bindings.STRING);
275 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
276 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, contr.getUnit(), Bindings.STRING);
277 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, contr.getVariableGain(), Bindings.DOUBLE);
278 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, contr.getVariableBias(), Bindings.DOUBLE);
279 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, contr.getDefaultSizeMap().getLabel(), Bindings.STRING);
280 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, contr.getDefaultMin(), Bindings.DOUBLE);
281 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, contr.getDefaultMax(), Bindings.DOUBLE);
282 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
283 graph.claimLiteral(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
285 graph.claim(visualisation, DN.Diagram_Visualisations_sizeContributions, sizeContribution);
289 public static void setActiveVisualisation(WriteGraph graph, Resource diagram, Resource visualisationTemplate) throws DatabaseException {
290 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
291 graph.deny(diagram, DN.Diagram_hasActiveVisualisation);
292 graph.claim(diagram, DN.Diagram_hasActiveVisualisation, visualisationTemplate);
295 public static void setHideElements(WriteGraph graph, Resource visualisation,
301 boolean pumpingStations) throws DatabaseException {
302 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
303 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideEdges, edges, Bindings.BOOLEAN);
304 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HidePoints, points, Bindings.BOOLEAN);
305 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideConsumers, consumers, Bindings.BOOLEAN);
306 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideProducers, producers, Bindings.BOOLEAN);
307 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideValves, valves, Bindings.BOOLEAN);
308 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HidePumpingStations, pumpingStations, Bindings.BOOLEAN);
311 public static void setStaticProperties(WriteGraph graph, Resource visualisation,
312 boolean networkBranches,
314 boolean consumers) throws DatabaseException {
315 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
316 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesNetworkBranches, networkBranches, Bindings.BOOLEAN);
317 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesPoints, points, Bindings.BOOLEAN);
318 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesConsumers, consumers, Bindings.BOOLEAN);
321 public static void setDynamicSymbols(WriteGraph graph, Resource visualisation,
325 boolean pumpingStations) throws DatabaseException {
326 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
327 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsProducers, producers, Bindings.BOOLEAN);
328 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsShutoffValves, edges, Bindings.BOOLEAN);
329 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsValves, valves, Bindings.BOOLEAN);
330 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsPumpingStations, pumpingStations, Bindings.BOOLEAN);
333 public static void setIntervalAndDisabled(WriteGraph graph, Resource visualisation, long interval, boolean disabled, boolean resetVisualisation) throws DatabaseException {
334 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
335 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_Interval, interval, Bindings.LONG);
336 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DisabledUpdates, disabled, Bindings.BOOLEAN);
337 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ResetVisualisation, resetVisualisation, Bindings.BOOLEAN);
340 public static void setKeyVariablesHover(WriteGraph graph, Resource visualisation, boolean hoverVertex, boolean hoverEdges) throws DatabaseException {
341 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
342 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_KeyVariableVertexHover, hoverVertex, Bindings.BOOLEAN);
343 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_KeyVariableEdgeHover, hoverEdges, Bindings.BOOLEAN);
346 public static void setElevationServerBoundingBox(WriteGraph graph, Resource visualisation, boolean elevationServerBoundingBox) throws DatabaseException {
347 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
348 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowElevationServerBoundingBox, elevationServerBoundingBox, Bindings.BOOLEAN);
351 public static Boolean showElevationServerBoundingBox(ReadGraph graph, Resource visualisation) throws DatabaseException {
352 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
353 return graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowElevationServerBoundingBox, Bindings.BOOLEAN);
356 public static void setNotInSimulation(WriteGraph graph, Resource visualisation, boolean notInSimulation) throws DatabaseException {
357 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
358 graph.claimLiteral(visualisation, DN.Diagram_Visualisations_NotInSimulation, notInSimulation, Bindings.BOOLEAN);
361 public static Boolean isNotInSimulation(ReadGraph graph, Resource visualisation) throws DatabaseException {
362 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
363 return graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_NotInSimulation, Bindings.BOOLEAN);