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
@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.readOnly true
+ >-- DN.Edge.ArrowLengthProperty.gain --> L0.Double <R L0.HasProperty : SEL.GenericParameterType
+ L0.readOnly true
+ >-- DN.Edge.ArrowLengthProperty.bias --> L0.Double <R L0.HasProperty : SEL.GenericParameterType
+ L0.readOnly true
+ @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.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.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
DN.Functions.constantOne : L0.Function
L0.HasValueType "Resource -> <ReadGraph> Maybe Double"
+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
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.ElementColoringStyle : DIA.Style
DN.VertexSizeStyle : DIA.Style
DN.EdgeThicknessStyle : DIA.Style
+DN.ArrowLengthStyle : DIA.Style
DN.HideStyle : DIA.Style
DN.VertexSymbolStyle : DIA.Style
DN.ConnectionLineStyle : DIA.Style
public final Resource Actions;
public final Resource Actions_NewDNDiagram;
public final Resource AddLayerToDNDiagramTemplate;
+ public final Resource ArrowLengthPropertyParameterType;
+ public final Resource ArrowLengthStyle;
public final Resource BrowseContext;
public final Resource Composite;
public final Resource Connection;
public final Resource Diagram;
public final Resource Diagram_MappedDiagram;
public final Resource Diagram_MappedFromDiagram;
+ 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 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_ArrowLengthProperty_bias_Inverse;
+ public final Resource Edge_ArrowLengthProperty_gain;
+ public final Resource Edge_ArrowLengthProperty_gain_Inverse;
+ public final Resource Edge_ArrowLengthProperty_value;
+ public final Resource Edge_ArrowLengthProperty_value_Inverse;
public final Resource Edge_HasDiameter;
public final Resource Edge_HasDiameter_Inverse;
public final Resource Edge_HasElevation;
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 Element;
public final Resource ElementColoringStyle;
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_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 static final String Actions = "http://www.simantics.org/DistrictNetwork-1.0/Actions";
public static final String Actions_NewDNDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Actions/NewDNDiagram";
public static final String AddLayerToDNDiagramTemplate = "http://www.simantics.org/DistrictNetwork-1.0/AddLayerToDNDiagramTemplate";
+ public static final String ArrowLengthPropertyParameterType = "http://www.simantics.org/DistrictNetwork-1.0/ArrowLengthPropertyParameterType";
+ public static final String ArrowLengthStyle = "http://www.simantics.org/DistrictNetwork-1.0/ArrowLengthStyle";
public static final String BrowseContext = "http://www.simantics.org/DistrictNetwork-1.0/BrowseContext";
public static final String Composite = "http://www.simantics.org/DistrictNetwork-1.0/Composite";
public static final String Connection = "http://www.simantics.org/DistrictNetwork-1.0/Connection";
public static final String Diagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram";
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_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 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_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";
+ public static final String Edge_ArrowLengthProperty_gain_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/gain/Inverse";
+ public static final String Edge_ArrowLengthProperty_value = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/value";
+ public static final String Edge_ArrowLengthProperty_value_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/ArrowLengthProperty/value/Inverse";
public static final String Edge_HasDiameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter";
public static final String Edge_HasDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter/Inverse";
public static final String Edge_HasElevation = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasElevation";
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 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 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_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";
Actions = getResourceOrNull(graph, URIs.Actions);
Actions_NewDNDiagram = getResourceOrNull(graph, URIs.Actions_NewDNDiagram);
AddLayerToDNDiagramTemplate = getResourceOrNull(graph, URIs.AddLayerToDNDiagramTemplate);
+ ArrowLengthPropertyParameterType = getResourceOrNull(graph, URIs.ArrowLengthPropertyParameterType);
+ ArrowLengthStyle = getResourceOrNull(graph, URIs.ArrowLengthStyle);
BrowseContext = getResourceOrNull(graph, URIs.BrowseContext);
Composite = getResourceOrNull(graph, URIs.Composite);
Connection = getResourceOrNull(graph, URIs.Connection);
Diagram = getResourceOrNull(graph, URIs.Diagram);
Diagram_MappedDiagram = getResourceOrNull(graph, URIs.Diagram_MappedDiagram);
Diagram_MappedFromDiagram = getResourceOrNull(graph, URIs.Diagram_MappedFromDiagram);
+ 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);
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_ArrowLengthProperty_bias_Inverse = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_bias_Inverse);
+ Edge_ArrowLengthProperty_gain = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_gain);
+ Edge_ArrowLengthProperty_gain_Inverse = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_gain_Inverse);
+ Edge_ArrowLengthProperty_value = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_value);
+ Edge_ArrowLengthProperty_value_Inverse = getResourceOrNull(graph, URIs.Edge_ArrowLengthProperty_value_Inverse);
Edge_HasDiameter = getResourceOrNull(graph, URIs.Edge_HasDiameter);
Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse);
Edge_HasElevation = getResourceOrNull(graph, URIs.Edge_HasElevation);
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);
Element = getResourceOrNull(graph, URIs.Element);
ElementColoringStyle = getResourceOrNull(graph, URIs.ElementColoringStyle);
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_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);
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 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 {
+ 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 Object nodeScalePropertyModifier(ReadGraph graph, Resource resource, Variable context) throws DatabaseException {
Resource diagram = resolveElement(graph, context);
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
+import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
private static final double height = 0.5;
private static final Rectangle2D NORMAL = new Rectangle2D.Double(left, top, width, height);
-
+
private transient Point2D centerPoint;
private transient Rectangle2D symbolRect;
private transient AffineTransform symbolTransform;
-
+
+ private Double arrowLength;
+
+ private static double startX;
+ private static double startY;
+ private static double endX;
+ private static double endY;
+
@Override
public void init() {
}
g2d.setStroke(bs);
g2d.draw(path);
+ // Draw arrow
+ if (arrowLength != null) {
+ g2d.setColor(Color.BLACK);
+ g2d.setStroke(new BasicStroke(bs.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+
+ double l = arrowLength;
+ double w = 2 * (double) bs.getLineWidth() * Math.signum(l);
+ if (Math.abs(w) > Math.abs(l)) w = l;
+ double offset = 2 * (double) bs.getLineWidth();
+
+ double centerX = (startX + endX) / 2, centerY = (startY + endY) / 2;
+ double deltaX = endX - startX, deltaY = endY - startY;
+ double length = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ deltaX /= length;
+ deltaY /= length;
+
+ double x0 = centerX - l/2 * deltaX + offset * deltaY;
+ double y0 = centerY - l/2 * deltaY - offset * deltaX;
+ double x1 = centerX + (l/2 - w) * deltaX + offset * deltaY;
+ double y1 = centerY + (l/2 - w) * deltaY - offset * deltaX;
+
+ g2d.draw(new Line2D.Double(x0, y0, x1, y1));
+
+ Path2D path = new Path2D.Double();
+ path.moveTo(x1 + w * deltaX, y1 + w * deltaY);
+ path.lineTo(x1 + w * deltaY, y1 - w * deltaX);
+ path.lineTo(x1 - w * deltaY, y1 + w * deltaX);
+ path.closePath();
+ g2d.fill(path);
+ }
+
// Reset
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
// }
public static Path2D calculatePath(DistrictNetworkEdge edge, Path2D result, boolean detailed) {
- // Convert to screen coordinates
- double startX = ModelledCRS.longitudeToX(edge.getStartPoint().getX());
- double startY = ModelledCRS.latitudeToY(-edge.getStartPoint().getY()); // Invert for Simantics
- double endX = ModelledCRS.longitudeToX(edge.getEndPoint().getX());
- double endY = ModelledCRS.latitudeToY(-edge.getEndPoint().getY());// Invert for Simantics
+ startX = ModelledCRS.longitudeToX(edge.getStartPoint().getX());
+ startY = ModelledCRS.latitudeToY(-edge.getStartPoint().getY());
+ endX = ModelledCRS.longitudeToX(edge.getEndPoint().getX());
+ endY = ModelledCRS.latitudeToY(-edge.getEndPoint().getY());
if (result == null) {
result = new Path2D.Double();
public void setDynamicColor(Color color) {
this.dynamicColor = color;
}
+
+ @PropertySetter(value = "arrowLength")
+ public void setArroLength(Double length) {
+ arrowLength = length;
+ }
@PropertySetter(value = "SVG")
public void setSVG(String value) {
<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>
<resource uri="http://www.simantics.org/DistrictNetwork-1.0/HideStyle"
class="org.simantics.district.network.profile.HideStyle">
</resource>
--- /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 ArrowLengthStyle 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 length = ONE;
+ if (ds.arrowLengthProperty.isPresent()) {
+ length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem);
+ // System.out.println("read thickness: " + thickness + " : " + ds.arrowLengthProperty);
+ if (length == null) {
+ length = ONE;
+ } else {
+ length = length * ds.arrowLengthGain + ds.arrowLengthBias;
+ }
+ }
+
+ return length;
+ }
+ 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);
+ }
+ for (INode nn : n.getNodes())
+ ProfileVariables.claimNodeProperty(nn, "arrowLength", 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, "arrowLength", null, evaluationContext);
+ }
+
+}
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 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
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;
final int prime = 31;
int result = 1;
result = prime * result + edgeThicknessProperty.hashCode();
+ result = prime * result + arrowLengthProperty.hashCode();
long temp;
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));
result = prime * result + vertexScaleProperty.hashCode();
temp = Double.doubleToLongBits(vertexScaleGain);
result = prime * result + (int) (temp ^ (temp >>> 32));
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))
@Override
public String toString() {
- return String.format("DiagramSettings[%s * %f + %f - %s * %f + %f - coloringFunction: %s, hue: %f, saturation: %f]",
+ 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
);
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;
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) {
+ 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);
+ }
Resource nsp = graph.getPossibleObject(diagram, DN.Diagram_nodeScaleProperty);
if (nsp != null) {
Variable nspv = Variables.getPossibleVariable(graph, nsp);
DiagramSettings ds = new DiagramSettings(
nodeScaleProperty, nodeScaleGain, nodeScaleBias,
edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias,
+ arrowLengthProperty, arrowLengthGain, arrowLengthBias,
elementColoringFunction,
elementColoringGradientHue,
elementColoringGradientSaturation);