public final Optional<Function1<Resource, Double>> edgeThicknessProperty;
public final double edgeThicknessGain;
public final double edgeThicknessBias;
+ 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) {
+ public DiagramSettings(
+ Function1<Resource, Double> vertexScaleProperty, double vertexScaleGain, double vertexScaleBias,
+ Function1<Resource, Double> edgeThicknessProperty, double edgeThicknessGain, double edgeThicknessBias,
+ Function1<Resource, Double> elementColoringFunction,
+ float elementColoringGradientHue,
+ float elementColoringGradientSaturation
+ ) {
this.vertexScaleProperty = Optional.ofNullable(vertexScaleProperty);
this.vertexScaleGain = vertexScaleGain;
this.vertexScaleBias = vertexScaleBias;
this.edgeThicknessProperty = Optional.ofNullable(edgeThicknessProperty);
this.edgeThicknessGain = edgeThicknessGain;
this.edgeThicknessBias = edgeThicknessBias;
+ this.elementColoringFunction = Optional.ofNullable(elementColoringFunction);
+ this.elementColoringGradientHue = elementColoringGradientHue;
+ this.elementColoringGradientSaturation = elementColoringGradientSaturation;
+ this.coloringGradient = Colors.cached(
+ Colors.hsvGradient(
+ elementColoringGradientHue,
+ elementColoringGradientSaturation)
+ );
}
@Override
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;
}
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]", vertexScaleProperty.toString(),
- vertexScaleGain, vertexScaleBias, edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias);
+ return String.format("DiagramSettings[%s * %f + %f - %s * %f + %f - coloringFunction: %s, hue: %f, saturation: %f]",
+ vertexScaleProperty.toString(), vertexScaleGain, vertexScaleBias,
+ edgeThicknessProperty, edgeThicknessGain, edgeThicknessBias,
+ elementColoringFunction.toString(),
+ elementColoringGradientHue, elementColoringGradientSaturation
+ );
}
}