@defProperty "Size Bar Location" L0.String
>-- DN.Diagram.Visualisations.SizeBarSize
@defProperty "Size Bar Size" L0.String
+ >-- DN.Diagram.Visualisations.HideEdges
+ @defProperty "Hide Edges" L0.String
+ >-- DN.Diagram.Visualisations.HidePoints
+ @defProperty "Hide Points" L0.String
+ >-- DN.Diagram.Visualisations.HideConsumers
+ @defProperty "Hide Consumers" L0.String
+ >-- DN.Diagram.Visualisations.HideProducers
+ @defProperty "Hide Producers" L0.String
+ >-- DN.Diagram.Visualisations.HideValves
+ @defProperty "Hide Valves" L0.String
+ >-- DN.Diagram.Visualisations.HidePumpingStations
+ @defProperty "Hide Pumping Stations" L0.String
+ >-- DN.Diagram.Visualisations.StaticPropertiesNetworkBranches
+ @defProperty "Static Properties Network Branches" L0.String
+ >-- DN.Diagram.Visualisations.StaticPropertiesPoints
+ @defProperty "Static Properties Points" L0.String
+ >-- DN.Diagram.Visualisations.StaticPropertiesConsumers
+ @defProperty "Static Properties Consumers" L0.String
+ >-- DN.Diagram.Visualisations.DynamicSymbolsShutoffValves
+ @defProperty "Dynamic Symbols Shutoff Valves" L0.String
+ >-- DN.Diagram.Visualisations.DynamicSymbolsProducers
+ @defProperty "Dynamic Symbols Producers" L0.String
+ >-- DN.Diagram.Visualisations.DynamicSymbolsValves
+ @defProperty "Dynamic Symbols Valves" L0.String
+ >-- DN.Diagram.Visualisations.DynamicSymbolsPumpingStations
+ @defProperty "Dynamic Symbols Pumping Stations" L0.String
DN.Diagram.Visualisations.ColorContribution <T L0.Entity
DN.Diagram.Visualisations.SizeContribution <T L0.Entity
+DN.Diagram.Visualisations.ArrowContribution <T L0.Entity
DN.Diagram.Visualisations.colorContributions <R L0.HasProperty
DN.Diagram.Visualisations.sizeContributions <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributions <R L0.HasProperty
DN.Diagram.Visualisations.colorContributionContributorName <R L0.HasProperty
DN.Diagram.Visualisations.colorContributionLabel <R L0.HasProperty
DN.Diagram.Visualisations.sizeContributionUsed <R L0.HasProperty
DN.Diagram.Visualisations.sizeContributionUseDefault <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionContributorName <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionLabel <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionModuleName <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionModuleAttribute <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionVariableGain <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionVariableBias <R L0.HasProperty
+// for graph persistence only
+DN.Diagram.Visualisations.arrowContributionUsed <R L0.HasProperty
+DN.Diagram.Visualisations.arrowContributionUseDefault <R L0.HasProperty
// End of dynamic visualisations
DN.Edge.ThicknessProperty <T L0.Value
DN.Diagram
- >-- DN.Diagram.arrowLengthGain ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Arrow Length Gain"
- >-- DN.Diagram.arrowLengthBias ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Arrow Length Bias"
- >-- DN.Diagram.arrowLengthProperty --> DN.Edge.ArrowLengthProperty <R L0.HasProperty : DN.ArrowLengthPropertyParameterType
- L0.HasLabel "Arrow Length Property"
>-- DN.Diagram.backgroundColor --> DATATYPES.RGB.Integer <R L0.HasProperty : SEL.ColorParameterType
L0.HasLabel "Diagram Background Color"
>-- DN.Diagram.drawMapEnabled ==> "Boolean" <R L0.HasProperty : SEL.GenericParameterType
// >-- DN.Diagram.profileUpdateInterval ==> "Long" <R L0.HasProperty : SEL.GenericParameterType
// L0.HasLabel "Profile update interval"
- @L0.assert DN.Diagram.arrowLengthGain 1.0
- @L0.assert DN.Diagram.arrowLengthBias 0.0
- @L0.assert DN.Diagram.arrowLengthProperty DN.Edge.ArrowLengthProperty.FlowRate
@L0.assert DN.Diagram.drawMapEnabled true
// Removed by Jani as the intervalled profile update is not currently working
// @L0.assert DN.Diagram.profileUpdateInterval
DN.Functions.hasNominalMassFlowValue : L0.Function
L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
-
-DN.Edge.ArrowLengthProperty.FlowRate : DN.Edge.ArrowLengthProperty
- L0.HasLabel "Nominal Mass Flow"
- DN.Edge.ArrowLengthProperty.value
- DN.Functions.hasNominalMassFlowValue
- DN.Edge.ArrowLengthProperty.gain 1.0
public final Resource Diagram_MappedDiagram;
public final Resource Diagram_MappedFromDiagram;
public final Resource Diagram_Visualisations;
+ public final Resource Diagram_Visualisations_ArrowContribution;
public final Resource Diagram_Visualisations_ColorBarLocation;
public final Resource Diagram_Visualisations_ColorBarLocation_Inverse;
public final Resource Diagram_Visualisations_ColorBarSize;
public final Resource Diagram_Visualisations_ColorBarSize_Inverse;
public final Resource Diagram_Visualisations_ColorContribution;
+ public final Resource Diagram_Visualisations_DynamicSymbolsProducers;
+ public final Resource Diagram_Visualisations_DynamicSymbolsProducers_Inverse;
+ public final Resource Diagram_Visualisations_DynamicSymbolsPumpingStations;
+ public final Resource Diagram_Visualisations_DynamicSymbolsPumpingStations_Inverse;
+ public final Resource Diagram_Visualisations_DynamicSymbolsShutoffValves;
+ public final Resource Diagram_Visualisations_DynamicSymbolsShutoffValves_Inverse;
+ public final Resource Diagram_Visualisations_DynamicSymbolsValves;
+ public final Resource Diagram_Visualisations_DynamicSymbolsValves_Inverse;
+ public final Resource Diagram_Visualisations_HideConsumers;
+ public final Resource Diagram_Visualisations_HideConsumers_Inverse;
+ public final Resource Diagram_Visualisations_HideEdges;
+ public final Resource Diagram_Visualisations_HideEdges_Inverse;
+ public final Resource Diagram_Visualisations_HidePoints;
+ public final Resource Diagram_Visualisations_HidePoints_Inverse;
+ public final Resource Diagram_Visualisations_HideProducers;
+ public final Resource Diagram_Visualisations_HideProducers_Inverse;
+ public final Resource Diagram_Visualisations_HidePumpingStations;
+ public final Resource Diagram_Visualisations_HidePumpingStations_Inverse;
+ public final Resource Diagram_Visualisations_HideValves;
+ public final Resource Diagram_Visualisations_HideValves_Inverse;
public final Resource Diagram_Visualisations_ShowColorBarTicks;
public final Resource Diagram_Visualisations_ShowColorBarTicks_Inverse;
public final Resource Diagram_Visualisations_ShowColorBars;
public final Resource Diagram_Visualisations_SizeBarSize;
public final Resource Diagram_Visualisations_SizeBarSize_Inverse;
public final Resource Diagram_Visualisations_SizeContribution;
+ public final Resource Diagram_Visualisations_StaticPropertiesConsumers;
+ public final Resource Diagram_Visualisations_StaticPropertiesConsumers_Inverse;
+ public final Resource Diagram_Visualisations_StaticPropertiesNetworkBranches;
+ public final Resource Diagram_Visualisations_StaticPropertiesNetworkBranches_Inverse;
+ public final Resource Diagram_Visualisations_StaticPropertiesPoints;
+ public final Resource Diagram_Visualisations_StaticPropertiesPoints_Inverse;
public final Resource Diagram_Visualisations_UseColorBarGradients;
public final Resource Diagram_Visualisations_UseColorBarGradients_Inverse;
public final Resource Diagram_Visualisations_UseSizeBarGradients;
public final Resource Diagram_Visualisations_UseSizeBarGradients_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionContributorName;
+ public final Resource Diagram_Visualisations_arrowContributionContributorName_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionLabel;
+ public final Resource Diagram_Visualisations_arrowContributionLabel_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionModuleAttribute;
+ public final Resource Diagram_Visualisations_arrowContributionModuleAttribute_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionModuleName;
+ public final Resource Diagram_Visualisations_arrowContributionModuleName_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionUseDefault;
+ public final Resource Diagram_Visualisations_arrowContributionUseDefault_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionUsed;
+ public final Resource Diagram_Visualisations_arrowContributionUsed_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionVariableBias;
+ public final Resource Diagram_Visualisations_arrowContributionVariableBias_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributionVariableGain;
+ public final Resource Diagram_Visualisations_arrowContributionVariableGain_Inverse;
+ public final Resource Diagram_Visualisations_arrowContributions;
+ public final Resource Diagram_Visualisations_arrowContributions_Inverse;
public final Resource Diagram_Visualisations_colorContributionContributorName;
public final Resource Diagram_Visualisations_colorContributionContributorName_Inverse;
public final Resource Diagram_Visualisations_colorContributionDefaultColorMap;
public final Resource Diagram_Visualisations_sizeContributionVariableGain_Inverse;
public final Resource Diagram_Visualisations_sizeContributions;
public final Resource Diagram_Visualisations_sizeContributions_Inverse;
- public final Resource Diagram_arrowLengthBias;
- public final Resource Diagram_arrowLengthBias_Inverse;
- public final Resource Diagram_arrowLengthGain;
- public final Resource Diagram_arrowLengthGain_Inverse;
- public final Resource Diagram_arrowLengthProperty;
- public final Resource Diagram_arrowLengthProperty_Inverse;
public final Resource Diagram_backgroundColor;
public final Resource Diagram_backgroundColor_Inverse;
public final Resource Diagram_drawMapEnabled;
public final Resource EdgeDefaultMapping_Inverse;
public final Resource EdgeMappingParameterType;
public final Resource Edge_ArrowLengthProperty;
- public final Resource Edge_ArrowLengthProperty_FlowRate;
public final Resource Edge_ArrowLengthProperty_bias;
public final Resource Edge_ArrowLengthProperty_bias_Inverse;
public final Resource Edge_ArrowLengthProperty_gain;
public static final String Diagram_MappedDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/MappedDiagram";
public static final String Diagram_MappedFromDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/MappedFromDiagram";
public static final String Diagram_Visualisations = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations";
+ public static final String Diagram_Visualisations_ArrowContribution = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ArrowContribution";
public static final String Diagram_Visualisations_ColorBarLocation = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ColorBarLocation";
public static final String Diagram_Visualisations_ColorBarLocation_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ColorBarLocation/Inverse";
public static final String Diagram_Visualisations_ColorBarSize = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ColorBarSize";
public static final String Diagram_Visualisations_ColorBarSize_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ColorBarSize/Inverse";
public static final String Diagram_Visualisations_ColorContribution = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ColorContribution";
+ public static final String Diagram_Visualisations_DynamicSymbolsProducers = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsProducers";
+ public static final String Diagram_Visualisations_DynamicSymbolsProducers_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsProducers/Inverse";
+ public static final String Diagram_Visualisations_DynamicSymbolsPumpingStations = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsPumpingStations";
+ public static final String Diagram_Visualisations_DynamicSymbolsPumpingStations_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsPumpingStations/Inverse";
+ public static final String Diagram_Visualisations_DynamicSymbolsShutoffValves = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsShutoffValves";
+ public static final String Diagram_Visualisations_DynamicSymbolsShutoffValves_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsShutoffValves/Inverse";
+ public static final String Diagram_Visualisations_DynamicSymbolsValves = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsValves";
+ public static final String Diagram_Visualisations_DynamicSymbolsValves_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/DynamicSymbolsValves/Inverse";
+ public static final String Diagram_Visualisations_HideConsumers = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideConsumers";
+ public static final String Diagram_Visualisations_HideConsumers_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideConsumers/Inverse";
+ public static final String Diagram_Visualisations_HideEdges = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideEdges";
+ public static final String Diagram_Visualisations_HideEdges_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideEdges/Inverse";
+ public static final String Diagram_Visualisations_HidePoints = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HidePoints";
+ public static final String Diagram_Visualisations_HidePoints_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HidePoints/Inverse";
+ public static final String Diagram_Visualisations_HideProducers = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideProducers";
+ public static final String Diagram_Visualisations_HideProducers_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideProducers/Inverse";
+ public static final String Diagram_Visualisations_HidePumpingStations = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HidePumpingStations";
+ public static final String Diagram_Visualisations_HidePumpingStations_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HidePumpingStations/Inverse";
+ public static final String Diagram_Visualisations_HideValves = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideValves";
+ public static final String Diagram_Visualisations_HideValves_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/HideValves/Inverse";
public static final String Diagram_Visualisations_ShowColorBarTicks = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ShowColorBarTicks";
public static final String Diagram_Visualisations_ShowColorBarTicks_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ShowColorBarTicks/Inverse";
public static final String Diagram_Visualisations_ShowColorBars = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/ShowColorBars";
public static final String Diagram_Visualisations_SizeBarSize = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/SizeBarSize";
public static final String Diagram_Visualisations_SizeBarSize_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/SizeBarSize/Inverse";
public static final String Diagram_Visualisations_SizeContribution = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/SizeContribution";
+ public static final String Diagram_Visualisations_StaticPropertiesConsumers = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesConsumers";
+ public static final String Diagram_Visualisations_StaticPropertiesConsumers_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesConsumers/Inverse";
+ public static final String Diagram_Visualisations_StaticPropertiesNetworkBranches = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesNetworkBranches";
+ public static final String Diagram_Visualisations_StaticPropertiesNetworkBranches_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesNetworkBranches/Inverse";
+ public static final String Diagram_Visualisations_StaticPropertiesPoints = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesPoints";
+ public static final String Diagram_Visualisations_StaticPropertiesPoints_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/StaticPropertiesPoints/Inverse";
public static final String Diagram_Visualisations_UseColorBarGradients = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/UseColorBarGradients";
public static final String Diagram_Visualisations_UseColorBarGradients_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/UseColorBarGradients/Inverse";
public static final String Diagram_Visualisations_UseSizeBarGradients = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/UseSizeBarGradients";
public static final String Diagram_Visualisations_UseSizeBarGradients_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/UseSizeBarGradients/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionContributorName = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionContributorName";
+ public static final String Diagram_Visualisations_arrowContributionContributorName_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionContributorName/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionLabel = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionLabel";
+ public static final String Diagram_Visualisations_arrowContributionLabel_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionLabel/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionModuleAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionModuleAttribute";
+ public static final String Diagram_Visualisations_arrowContributionModuleAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionModuleAttribute/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionModuleName = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionModuleName";
+ public static final String Diagram_Visualisations_arrowContributionModuleName_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionModuleName/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionUseDefault = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionUseDefault";
+ public static final String Diagram_Visualisations_arrowContributionUseDefault_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionUseDefault/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionUsed = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionUsed";
+ public static final String Diagram_Visualisations_arrowContributionUsed_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionUsed/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionVariableBias = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionVariableBias";
+ public static final String Diagram_Visualisations_arrowContributionVariableBias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionVariableBias/Inverse";
+ public static final String Diagram_Visualisations_arrowContributionVariableGain = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionVariableGain";
+ public static final String Diagram_Visualisations_arrowContributionVariableGain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributionVariableGain/Inverse";
+ public static final String Diagram_Visualisations_arrowContributions = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributions";
+ public static final String Diagram_Visualisations_arrowContributions_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/arrowContributions/Inverse";
public static final String Diagram_Visualisations_colorContributionContributorName = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/colorContributionContributorName";
public static final String Diagram_Visualisations_colorContributionContributorName_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/colorContributionContributorName/Inverse";
public static final String Diagram_Visualisations_colorContributionDefaultColorMap = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/colorContributionDefaultColorMap";
public static final String Diagram_Visualisations_sizeContributionVariableGain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/sizeContributionVariableGain/Inverse";
public static final String Diagram_Visualisations_sizeContributions = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/sizeContributions";
public static final String Diagram_Visualisations_sizeContributions_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/Visualisations/sizeContributions/Inverse";
- public static final String Diagram_arrowLengthBias = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthBias";
- public static final String Diagram_arrowLengthBias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthBias/Inverse";
- public static final String Diagram_arrowLengthGain = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthGain";
- public static final String Diagram_arrowLengthGain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthGain/Inverse";
- public static final String Diagram_arrowLengthProperty = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthProperty";
- public static final String Diagram_arrowLengthProperty_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/arrowLengthProperty/Inverse";
public static final String Diagram_backgroundColor = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/backgroundColor";
public static final String Diagram_backgroundColor_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/backgroundColor/Inverse";
public static final String Diagram_drawMapEnabled = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/drawMapEnabled";
public static final String EdgeDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping/Inverse";
public static final String EdgeMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeMappingParameterType";
public static final String Edge_ArrowLengthProperty = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty";
- public static final String Edge_ArrowLengthProperty_FlowRate = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/FlowRate";
public static final String Edge_ArrowLengthProperty_bias = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/bias";
public static final String Edge_ArrowLengthProperty_bias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/bias/Inverse";
public static final String Edge_ArrowLengthProperty_gain = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/gain";
Diagram_MappedDiagram = getResourceOrNull(graph, URIs.Diagram_MappedDiagram);
Diagram_MappedFromDiagram = getResourceOrNull(graph, URIs.Diagram_MappedFromDiagram);
Diagram_Visualisations = getResourceOrNull(graph, URIs.Diagram_Visualisations);
+ Diagram_Visualisations_ArrowContribution = getResourceOrNull(graph, URIs.Diagram_Visualisations_ArrowContribution);
Diagram_Visualisations_ColorBarLocation = getResourceOrNull(graph, URIs.Diagram_Visualisations_ColorBarLocation);
Diagram_Visualisations_ColorBarLocation_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_ColorBarLocation_Inverse);
Diagram_Visualisations_ColorBarSize = getResourceOrNull(graph, URIs.Diagram_Visualisations_ColorBarSize);
Diagram_Visualisations_ColorBarSize_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_ColorBarSize_Inverse);
Diagram_Visualisations_ColorContribution = getResourceOrNull(graph, URIs.Diagram_Visualisations_ColorContribution);
+ Diagram_Visualisations_DynamicSymbolsProducers = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsProducers);
+ Diagram_Visualisations_DynamicSymbolsProducers_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsProducers_Inverse);
+ Diagram_Visualisations_DynamicSymbolsPumpingStations = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsPumpingStations);
+ Diagram_Visualisations_DynamicSymbolsPumpingStations_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsPumpingStations_Inverse);
+ Diagram_Visualisations_DynamicSymbolsShutoffValves = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsShutoffValves);
+ Diagram_Visualisations_DynamicSymbolsShutoffValves_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsShutoffValves_Inverse);
+ Diagram_Visualisations_DynamicSymbolsValves = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsValves);
+ Diagram_Visualisations_DynamicSymbolsValves_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_DynamicSymbolsValves_Inverse);
+ Diagram_Visualisations_HideConsumers = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideConsumers);
+ Diagram_Visualisations_HideConsumers_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideConsumers_Inverse);
+ Diagram_Visualisations_HideEdges = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideEdges);
+ Diagram_Visualisations_HideEdges_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideEdges_Inverse);
+ Diagram_Visualisations_HidePoints = getResourceOrNull(graph, URIs.Diagram_Visualisations_HidePoints);
+ Diagram_Visualisations_HidePoints_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HidePoints_Inverse);
+ Diagram_Visualisations_HideProducers = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideProducers);
+ Diagram_Visualisations_HideProducers_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideProducers_Inverse);
+ Diagram_Visualisations_HidePumpingStations = getResourceOrNull(graph, URIs.Diagram_Visualisations_HidePumpingStations);
+ Diagram_Visualisations_HidePumpingStations_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HidePumpingStations_Inverse);
+ Diagram_Visualisations_HideValves = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideValves);
+ Diagram_Visualisations_HideValves_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_HideValves_Inverse);
Diagram_Visualisations_ShowColorBarTicks = getResourceOrNull(graph, URIs.Diagram_Visualisations_ShowColorBarTicks);
Diagram_Visualisations_ShowColorBarTicks_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_ShowColorBarTicks_Inverse);
Diagram_Visualisations_ShowColorBars = getResourceOrNull(graph, URIs.Diagram_Visualisations_ShowColorBars);
Diagram_Visualisations_SizeBarSize = getResourceOrNull(graph, URIs.Diagram_Visualisations_SizeBarSize);
Diagram_Visualisations_SizeBarSize_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_SizeBarSize_Inverse);
Diagram_Visualisations_SizeContribution = getResourceOrNull(graph, URIs.Diagram_Visualisations_SizeContribution);
+ Diagram_Visualisations_StaticPropertiesConsumers = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesConsumers);
+ Diagram_Visualisations_StaticPropertiesConsumers_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesConsumers_Inverse);
+ Diagram_Visualisations_StaticPropertiesNetworkBranches = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesNetworkBranches);
+ Diagram_Visualisations_StaticPropertiesNetworkBranches_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesNetworkBranches_Inverse);
+ Diagram_Visualisations_StaticPropertiesPoints = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesPoints);
+ Diagram_Visualisations_StaticPropertiesPoints_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_StaticPropertiesPoints_Inverse);
Diagram_Visualisations_UseColorBarGradients = getResourceOrNull(graph, URIs.Diagram_Visualisations_UseColorBarGradients);
Diagram_Visualisations_UseColorBarGradients_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_UseColorBarGradients_Inverse);
Diagram_Visualisations_UseSizeBarGradients = getResourceOrNull(graph, URIs.Diagram_Visualisations_UseSizeBarGradients);
Diagram_Visualisations_UseSizeBarGradients_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_UseSizeBarGradients_Inverse);
+ Diagram_Visualisations_arrowContributionContributorName = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionContributorName);
+ Diagram_Visualisations_arrowContributionContributorName_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionContributorName_Inverse);
+ Diagram_Visualisations_arrowContributionLabel = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionLabel);
+ Diagram_Visualisations_arrowContributionLabel_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionLabel_Inverse);
+ Diagram_Visualisations_arrowContributionModuleAttribute = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionModuleAttribute);
+ Diagram_Visualisations_arrowContributionModuleAttribute_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionModuleAttribute_Inverse);
+ Diagram_Visualisations_arrowContributionModuleName = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionModuleName);
+ Diagram_Visualisations_arrowContributionModuleName_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionModuleName_Inverse);
+ Diagram_Visualisations_arrowContributionUseDefault = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionUseDefault);
+ Diagram_Visualisations_arrowContributionUseDefault_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionUseDefault_Inverse);
+ Diagram_Visualisations_arrowContributionUsed = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionUsed);
+ Diagram_Visualisations_arrowContributionUsed_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionUsed_Inverse);
+ Diagram_Visualisations_arrowContributionVariableBias = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionVariableBias);
+ Diagram_Visualisations_arrowContributionVariableBias_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionVariableBias_Inverse);
+ Diagram_Visualisations_arrowContributionVariableGain = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionVariableGain);
+ Diagram_Visualisations_arrowContributionVariableGain_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributionVariableGain_Inverse);
+ Diagram_Visualisations_arrowContributions = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributions);
+ Diagram_Visualisations_arrowContributions_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_arrowContributions_Inverse);
Diagram_Visualisations_colorContributionContributorName = getResourceOrNull(graph, URIs.Diagram_Visualisations_colorContributionContributorName);
Diagram_Visualisations_colorContributionContributorName_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_colorContributionContributorName_Inverse);
Diagram_Visualisations_colorContributionDefaultColorMap = getResourceOrNull(graph, URIs.Diagram_Visualisations_colorContributionDefaultColorMap);
Diagram_Visualisations_sizeContributionVariableGain_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_sizeContributionVariableGain_Inverse);
Diagram_Visualisations_sizeContributions = getResourceOrNull(graph, URIs.Diagram_Visualisations_sizeContributions);
Diagram_Visualisations_sizeContributions_Inverse = getResourceOrNull(graph, URIs.Diagram_Visualisations_sizeContributions_Inverse);
- Diagram_arrowLengthBias = getResourceOrNull(graph, URIs.Diagram_arrowLengthBias);
- Diagram_arrowLengthBias_Inverse = getResourceOrNull(graph, URIs.Diagram_arrowLengthBias_Inverse);
- Diagram_arrowLengthGain = getResourceOrNull(graph, URIs.Diagram_arrowLengthGain);
- Diagram_arrowLengthGain_Inverse = getResourceOrNull(graph, URIs.Diagram_arrowLengthGain_Inverse);
- Diagram_arrowLengthProperty = getResourceOrNull(graph, URIs.Diagram_arrowLengthProperty);
- Diagram_arrowLengthProperty_Inverse = getResourceOrNull(graph, URIs.Diagram_arrowLengthProperty_Inverse);
Diagram_backgroundColor = getResourceOrNull(graph, URIs.Diagram_backgroundColor);
Diagram_backgroundColor_Inverse = getResourceOrNull(graph, URIs.Diagram_backgroundColor_Inverse);
Diagram_drawMapEnabled = getResourceOrNull(graph, URIs.Diagram_drawMapEnabled);
EdgeDefaultMapping_Inverse = getResourceOrNull(graph, URIs.EdgeDefaultMapping_Inverse);
EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType);
Edge_ArrowLengthProperty = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty);
- Edge_ArrowLengthProperty_FlowRate = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_FlowRate);
Edge_ArrowLengthProperty_bias = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_bias);
Edge_ArrowLengthProperty_bias_Inverse = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_bias_Inverse);
Edge_ArrowLengthProperty_gain = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_gain);
import java.awt.geom.AffineTransform;
import java.util.Collections;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.simantics.district.network.ui.participants.DynamicVisualisationContributionsParticipant;
import org.simantics.district.network.ui.participants.ElevationServerParticipant;
import org.simantics.district.network.ui.participants.MapRulerPainter;
+import org.simantics.district.network.visualisations.DynamicVisualisations;
import org.simantics.district.network.visualisations.model.ColorBarOptions;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
public class DistrictDiagramViewer extends DiagramViewer {
- @SuppressWarnings("unused")
private static final Logger LOGGER = LoggerFactory.getLogger(DistrictDiagramViewer.class);
@Override
protected String getPopupId() {
return "#DistrictDiagramPopup";
}
-
+
+ @Override
+ protected void fillInitialDiagramHints(Resource diagram, IHintContext initialHints) throws DatabaseException {
+ super.fillInitialDiagramHints(diagram, initialHints);
+
+ }
+
@Override
public void initializeCanvasContext(CanvasContext ctx) {
super.initializeCanvasContext(ctx);
private Consumer<Boolean> callback;
private Supplier<Boolean> isDisposed;
+
+ private Boolean lastResult;
public DrawMapEnabledListener(Consumer<Boolean> callback, Supplier<Boolean> isDisposed) {
this.callback = callback;
@Override
public void execute(Boolean result) {
- callback.accept(result);
+ // Minor optimization
+ if (!Objects.equals(lastResult, result)) {
+ lastResult = result;
+ callback.accept(result);
+ }
}
@Override
private Consumer<RGB.Integer> callback;
private Supplier<Boolean> isDisposed;
+
+ private RGB.Integer lastResult;
public MapBackgroundColorListener(Consumer<RGB.Integer> callback, Supplier<Boolean> isDisposed) {
this.callback = callback;
@Override
public void execute(RGB.Integer result) {
- callback.accept(result);
+ if (!Objects.equals(lastResult, result)) {
+ lastResult = result;
+ callback.accept(result);
+ }
}
@Override
public ColorBarOptions perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DistrictNetworkUtil.getVisualisationFolder(graph, model);
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
if (vf != null) {
Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
if (activeVisualisation != null) {
- return DistrictNetworkUtil.colorBarOptions(graph, activeVisualisation);
+ return DynamicVisualisations.colorBarOptions(graph, activeVisualisation);
}
} else {
LOGGER.debug("No visualisation folder available for model {}", model);
public Map<String, DynamicColorContribution> perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DistrictNetworkUtil.getVisualisationFolder(graph, model);
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
if (vf != null) {
Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
if (activeVisualisation != null) {
- return DistrictNetworkUtil.colorContributions(graph, activeVisualisation);
+ return DynamicVisualisations.colorContributions(graph, activeVisualisation);
}
} else {
LOGGER.debug("No visualisation folder available for model {}", model);
private Consumer<Map<String,DynamicColorContribution>> callback;
private Supplier<Boolean> isDisposed;
+
+ //private Map<String, DynamicColorContribution> lastResult
public ColoringObjectsListener(Consumer<Map<String,DynamicColorContribution>> callback, Supplier<Boolean> isDisposed) {
this.callback = callback;
public SizeBarOptions perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DistrictNetworkUtil.getVisualisationFolder(graph, model);
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
if (vf != null) {
Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
if (activeVisualisation != null) {
- return DistrictNetworkUtil.sizeBarOptions(graph, activeVisualisation);
+ return DynamicVisualisations.sizeBarOptions(graph, activeVisualisation);
}
} else {
LOGGER.debug("No visualisation folder available for model {}", model);
public Map<String, DynamicSizeContribution> perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DistrictNetworkUtil.getVisualisationFolder(graph, model);
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
if (vf != null) {
Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
if (activeVisualisation != null) {
- return DistrictNetworkUtil.sizeContributions(graph, activeVisualisation);
+ return DynamicVisualisations.sizeContributions(graph, activeVisualisation);
}
} else {
LOGGER.debug("No visualisation folder available for model {}", model);
.collect(Collectors.toList());
}
- @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
- public static Object arrowLengthPropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return listInstanceNames(graph, context, DN.Edge_ArrowLengthProperty);
- }
-
- @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
- public static Object arrowLengthPropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- Resource diagram = resolveElement(graph, context);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return baseMappingModifier(graph, diagram, DN.Diagram_arrowLengthProperty, DN.Edge_ArrowLengthProperty, context);
- }
-
@SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
public static Function1<Resource, Double> hasDiameterValue(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
return directPropertyValueFunction(DistrictNetworkResource.getInstance(graph).Edge_HasDiameter, 0);
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.util.RemoverUtil;
import org.simantics.db.procedure.Listener;
-import org.simantics.district.network.DistrictNetworkUtil;
import org.simantics.district.network.profile.ActiveDynamicVisualisationsRequest;
import org.simantics.district.network.profile.DynamicVisualisationsRequest;
+import org.simantics.district.network.visualisations.DynamicVisualisations;
import org.simantics.district.network.visualisations.DynamicVisualisationsContributions;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicArrowObject;
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.ColorBarOptions.ColorBarsLocation;
import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsSize;
+import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicColorMap;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DynamicVisualisationsUI extends Composite {
+public class DynamicVisualisationsUI {
private static final Logger LOGGER = LoggerFactory.getLogger(DynamicVisualisationsUI.class);
private Button removeVisualisationTemplateButton;
- public DynamicVisualisationsUI(Composite parent, int style) {
- super(parent, style);
-// ScrolledComposite scrolledComposite = new ScrolledComposite(this, SWT.V_SCROLL);
-// scrolledComposite.setLayout(new GridLayout(1, false));
-// scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-//
-// Composite firstContent = new Composite(scrolledComposite, SWT.NONE);
-// firstContent.setLayout(new GridLayout(1, false));
-// firstContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- defaultInitializeUI(this);
+ private Composite parent;
+
+ private Button disableUpdatesButton;
+
+ private List<Supplier<Pair<String, DynamicArrowContribution>>> edgeArrowSuppliers;
+
+ private Button saveVisualisationTemplateAsButton;
+
+ private Button hideEdgesButton;
+ private Button hidePointsButton;
+ private Button hideConsumersButton;
+ private Button hideProducersButton;
+ private Button hideValvesButton;
+ private Button hidePumpingStationsButton;
+
+ private Button networkBranchesStaticPropertiesButton;
+ private Button pointsStaticPropertiesButton;
+ private Button consumersStaticPropertiesButton;
+
+ private Button dynamicSymbolsEdgesButton;
+ private Button dynamicSymbolsProducersButton;
+ private Button dynamicSymbolsValvesButton;
+ private Button dynamicSymbolsPumpingStationsButton;
+
+ public DynamicVisualisationsUI(Composite parent) {
+ this.parent = parent;
+ ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
+ scrolledComposite.setLayout(new GridLayout(1, false));
+ scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Composite firstContent = new Composite(scrolledComposite, SWT.NONE);
+ firstContent.setLayout(new GridLayout(1, false));
+ firstContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-// scrolledComposite.setContent(firstContent);
-// scrolledComposite.setExpandHorizontal(true);
-// scrolledComposite.setExpandVertical(true);
-// scrolledComposite.setMinSize(firstContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ defaultInitializeUI(firstContent);
+ scrolledComposite.setContent(firstContent);
+ scrolledComposite.setExpandHorizontal(true);
+ scrolledComposite.setExpandVertical(true);
+ scrolledComposite.setMinSize(firstContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
private void defaultInitializeUI(Composite parent) {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
- Resource vf = DistrictNetworkUtil.getVisualisationFolder(graph, parentResource);
- DistrictNetworkUtil.setActiveVisualisation(graph, vf, template.getResource());
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, parentResource);
+ DynamicVisualisations.setActiveVisualisation(graph, vf, template.getResource());
}
});
break;
}
});
+ Composite hideElementsComposite = new Composite(parent, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(hideElementsComposite);
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(hideElementsComposite);
+ initializeHideElements(hideElementsComposite);
+
+ Composite staticPropertiesComposite = new Composite(parent, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(staticPropertiesComposite);
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(staticPropertiesComposite);
+ initializeStaticProperties(staticPropertiesComposite);
+
+ Composite dynamicSymbolsComposite = new Composite(parent, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(dynamicSymbolsComposite);
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(dynamicSymbolsComposite);
+ initializeDynamicSymbols(dynamicSymbolsComposite);
+
Composite coloringObjectsComposite = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(coloringObjectsComposite);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(coloringObjectsComposite);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(sizeBarsComposite);
initializeSizeBars(sizeBarsComposite);
+ Composite edgeArrowsComposite = new Composite(parent, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(edgeArrowsComposite);
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(edgeArrowsComposite);
+ initializeEdgeArrows(edgeArrowsComposite);
+
Composite buttonBarsComposite = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonBarsComposite);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonBarsComposite);
- Button saveVisualisationTemplateAsButton = new Button(buttonBarsComposite, SWT.NONE);
+ saveVisualisationTemplateAsButton = new Button(buttonBarsComposite, SWT.NONE);
saveVisualisationTemplateAsButton.setText("Save as visualisation template");
saveVisualisationTemplateAsButton.addSelectionListener(new SelectionAdapter() {
}
});
+ disableUpdatesButton = new Button(buttonBarsComposite, SWT.CHECK);
+ disableUpdatesButton.setText("Disable updates");
+ disableUpdatesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ disableUpdates();
+ }
+ });
}
+ private void initializeHideElements(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Hide Elements");
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(8).margins(5, 5).applyTo(group);
+
+ createHideElements(group);
+ }
+
+ private void createHideElements(Composite parent) {
+
+ hideEdgesButton = new Button(parent, SWT.CHECK);
+ hideEdgesButton.setText("Edges");
+ addSelectionListener(hideEdgesButton);
+
+ hidePointsButton = new Button(parent, SWT.CHECK);
+ hidePointsButton.setText("Points");
+ addSelectionListener(hidePointsButton);
+
+ hideConsumersButton = new Button(parent, SWT.CHECK);
+ hideConsumersButton.setText("Consumers");
+ addSelectionListener(hideConsumersButton);
+
+ hideProducersButton = new Button(parent, SWT.CHECK);
+ hideProducersButton.setText("Producers");
+ addSelectionListener(hideProducersButton);
+
+ hideValvesButton = new Button(parent, SWT.CHECK);
+ hideValvesButton.setText("Valves");
+ addSelectionListener(hideValvesButton);
+
+ hidePumpingStationsButton = new Button(parent, SWT.CHECK);
+ hidePumpingStationsButton.setText("Pumping Stations");
+ addSelectionListener(hidePumpingStationsButton);
+ }
+
+ private void initializeStaticProperties(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Static Properties");
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(8).margins(5, 5).applyTo(group);
+
+ createStaticProperties(group);
+ }
+
+ private void createStaticProperties(Composite parent) {
+
+ networkBranchesStaticPropertiesButton = new Button(parent, SWT.CHECK);
+ networkBranchesStaticPropertiesButton.setText("Network Branches");
+ addSelectionListener(networkBranchesStaticPropertiesButton);
+
+ pointsStaticPropertiesButton = new Button(parent, SWT.CHECK);
+ pointsStaticPropertiesButton.setText("Points");
+ addSelectionListener(pointsStaticPropertiesButton);
+
+ consumersStaticPropertiesButton = new Button(parent, SWT.CHECK);
+ consumersStaticPropertiesButton.setText("Consumers");
+ addSelectionListener(consumersStaticPropertiesButton);
+
+ }
+
+ private void initializeDynamicSymbols(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Dynamic Symbols");
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(8).margins(5, 5).applyTo(group);
+
+ createDynamicSymbols(group);
+ }
+
+ private void createDynamicSymbols(Composite parent) {
+
+ dynamicSymbolsEdgesButton = new Button(parent, SWT.CHECK);
+ dynamicSymbolsEdgesButton.setText("Shutoff Valves in Pipes");
+ addSelectionListener(dynamicSymbolsEdgesButton);
+
+ dynamicSymbolsProducersButton = new Button(parent, SWT.CHECK);
+ dynamicSymbolsProducersButton.setText("Producers");
+ addSelectionListener(dynamicSymbolsProducersButton);
+
+ dynamicSymbolsValvesButton = new Button(parent, SWT.CHECK);
+ dynamicSymbolsValvesButton.setText("Valves");
+ addSelectionListener(dynamicSymbolsValvesButton);
+
+ dynamicSymbolsPumpingStationsButton = new Button(parent, SWT.CHECK);
+ dynamicSymbolsPumpingStationsButton.setText("Pumping Stations");
+ addSelectionListener(dynamicSymbolsPumpingStationsButton);
+ }
+
+ private void initializeEdgeArrows(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Edge Arrows");
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(6).margins(5, 5).applyTo(group);
+
+ createEdgeArrowsHeaderRow(group);
+
+ edgeArrowSuppliers = new ArrayList<>();
+ {
+ try {
+ Collection<DynamicArrowObject> result = Simantics.getSession().syncRequest(new UniqueRead<Collection<DynamicArrowObject>>() {
+
+ @Override
+ public Collection<DynamicArrowObject> perform(ReadGraph graph) throws DatabaseException {
+ return DynamicVisualisationsContributions.dynamicEdgeArrowObjects(graph);
+ }
+ });
+
+ for (DynamicArrowObject object : result) {
+ edgeArrowSuppliers.add(createEdgeArrowRow(group, object));
+ }
+ } catch (DatabaseException e) {
+ LOGGER.error("Could not create coloring objecst", e);
+ }
+ }
+ }
+
+
+ private void createEdgeArrowsHeaderRow(Composite parent) {
+
+ Label label = new Label(parent, SWT.NONE);
+ label.setText("Label");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ label = new Label(parent, SWT.NONE);
+ label.setText("Used");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ label = new Label(parent, SWT.NONE);
+ label.setText("Variable");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ label = new Label(parent, SWT.NONE);
+ label.setText("Gain");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ label = new Label(parent, SWT.NONE);
+ label.setText("Bias");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ label = new Label(parent, SWT.NONE);
+ label.setText("Default");
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(label);
+ }
+
+ private Supplier<Pair<String, DynamicArrowContribution>> createEdgeArrowRow(Composite parent, DynamicArrowObject object) {
+
+ Map<String, DynamicArrowContribution> arrowContributions = object.getArrowContributions();
+ if (arrowContributions.isEmpty()) {
+ // ok, no point in showing empty combo boxes
+ return null;
+ }
+
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(object.getArrowObject().getName());
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(label);
+
+ 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(arrowContributions.keySet().toArray(new String[arrowContributions.size()]));
+ addSelectionListener(variableCombo);
+
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
+
+ Text gainText = new Text(parent, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(gainText);
+ addSelectionListener(gainText);
+
+ Text biasText = new Text(parent, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(biasText);
+ addSelectionListener(biasText);
+
+ Button defaultButton = new Button(parent, SWT.CHECK);
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
+ addSelectionListener(defaultButton);
+ defaultButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int index = variableCombo.getSelectionIndex();
+ if (index >= 0) {
+ String key = variableCombo.getItem(index);
+ DynamicArrowContribution cont = arrowContributions.get(key);
+
+ gainText.setText(Double.toString(cont.getDefaultGain()));
+ gainText.setEnabled(!defaultButton.getSelection());
+ biasText.setText(Double.toString(cont.getDefaultBias()));
+ biasText.setEnabled(!defaultButton.getSelection());
+
+ }
+ }
+ });
+
+ variableCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // handle update for others
+ String key = variableCombo.getItem(variableCombo.getSelectionIndex());
+ DynamicArrowContribution cont = arrowContributions.get(key);
+
+ if (gainText.getText().isEmpty()) {
+ gainText.setText(Double.toString(cont.getDefaultGain()));
+ }
+ if (biasText.getText().isEmpty()) {
+ biasText.setText(Double.toString(cont.getDefaultBias()));
+ }
+
+ defaultButton.setSelection(true);
+ }
+ });
+
+ arrowRows.put(object.getArrowObject().getName(), new ArrowObjectRow(label, usedButton, variableCombo, gainText, biasText, defaultButton));
+
+ return new Supplier<Pair<String, DynamicArrowContribution>>() {
+
+ @Override
+ public Pair<String, DynamicArrowContribution> get() {
+ int selectionIndex = variableCombo.getSelectionIndex();
+ if (selectionIndex >= 0) {
+ String key = variableCombo.getItem(selectionIndex);
+ DynamicArrowContribution cont = arrowContributions.get(key);
+ if (cont != null) {
+ String label = variableCombo.getItem(variableCombo.getSelectionIndex());
+
+ double gain = cont.getDefaultGain();
+ String gainS = gainText.getText();
+ if (gainS != null && !gainS.isEmpty()) {
+ gain = Double.parseDouble(gainS);
+ }
+ double bias = cont.getDefaultBias();
+ String biasS = biasText.getText();
+ if (biasS != null && !biasS.isEmpty()) {
+ bias = Double.parseDouble(biasText.getText());
+ }
+
+ DynamicArrowContribution dsc = new DynamicArrowContribution(label, cont.getModuleName(), cont.getAttributeName(), gain, bias);
+ dsc.setUsed(usedButton.getSelection());
+ dsc.setUseDefault(defaultButton.getSelection());
+
+ return Pair.make(object.getArrowObject().getName(), dsc);
+ }
+ }
+ return null;
+ }
+ };
+ }
+
+ protected void disableUpdates() {
+
+ }
+
protected void removeVisualisationTemplate(String name, Optional<Resource> of) {
if (of.isPresent()) {
Resource visualisation = of.get();
private void persistVisualisationTemplate(String templateName, Optional<Resource> existing) throws Exception {
- List<Pair<String, DynamicColorContribution>> colorCollect = colorSuppliers.stream().map(s -> s.get()).filter(Objects::nonNull).collect(Collectors.toList());
+ List<Pair<String, DynamicColorContribution>> colorCollect = colorSuppliers.stream().filter(Objects::nonNull).map(s -> s.get()).filter(Objects::nonNull).collect(Collectors.toList());
String colorLocation = colorLocationCombo.getItem(colorLocationCombo.getSelectionIndex());
String colorSize = colorSizeCombo.getItem(colorSizeCombo.getSelectionIndex());
.withLocation(ColorBarsLocation.valueOf(colorLocation))
.withSize(ColorBarsSize.valueOf(colorSize));
- List<Pair<String, DynamicSizeContribution>> sizeCollect = sizeSuppliers.stream().map(s -> s.get()).filter(Objects::nonNull).collect(Collectors.toList());
+ List<Pair<String, DynamicSizeContribution>> sizeCollect = sizeSuppliers.stream().filter(Objects::nonNull).map(s -> s.get()).filter(Objects::nonNull).collect(Collectors.toList());
String sizeLocation = sizeLocationCombo.getItem(sizeLocationCombo.getSelectionIndex());
String sizeSize = sizeSizeCombo.getItem(sizeSizeCombo.getSelectionIndex());
- SizeBarOptions sizeBarOptions = new SizeBarOptions()
+ final SizeBarOptions sizeBarOptions = new SizeBarOptions()
.showSizeBars(showSizeButton.getSelection())
.showSizeBarsTicks(sizeTicksButton.getSelection())
.useGradients(sizeGradientButton.getSelection())
.withLocation(SizeBarsLocation.valueOf(sizeLocation))
.withSize(SizeBarsSize.valueOf(sizeSize));
+ List<Pair<String, DynamicArrowContribution>> edgeArrowCollect = edgeArrowSuppliers.stream().filter(Objects::nonNull).map(s -> s.get()).filter(Objects::nonNull).collect(Collectors.toList());
+
+ boolean hideEdges = hideEdgesButton.getSelection();
+ boolean hidePoints = hidePointsButton.getSelection();
+ boolean hideConsumers = hideConsumersButton.getSelection();
+ boolean hideProducers = hideProducersButton.getSelection();
+ boolean hideValves = hideValvesButton.getSelection();
+ boolean hidePumpingStations = hidePumpingStationsButton.getSelection();
+
+ boolean networkBranchesStaticProperties = networkBranchesStaticPropertiesButton.getSelection();
+ boolean pointsStaticProperties = pointsStaticPropertiesButton.getSelection();
+ boolean consumersStaticProperties = consumersStaticPropertiesButton.getSelection();
+
+ boolean dynamicSymbolsEdges = dynamicSymbolsEdgesButton.getSelection();
+ boolean dynamicSymbolsProducers = dynamicSymbolsProducersButton.getSelection();
+ boolean dynamicSymbolsValves = dynamicSymbolsValvesButton.getSelection();
+ boolean dynamicSymbolsPumpingStations = dynamicSymbolsPumpingStationsButton.getSelection();
+
Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
if (existing.isPresent()) {
exist = existing.get();
} else {
- exist = DistrictNetworkUtil.createVisualisation(graph, parentResource, templateName);
+ exist = DynamicVisualisations.createVisualisation(graph, parentResource, templateName);
}
+ DynamicVisualisations.setColorContributions(graph, exist, colorCollect);
+ DynamicVisualisations.setColorBarOptions(graph, exist, colorBarOptions);
+ DynamicVisualisations.setSizeContributions(graph, exist, sizeCollect);
+ DynamicVisualisations.setSizeBarOptions(graph, exist, sizeBarOptions);
+ DynamicVisualisations.setEdgeArrowContributions(graph, exist, edgeArrowCollect);
+ DynamicVisualisations.setHideElements(graph, exist,
+ hideEdges,
+ hidePoints,
+ hideConsumers,
+ hideProducers,
+ hideValves,
+ hidePumpingStations
+ );
- DistrictNetworkUtil.setColorContributions(graph, exist, colorCollect);
+ DynamicVisualisations.setStaticProperties(graph, exist,
+ networkBranchesStaticProperties,
+ pointsStaticProperties,
+ consumersStaticProperties
+ );
- DistrictNetworkUtil.setColorBarOptions(graph, exist, colorBarOptions);
- DistrictNetworkUtil.setSizeContributions(graph, exist, sizeCollect);
- DistrictNetworkUtil.setSizeBarOptions(graph, exist, sizeBarOptions);
+ DynamicVisualisations.setDynamicSymbols(graph, exist,
+ dynamicSymbolsEdges,
+ dynamicSymbolsProducers,
+ dynamicSymbolsValves,
+ dynamicSymbolsPumpingStations
+ );
}
});
}
private Map<String, ColoringObjectRow> coloringRows = new HashMap<>();
private Map<String, SizingObjectRow> sizingRows = new HashMap<>();
+ private Map<String, ArrowObjectRow> arrowRows = new HashMap<>();
private VisualisationsListener visualisationsListener;
}
}
+ private static class ArrowObjectRow {
+
+ private final Label label;
+ private final Button usedButton;
+ private final Combo variableCombo;
+ private final Text gainText;
+ private final Text biasText;
+ private final Button defaultButton;
+
+ public ArrowObjectRow(Label label, Button usedButton, Combo variableCombo, Text gainText, Text biasText, Button defaultButton) {
+ this.label = label;
+ this.usedButton = usedButton;
+ this.variableCombo = variableCombo;
+ this.gainText = gainText;
+ this.biasText = biasText;
+ this.defaultButton = defaultButton;
+ }
+
+ public void update(DynamicColorContribution colorContribution) {
+ String[] items = variableCombo.getItems();
+ for (int i = 0; i < items.length; i++) {
+ if (colorContribution.getLabel().equals(items[i])) {
+ variableCombo.select(i);
+ break;
+ }
+ }
+ gainText.setText(Double.toString(colorContribution.getDefaultMin()));
+ biasText.setText(Double.toString(colorContribution.getDefaultMax()));
+
+ usedButton.setSelection(colorContribution.isUsed());
+ defaultButton.setSelection(colorContribution.isUseDefault());
+
+ gainText.setEnabled(!colorContribution.isUseDefault());
+ biasText.setEnabled(!colorContribution.isUseDefault());
+ }
+ }
+
private Supplier<Pair<String, DynamicColorContribution>> createColoringObjectRow(Composite parent, DynamicColoringObject object, Map<String, DynamicColorMap> colorMaps) {
Label label = new Label(parent, SWT.NONE);
label.setText(object.getColoringObject().getName());
this.parentResource = parentResource;
updateListening();
}
+ saveVisualisationTemplateAsButton.setEnabled(parentResource != null);
}
private void updateListening() {
@Override
public boolean isDisposed() {
- return disposed || ui.isDisposed();
+ return disposed || ui.getParent().isDisposed();
}
public void dispose() {
@Override
public boolean isDisposed() {
- return disposed || ui.isDisposed();
+ return disposed ||ui.getParent().isDisposed();
}
public void dispose() {
});
}
+
+ public Composite getParent() {
+ return parent;
+ }
}
@PostConstruct
public void postConstruct(Composite parent) {
- ui = new DynamicVisualisationsUI(parent, 0);
+ ui = new DynamicVisualisationsUI(parent);
Simantics.getSession().asyncRequest(new PossibleActiveModel(Simantics.getProjectResource()), new AsyncListenerAdapter<Resource>() {
@Override
public void execute(AsyncReadGraph graph, Resource result) {
- if (ui != null && !ui.isDisposed()) {
- ui.getDisplay().asyncExec(() -> {
+ if (ui != null && !ui.getParent().isDisposed()) {
+ ui.getParent().getDisplay().asyncExec(() -> {
ui.setParentResource(result);
});
}
@Override
public boolean isDisposed() {
- return ui != null ? ui.isDisposed() : true;
+ return ui != null ? ui.getParent().isDisposed() : true;
}
});
}
@PreDestroy
public void dispose() {
- ui.dispose();
+ ui.getParent().dispose();
ui = null;
}
org.simantics.maps.elevation.server;bundle-version="1.0.0",
org.simantics.modeling,
org.simantics.db.indexing,
- org.simantics.scl.osgi
+ org.simantics.scl.osgi,
+ org.eclipse.collections.eclipse-collections,
+ org.eclipse.collections.eclipse-collections-api
Export-Package: org.simantics.district.network,
org.simantics.district.network.changeset,
org.simantics.district.network.profile,
--- /dev/null
+
+importJava "org.simantics.district.network.visualisations.model.DynamicArrowContribution" where
+ data DynamicArrowContribution
+
+ @JavaName "<init>"
+ dynamicArrowContribution :: String -> String -> String -> Double -> Double -> DynamicArrowContribution
\ No newline at end of file
data DynamicColorContribution
@JavaName "<init>"
- dynamicColorContribution :: String -> String -> String -> String -> Double -> Double -> DynamicColorMap -> Double -> Double -> DynamicColorContribution
-
+ dynamicColorContribution :: String -> String -> String -> String -> Double -> Double -> DynamicColorMap -> Double -> Double -> DynamicColorContribution
\ No newline at end of file
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;
import org.simantics.db.exception.ServiceException;
import org.simantics.db.indexing.IndexUtils;
-import org.simantics.db.layer0.QueryIndexUtils;
import org.simantics.db.layer0.request.PossibleVariable;
import org.simantics.db.layer0.variable.Variable;
import org.simantics.diagram.stubs.DiagramResource;
import org.simantics.diagram.synchronization.graph.layer.GraphLayer;
import org.simantics.diagram.synchronization.graph.layer.IGraphLayerUtil;
import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.district.network.visualisations.DynamicVisualisationsContributions;
-import org.simantics.district.network.visualisations.model.ColorBarOptions;
-import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsLocation;
-import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsSize;
-import org.simantics.district.network.visualisations.model.DynamicColorContribution;
-import org.simantics.district.network.visualisations.model.DynamicColorMap;
-import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
-import org.simantics.district.network.visualisations.model.DynamicSizeMap;
-import org.simantics.district.network.visualisations.model.SizeBarOptions;
-import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsLocation;
-import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsSize;
import org.simantics.layer0.Layer0;
import org.simantics.maps.elevation.server.SingletonTiffTileInterface;
import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences;
import org.simantics.modeling.ModelingResources;
import org.simantics.modeling.adapters.NewCompositeActionFactory;
import org.simantics.operation.Layer0X;
-import org.simantics.utils.datastructures.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
return results;
}
- public static ColorBarOptions colorBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- if (visualisation != null) {
- String colorBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarLocation, Bindings.STRING);
- String colorBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarSize, Bindings.STRING);
- Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBars, Bindings.BOOLEAN);
- Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, Bindings.BOOLEAN);
- Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, Bindings.BOOLEAN);
- if (colorBarLocation != null) {
- return new ColorBarOptions()
- .showColorBars(show != null ? show : false)
- .showColorBarsTicks(showTicks != null ? showTicks : false)
- .useGradients(useGradients != null ? useGradients : false)
- .withLocation(ColorBarsLocation.valueOf(colorBarLocation))
- .withSize(ColorBarsSize.valueOf(colorBarSize));
- }
- }
- return ColorBarOptions.useDefault();
- }
-
- public static void setColorBarOptions(WriteGraph graph, Resource visualisation, ColorBarOptions options) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarLocation, options.getLocation().toString(), Bindings.STRING);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarSize, options.getSize().toString(), Bindings.STRING);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBars, options.isShowColorBars(), Bindings.BOOLEAN);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, options.isShowColorBarsTicks(), Bindings.BOOLEAN);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
- }
-
- public static Resource createVisualisation(WriteGraph graph, Resource parent, String visualisationName) throws DatabaseException {
- Resource vf = getOrCreateVisualisationsFolder(graph, parent);
- Layer0 L0 = Layer0.getInstance(graph);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource visualisation = graph.newResource();
- graph.claim(visualisation, L0.InstanceOf, DN.Diagram_Visualisations);
- graph.claimLiteral(visualisation, L0.HasName, visualisationName);
- graph.claim(vf, DN.Diagram_hasVisualisation, visualisation);
- return visualisation;
- }
-
- public static Resource getOrCreateVisualisationsFolder(WriteGraph graph, Resource model) throws DatabaseException {
- Resource rf = getVisualisationFolder(graph, model);
- if (rf == null) {
- Layer0 L0 = Layer0.getInstance(graph);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- rf = graph.newResource();
- graph.claim(rf, L0.InstanceOf, null, DN.VisualisationsFolder);
- graph.claimLiteral(rf, L0.HasName, L0.NameOf, L0.String, UUID.randomUUID().toString(), Bindings.STRING);
- graph.claim(model, L0.ConsistsOf, L0.PartOf, rf);
- }
- return rf;
- }
-
- public static Resource getVisualisationFolder(ReadGraph graph, Resource model) throws DatabaseException {
- List<Resource> visualisationsFolders = QueryIndexUtils.searchByType(graph, model, DistrictNetworkResource.getInstance(graph).VisualisationsFolder);
- if (visualisationsFolders.size() > 0)
- return visualisationsFolders.get(0);
- return null;
- }
-
- public static SizeBarOptions sizeBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- if (visualisation != null) {
- String sizeBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarLocation, Bindings.STRING);
- String sizeBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarSize, Bindings.STRING);
- Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBars, Bindings.BOOLEAN);
- Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, Bindings.BOOLEAN);
- Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, Bindings.BOOLEAN);
- if (sizeBarLocation != null) {
- return new SizeBarOptions()
- .showSizeBars(show != null ? show : false)
- .showSizeBarsTicks(showTicks != null ? showTicks : false)
- .useGradients(useGradients != null ? useGradients : false)
- .withLocation(SizeBarsLocation.valueOf(sizeBarLocation))
- .withSize(SizeBarsSize.valueOf(sizeBarSize));
- }
- }
- return SizeBarOptions.useDefault();
- }
-
- public static void setSizeBarOptions(WriteGraph graph, Resource visualisation, SizeBarOptions options) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarLocation, options.getLocation().toString(), Bindings.STRING);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarSize, options.getSize().toString(), Bindings.STRING);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBars, options.isShowSizeBars(), Bindings.BOOLEAN);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, options.isShowSizeBarsTicks(), Bindings.BOOLEAN);
- graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
- }
-
- public static Map<String, DynamicColorContribution> colorContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- if (visualisation == null) {
- return Collections.emptyMap();
- }
- Map<String, DynamicColorContribution> contributions = new HashMap<>();
-
- Map<String, DynamicColorMap> colorMaps = DynamicVisualisationsContributions.dynamicColorMaps(graph);
-
- Collection<Resource> colorContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_colorContributions);
- for (Resource colorContribution : colorContributions) {
- String ucName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, Bindings.STRING);
- String label = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, Bindings.STRING);
- String moduleName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, Bindings.STRING);
- String attributeName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, Bindings.STRING);
- String unit = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, Bindings.STRING);
- Double variableGain = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, Bindings.DOUBLE);
- Double variableBias = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, Bindings.DOUBLE);
- String dynamicColorMap = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, Bindings.STRING);
- Double defaultMin = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, Bindings.DOUBLE);
- Double defaultMax = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, Bindings.DOUBLE);
- Boolean used = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, Bindings.BOOLEAN);
- Boolean useDefault = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, Bindings.BOOLEAN);
- DynamicColorContribution dynamicColorContribution = new DynamicColorContribution(label, moduleName, attributeName, unit, variableGain, variableBias, colorMaps.get(dynamicColorMap), defaultMin, defaultMax);
- dynamicColorContribution.setUsed(used != null ? used : false);
- dynamicColorContribution.setUseDefault(useDefault != null ? useDefault : false);
- contributions.put(ucName, dynamicColorContribution);
- }
- return contributions;
- }
-
- public static void setColorContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicColorContribution>> collect) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Layer0 L0 = Layer0.getInstance(graph);
-
- graph.deny(visualisation, DN.Diagram_Visualisations_colorContributions);
- for (Pair<String, DynamicColorContribution> coll : collect) {
- Resource colorContribution = graph.newResource();
- graph.claim(colorContribution, L0.InstanceOf, DN.Diagram_Visualisations_ColorContribution);
- graph.claimLiteral(colorContribution, L0.HasName, coll.first);
-
- DynamicColorContribution contr = coll.second;
- 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);
- }
- }
-
- public static Map<String, DynamicSizeContribution> sizeContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- if (visualisation == null) {
- return Collections.emptyMap();
- }
- Map<String, DynamicSizeContribution> contributions = new HashMap<>();
-
- Map<String, DynamicSizeMap> sizeMaps = DynamicVisualisationsContributions.dynamicSizeMaps(graph);
-
- Collection<Resource> sizeContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_sizeContributions);
- for (Resource sizeContribution : sizeContributions) {
- String ucName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, Bindings.STRING);
- String label = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, Bindings.STRING);
- String moduleName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, Bindings.STRING);
- String attributeName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, Bindings.STRING);
- String unit = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, Bindings.STRING);
- Double variableGain = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, Bindings.DOUBLE);
- Double variableBias = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, Bindings.DOUBLE);
- String dynamicSizeMap = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, Bindings.STRING);
- Double defaultMin = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, Bindings.DOUBLE);
- Double defaultMax = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, Bindings.DOUBLE);
- Boolean used = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, Bindings.BOOLEAN);
- Boolean useDefault = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, Bindings.BOOLEAN);
- DynamicSizeContribution dsc = new DynamicSizeContribution(label, moduleName, attributeName, unit, variableGain, variableBias, sizeMaps.get(dynamicSizeMap), defaultMin, defaultMax);
- dsc.setUsed(used != null ? used : false);
- dsc.setUseDefault(useDefault != null ? useDefault : false);
- contributions.put(ucName, dsc);
- }
- return contributions;
- }
-
- public static void setSizeContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicSizeContribution>> collect) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Layer0 L0 = Layer0.getInstance(graph);
-
- graph.deny(visualisation, DN.Diagram_Visualisations_sizeContributions);
- for (Pair<String, DynamicSizeContribution> coll : collect) {
- Resource sizeContribution = graph.newResource();
- graph.claim(sizeContribution, L0.InstanceOf, DN.Diagram_Visualisations_SizeContribution);
- graph.claimLiteral(sizeContribution, L0.HasName, coll.first);
-
- DynamicSizeContribution contr = coll.second;
- 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);
- }
- }
-
- public static void setActiveVisualisation(WriteGraph graph, Resource diagram, Resource visualisationTemplate) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- graph.deny(diagram, DN.Diagram_hasActiveVisualisation);
- graph.claim(diagram, DN.Diagram_hasActiveVisualisation, visualisationTemplate);
- }
}
import java.util.Map;
import java.util.stream.Collectors;
+import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.common.request.ResourceRead;
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.DynamicVisualisations;
import org.simantics.district.network.visualisations.DynamicVisualisationsContributions;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicArrowObject;
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.DynamicArrowContribution;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
import org.simantics.district.network.visualisations.model.DynamicVisualisation;
@Override
public DynamicVisualisation perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource visualisationFolder = DistrictNetworkUtil.getVisualisationFolder(graph, resource);
+ Resource visualisationFolder = DynamicVisualisations.getVisualisationFolder(graph, resource);
if (visualisationFolder != null) {
Resource visualisationResource = graph.getPossibleObject(visualisationFolder, DN.Diagram_hasActiveVisualisation);
if (visualisationResource != null) {
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, defaultColoringObjects, colorBarOptions, sizeContributions, defaultSizingObjects, sizeBarOptions);
+ Collection<DynamicArrowObject> dynamicArrowObjects = DynamicVisualisationsContributions.dynamicEdgeArrowObjects(graph);
+ Map<String, DynamicArrowObject> defaultArrowObjects = dynamicArrowObjects.stream().collect(Collectors.toMap(dac -> dac.getArrowObject().getName(), dac -> dac));
+
+ Map<String, DynamicColorContribution> colorContributions = DynamicVisualisations.colorContributions(graph, visualisationResource);
+ ColorBarOptions colorBarOptions = DynamicVisualisations.colorBarOptions(graph, visualisationResource);
+ Map<String, DynamicSizeContribution> sizeContributions = DynamicVisualisations.sizeContributions(graph, visualisationResource);
+ SizeBarOptions sizeBarOptions = DynamicVisualisations.sizeBarOptions(graph, visualisationResource);
+ Map<String, DynamicArrowContribution> arrowContributions = DynamicVisualisations.arrowContributions(graph, visualisationResource);
+
+ Boolean hideEdges = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HideEdges, Bindings.BOOLEAN);
+ Boolean hidePoints = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HidePoints, Bindings.BOOLEAN);
+ Boolean hideConsumers = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HideConsumers, Bindings.BOOLEAN);
+ Boolean hideProducers = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HideProducers, Bindings.BOOLEAN);
+ Boolean hideValves = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HideValves, Bindings.BOOLEAN);
+ Boolean hidePumpingStations = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_HidePumpingStations, Bindings.BOOLEAN);
+ Boolean staticPropertiesNetworkBranch = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_StaticPropertiesNetworkBranches, Bindings.BOOLEAN);
+ Boolean staticProperiesPoints = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_StaticPropertiesPoints, Bindings.BOOLEAN);
+ Boolean staticPropertiesConsumers = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_StaticPropertiesConsumers, Bindings.BOOLEAN);
+ Boolean dynamicSymbolsProducers = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_DynamicSymbolsProducers, Bindings.BOOLEAN);
+ Boolean dynamicSymbolsShutoffValves = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_DynamicSymbolsShutoffValves, Bindings.BOOLEAN);
+ Boolean dynamicSymbolsValves = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_DynamicSymbolsValves, Bindings.BOOLEAN);
+ Boolean dynamicSymbolsPumpingStations = graph.getPossibleRelatedValue(visualisationResource, DN.Diagram_Visualisations_DynamicSymbolsPumpingStations, Bindings.BOOLEAN);
+
+ DynamicVisualisation visualisation = new DynamicVisualisation(name, visualisationResource,
+ colorContributions,
+ defaultColoringObjects,
+ colorBarOptions,
+ sizeContributions,
+ defaultSizingObjects,
+ sizeBarOptions,
+ defaultArrowObjects,
+ arrowContributions,
+ hideEdges != null ? hideEdges : false,
+ hidePoints != null ? hidePoints : false,
+ hideConsumers != null ? hideConsumers : false,
+ hideProducers != null ? hideProducers : false,
+ hideValves != null ? hideValves : false,
+ hidePumpingStations != null ? hidePumpingStations : false,
+ staticPropertiesNetworkBranch != null ? staticPropertiesNetworkBranch : false,
+ staticProperiesPoints != null ? staticProperiesPoints : false,
+ staticPropertiesConsumers != null ? staticPropertiesConsumers : false,
+ dynamicSymbolsProducers != null ? dynamicSymbolsProducers : false,
+ dynamicSymbolsShutoffValves != null ? dynamicSymbolsShutoffValves : false,
+ dynamicSymbolsValves != null ? dynamicSymbolsValves : false,
+ dynamicSymbolsPumpingStations != null ? dynamicSymbolsPumpingStations : false
+ );
return visualisation;
}
}
package org.simantics.district.network.profile;
+import java.util.Map;
import java.util.Set;
-import org.simantics.Simantics;
+import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
import org.simantics.db.common.procedure.adapter.TransientCacheListener;
import org.simantics.db.exception.DatabaseException;
+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.DynamicArrowObject;
+import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
+import org.simantics.district.network.visualisations.model.DynamicVisualisation;
import org.simantics.layer0.Layer0;
+import org.simantics.modeling.ModelingResources;
import org.simantics.scenegraph.INode;
import org.simantics.scenegraph.g2d.G2DSceneGraph;
import org.simantics.scenegraph.g2d.nodes.ConnectionNode;
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;
public class ArrowLengthStyle extends ThrottledStyleBase<Double> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ArrowLengthStyle.class);
private static final Double PENDING = Double.NaN;
@Override
if (!edgesToUse.contains(groupItem))
return null;
- DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheListener.instance());
+ DynamicVisualisation dv = graph.syncRequest(new RuntimeDynamicVisualisationsRequest(runtimeDiagram),
+ TransientCacheAsyncListener.instance());
// Prevent PendingVariableExceptions from coming through
boolean wasSynchronous = graph.setSynchronous(true);
try {
- if (ds.arrowLengthProperty.isPresent()) {
- Double length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem);
- return length != null ? length * ds.arrowLengthGain + ds.arrowLengthBias : null;
- }
- else {
- return null;
- }
- }
- finally {
- graph.setSynchronous(wasSynchronous);
- }
- }
+ if (dv != null) {
+ Layer0 L0 = Layer0.getInstance(graph);
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ Resource mapping = graph.getSingleObject(groupItem, DN.HasMapping);
+
+ Map<String, DynamicArrowContribution> arrowContributions = dv.getArrowContributions();
+ String mappingName = graph.getRelatedValue(mapping, L0.HasName);
+ DynamicArrowContribution dac = arrowContributions.get(mappingName);
+ if (dac != null && dac.isUsed()) {
+
+ Resource mappedComponent = graph.getPossibleObject(groupItem, DN.MappedComponent);
+ if (mappedComponent != null) {
+
+ Resource component = graph.getSingleObject(mappedComponent, MOD.ElementToComponent);
+ Variable variable = Variables.getVariable(graph, component);
+ Variable possibleActiveVariable = Variables.possibleActiveVariable(graph, variable);
+ if (possibleActiveVariable != null) {
+
+ Variable module = possibleActiveVariable.getPossibleChild(graph, dac.getModuleName());
+ if (module != null) {
+ Variable attribute = module.getPossibleProperty(graph, dac.getAttributeName());
+ if (attribute != null) {
+ Double possibleValue = attribute.getPossibleValue(graph, Bindings.DOUBLE);
+ if (possibleValue != null) {
+
+ double biasValue;
+ double gainValue;
+ if (dac.isUseDefault()) {
+ DynamicArrowObject dynamicArrowObject = dv.getDefaultArrowContributions().get(mappingName);
+
+ // This is required if ontology module needs to be compiled
+ Object currentGraph = SCLContext.getCurrent().get("graph");
+ try {
+ SCLContext.getCurrent().put("graph", graph);
+
+ DynamicArrowContribution ddcc = dynamicArrowObject.getArrowContributions().get(dac.getLabel());
+ biasValue = ddcc.getDefaultBias();
+ gainValue = ddcc.getDefaultGain();
+ } finally {
+ SCLContext.getCurrent().put("graph", currentGraph);
+ }
+ } else {
+ biasValue = dac.getDefaultBias();
+ gainValue = dac.getDefaultGain();
+ }
+ // here we do the adjusting according to spec in #15038
+ return possibleValue.doubleValue() * gainValue + biasValue;
+ } else {
+ LOGGER.warn("No value for {}", attribute.getURI(graph));
+ }
+ } else {
+ LOGGER.warn("Wrong attribute name {} for {} !!", dac.getAttributeName(), module.getURI(graph));
+ }
+ } else {
+ LOGGER.warn("Wrong modulename {} for {} !!", dac.getModuleName(), possibleActiveVariable.getURI(graph));
+ }
+ } else {
+ LOGGER.debug("No active experiment for {}", variable.getURI(graph));
+ }
+ } else {
+ LOGGER.debug("No mapped component for {} to calculate dynamic color style", groupItem);
+ }
+ }
+ }
+ } finally {
+ graph.setSynchronous(wasSynchronous);
+ }
+ return null;
+ }
@Override
public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Double value) {
+++ /dev/null
-package org.simantics.district.network.profile;
-
-import java.util.Optional;
-
-import org.simantics.db.Resource;
-import org.simantics.scl.runtime.function.Function1;
-
-/**
- * @author Tuukka Lehtonen
- */
-public class DiagramSettings {
-
- public final Optional<Function1<Resource, Double>> arrowLengthProperty;
- public final double arrowLengthGain;
- public final double arrowLengthBias;
-
- public DiagramSettings(
- Function1<Resource, Double> arrowLengthProperty, double arrowLengthGain, double arrowLengthBias
- ) {
- this.arrowLengthProperty = Optional.ofNullable(arrowLengthProperty);
- this.arrowLengthGain = arrowLengthGain;
- this.arrowLengthBias = arrowLengthBias;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- //result = prime * result + edgeThicknessProperty.hashCode();
- result = prime * result + arrowLengthProperty.hashCode();
- long temp = result;
- //temp = Double.doubleToLongBits(edgeThicknessGain);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- //temp = Double.doubleToLongBits(edgeThicknessBias);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(arrowLengthGain);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(arrowLengthBias);
- result = prime * result + (int) (temp ^ (temp >>> 32));
-
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- DiagramSettings other = (DiagramSettings) obj;
-
- if (!arrowLengthProperty.equals(other.arrowLengthProperty))
- return false;
- if (Double.doubleToLongBits(arrowLengthGain) != Double.doubleToLongBits(other.arrowLengthGain))
- return false;
- if (Double.doubleToLongBits(arrowLengthBias) != Double.doubleToLongBits(other.arrowLengthBias))
- return false;
-
- return true;
- }
-
- @Override
- public String toString() {
- return String.format("DiagramSettings[%s * %f + %f]",
- arrowLengthProperty, arrowLengthGain, arrowLengthBias
- );
- }
-
-}
+++ /dev/null
-package org.simantics.district.network.profile;
-
-import org.simantics.databoard.Bindings;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.request.ResourceRead;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.variable.Variable;
-import org.simantics.db.layer0.variable.Variables;
-import org.simantics.diagram.stubs.DiagramResource;
-import org.simantics.district.network.ontology.DistrictNetworkResource;
-import org.simantics.scl.runtime.function.Function1;
-
-/**
- * @author Tuukka Lehtonen
- */
-public class DiagramSettingsRequest extends ResourceRead<DiagramSettings> {
-
- public DiagramSettingsRequest(Resource runtimeDiagram) {
- super(runtimeDiagram);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public DiagramSettings perform(ReadGraph graph) throws DatabaseException {
- DiagramResource DIA = DiagramResource.getInstance(graph);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
-
- Function1<Resource, Double> arrowLengthProperty = null;
- double arrowLengthGain = 1;
- double arrowLengthBias = 0;
-
- Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
- if (diagram != null) {
- Variable dv = Variables.getPossibleVariable(graph, diagram);
-
- Resource alp = graph.getPossibleObject(diagram, DN.Diagram_arrowLengthProperty);
- //System.out.println("alp: " + NameUtils.getURIOrSafeNameInternal(graph, alp));
- if (alp != null) {
- Variable alpv = Variables.getPossibleVariable(graph, alp);
- if (alpv != null) {
- //System.out.println("alpv: " + alpv.getURI(graph));
- arrowLengthProperty = alpv.getPropertyValue(graph, DN.Edge_ArrowLengthProperty_value);
- }
-
- arrowLengthGain =
- safeDoubleProperty(graph, alp, DN.Edge_ArrowLengthProperty_gain, 1)
- * safeDoubleProperty(graph, diagram, DN.Diagram_arrowLengthGain, 1);
- arrowLengthBias =
- safeDoubleProperty(graph, alp, DN.Edge_ArrowLengthProperty_bias, 0)
- + safeDoubleProperty(graph, diagram, DN.Diagram_arrowLengthBias, 0);
- }
-
- }
-
- DiagramSettings ds = new DiagramSettings( arrowLengthProperty, arrowLengthGain, arrowLengthBias);
- //System.out.println("new diagram settings: " + ds);
- return ds;
- }
-
- private static float safeFloatProperty(ReadGraph graph, Resource r, Resource property, float defaultValue) throws DatabaseException {
- Float d = graph.getPossibleRelatedValue(r, property, Bindings.FLOAT);
- return d != null ? d : defaultValue;
- }
-
- private static double safeDoubleProperty(ReadGraph graph, Resource r, Resource property, double defaultValue) throws DatabaseException {
- Double d = graph.getPossibleRelatedValue(r, property, Bindings.DOUBLE);
- return d != null ? d : defaultValue;
- }
-
- private static float limit(float min, float max, float value) {
- return Math.max(min, Math.min(value, max));
- }
-
- @SuppressWarnings("unused")
- private static double limit(double min, double max, double value) {
- return Math.max(min, Math.min(value, max));
- }
-
-}
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.DynamicVisualisations;
import org.simantics.layer0.Layer0;
/**
public Collection<NamedResource> perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
List<NamedResource> results = new ArrayList<>();
- Resource visualisationFolder = DistrictNetworkUtil.getVisualisationFolder(graph, resource);
+ Resource visualisationFolder = DynamicVisualisations.getVisualisationFolder(graph, resource);
if (visualisationFolder != null) {
Collection<Resource> visualisationResources = graph.getObjects(visualisationFolder, DN.Diagram_hasVisualisation);
if (visualisationResources != null && !visualisationResources.isEmpty()) {
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.adapter.TransientCacheListener;
import org.simantics.db.exception.DatabaseException;
import org.simantics.diagram.profile.StyleBase;
+import org.simantics.district.network.visualisations.model.DynamicVisualisation;
import org.simantics.scenegraph.INode;
import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
import org.simantics.scenegraph.profile.EvaluationContext;
@Override
public Boolean calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
+
+ DynamicVisualisation dv = graph.syncRequest(new ActiveDynamicVisualisationsRequest(runtimeDiagram), TransientCacheListener.instance());
+
+
return Boolean.TRUE;
}
Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
if (diagram != null) {
Resource model = graph.syncRequest(new IndexRoot(diagram));
- return graph.syncRequest(new ActiveDynamicVisualisationsRequest(model), TransientCacheAsyncListener.instance());
+ return graph.syncRequest(new ActiveDynamicVisualisationsRequest(model));
}
return null;
}
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
-import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.common.request.UnaryRead;
--- /dev/null
+package org.simantics.district.network.visualisations;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.QueryIndexUtils;
+import org.simantics.district.network.ontology.DistrictNetworkResource;
+import org.simantics.district.network.visualisations.model.ColorBarOptions;
+import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
+import org.simantics.district.network.visualisations.model.DynamicColorContribution;
+import org.simantics.district.network.visualisations.model.DynamicColorMap;
+import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
+import org.simantics.district.network.visualisations.model.DynamicSizeMap;
+import org.simantics.district.network.visualisations.model.SizeBarOptions;
+import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsLocation;
+import org.simantics.district.network.visualisations.model.ColorBarOptions.ColorBarsSize;
+import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsLocation;
+import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsSize;
+import org.simantics.layer0.Layer0;
+import org.simantics.utils.datastructures.Pair;
+
+public class DynamicVisualisations {
+
+ public static ColorBarOptions colorBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ if (visualisation != null) {
+ String colorBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarLocation, Bindings.STRING);
+ String colorBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ColorBarSize, Bindings.STRING);
+ Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBars, Bindings.BOOLEAN);
+ Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, Bindings.BOOLEAN);
+ Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, Bindings.BOOLEAN);
+ if (colorBarLocation != null) {
+ return new ColorBarOptions()
+ .showColorBars(show != null ? show : false)
+ .showColorBarsTicks(showTicks != null ? showTicks : false)
+ .useGradients(useGradients != null ? useGradients : false)
+ .withLocation(ColorBarsLocation.valueOf(colorBarLocation))
+ .withSize(ColorBarsSize.valueOf(colorBarSize));
+ }
+ }
+ return ColorBarOptions.useDefault();
+ }
+
+ public static void setColorBarOptions(WriteGraph graph, Resource visualisation, ColorBarOptions options) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarLocation, options.getLocation().toString(), Bindings.STRING);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ColorBarSize, options.getSize().toString(), Bindings.STRING);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBars, options.isShowColorBars(), Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowColorBarTicks, options.isShowColorBarsTicks(), Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseColorBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
+ }
+
+ public static Resource createVisualisation(WriteGraph graph, Resource parent, String visualisationName) throws DatabaseException {
+ Resource vf = getOrCreateVisualisationsFolder(graph, parent);
+ Layer0 L0 = Layer0.getInstance(graph);
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ Resource visualisation = graph.newResource();
+ graph.claim(visualisation, L0.InstanceOf, DN.Diagram_Visualisations);
+ graph.claimLiteral(visualisation, L0.HasName, visualisationName);
+ graph.claim(vf, DN.Diagram_hasVisualisation, visualisation);
+ return visualisation;
+ }
+
+ public static Resource getOrCreateVisualisationsFolder(WriteGraph graph, Resource model) throws DatabaseException {
+ Resource rf = getVisualisationFolder(graph, model);
+ if (rf == null) {
+ Layer0 L0 = Layer0.getInstance(graph);
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ rf = graph.newResource();
+ graph.claim(rf, L0.InstanceOf, null, DN.VisualisationsFolder);
+ graph.claimLiteral(rf, L0.HasName, L0.NameOf, L0.String, UUID.randomUUID().toString(), Bindings.STRING);
+ graph.claim(model, L0.ConsistsOf, L0.PartOf, rf);
+ }
+ return rf;
+ }
+
+ public static Resource getVisualisationFolder(ReadGraph graph, Resource model) throws DatabaseException {
+ List<Resource> visualisationsFolders = QueryIndexUtils.searchByType(graph, model, DistrictNetworkResource.getInstance(graph).VisualisationsFolder);
+ if (visualisationsFolders.size() > 0)
+ return visualisationsFolders.get(0);
+ return null;
+ }
+
+ public static SizeBarOptions sizeBarOptions(ReadGraph graph, Resource visualisation) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ if (visualisation != null) {
+ String sizeBarLocation = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarLocation, Bindings.STRING);
+ String sizeBarSize = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_SizeBarSize, Bindings.STRING);
+ Boolean show = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBars, Bindings.BOOLEAN);
+ Boolean showTicks = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, Bindings.BOOLEAN);
+ Boolean useGradients = graph.getPossibleRelatedValue(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, Bindings.BOOLEAN);
+ if (sizeBarLocation != null) {
+ return new SizeBarOptions()
+ .showSizeBars(show != null ? show : false)
+ .showSizeBarsTicks(showTicks != null ? showTicks : false)
+ .useGradients(useGradients != null ? useGradients : false)
+ .withLocation(SizeBarsLocation.valueOf(sizeBarLocation))
+ .withSize(SizeBarsSize.valueOf(sizeBarSize));
+ }
+ }
+ return SizeBarOptions.useDefault();
+ }
+
+ public static void setSizeBarOptions(WriteGraph graph, Resource visualisation, SizeBarOptions options) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarLocation, options.getLocation().toString(), Bindings.STRING);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_SizeBarSize, options.getSize().toString(), Bindings.STRING);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBars, options.isShowSizeBars(), Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_ShowSizeBarTicks, options.isShowSizeBarsTicks(), Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_UseSizeBarGradients, options.isUseGradients(), Bindings.BOOLEAN);
+ }
+
+ public static Map<String, DynamicColorContribution> colorContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ if (visualisation == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, DynamicColorContribution> contributions = new HashMap<>();
+
+ Map<String, DynamicColorMap> colorMaps = DynamicVisualisationsContributions.dynamicColorMaps(graph);
+
+ Collection<Resource> colorContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_colorContributions);
+ for (Resource colorContribution : colorContributions) {
+ String ucName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionContributorName, Bindings.STRING);
+ String label = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionLabel, Bindings.STRING);
+ String moduleName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleName, Bindings.STRING);
+ String attributeName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionModuleAttribute, Bindings.STRING);
+ String unit = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUnit, Bindings.STRING);
+ Double variableGain = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableGain, Bindings.DOUBLE);
+ Double variableBias = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionVariableBias, Bindings.DOUBLE);
+ String dynamicColorMap = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultColorMap, Bindings.STRING);
+ Double defaultMin = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMin, Bindings.DOUBLE);
+ Double defaultMax = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionDefaultMax, Bindings.DOUBLE);
+ Boolean used = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUsed, Bindings.BOOLEAN);
+ Boolean useDefault = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_colorContributionUseDefault, Bindings.BOOLEAN);
+ DynamicColorContribution dynamicColorContribution = new DynamicColorContribution(label, moduleName, attributeName, unit, variableGain, variableBias, colorMaps.get(dynamicColorMap), defaultMin, defaultMax);
+ dynamicColorContribution.setUsed(used != null ? used : false);
+ dynamicColorContribution.setUseDefault(useDefault != null ? useDefault : false);
+ contributions.put(ucName, dynamicColorContribution);
+ }
+ return contributions;
+ }
+
+ public static void setColorContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicColorContribution>> collect) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ Layer0 L0 = Layer0.getInstance(graph);
+
+ graph.deny(visualisation, DN.Diagram_Visualisations_colorContributions);
+ for (Pair<String, DynamicColorContribution> coll : collect) {
+ Resource colorContribution = graph.newResource();
+ graph.claim(colorContribution, L0.InstanceOf, DN.Diagram_Visualisations_ColorContribution);
+ graph.claimLiteral(colorContribution, L0.HasName, coll.first);
+
+ DynamicColorContribution contr = coll.second;
+ 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);
+ }
+ }
+
+ public static void setEdgeArrowContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicArrowContribution>> edgeArrowCollect) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ Layer0 L0 = Layer0.getInstance(graph);
+
+ graph.deny(visualisation, DN.Diagram_Visualisations_arrowContributions);
+ for (Pair<String, DynamicArrowContribution> coll : edgeArrowCollect) {
+ Resource arrowContribution = graph.newResource();
+ graph.claim(arrowContribution, L0.InstanceOf, DN.Diagram_Visualisations_ArrowContribution);
+ graph.claimLiteral(arrowContribution, L0.HasName, coll.first);
+
+ DynamicArrowContribution contr = coll.second;
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionContributorName, coll.first, Bindings.STRING);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionLabel, contr.getLabel(), Bindings.STRING);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionModuleName, contr.getModuleName(), Bindings.STRING);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionModuleAttribute, contr.getAttributeName(), Bindings.STRING);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionVariableGain, contr.getDefaultGain(), Bindings.DOUBLE);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionVariableBias, contr.getDefaultBias(), Bindings.DOUBLE);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionUsed, contr.isUsed(), Bindings.BOOLEAN);
+ graph.claimLiteral(arrowContribution, DN.Diagram_Visualisations_arrowContributionUseDefault, contr.isUseDefault(), Bindings.BOOLEAN);
+
+ graph.claim(visualisation, DN.Diagram_Visualisations_arrowContributions, arrowContribution);
+ }
+ }
+
+ public static Map<String, DynamicSizeContribution> sizeContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ if (visualisation == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, DynamicSizeContribution> contributions = new HashMap<>();
+
+ Map<String, DynamicSizeMap> sizeMaps = DynamicVisualisationsContributions.dynamicSizeMaps(graph);
+
+ Collection<Resource> sizeContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_sizeContributions);
+ for (Resource sizeContribution : sizeContributions) {
+ String ucName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionContributorName, Bindings.STRING);
+ String label = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionLabel, Bindings.STRING);
+ String moduleName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleName, Bindings.STRING);
+ String attributeName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, Bindings.STRING);
+ String unit = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUnit, Bindings.STRING);
+ Double variableGain = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, Bindings.DOUBLE);
+ Double variableBias = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, Bindings.DOUBLE);
+ String dynamicSizeMap = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, Bindings.STRING);
+ Double defaultMin = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, Bindings.DOUBLE);
+ Double defaultMax = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, Bindings.DOUBLE);
+ Boolean used = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUsed, Bindings.BOOLEAN);
+ Boolean useDefault = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, Bindings.BOOLEAN);
+ DynamicSizeContribution dsc = new DynamicSizeContribution(label, moduleName, attributeName, unit, variableGain, variableBias, sizeMaps.get(dynamicSizeMap), defaultMin, defaultMax);
+ dsc.setUsed(used != null ? used : false);
+ dsc.setUseDefault(useDefault != null ? useDefault : false);
+ contributions.put(ucName, dsc);
+ }
+ return contributions;
+ }
+
+ public static Map<String, DynamicArrowContribution> arrowContributions(ReadGraph graph, Resource visualisation) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ if (visualisation == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, DynamicArrowContribution> contributions = new HashMap<>();
+
+ Collection<Resource> sizeContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_arrowContributions);
+ for (Resource sizeContribution : sizeContributions) {
+ String ucName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionContributorName, Bindings.STRING);
+ String label = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionLabel, Bindings.STRING);
+ String moduleName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionModuleName, Bindings.STRING);
+ String attributeName = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionModuleAttribute, Bindings.STRING);
+ Double variableGain = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionVariableGain, Bindings.DOUBLE);
+ Double variableBias = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionVariableBias, Bindings.DOUBLE);
+ Boolean used = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionUsed, Bindings.BOOLEAN);
+ Boolean useDefault = graph.getRelatedValue(sizeContribution, DN.Diagram_Visualisations_arrowContributionUseDefault, Bindings.BOOLEAN);
+ DynamicArrowContribution dac = new DynamicArrowContribution(label, moduleName, attributeName, variableGain, variableBias);
+ dac.setUsed(used != null ? used : false);
+ dac.setUseDefault(useDefault != null ? useDefault : false);
+ contributions.put(ucName, dac);
+ }
+ return contributions;
+ }
+
+ public static void setSizeContributions(WriteGraph graph, Resource visualisation, List<Pair<String, DynamicSizeContribution>> collect) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ Layer0 L0 = Layer0.getInstance(graph);
+
+ graph.deny(visualisation, DN.Diagram_Visualisations_sizeContributions);
+ for (Pair<String, DynamicSizeContribution> coll : collect) {
+ Resource sizeContribution = graph.newResource();
+ graph.claim(sizeContribution, L0.InstanceOf, DN.Diagram_Visualisations_SizeContribution);
+ graph.claimLiteral(sizeContribution, L0.HasName, coll.first);
+
+ DynamicSizeContribution contr = coll.second;
+ 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);
+ }
+ }
+
+ public static void setActiveVisualisation(WriteGraph graph, Resource diagram, Resource visualisationTemplate) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.deny(diagram, DN.Diagram_hasActiveVisualisation);
+ graph.claim(diagram, DN.Diagram_hasActiveVisualisation, visualisationTemplate);
+ }
+
+ public static void setHideElements(WriteGraph graph, Resource visualisation,
+ boolean edges,
+ boolean points,
+ boolean consumers,
+ boolean producers,
+ boolean valves,
+ boolean pumpingStations) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideEdges, edges, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HidePoints, points, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideConsumers, consumers, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideProducers, producers, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HideValves, valves, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_HidePumpingStations, pumpingStations, Bindings.BOOLEAN);
+ }
+
+ public static void setStaticProperties(WriteGraph graph, Resource visualisation,
+ boolean networkBranches,
+ boolean points,
+ boolean consumers) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesNetworkBranches, networkBranches, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesPoints, points, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_StaticPropertiesConsumers, consumers, Bindings.BOOLEAN);
+ }
+
+ public static void setDynamicSymbols(WriteGraph graph, Resource visualisation,
+ boolean edges,
+ boolean producers,
+ boolean valves,
+ boolean pumpingStations) throws DatabaseException {
+ DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsProducers, producers, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsShutoffValves, edges, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsValves, valves, Bindings.BOOLEAN);
+ graph.claimLiteral(visualisation, DN.Diagram_Visualisations_DynamicSymbolsPumpingStations, pumpingStations, Bindings.BOOLEAN);
+ }
+}
import org.simantics.db.common.request.ObjectsWithSupertype;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.util.Layer0Utils;
+import org.simantics.district.network.visualisations.model.DynamicArrowContribution;
import org.simantics.district.network.visualisations.model.DynamicColorContribution;
import org.simantics.district.network.visualisations.model.DynamicColorMap;
import org.simantics.district.network.visualisations.model.DynamicSizeContribution;
private static final String DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE = "DynamicVisualisationsContribution";
private static final String COLOR_CONTRIBUTION = "colorContribution";
private static final String SIZE_CONTRIBUTION = "sizeContribution";
+ private static final String ARROW_CONTRIBUTION = "arrowContribution";
public static Map<String, DynamicColorMap> dynamicColorMaps(ReadGraph graph) throws DatabaseException {
List<Resource> sharedOntologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
return null;
}
+ public static Collection<DynamicArrowObject> dynamicEdgeArrowObjects(ReadGraph graph) throws DatabaseException {
+
+ List<Resource> sharedOntologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
+
+ List<DynamicArrowObject> results = new ArrayList<>();
+
+ for (Resource sharedOntology : sharedOntologies) {
+ Collection<Resource> findByType = graph.syncRequest(new ObjectsWithSupertype(sharedOntology, Layer0.getInstance(graph).ConsistsOf, StructuralResource2.getInstance(graph).Component));
+ //Collection<Resource> findByType = QueryIndexUtils.searchByType(graph, sharedOntology, );
+ for (Resource find : findByType) {
+ NamedResource moduleType = new NamedResource(NameLabelUtil.modalName(graph, find), find);
+ DynamicArrowObject dynamicarrowObject = dynamicEdgeArrowObject(graph, moduleType);
+ if (dynamicarrowObject != null)
+ results.add(dynamicarrowObject);
+ }
+ }
+ return results;
+ }
+
+ private static DynamicArrowObject dynamicEdgeArrowObject(ReadGraph graph, NamedResource moduleType) throws DatabaseException {
+ Layer0 L0 = Layer0.getInstance(graph);
+ Resource sclModule = Layer0Utils.getPossibleChild(graph, moduleType.getResource(), L0.SCLModule, DYNAMIC_VISUALISATIONS_CONTRIBUTION_MODULE);
+ if (sclModule != null) {
+ String moduleURI = graph.getURI(sclModule);
+ return new DynamicArrowObject(moduleType, getDynamicEdgeArrowContributionSupplier(moduleURI, ARROW_CONTRIBUTION));
+ }
+ return null;
+ }
+
private static Supplier<Stream<DynamicColorMap>> getDynamicColorMapSupplier(String uri, String expressionText) {
return () -> {
try {
};
}
+ private static Supplier<Stream<DynamicArrowContribution>> getDynamicEdgeArrowContributionSupplier(String uri, String expressionText) {
+ return () -> {
+ try {
+ @SuppressWarnings("unchecked")
+ List<DynamicArrowContribution> result = (List<DynamicArrowContribution>) SCLOsgi.MODULE_REPOSITORY.getValue(uri, expressionText);
+ return result.stream();//result.stream().map(DynamicColorContribution::fromTuple9);
+ } catch (ValueNotFound e) {
+ LOGGER.error("Could not find contributions", e);
+ //throw new RuntimeException(e);
+ return Stream.empty();
+ }
+ };
+ }
+
private static Supplier<Stream<DynamicSizeContribution>> getDynamicSizeContributionSupplier(String uri, String expressionText) {
return () -> {
try {
};
}
+ public static class DynamicArrowObject {
+
+ private final NamedResource arrowObject;
+ private final Supplier<Stream<DynamicArrowContribution>> arrowContributionSupplier;
+ private Map<String, DynamicArrowContribution> arrowContributions;
+
+ public DynamicArrowObject(NamedResource coloringObject, Supplier<Stream<DynamicArrowContribution>> arrowContributionSupplier) {
+ this.arrowObject = coloringObject;
+ this.arrowContributionSupplier = arrowContributionSupplier;
+ }
+
+ public NamedResource getArrowObject() {
+ return arrowObject;
+ }
+
+ public Map<String, DynamicArrowContribution> getArrowContributions() {
+ if (arrowContributions == null)
+ arrowContributions = arrowContributionSupplier.get().collect(Collectors.toMap(c -> c.getLabel(), c -> c));
+ return arrowContributions;
+ }
+ }
+
public static class DynamicColoringObject {
private final NamedResource coloringObject;
--- /dev/null
+package org.simantics.district.network.visualisations.model;
+
+public class DynamicArrowContribution {
+
+ private String label;
+ private String moduleName;
+ private String attributeName;
+ private double variableGain;
+ private double variableBias;
+
+ // for graph persistence only
+ private boolean used;
+ private boolean useDefault;
+
+ public DynamicArrowContribution(String label, String moduleName, String attributeName, double variableGain, double variableBias) {
+ this.label = label;
+ this.moduleName = moduleName;
+ this.attributeName = attributeName;
+ this.variableGain = variableGain;
+ this.variableBias = variableBias;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public String getAttributeName() {
+ return attributeName;
+ }
+
+ public double getDefaultGain() {
+ return variableGain;
+ }
+
+ public double getDefaultBias() {
+ return variableBias;
+ }
+
+ public void setUsed(boolean used) {
+ this.used = used;
+ }
+
+ public boolean isUsed() {
+ return used;
+ }
+
+ public void setUseDefault(boolean useDefault) {
+ this.useDefault = useDefault;
+ }
+
+ public boolean isUseDefault() {
+ return useDefault;
+ }
+}
\ No newline at end of file
public boolean isUseDefault() {
return useDefault;
}
+
+ public double adjustedValue(double value) {
+ // here we do the adjusting according to spec in #15038
+ return value * getVariableGain() + getVariableBias();
+ }
}
\ No newline at end of file
package org.simantics.district.network.visualisations.model;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
+import org.simantics.scl.runtime.SCLContext;
+
public class DynamicSizeContribution {
private String label;
public void setUseDefault(boolean useDefault) {
this.useDefault = useDefault;
}
+
+ public double adjustedValue(double value) {
+ // here we do the adjusting according to spec in #15038
+ return value * getVariableGain() + getVariableBias();
+ }
}
\ No newline at end of file
import java.util.Map;
import org.simantics.db.Resource;
+import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicArrowObject;
import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicColoringObject;
import org.simantics.district.network.visualisations.DynamicVisualisationsContributions.DynamicSizingObject;
public class DynamicVisualisation {
- private String name;
- private Resource visualisationResource;
+ private final String name;
+ private final 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;
+ private final Map<String, DynamicColorContribution> colorContributions;
+ private final Map<String, DynamicColoringObject> defaultColorContributions;
+ private final ColorBarOptions colorBarOptions;
+ private final Map<String, DynamicSizeContribution> sizeContributions;
+ private final Map<String, DynamicSizingObject> defaultSizeContributions;
+ private final SizeBarOptions sizeBarOptions;
+ private final Map<String, DynamicArrowObject> defaultArrowContributions;
+ private final Map<String, DynamicArrowContribution> arrowContributions;
- 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) {
+ private final boolean hideEdges;
+ private final boolean hidePoints;
+ private final boolean hideConsumers;
+ private final boolean hideProducers;
+ private final boolean hideValves;
+ private final boolean hidePumpingStations;
+
+ private final boolean staticPropertiesNetworkBranches;
+ private final boolean staticPropertiesPoints;
+ private final boolean staticPropertiesConsumers;
+
+ private final boolean dynamicSymbolsProducers;
+ private final boolean dynamicSymbolsShutoffValves;
+ private final boolean dynamicSymbolsValves;
+ private final boolean dynamicSymbolsPumpingStations;
+
+ 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,
+ Map<String, DynamicArrowObject> defaultArrowContributions,
+ Map<String, DynamicArrowContribution> arrowContributions,
+ boolean hideEdges,
+ boolean hidePoints,
+ boolean hideConsumers,
+ boolean hideProducers,
+ boolean hideValves,
+ boolean hidePumpingStations,
+ boolean staticPropertiesNetworkBranch,
+ boolean staticProperiesPoints,
+ boolean staticPropertiesConsumers,
+ boolean dynamicSymbolsProducers,
+ boolean dynamicSymbolsShutoffValves,
+ boolean dynamicSymbolsValves,
+ boolean dynamicSymbolsPumpingStations
+ ) {
this.name = name;
this.visualisationResource = visualisationResource;
this.colorContributions = colorContributions;
this.sizeContributions = sizeContributions;
this.defaultSizeContributions = defaultSizingObjects;
this.sizeBarOptions = sizeBarOptions;
+ this.defaultArrowContributions = defaultArrowContributions;
+ this.arrowContributions = arrowContributions;
+
+ this.hidePoints = hidePoints;
+ this.hideConsumers = hideConsumers;
+ this.hideEdges = hideEdges;
+ this.hideProducers = hideProducers;
+ this.hideValves = hideValves;
+ this.hidePumpingStations = hidePumpingStations;
+
+ this.staticPropertiesConsumers = staticPropertiesConsumers;
+ this.staticPropertiesNetworkBranches = staticPropertiesNetworkBranch;
+ this.staticPropertiesPoints = staticProperiesPoints;
+ this.dynamicSymbolsProducers = dynamicSymbolsProducers;
+ this.dynamicSymbolsPumpingStations = dynamicSymbolsPumpingStations;
+ this.dynamicSymbolsShutoffValves = dynamicSymbolsShutoffValves;
+ this.dynamicSymbolsValves = dynamicSymbolsValves;
}
public String getName() {
public Map<String, DynamicColorContribution> getColorContributions() {
return colorContributions;
}
-
+
public Map<String, DynamicColoringObject> getDefaultColorContributions() {
return defaultColorContributions;
}
public Map<String, DynamicSizeContribution> getSizeContributions() {
return sizeContributions;
}
-
+
public Map<String, DynamicSizingObject> getDefaultSizeContributions() {
return defaultSizeContributions;
}
public SizeBarOptions getSizeBarOptions() {
return sizeBarOptions;
}
+
+ public Map<String, DynamicArrowObject> getDefaultArrowContributions() {
+ return defaultArrowContributions;
+ }
+
+ public Map<String, DynamicArrowContribution> getArrowContributions() {
+ return arrowContributions;
+ }
+
+ public boolean isHideEdges() {
+ return hideEdges;
+ }
+
+ public boolean isHidePoints() {
+ return hidePoints;
+ }
+
+ public boolean isHideConsumers() {
+ return hideConsumers;
+ }
+
+ public boolean isHideProducers() {
+ return hideProducers;
+ }
+
+ public boolean isHideValves() {
+ return hideValves;
+ }
+
+ public boolean isHidePumpingStations() {
+ return hidePumpingStations;
+ }
+
+ public boolean isStaticPropertiesNetworkBranches() {
+ return staticPropertiesNetworkBranches;
+ }
+
+ public boolean isStaticPropertiesPoints() {
+ return staticPropertiesPoints;
+ }
+
+ public boolean isStaticPropertiesConsumers() {
+ return staticPropertiesConsumers;
+ }
+
+ public boolean isDynamicSymbolsProducers() {
+ return dynamicSymbolsProducers;
+ }
+
+ public boolean isDynamicSymbolsPumpingStations() {
+ return dynamicSymbolsPumpingStations;
+ }
+
+ public boolean isDynamicSymbolsShutoffValves() {
+ return dynamicSymbolsShutoffValves;
+ }
+
+ public boolean isDynamicSymbolsValves() {
+ return dynamicSymbolsValves;
+ }
}