@defProperty "K Supply" L0.Double
>-- DN.Edge.HasTGround
@defProperty "T Ground" L0.Double
- @L0.assert DN.Edge.HasDiameter 0.1
- @L0.assert DN.Edge.HasOuterDiameter 0.11
+ @L0.assert DN.Edge.HasDiameter 100
+ @L0.assert DN.Edge.HasOuterDiameter 125
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-DN.EdgeThicknessPropertyParameterType <T SEL.GenericParameterType
- @L0.assert SEL.HasDisplayValue
- _ : SEL.DisplayValue
- SEL.HasEnumerationValues DN.Functions.edgeThicknessPropertyEnumerationValues : L0.Function
- SEL.HasCustomModifier DN.Functions.edgeThicknessPropertyModifier : L0.Function
-
DN.ArrowLengthPropertyParameterType <T SEL.GenericParameterType
@L0.assert SEL.HasDisplayValue
_ : SEL.DisplayValue
SEL.HasEnumerationValues DN.Functions.arrowLengthPropertyEnumerationValues : L0.Function
SEL.HasCustomModifier DN.Functions.arrowLengthPropertyModifier : L0.Function
-DN.VertexScalePropertyParameterType <T SEL.GenericParameterType
- @L0.assert SEL.HasDisplayValue
- _ : SEL.DisplayValue
- SEL.HasEnumerationValues DN.Functions.nodeScalePropertyEnumerationValues : L0.Function
- SEL.HasCustomModifier DN.Functions.nodeScalePropertyModifier : L0.Function
-
-DN.Edge.ThicknessProperty <T L0.Value
- @L0.assert L0.ConvertsToValueWith DN.Functions.convertToValue
- >-- DN.Edge.ThicknessProperty.value ==> "Resource -> <ReadGraph> Maybe Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- >-- DN.Edge.ThicknessProperty.gain --> L0.Double <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- >-- DN.Edge.ThicknessProperty.bias --> L0.Double <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- @L0.assert DN.Edge.ThicknessProperty.gain 1.0
- @L0.assert DN.Edge.ThicknessProperty.bias 0.0
-
DN.Edge.ArrowLengthProperty <T L0.Value
@L0.assert L0.ConvertsToValueWith DN.Functions.convertToValue
>-- DN.Edge.ArrowLengthProperty.value ==> "Resource -> <ReadGraph> Maybe Double" <R L0.HasProperty : SEL.GenericParameterType
@L0.assert DN.Edge.ArrowLengthProperty.gain 1.0
@L0.assert DN.Edge.ArrowLengthProperty.bias 0.0
-DN.Vertex.ScaleProperty <T L0.Value
- @L0.assert L0.ConvertsToValueWith DN.Functions.convertToValue
- >-- DN.Vertex.ScaleProperty.value ==> "Resource -> <ReadGraph> Maybe Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- >-- DN.Vertex.ScaleProperty.gain ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- >-- DN.Vertex.ScaleProperty.bias ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.readOnly true
- @L0.assert DN.Vertex.ScaleProperty.gain 1.0
- @L0.assert DN.Vertex.ScaleProperty.bias 0.0
+// these should be deprecated
+DN.Edge.ThicknessProperty <T L0.Value
DN.Diagram
- >-- DN.Diagram.elementColoringGradientHue ==> "Float" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Element Color Hue"
- L0.HasDescription "HSV/HSB color space hue value used for element coloring in degrees (0-360)"
- L0X.HasUnit "deg"
- L0X.RequiresDataType $(Float(unit="deg",range=[0..360]))
- SEL.HasDisplayValue _ : SEL.DisplayValue
- L0.Literal.HasInputValidator DN.Functions.hueValidator : L0.Function
- >-- DN.Diagram.elementColoringGradientSaturation ==> "Float" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Element Color Saturation"
- L0.HasDescription "HSV/HSB color space saturation value used for element coloring in % (0-100)"
- L0X.HasUnit "%"
- L0X.RequiresDataType $(Float(unit="%",range=[0..100]))
- SEL.HasDisplayValue _ : SEL.DisplayValue
- L0.Literal.HasInputValidator DN.Functions.saturationValidator : L0.Function
- >-- DN.Diagram.elementColoringFunction --> L0.String ==> "Resource -> <ReadGraph> Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Element Color Brightness Function"
- L0.HasDescription "Defines HSV/HSB color space brightness function whose value is cut off to fit [0,1]. Together with hue and saturation this defines the element color."
- SEL.HasDisplayValue _ : SEL.DisplayValue
- L0.Literal.HasInputValidator DN.Functions.brightnessValidator : L0.Function
- >-- DN.Diagram.edgeThicknessGain ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Edge Thickness Gain"
- >-- DN.Diagram.edgeThicknessBias ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Edge Thickness Bias"
- >-- DN.Diagram.edgeThicknessProperty --> DN.Edge.ThicknessProperty <R L0.HasProperty : DN.EdgeThicknessPropertyParameterType
- L0.HasLabel "Edge Thickness Property"
>-- 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.nodeScaleGain ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Node Scale Gain"
- >-- DN.Diagram.nodeScaleBias ==> "Double" <R L0.HasProperty : SEL.GenericParameterType
- L0.HasLabel "Node Scale Bias"
- >-- DN.Diagram.nodeScaleProperty --> DN.Vertex.ScaleProperty <R L0.HasProperty : DN.VertexScalePropertyParameterType
- L0.HasLabel "Node Scale 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.hasActiveVisualisation --> DN.Diagram.Visualisations <R L0.HasProperty
>-- DN.Diagram.profileUpdateInterval ==> "Long" <R L0.HasProperty : SEL.GenericParameterType
L0.HasLabel "Profile update interval"
- @L0.assert DN.Diagram.elementColoringGradientHue
- 0.0 : L0.Float
- L0.HasDataType $(Float(unit="deg",range=[0..360]))
- @L0.assert DN.Diagram.elementColoringGradientSaturation
- 100.0 : L0.Float
- L0.HasDataType $(Float(unit="%",range=[0..100]))
- @MOD.sclAssertion DN.Diagram.elementColoringFunction "\r -> 1.0" "Resource -> <ReadGraph> Double"
- @L0.assert DN.Diagram.edgeThicknessGain 1.0
- @L0.assert DN.Diagram.edgeThicknessBias 0.0
- @L0.assert DN.Diagram.edgeThicknessProperty DN.Edge.ThicknessProperty.Diameter
+
@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.nodeScaleGain 1.0
- @L0.assert DN.Diagram.nodeScaleBias 0.0
- @L0.assert DN.Diagram.nodeScaleProperty DN.Vertex.ScaleProperty.NominalSupplyPressure
@L0.assert DN.Diagram.drawMapEnabled true
@L0.assert DN.Diagram.profileUpdateInterval
2000 : L0.Long
DN.Functions.hasNominalMassFlowValue : L0.Function
L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
-DN.Edge.ThicknessProperty.OnlyGainAndBias: DN.Edge.ThicknessProperty
- L0.HasLabel "Only Gain and Bias"
- DN.Edge.ThicknessProperty.value
- DN.Functions.constantOne
-
-DN.Edge.ThicknessProperty.Diameter : DN.Edge.ThicknessProperty
- L0.HasLabel "Diameter"
- DN.Edge.ThicknessProperty.value
- DN.Functions.hasDiameterValue : L0.Function
- L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
- DN.Edge.ThicknessProperty.gain 0.001
-
-DN.Edge.ThicknessProperty.FlowRate : DN.Edge.ThicknessProperty
- L0.HasLabel "Nominal Mass Flow"
- DN.Edge.ThicknessProperty.value
- DN.Functions.hasNominalMassFlowValue
- DN.Edge.ThicknessProperty.gain 0.1
-
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
-
-DN.Vertex.ScaleProperty.OnlyGainAndBias: DN.Vertex.ScaleProperty
- L0.HasLabel "Only Gain and Bias"
- DN.Vertex.ScaleProperty.value
- DN.Functions.constantOne
-
-DN.Vertex.ScaleProperty.NominalSupplyPressure : DN.Vertex.ScaleProperty
- L0.HasLabel "Nominal Supply Pressure"
- DN.Vertex.ScaleProperty.value
- DN.Functions.hasNominalSupplyPressure : L0.Function
- L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
- DN.Vertex.ScaleProperty.gain 0.001
-
-DN.Vertex.ScaleProperty.Elevation : DN.Vertex.ScaleProperty
- L0.HasLabel "Elevation"
- DN.Vertex.ScaleProperty.value
- DN.Functions.hasElevation : L0.Function
- L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
- DN.Vertex.ScaleProperty.gain 0.1
- DN.Vertex.ScaleProperty.bias 0.001
DN.ElementColoringStyle : DIA.Style
DN.ElementSizingStyle : DIA.Style
-DN.VertexSizeStyle : DIA.Style
-DN.EdgeThicknessStyle : DIA.Style
+// These are deprecated in favor of new dynamic visualisations
+//DN.VertexSizeStyle : DIA.Style
+//DN.EdgeThicknessStyle : DIA.Style
DN.ArrowLengthStyle : DIA.Style
DN.HideStyle : DIA.Style
DN.VertexSymbolStyle : DIA.Style
public final Resource Diagram_backgroundColor_Inverse;
public final Resource Diagram_drawMapEnabled;
public final Resource Diagram_drawMapEnabled_Inverse;
- public final Resource Diagram_edgeThicknessBias;
- public final Resource Diagram_edgeThicknessBias_Inverse;
- public final Resource Diagram_edgeThicknessGain;
- public final Resource Diagram_edgeThicknessGain_Inverse;
- public final Resource Diagram_edgeThicknessProperty;
- public final Resource Diagram_edgeThicknessProperty_Inverse;
- public final Resource Diagram_elementColoringFunction;
- public final Resource Diagram_elementColoringFunction_Inverse;
- public final Resource Diagram_elementColoringGradientHue;
- public final Resource Diagram_elementColoringGradientHue_Inverse;
- public final Resource Diagram_elementColoringGradientSaturation;
- public final Resource Diagram_elementColoringGradientSaturation_Inverse;
public final Resource Diagram_hasActiveVisualisation;
public final Resource Diagram_hasActiveVisualisation_Inverse;
public final Resource Diagram_hasVisualisation;
public final Resource Diagram_hasVisualisation_Inverse;
- public final Resource Diagram_nodeScaleBias;
- public final Resource Diagram_nodeScaleBias_Inverse;
- public final Resource Diagram_nodeScaleGain;
- public final Resource Diagram_nodeScaleGain_Inverse;
- public final Resource Diagram_nodeScaleProperty;
- public final Resource Diagram_nodeScaleProperty_Inverse;
public final Resource Diagram_profileUpdateInterval;
public final Resource Diagram_profileUpdateInterval_Inverse;
public final Resource Diagram_splitToMultipleEnabled;
public final Resource EdgeDefaultMapping;
public final Resource EdgeDefaultMapping_Inverse;
public final Resource EdgeMappingParameterType;
- public final Resource EdgeThicknessPropertyParameterType;
- public final Resource EdgeThicknessStyle;
public final Resource Edge_ArrowLengthProperty;
public final Resource Edge_ArrowLengthProperty_FlowRate;
public final Resource Edge_ArrowLengthProperty_bias;
public final Resource Edge_HasTGround;
public final Resource Edge_HasTGround_Inverse;
public final Resource Edge_ThicknessProperty;
- public final Resource Edge_ThicknessProperty_Diameter;
- public final Resource Edge_ThicknessProperty_FlowRate;
- public final Resource Edge_ThicknessProperty_OnlyGainAndBias;
- public final Resource Edge_ThicknessProperty_bias;
- public final Resource Edge_ThicknessProperty_bias_Inverse;
- public final Resource Edge_ThicknessProperty_gain;
- public final Resource Edge_ThicknessProperty_gain_Inverse;
- public final Resource Edge_ThicknessProperty_value;
- public final Resource Edge_ThicknessProperty_value_Inverse;
public final Resource Element;
public final Resource ElementColoringStyle;
public final Resource ElementSizingStyle;
public final Resource Functions;
public final Resource Functions_arrowLengthPropertyEnumerationValues;
public final Resource Functions_arrowLengthPropertyModifier;
- public final Resource Functions_brightnessValidator;
public final Resource Functions_compositeInstantiator;
public final Resource Functions_constantOne;
public final Resource Functions_convertToValue;
public final Resource Functions_defaultEdgeMappingModifier;
public final Resource Functions_defaultVertexMappingModifier;
- public final Resource Functions_edgeThicknessPropertyEnumerationValues;
- public final Resource Functions_edgeThicknessPropertyModifier;
public final Resource Functions_enumerationValues;
- public final Resource Functions_hasDiameterValue;
- public final Resource Functions_hasElevation;
public final Resource Functions_hasNominalMassFlowValue;
- public final Resource Functions_hasNominalSupplyPressure;
- public final Resource Functions_hueValidator;
public final Resource Functions_mappingModifier;
- public final Resource Functions_nodeScalePropertyEnumerationValues;
- public final Resource Functions_nodeScalePropertyModifier;
- public final Resource Functions_saturationValidator;
public final Resource Groups;
public final Resource Groups_EdgeGroup;
public final Resource Groups_VertexGroup;
public final Resource VertexDefaultMapping;
public final Resource VertexDefaultMapping_Inverse;
public final Resource VertexMappingParameterType;
- public final Resource VertexScalePropertyParameterType;
- public final Resource VertexSizeStyle;
public final Resource VertexSymbolStyle;
public final Resource Vertex_HasAddress;
public final Resource Vertex_HasAddress_Inverse;
public final Resource Vertex_HasVelocity_Inverse;
public final Resource Vertex_HasVolFlow;
public final Resource Vertex_HasVolFlow_Inverse;
- public final Resource Vertex_ScaleProperty;
- public final Resource Vertex_ScaleProperty_Elevation;
- public final Resource Vertex_ScaleProperty_NominalSupplyPressure;
- public final Resource Vertex_ScaleProperty_OnlyGainAndBias;
- public final Resource Vertex_ScaleProperty_bias;
- public final Resource Vertex_ScaleProperty_bias_Inverse;
- public final Resource Vertex_ScaleProperty_gain;
- public final Resource Vertex_ScaleProperty_gain_Inverse;
- public final Resource Vertex_ScaleProperty_value;
- public final Resource Vertex_ScaleProperty_value_Inverse;
public static class URIs {
public static final String ActionContext = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext";
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 Diagram_drawMapEnabled_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/drawMapEnabled/Inverse";
- public static final String Diagram_edgeThicknessBias = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessBias";
- public static final String Diagram_edgeThicknessBias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessBias/Inverse";
- public static final String Diagram_edgeThicknessGain = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessGain";
- public static final String Diagram_edgeThicknessGain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessGain/Inverse";
- public static final String Diagram_edgeThicknessProperty = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessProperty";
- public static final String Diagram_edgeThicknessProperty_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/edgeThicknessProperty/Inverse";
- public static final String Diagram_elementColoringFunction = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringFunction";
- public static final String Diagram_elementColoringFunction_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringFunction/Inverse";
- public static final String Diagram_elementColoringGradientHue = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringGradientHue";
- public static final String Diagram_elementColoringGradientHue_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringGradientHue/Inverse";
- public static final String Diagram_elementColoringGradientSaturation = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringGradientSaturation";
- public static final String Diagram_elementColoringGradientSaturation_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/elementColoringGradientSaturation/Inverse";
public static final String Diagram_hasActiveVisualisation = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/hasActiveVisualisation";
public static final String Diagram_hasActiveVisualisation_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/hasActiveVisualisation/Inverse";
public static final String Diagram_hasVisualisation = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/hasVisualisation";
public static final String Diagram_hasVisualisation_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/hasVisualisation/Inverse";
- public static final String Diagram_nodeScaleBias = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleBias";
- public static final String Diagram_nodeScaleBias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleBias/Inverse";
- public static final String Diagram_nodeScaleGain = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleGain";
- public static final String Diagram_nodeScaleGain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleGain/Inverse";
- public static final String Diagram_nodeScaleProperty = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleProperty";
- public static final String Diagram_nodeScaleProperty_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/nodeScaleProperty/Inverse";
public static final String Diagram_profileUpdateInterval = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/profileUpdateInterval";
public static final String Diagram_profileUpdateInterval_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/profileUpdateInterval/Inverse";
public static final String Diagram_splitToMultipleEnabled = "http://www.simantics.org/DistrictNetwork-1.0/Diagram/splitToMultipleEnabled";
public static final String EdgeDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping";
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 EdgeThicknessPropertyParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeThicknessPropertyParameterType";
- public static final String EdgeThicknessStyle = "http://www.simantics.org/DistrictNetwork-1.0/EdgeThicknessStyle";
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_HasTGround = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasTGround";
public static final String Edge_HasTGround_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasTGround/Inverse";
public static final String Edge_ThicknessProperty = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty";
- public static final String Edge_ThicknessProperty_Diameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/Diameter";
- public static final String Edge_ThicknessProperty_FlowRate = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/FlowRate";
- public static final String Edge_ThicknessProperty_OnlyGainAndBias = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/OnlyGainAndBias";
- public static final String Edge_ThicknessProperty_bias = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/bias";
- public static final String Edge_ThicknessProperty_bias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/bias/Inverse";
- public static final String Edge_ThicknessProperty_gain = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/gain";
- public static final String Edge_ThicknessProperty_gain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/gain/Inverse";
- public static final String Edge_ThicknessProperty_value = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/value";
- public static final String Edge_ThicknessProperty_value_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ThicknessProperty/value/Inverse";
public static final String Element = "http://www.simantics.org/DistrictNetwork-1.0/Element";
public static final String ElementColoringStyle = "http://www.simantics.org/DistrictNetwork-1.0/ElementColoringStyle";
public static final String ElementSizingStyle = "http://www.simantics.org/DistrictNetwork-1.0/ElementSizingStyle";
public static final String Functions = "http://www.simantics.org/DistrictNetwork-1.0/Functions";
public static final String Functions_arrowLengthPropertyEnumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/arrowLengthPropertyEnumerationValues";
public static final String Functions_arrowLengthPropertyModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/arrowLengthPropertyModifier";
- public static final String Functions_brightnessValidator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/brightnessValidator";
public static final String Functions_compositeInstantiator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/compositeInstantiator";
public static final String Functions_constantOne = "http://www.simantics.org/DistrictNetwork-1.0/Functions/constantOne";
public static final String Functions_convertToValue = "http://www.simantics.org/DistrictNetwork-1.0/Functions/convertToValue";
public static final String Functions_defaultEdgeMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultEdgeMappingModifier";
public static final String Functions_defaultVertexMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultVertexMappingModifier";
- public static final String Functions_edgeThicknessPropertyEnumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/edgeThicknessPropertyEnumerationValues";
- public static final String Functions_edgeThicknessPropertyModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/edgeThicknessPropertyModifier";
public static final String Functions_enumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/enumerationValues";
- public static final String Functions_hasDiameterValue = "http://www.simantics.org/DistrictNetwork-1.0/Functions/hasDiameterValue";
- public static final String Functions_hasElevation = "http://www.simantics.org/DistrictNetwork-1.0/Functions/hasElevation";
public static final String Functions_hasNominalMassFlowValue = "http://www.simantics.org/DistrictNetwork-1.0/Functions/hasNominalMassFlowValue";
- public static final String Functions_hasNominalSupplyPressure = "http://www.simantics.org/DistrictNetwork-1.0/Functions/hasNominalSupplyPressure";
- public static final String Functions_hueValidator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/hueValidator";
public static final String Functions_mappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/mappingModifier";
- public static final String Functions_nodeScalePropertyEnumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/nodeScalePropertyEnumerationValues";
- public static final String Functions_nodeScalePropertyModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/nodeScalePropertyModifier";
- public static final String Functions_saturationValidator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/saturationValidator";
public static final String Groups = "http://www.simantics.org/DistrictNetwork-1.0/Groups";
public static final String Groups_EdgeGroup = "http://www.simantics.org/DistrictNetwork-1.0/Groups/EdgeGroup";
public static final String Groups_VertexGroup = "http://www.simantics.org/DistrictNetwork-1.0/Groups/VertexGroup";
public static final String VertexDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping";
public static final String VertexDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping/Inverse";
public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType";
- public static final String VertexScalePropertyParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexScalePropertyParameterType";
- public static final String VertexSizeStyle = "http://www.simantics.org/DistrictNetwork-1.0/VertexSizeStyle";
public static final String VertexSymbolStyle = "http://www.simantics.org/DistrictNetwork-1.0/VertexSymbolStyle";
public static final String Vertex_HasAddress = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress";
public static final String Vertex_HasAddress_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasAddress/Inverse";
public static final String Vertex_HasVelocity_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVelocity/Inverse";
public static final String Vertex_HasVolFlow = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVolFlow";
public static final String Vertex_HasVolFlow_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/HasVolFlow/Inverse";
- public static final String Vertex_ScaleProperty = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty";
- public static final String Vertex_ScaleProperty_Elevation = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/Elevation";
- public static final String Vertex_ScaleProperty_NominalSupplyPressure = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/NominalSupplyPressure";
- public static final String Vertex_ScaleProperty_OnlyGainAndBias = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/OnlyGainAndBias";
- public static final String Vertex_ScaleProperty_bias = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/bias";
- public static final String Vertex_ScaleProperty_bias_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/bias/Inverse";
- public static final String Vertex_ScaleProperty_gain = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/gain";
- public static final String Vertex_ScaleProperty_gain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/gain/Inverse";
- public static final String Vertex_ScaleProperty_value = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/value";
- public static final String Vertex_ScaleProperty_value_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Vertex/ScaleProperty/value/Inverse";
}
public static Resource getResourceOrNull(ReadGraph graph, String uri) {
Diagram_backgroundColor_Inverse = getResourceOrNull(graph, URIs.Diagram_backgroundColor_Inverse);
Diagram_drawMapEnabled = getResourceOrNull(graph, URIs.Diagram_drawMapEnabled);
Diagram_drawMapEnabled_Inverse = getResourceOrNull(graph, URIs.Diagram_drawMapEnabled_Inverse);
- Diagram_edgeThicknessBias = getResourceOrNull(graph, URIs.Diagram_edgeThicknessBias);
- Diagram_edgeThicknessBias_Inverse = getResourceOrNull(graph, URIs.Diagram_edgeThicknessBias_Inverse);
- Diagram_edgeThicknessGain = getResourceOrNull(graph, URIs.Diagram_edgeThicknessGain);
- Diagram_edgeThicknessGain_Inverse = getResourceOrNull(graph, URIs.Diagram_edgeThicknessGain_Inverse);
- Diagram_edgeThicknessProperty = getResourceOrNull(graph, URIs.Diagram_edgeThicknessProperty);
- Diagram_edgeThicknessProperty_Inverse = getResourceOrNull(graph, URIs.Diagram_edgeThicknessProperty_Inverse);
- Diagram_elementColoringFunction = getResourceOrNull(graph, URIs.Diagram_elementColoringFunction);
- Diagram_elementColoringFunction_Inverse = getResourceOrNull(graph, URIs.Diagram_elementColoringFunction_Inverse);
- Diagram_elementColoringGradientHue = getResourceOrNull(graph, URIs.Diagram_elementColoringGradientHue);
- Diagram_elementColoringGradientHue_Inverse = getResourceOrNull(graph, URIs.Diagram_elementColoringGradientHue_Inverse);
- Diagram_elementColoringGradientSaturation = getResourceOrNull(graph, URIs.Diagram_elementColoringGradientSaturation);
- Diagram_elementColoringGradientSaturation_Inverse = getResourceOrNull(graph, URIs.Diagram_elementColoringGradientSaturation_Inverse);
Diagram_hasActiveVisualisation = getResourceOrNull(graph, URIs.Diagram_hasActiveVisualisation);
Diagram_hasActiveVisualisation_Inverse = getResourceOrNull(graph, URIs.Diagram_hasActiveVisualisation_Inverse);
Diagram_hasVisualisation = getResourceOrNull(graph, URIs.Diagram_hasVisualisation);
Diagram_hasVisualisation_Inverse = getResourceOrNull(graph, URIs.Diagram_hasVisualisation_Inverse);
- Diagram_nodeScaleBias = getResourceOrNull(graph, URIs.Diagram_nodeScaleBias);
- Diagram_nodeScaleBias_Inverse = getResourceOrNull(graph, URIs.Diagram_nodeScaleBias_Inverse);
- Diagram_nodeScaleGain = getResourceOrNull(graph, URIs.Diagram_nodeScaleGain);
- Diagram_nodeScaleGain_Inverse = getResourceOrNull(graph, URIs.Diagram_nodeScaleGain_Inverse);
- Diagram_nodeScaleProperty = getResourceOrNull(graph, URIs.Diagram_nodeScaleProperty);
- Diagram_nodeScaleProperty_Inverse = getResourceOrNull(graph, URIs.Diagram_nodeScaleProperty_Inverse);
Diagram_profileUpdateInterval = getResourceOrNull(graph, URIs.Diagram_profileUpdateInterval);
Diagram_profileUpdateInterval_Inverse = getResourceOrNull(graph, URIs.Diagram_profileUpdateInterval_Inverse);
Diagram_splitToMultipleEnabled = getResourceOrNull(graph, URIs.Diagram_splitToMultipleEnabled);
EdgeDefaultMapping = getResourceOrNull(graph, URIs.EdgeDefaultMapping);
EdgeDefaultMapping_Inverse = getResourceOrNull(graph, URIs.EdgeDefaultMapping_Inverse);
EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType);
- EdgeThicknessPropertyParameterType = getResourceOrNull(graph, URIs.EdgeThicknessPropertyParameterType);
- EdgeThicknessStyle = getResourceOrNull(graph, URIs.EdgeThicknessStyle);
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_HasTGround = getResourceOrNull(graph, URIs.Edge_HasTGround);
Edge_HasTGround_Inverse = getResourceOrNull(graph, URIs.Edge_HasTGround_Inverse);
Edge_ThicknessProperty = getResourceOrNull(graph, URIs.Edge_ThicknessProperty);
- Edge_ThicknessProperty_Diameter = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_Diameter);
- Edge_ThicknessProperty_FlowRate = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_FlowRate);
- Edge_ThicknessProperty_OnlyGainAndBias = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_OnlyGainAndBias);
- Edge_ThicknessProperty_bias = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_bias);
- Edge_ThicknessProperty_bias_Inverse = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_bias_Inverse);
- Edge_ThicknessProperty_gain = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_gain);
- Edge_ThicknessProperty_gain_Inverse = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_gain_Inverse);
- Edge_ThicknessProperty_value = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_value);
- Edge_ThicknessProperty_value_Inverse = getResourceOrNull(graph, URIs.Edge_ThicknessProperty_value_Inverse);
Element = getResourceOrNull(graph, URIs.Element);
ElementColoringStyle = getResourceOrNull(graph, URIs.ElementColoringStyle);
ElementSizingStyle = getResourceOrNull(graph, URIs.ElementSizingStyle);
Functions = getResourceOrNull(graph, URIs.Functions);
Functions_arrowLengthPropertyEnumerationValues = getResourceOrNull(graph, URIs.Functions_arrowLengthPropertyEnumerationValues);
Functions_arrowLengthPropertyModifier = getResourceOrNull(graph, URIs.Functions_arrowLengthPropertyModifier);
- Functions_brightnessValidator = getResourceOrNull(graph, URIs.Functions_brightnessValidator);
Functions_compositeInstantiator = getResourceOrNull(graph, URIs.Functions_compositeInstantiator);
Functions_constantOne = getResourceOrNull(graph, URIs.Functions_constantOne);
Functions_convertToValue = getResourceOrNull(graph, URIs.Functions_convertToValue);
Functions_defaultEdgeMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultEdgeMappingModifier);
Functions_defaultVertexMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultVertexMappingModifier);
- Functions_edgeThicknessPropertyEnumerationValues = getResourceOrNull(graph, URIs.Functions_edgeThicknessPropertyEnumerationValues);
- Functions_edgeThicknessPropertyModifier = getResourceOrNull(graph, URIs.Functions_edgeThicknessPropertyModifier);
Functions_enumerationValues = getResourceOrNull(graph, URIs.Functions_enumerationValues);
- Functions_hasDiameterValue = getResourceOrNull(graph, URIs.Functions_hasDiameterValue);
- Functions_hasElevation = getResourceOrNull(graph, URIs.Functions_hasElevation);
Functions_hasNominalMassFlowValue = getResourceOrNull(graph, URIs.Functions_hasNominalMassFlowValue);
- Functions_hasNominalSupplyPressure = getResourceOrNull(graph, URIs.Functions_hasNominalSupplyPressure);
- Functions_hueValidator = getResourceOrNull(graph, URIs.Functions_hueValidator);
Functions_mappingModifier = getResourceOrNull(graph, URIs.Functions_mappingModifier);
- Functions_nodeScalePropertyEnumerationValues = getResourceOrNull(graph, URIs.Functions_nodeScalePropertyEnumerationValues);
- Functions_nodeScalePropertyModifier = getResourceOrNull(graph, URIs.Functions_nodeScalePropertyModifier);
- Functions_saturationValidator = getResourceOrNull(graph, URIs.Functions_saturationValidator);
Groups = getResourceOrNull(graph, URIs.Groups);
Groups_EdgeGroup = getResourceOrNull(graph, URIs.Groups_EdgeGroup);
Groups_VertexGroup = getResourceOrNull(graph, URIs.Groups_VertexGroup);
VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping);
VertexDefaultMapping_Inverse = getResourceOrNull(graph, URIs.VertexDefaultMapping_Inverse);
VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType);
- VertexScalePropertyParameterType = getResourceOrNull(graph, URIs.VertexScalePropertyParameterType);
- VertexSizeStyle = getResourceOrNull(graph, URIs.VertexSizeStyle);
VertexSymbolStyle = getResourceOrNull(graph, URIs.VertexSymbolStyle);
Vertex_HasAddress = getResourceOrNull(graph, URIs.Vertex_HasAddress);
Vertex_HasAddress_Inverse = getResourceOrNull(graph, URIs.Vertex_HasAddress_Inverse);
Vertex_HasVelocity_Inverse = getResourceOrNull(graph, URIs.Vertex_HasVelocity_Inverse);
Vertex_HasVolFlow = getResourceOrNull(graph, URIs.Vertex_HasVolFlow);
Vertex_HasVolFlow_Inverse = getResourceOrNull(graph, URIs.Vertex_HasVolFlow_Inverse);
- Vertex_ScaleProperty = getResourceOrNull(graph, URIs.Vertex_ScaleProperty);
- Vertex_ScaleProperty_Elevation = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_Elevation);
- Vertex_ScaleProperty_NominalSupplyPressure = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_NominalSupplyPressure);
- Vertex_ScaleProperty_OnlyGainAndBias = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_OnlyGainAndBias);
- Vertex_ScaleProperty_bias = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_bias);
- Vertex_ScaleProperty_bias_Inverse = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_bias_Inverse);
- Vertex_ScaleProperty_gain = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_gain);
- Vertex_ScaleProperty_gain_Inverse = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_gain_Inverse);
- Vertex_ScaleProperty_value = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_value);
- Vertex_ScaleProperty_value_Inverse = getResourceOrNull(graph, URIs.Vertex_ScaleProperty_value_Inverse);
}
public static DistrictNetworkResource getInstance(ReadGraph graph) {
private static List<String> listInstanceNames(ReadGraph graph, Variable context, Resource type) throws DatabaseException {
Resource indexRoot = Variables.getIndexRoot(graph, context);
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- List<Resource> properties = QueryIndexUtils.searchByType(graph, indexRoot, DN.Vertex_ScaleProperty);
+ List<Resource> properties = Collections.emptyList();//QueryIndexUtils.searchByType(graph, indexRoot, DN.Vertex_ScaleProperty);
return properties.stream()
.map(m -> createEnumeratedValue(graph, m))
.map(EnumeratedValue::getName)
.collect(Collectors.toList());
}
- @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
- public static Object edgeThicknessPropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return listInstanceNames(graph, context, DN.Edge_ThicknessProperty);
- }
-
@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 nodeScalePropertyEnumerationValues(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return listInstanceNames(graph, context, DN.Vertex_ScaleProperty);
- }
-
- @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
- public static Object edgeThicknessPropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- Resource diagram = resolveElement(graph, context);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return baseMappingModifier(graph, diagram, DN.Diagram_edgeThicknessProperty, DN.Edge_ThicknessProperty, context);
- }
@SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
public static Object arrowLengthPropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
return baseMappingModifier(graph, diagram, DN.Diagram_arrowLengthProperty, DN.Edge_ArrowLengthProperty, context);
}
-
- @SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
- public static Object nodeScalePropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
- Resource diagram = resolveElement(graph, context);
- DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- return baseMappingModifier(graph, diagram, DN.Diagram_nodeScaleProperty, DN.Vertex_ScaleProperty, context);
- }
@SCLValue(type = "ReadGraph -> Resource -> Variable -> b")
public static Function1<Resource, Double> hasDiameterValue(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
-import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.util.List;
import java.util.Map;
int i = 0;
- for (Entry<String, DynamicSizeContribution> object : dynamicSizingContributions.entrySet()) {
- DynamicSizeContribution cc = object.getValue();
-
- double min = cc.getDefaultMin();
- double max = cc.getDefaultMax();
- String unit = cc.getUnit();
- String label = cc.getLabel();
-
- DynamicSizeMap map = cc.getDefaultSizeMap();
-
- List<Double> sizes = map.getSizes();
-
- double sizeBarBoxTop = (sizeBarBoxTopInitial + (colorBarBoxHeight * i));
- i++;
-
- g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
- g2d.setColor(new Color(0.9f, 0.9f, 0.9f, 0.95f));
-
- Rectangle2D vertical = new Rectangle2D.Double(sizeBarBoxLeft, sizeBarBoxTop, colorBarBoxWidth, colorBarBoxHeight);
- g2d.fill(vertical);
-
- double sizeVerticalLeft = sizeBarBoxLeft + 5;
- double sizeVerticalTop = sizeBarBoxTop + 15;
- double sizeVerticalHeigth = colorBarBoxHeight - 30;
-
- double sizeVerticalWidth = (sizeBarBoxWidth - 10) / sizes.size();
-
- Font rulerFont = new Font("Tahoma", Font.PLAIN, DPIUtil.upscale(9));
- g2d.setFont(rulerFont);
-
- double interval = (max - min) / sizes.size();
-
- for (int j = 0; j < sizes.size(); j++) {
+ if (dynamicSizingContributions != null) {
+ for (Entry<String, DynamicSizeContribution> object : dynamicSizingContributions.entrySet()) {
+ DynamicSizeContribution cc = object.getValue();
+
+ if (!cc.isUsed())
+ continue;
+
+ double min = cc.getDefaultMin();
+ double max = cc.getDefaultMax();
+ String unit = cc.getUnit();
+ String label = cc.getLabel();
+
+ DynamicSizeMap map = cc.getDefaultSizeMap();
+
+ List<Double> sizes = map.getSizes();
+
+ double sizeBarBoxTop = (sizeBarBoxTopInitial + (colorBarBoxHeight * i));
+ i++;
+
+ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
+ g2d.setColor(new Color(0.9f, 0.9f, 0.9f, 0.95f));
+
+ Rectangle2D vertical = new Rectangle2D.Double(sizeBarBoxLeft, sizeBarBoxTop, colorBarBoxWidth, colorBarBoxHeight);
+ g2d.fill(vertical);
- Double size = sizes.get(j);
+ double sizeVerticalLeft = sizeBarBoxLeft + 5;
+ double sizeVerticalTop = sizeBarBoxTop + 15;
+ double sizeVerticalHeigth = colorBarBoxHeight - 30;
+
+ double sizeVerticalWidth = (sizeBarBoxWidth - 10) / sizes.size();
- g2d.setColor(new Color((float)0, (float)0, (float)0.8, 0.8f));
- double sizedWidth = (size / 5) * sizeVerticalHeigth;
- Rectangle2D rect = new Rectangle2D.Double(sizeVerticalLeft, (sizeVerticalTop), sizedWidth, sizeVerticalHeigth);
- g2d.fill(rect);
+ Font rulerFont = new Font("Tahoma", Font.PLAIN, DPIUtil.upscale(9));
+ g2d.setFont(rulerFont);
+
+ double interval = (max - min) / sizes.size();
- double value = min + j * interval;
- String str = Double.toString(value);
- if (str.length() > 4) {
- str = str.substring(0, 3);
+ for (int j = 0; j < sizes.size(); j++) {
+
+ Double size = sizes.get(j);
+
+ g2d.setColor(new Color((float)0, (float)0, (float)0.8, 0.8f));
+ double sizedWidth = (size / 5) * sizeVerticalHeigth;
+ Rectangle2D rect = new Rectangle2D.Double(sizeVerticalLeft, (sizeVerticalTop), sizedWidth, sizeVerticalHeigth);
+ g2d.fill(rect);
+
+ double value = min + j * interval;
+ String str = Double.toString(value);
+ if (str.length() > 4) {
+ str = str.substring(0, 3);
+ }
+ g2d.setColor(Color.BLACK);
+ g2d.drawString(str, (float)(sizeVerticalLeft - 8), (float)(sizeBarBoxTop + sizeBarBoxHeight));
+
+ sizeVerticalLeft = sizeVerticalLeft + sizeVerticalWidth;
}
g2d.setColor(Color.BLACK);
- g2d.drawString(str, (float)(sizeVerticalLeft - 8), (float)(sizeBarBoxTop + sizeBarBoxHeight));
- sizeVerticalLeft = sizeVerticalLeft + sizeVerticalWidth;
+ String str = Double.toString(max);
+ g2d.drawString(str, (int)(sizeBarBoxLeft + sizeBarBoxWidth - 30), (int)(sizeBarBoxTop + sizeBarBoxHeight));
+
+ str = object.getKey() + " - " + label + " [" + unit + "]";
+ g2d.drawString(str, (int)sizeBarBoxLeft + 5, (int)sizeBarBoxTop + 10);
}
- g2d.setColor(Color.BLACK);
-
- String str = Double.toString(max);
- g2d.drawString(str, (int)(sizeBarBoxLeft + sizeBarBoxWidth - 30), (int)(sizeBarBoxTop + sizeBarBoxHeight));
-
- str = object.getKey() + " - " + label + " [" + unit + "]";
- g2d.drawString(str, (int)sizeBarBoxLeft + 5, (int)sizeBarBoxTop + 10);
}
}
import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsLocation;
import org.simantics.district.network.visualisations.model.SizeBarOptions.SizeBarsSize;
import org.simantics.utils.datastructures.Pair;
+import org.simantics.utils.ui.dialogs.ShowError;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private Button showSizeButton;
private Button sizeTicksButton;
+ private Button sizeGradientButton;
private Combo sizeLocationCombo;
private Combo sizeSizeCombo;
private Button showColorButton;
private Button colorTicksButton;
+ private Button colorGradientButton;
private Combo colorLocationCombo;
private Combo colorSizeCombo;
@Override
public void widgetSelected(SelectionEvent e) {
- persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ try {
+ persistVisualisationTemplate(visualisation.getName(), Optional.of(visualisation.getVisualisationResource()));
+ } catch (Exception e1) {
+ LOGGER.error("Could not persist visualisation template", e1);
+ ShowError.showError("Could not persist visualisation template", e1.getMessage(), e1);
+ }
}
});
if (dialog.open() == Dialog.OK) {
String name = dialog.getValue();
- persistVisualisationTemplate(name, Optional.empty());
+ try {
+ persistVisualisationTemplate(name, Optional.empty());
+ } catch (Exception e) {
+ LOGGER.error("Could not persist visualisation template", e);
+ ShowError.showError("Could not persist visualisation template", e.getMessage(), e);
+ }
}
}
- private void persistVisualisationTemplate(String templateName, Optional<Resource> existing) {
+ 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());
ColorBarOptions colorBarOptions = new ColorBarOptions()
.showColorBars(showColorButton.getSelection())
.showColorBarsTicks(colorTicksButton.getSelection())
+ .useGradients(colorGradientButton.getSelection())
.withLocation(ColorBarsLocation.valueOf(colorLocation))
.withSize(ColorBarsSize.valueOf(colorSize));
SizeBarOptions sizeBarOptions = new SizeBarOptions()
.showSizeBars(showSizeButton.getSelection())
.showSizeBarsTicks(sizeTicksButton.getSelection())
+ .useGradients(sizeGradientButton.getSelection())
.withLocation(SizeBarsLocation.valueOf(sizeLocation))
.withSize(SizeBarsSize.valueOf(sizeSize));
Group group = new Group(parent, SWT.NONE);
group.setText("Color Bars");
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
- GridLayoutFactory.fillDefaults().numColumns(6).margins(5, 5).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(8).margins(5, 5).applyTo(group);
createColorBars(group);
}
colorTicksButton = new Button(parent, SWT.CHECK);
colorTicksButton.setText("Ticks");
+ colorGradientButton = new Button(parent, SWT.CHECK);
+ colorGradientButton.setText("Gradients");
+
Label label = new Label(parent, SWT.NONE);
label.setText("Location");
colorLocationCombo = new Combo(parent, SWT.READ_ONLY);
- colorLocationCombo.setItems(Stream.of(ColorBarsLocation.values()).map(size -> size.toString()).toArray(String[]::new));
+ String[] colorLocationItems = Stream.of(ColorBarsLocation.values()).map(size -> size.toString()).toArray(String[]::new);
+ colorLocationCombo.setItems(colorLocationItems);
+ if (colorLocationItems.length > 0) {
+ colorLocationCombo.select(0);
+ }
label = new Label(parent, SWT.NONE);
label.setText("Size");
colorSizeCombo = new Combo(parent, SWT.READ_ONLY);
- colorSizeCombo.setItems(Stream.of(ColorBarsSize.values()).map(size -> size.toString()).toArray(String[]::new));
+ String[] colorSizeItems = Stream.of(ColorBarsSize.values()).map(size -> size.toString()).toArray(String[]::new);
+ colorSizeCombo.setItems(colorSizeItems);
+ if (colorSizeItems.length > 0) {
+ colorSizeCombo.select(0);
+ }
}
private void initializeObjectSizes(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setText("Size Bars");
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
- GridLayoutFactory.fillDefaults().numColumns(6).margins(5, 5).applyTo(group);
+ GridLayoutFactory.fillDefaults().numColumns(8).margins(5, 5).applyTo(group);
createSizeBars(group);
}
sizeTicksButton = new Button(parent, SWT.CHECK);
sizeTicksButton.setText("Ticks");
+ sizeGradientButton = new Button(parent, SWT.CHECK);
+ sizeGradientButton.setText("Gradient");
+
Label label = new Label(parent, SWT.NONE);
label.setText("Location");
sizeLocationCombo = new Combo(parent, SWT.READ_ONLY);
- sizeLocationCombo.setItems(Stream.of(SizeBarsLocation.values()).map(size -> size.toString()).toArray(String[]::new));
+ String[] sizeLocationItems = Stream.of(SizeBarsLocation.values()).map(size -> size.toString()).toArray(String[]::new);
+ sizeLocationCombo.setItems(sizeLocationItems);
+ if (sizeLocationItems.length > 0) {
+ sizeLocationCombo.select(0);
+ }
label = new Label(parent, SWT.NONE);
label.setText("Size");
sizeSizeCombo = new Combo(parent, SWT.READ_ONLY);
- sizeSizeCombo.setItems(Stream.of(SizeBarsSize.values()).map(size -> size.toString()).toArray(String[]::new));
+ String[] sizeSizeItems = Stream.of(SizeBarsSize.values()).map(size -> size.toString()).toArray(String[]::new);
+ sizeSizeCombo.setItems(sizeSizeItems);
+ if (sizeSizeItems.length > 0) {
+ sizeSizeCombo.select(0);
+ }
}
public void setDiagramResource(Resource diagramResource) {
public void updateVisualisation(DynamicVisualisation result) {
this.visualisation = result;
- if (visualisation != null) {
- Display.getDefault().asyncExec(() -> {
- if (getParent().isDisposed())
- return;
-
- applyButton.setEnabled(visualisation != null);
-
+ Display.getDefault().asyncExec(() -> {
+ if (getParent().isDisposed())
+ return;
+
+ applyButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
+ removeVisualisationTemplateButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
+
+ if (visualisation != null) {
String[] items = templateSelectionCombo.getItems();
for (int i = 0; i < items.length; i++) {
if (visualisation.getName().equals(items[i])) {
break;
}
}
-
-
- removeVisualisationTemplateButton.setEnabled(visualisation != null && visualisation.getVisualisationResource() != null);
- });
- }
+ }
+ });
}
public void updateVisualisations(Collection<NamedResource> result) {
<resource uri="http://www.simantics.org/DistrictNetwork-1.0/ElementSizingStyle"
class="org.simantics.district.network.profile.DNElementSizeStyle">
</resource>
- <resource uri="http://www.simantics.org/DistrictNetwork-1.0/VertexSizeStyle"
- class="org.simantics.district.network.profile.VertexSizeStyle">
- </resource>
- <resource uri="http://www.simantics.org/DistrictNetwork-1.0/EdgeThicknessStyle"
- class="org.simantics.district.network.profile.EdgeThicknessStyle">
- </resource>
<resource uri="http://www.simantics.org/DistrictNetwork-1.0/ArrowLengthStyle"
class="org.simantics.district.network.profile.ArrowLengthStyle">
</resource>
Map<String, DynamicSizeMap> sizeMaps = DynamicVisualisationsContributions.dynamicSizeMaps(graph);
- Collection<Resource> colorContributions = graph.getObjects(visualisation, DN.Diagram_Visualisations_sizeContributions);
- for (Resource colorContribution : colorContributions) {
- String ucName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionContributorName, Bindings.STRING);
- String label = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionLabel, Bindings.STRING);
- String moduleName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionModuleName, Bindings.STRING);
- String attributeName = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionModuleAttribute, Bindings.STRING);
- String unit = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionUnit, Bindings.STRING);
- Double variableGain = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionVariableGain, Bindings.DOUBLE);
- Double variableBias = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionVariableBias, Bindings.DOUBLE);
- String dynamicSizeMap = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionDefaultSizeMap, Bindings.STRING);
- Double defaultMin = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionDefaultMin, Bindings.DOUBLE);
- Double defaultMax = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionDefaultMax, Bindings.DOUBLE);
- Boolean used = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionUsed, Bindings.BOOLEAN);
- Boolean useDefault = graph.getRelatedValue(colorContribution, DN.Diagram_Visualisations_sizeContributionUseDefault, Bindings.BOOLEAN);
+ 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);
import java.awt.Color;
import java.util.Map;
-import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
DynamicVisualisation dv = graph.syncRequest(new RuntimeDynamicVisualisationsRequest(runtimeDiagram),
TransientCacheAsyncListener.instance());
- DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
// Prevent PendingVariableExceptions from coming through
boolean wasSynchronous = graph.setSynchronous(true);
try {
}
}
}
-
- // the old implementation here
- if (ds.elementColoringFunction.isPresent()) {
- if (DEBUG)
- System.out.print("elementColoringFunction: " + ds.elementColoringFunction + "(" + groupItem + "): ");
- Double t = Simantics.applySCLRead(graph, ds.elementColoringFunction.get(), groupItem);
- if (DEBUG)
- System.out.print(t);
- if (t != null) {
- Color result = ds.coloringGradient.get(t);
- //System.out.println("color(" + t + "): " + result);
- return result;
- }
- }
}
finally {
graph.setSynchronous(wasSynchronous);
finally {
graph.setSynchronous(wasSynchronous);
}
- return null;
+ return 1.0;
}
@Override
*/
public class DiagramSettings {
- public final Optional<Function1<Resource, Double>> vertexScaleProperty;
- public final double vertexScaleGain;
- public final double vertexScaleBias;
- public final Optional<Function1<Resource, Double>> edgeThicknessProperty;
- public final double edgeThicknessGain;
- public final double edgeThicknessBias;
public final Optional<Function1<Resource, Double>> arrowLengthProperty;
public final double arrowLengthGain;
public final double arrowLengthBias;
- public final Optional<Function1<Resource, Double>> elementColoringFunction;
- public final float elementColoringGradientHue;
- public final float elementColoringGradientSaturation;
- public final transient ColorGradient coloringGradient;
public DiagramSettings(
- Function1<Resource, Double> vertexScaleProperty, double vertexScaleGain, double vertexScaleBias,
- Function1<Resource, Double> edgeThicknessProperty, double edgeThicknessGain, double edgeThicknessBias,
- Function1<Resource, Double> arrowLengthProperty, double arrowLengthGain, double arrowLengthBias,
- Function1<Resource, Double> elementColoringFunction,
- float elementColoringGradientHue,
- float elementColoringGradientSaturation
+ Function1<Resource, Double> arrowLengthProperty, double arrowLengthGain, double arrowLengthBias
) {
- this.vertexScaleProperty = Optional.ofNullable(vertexScaleProperty);
- this.vertexScaleGain = vertexScaleGain;
- this.vertexScaleBias = vertexScaleBias;
- this.edgeThicknessProperty = Optional.ofNullable(edgeThicknessProperty);
- this.edgeThicknessGain = edgeThicknessGain;
- this.edgeThicknessBias = edgeThicknessBias;
this.arrowLengthProperty = Optional.ofNullable(arrowLengthProperty);
this.arrowLengthGain = arrowLengthGain;
this.arrowLengthBias = arrowLengthBias;
- this.elementColoringFunction = Optional.ofNullable(elementColoringFunction);
- this.elementColoringGradientHue = elementColoringGradientHue;
- this.elementColoringGradientSaturation = elementColoringGradientSaturation;
- this.coloringGradient = Colors.cached(
- Colors.hsvGradient(
- elementColoringGradientHue,
- elementColoringGradientSaturation)
- );
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + edgeThicknessProperty.hashCode();
+ //result = prime * result + edgeThicknessProperty.hashCode();
result = prime * result + arrowLengthProperty.hashCode();
- long temp;
- temp = Double.doubleToLongBits(edgeThicknessGain);
+ long temp = result;
+ //temp = Double.doubleToLongBits(edgeThicknessGain);
result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(edgeThicknessBias);
+ //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));
- result = prime * result + vertexScaleProperty.hashCode();
- temp = Double.doubleToLongBits(vertexScaleGain);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(vertexScaleBias);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- result = prime * result + elementColoringFunction.hashCode();
- result = prime * result + Float.floatToIntBits(elementColoringGradientHue);
- result = prime * result + Float.floatToIntBits(elementColoringGradientSaturation);
+
return result;
}
if (getClass() != obj.getClass())
return false;
DiagramSettings other = (DiagramSettings) obj;
- if (!edgeThicknessProperty.equals(other.edgeThicknessProperty))
- return false;
- if (Double.doubleToLongBits(edgeThicknessGain) != Double.doubleToLongBits(other.edgeThicknessGain))
- return false;
- if (Double.doubleToLongBits(edgeThicknessBias) != Double.doubleToLongBits(other.edgeThicknessBias))
- return false;
+
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;
- if (!vertexScaleProperty.equals(other.vertexScaleProperty))
- return false;
- if (Double.doubleToLongBits(vertexScaleGain) != Double.doubleToLongBits(other.vertexScaleGain))
- return false;
- if (Double.doubleToLongBits(vertexScaleBias) != Double.doubleToLongBits(other.vertexScaleBias))
- return false;
- if (!elementColoringFunction.equals(other.elementColoringFunction))
- return false;
- if (Float.floatToIntBits(elementColoringGradientHue) != Float.floatToIntBits(other.elementColoringGradientHue))
- return false;
- if (Float.floatToIntBits(elementColoringGradientSaturation) != Float.floatToIntBits(other.elementColoringGradientSaturation))
- return false;
+
return true;
}
@Override
public String toString() {
- return String.format("DiagramSettings[%s * %f + %f - %s * %f + %f - %s * %f + %f - coloringFunction: %s, hue: %f, saturation: %f]",
- vertexScaleProperty.toString(), vertexScaleGain, vertexScaleBias,
- edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias,
- arrowLengthProperty, arrowLengthGain, arrowLengthBias,
- elementColoringFunction.toString(),
- elementColoringGradientHue, elementColoringGradientSaturation
+ return String.format("DiagramSettings[%s * %f + %f]",
+ arrowLengthProperty, arrowLengthGain, arrowLengthBias
);
}
DiagramResource DIA = DiagramResource.getInstance(graph);
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Function1<Resource, Double> elementColoringFunction = null;
- float elementColoringGradientHue = 0;
- float elementColoringGradientSaturation = 1;
- Function1<Resource, Double> edgeThicknessProperty = null;
Function1<Resource, Double> arrowLengthProperty = null;
- Function1<Resource, Double> nodeScaleProperty = null;
- double edgeThicknessGain = 1;
- double edgeThicknessBias = 0;
double arrowLengthGain = 1;
double arrowLengthBias = 0;
- double nodeScaleGain = 1;
- double nodeScaleBias = 0;
Resource diagram = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasConfiguration);
if (diagram != null) {
Variable dv = Variables.getPossibleVariable(graph, diagram);
- if (dv != null) {
- Object obj = dv.getPossiblePropertyValue(graph, DN.Diagram_elementColoringFunction);
- if (obj instanceof Function1<?,?>) {
- elementColoringFunction = (Function1<Resource, Double>) obj;
- }
- }
- elementColoringGradientHue =
- limit(0, 360, safeFloatProperty(graph, diagram, DN.Diagram_elementColoringGradientHue, 0.0f))
- / 360.0f;
- elementColoringGradientSaturation =
- limit(0, 100, safeFloatProperty(graph, diagram, DN.Diagram_elementColoringGradientSaturation, 0.0f))
- / 100.0f;
-
- Resource etp = graph.getPossibleObject(diagram, DN.Diagram_edgeThicknessProperty);
- //System.out.println("etp: " + NameUtils.getURIOrSafeNameInternal(graph, etp));
- if (etp != null) {
- Variable etpv = Variables.getPossibleVariable(graph, etp);
- if (etpv != null) {
- //System.out.println("etpv: " + etpv.getURI(graph));
- edgeThicknessProperty = etpv.getPropertyValue(graph, DN.Edge_ThicknessProperty_value);
- }
- edgeThicknessGain =
- safeDoubleProperty(graph, etp, DN.Edge_ThicknessProperty_gain, 1)
- * safeDoubleProperty(graph, diagram, DN.Diagram_edgeThicknessGain, 1);
- edgeThicknessBias =
- safeDoubleProperty(graph, etp, DN.Edge_ThicknessProperty_bias, 0)
- + safeDoubleProperty(graph, diagram, DN.Diagram_edgeThicknessBias, 0);
- }
Resource alp = graph.getPossibleObject(diagram, DN.Diagram_arrowLengthProperty);
//System.out.println("alp: " + NameUtils.getURIOrSafeNameInternal(graph, alp));
if (alp != null) {
safeDoubleProperty(graph, alp, DN.Edge_ArrowLengthProperty_bias, 0)
+ safeDoubleProperty(graph, diagram, DN.Diagram_arrowLengthBias, 0);
}
- Resource nsp = graph.getPossibleObject(diagram, DN.Diagram_nodeScaleProperty);
- if (nsp != null) {
- Variable nspv = Variables.getPossibleVariable(graph, nsp);
- if (nspv != null) {
- //System.out.println("nspv: " + nspv.getURI(graph));
- nodeScaleProperty = nspv.getPropertyValue(graph, DN.Vertex_ScaleProperty_value);
- }
- nodeScaleGain =
- safeDoubleProperty(graph, nsp, DN.Vertex_ScaleProperty_gain, 1)
- * safeDoubleProperty(graph, diagram, DN.Diagram_nodeScaleGain, 1);
- nodeScaleBias =
- safeDoubleProperty(graph, nsp, DN.Vertex_ScaleProperty_bias, 0)
- + safeDoubleProperty(graph, diagram, DN.Diagram_nodeScaleBias, 0);
- }
}
- DiagramSettings ds = new DiagramSettings(
- nodeScaleProperty, nodeScaleGain, nodeScaleBias,
- edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias,
- arrowLengthProperty, arrowLengthGain, arrowLengthBias,
- elementColoringFunction,
- elementColoringGradientHue,
- elementColoringGradientSaturation);
+ DiagramSettings ds = new DiagramSettings( arrowLengthProperty, arrowLengthGain, arrowLengthBias);
//System.out.println("new diagram settings: " + ds);
return ds;
}
+++ /dev/null
-package org.simantics.district.network.profile;
-
-import org.simantics.Simantics;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
-import org.simantics.db.exception.DatabaseException;
-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;
-
-public class EdgeThicknessStyle extends ThrottledStyleBase<Double> {
-
- private static final Double PENDING = Double.NaN;
- private static final Double ONE = 1.0;
-
- @Override
- public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
- DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
- // Prevent PendingVariableExceptions from coming through
- boolean wasSynchronous = graph.setSynchronous(true);
- try {
- Double thickness = ONE;
- if (ds.edgeThicknessProperty.isPresent()) {
- thickness = Simantics.applySCLRead(graph, ds.edgeThicknessProperty.get(), groupItem);
- // System.out.println("read thickness: " + thickness + " : " + ds.edgeThicknessProperty);
- if (thickness == null) {
- thickness = ONE;
- } else {
- thickness = thickness * ds.edgeThicknessGain + ds.edgeThicknessBias;
- }
- }
-
- return thickness;
- }
- finally {
- graph.setSynchronous(wasSynchronous);
- }
- }
-
- @Override
- public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Double value) {
-// System.out.println("apply: " + node + " : " + value);
- ConnectionNode n = (ConnectionNode) node;
- if (value == PENDING) {
- ((G2DSceneGraph)node.getRootNode()).setPending(node);
- } else {
- ((G2DSceneGraph)node.getRootNode()).clearPending(node);
- }
- if (value == null)
- value = ONE;
- for (INode nn : n.getNodes())
- ProfileVariables.claimNodeProperty(nn, "stroke", value, observer);
- }
-
- @Override
- protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
- ((G2DSceneGraph)node.getRootNode()).clearPending(node);
- ConnectionNode n = (ConnectionNode) node;
- for (INode nn : n.getNodes())
- ProfileVariables.claimNodeProperty(nn, "stroke", ONE, evaluationContext);
- }
-
-}
@Override
public final void applyStyleForNode(EvaluationContext evaluationContext, INode node, Optional<Result> result) {
- if (!result.equals(Optional.empty())) {
+ if (!Optional.empty().equals(result)) {
applyThrottledStyleForNode(evaluationContext, node, result.get());
} else {
LOGGER.debug("Do not apply as results are unchanged for {} {} {}", evaluationContext, node, result);
+ // TODO: fix this duplicate method invocation with null
+ applyThrottledStyleForNode(evaluationContext, node, null);
}
}
+++ /dev/null
-package org.simantics.district.network.profile;
-
-import org.simantics.Simantics;
-import org.simantics.db.ReadGraph;
-import org.simantics.db.Resource;
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.scenegraph.INode;
-import org.simantics.scenegraph.g2d.G2DSceneGraph;
-import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
-import org.simantics.scenegraph.profile.EvaluationContext;
-import org.simantics.scenegraph.profile.common.ProfileVariables;
-
-public class VertexSizeStyle extends ThrottledStyleBase<Double> {
-
- private static final Double PENDING = Double.NaN;
- private static final Double ONE = 1.0;
-
- @Override
- public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
- DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
- Double scaling = ONE;
- // Prevent PendingVariableExceptions from coming through
- boolean wasSynchronous = graph.setSynchronous(true);
- try {
- if (ds.vertexScaleProperty.isPresent()) {
- scaling = Simantics.applySCLRead(graph, ds.vertexScaleProperty.get(), groupItem);
- if (scaling == null) {
- scaling = ONE;
- } else {
- // System.out.println("read vertex scaling: " + scaling + " : " + ds.vertexScaleProperty);
- scaling = scaling * ds.vertexScaleGain + ds.vertexScaleBias;
- // System.out.println("RESULT: " + scaling);
- }
- }
- return scaling;
- }
- finally {
- graph.setSynchronous(wasSynchronous);
- }
- }
-
- @Override
- public void applyThrottledStyleForNode(EvaluationContext observer, INode node, Double value) {
- //System.out.println("apply: " + node + " : " + value);
- SingleElementNode n = (SingleElementNode) node;
- if (value == PENDING) {
- ((G2DSceneGraph)node.getRootNode()).setPending(node);
- } else {
- ((G2DSceneGraph)node.getRootNode()).clearPending(node);
- }
- if (value == null)
- value = ONE;
- for (INode nn : n.getNodes())
- ProfileVariables.claimNodeProperty(nn, "size", value, observer);
- }
-
- @Override
- protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) {
- ((G2DSceneGraph)node.getRootNode()).clearPending(node);
- SingleElementNode n = (SingleElementNode) node;
- for (INode nn : n.getNodes())
- ProfileVariables.claimNodeProperty(nn, "size", ONE, evaluationContext);
- }
-
-}
private boolean showColorBars;
private boolean showColorBarsTicks;
+ private boolean useGradients;
private ColorBarsLocation location;
private ColorBarsSize size;
public boolean isShowColorBarsTicks() {
return showColorBarsTicks;
}
+
+ public boolean isUseGradients() {
+ return useGradients;
+ }
public ColorBarOptions showColorBarsTicks(boolean show) {
this.showColorBarsTicks = show;
public static ColorBarOptions useDefault() {
return new ColorBarOptions().showColorBars(true).withLocation(ColorBarsLocation.EAST).withSize(ColorBarsSize.SMALL);
}
+
+ public ColorBarOptions useGradients(boolean useGradients) {
+ this.useGradients = useGradients;
+ return this;
+ }
}
private boolean showColorBars;
private boolean showColorBarsTicks;
+ private boolean useGradients;
private SizeBarsLocation location;
private SizeBarsSize size;
public boolean isShowSizeBarsTicks() {
return showColorBarsTicks;
}
+
+ public boolean isUseGradients() {
+ return useGradients;
+ }
public SizeBarOptions showSizeBarsTicks(boolean show) {
this.showColorBarsTicks = show;
public static SizeBarOptions useDefault() {
return new SizeBarOptions().showSizeBars(true).withLocation(SizeBarsLocation.EAST).withSize(SizeBarsSize.SMALL);
}
+
+ public SizeBarOptions useGradients(boolean useGradients) {
+ this.useGradients = useGradients;
+ return this;
+ }
}