X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fprofile%2FDiagramSettings.java;h=f76a4534a59f56d77f6586b0aa34d2430442c7e4;hb=607611b465ee7737db9489d21d261ff793692b89;hp=a0dcd40f9e7a8b022f038e4e1cbb984c07d34521;hpb=9b9ead4280aeb4981d3294230b17abc3c16b4b10;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java index a0dcd40f..f76a4534 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/DiagramSettings.java @@ -10,70 +10,34 @@ import org.simantics.scl.runtime.function.Function1; */ public class DiagramSettings { - public final Optional> vertexScaleProperty; - public final double vertexScaleGain; - public final double vertexScaleBias; - public final Optional> edgeThicknessProperty; - public final double edgeThicknessGain; - public final double edgeThicknessBias; public final Optional> arrowLengthProperty; public final double arrowLengthGain; public final double arrowLengthBias; - public final Optional> elementColoringFunction; - public final float elementColoringGradientHue; - public final float elementColoringGradientSaturation; - public final transient ColorGradient coloringGradient; public DiagramSettings( - Function1 vertexScaleProperty, double vertexScaleGain, double vertexScaleBias, - Function1 edgeThicknessProperty, double edgeThicknessGain, double edgeThicknessBias, - Function1 arrowLengthProperty, double arrowLengthGain, double arrowLengthBias, - Function1 elementColoringFunction, - float elementColoringGradientHue, - float elementColoringGradientSaturation + Function1 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; } @@ -86,41 +50,21 @@ public class DiagramSettings { 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 ); }