From c8ca57d200218c831aeb942c9448815f593b9bca Mon Sep 17 00:00:00 2001 From: frievoe97 Date: Tue, 4 Feb 2025 15:01:48 +0100 Subject: [PATCH 1/4] add XYTime Plot (breakpoints, colorRamp ...) functionality to the simwrapper contrib --- .../org/matsim/simwrapper/viz/XYTime.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java index 031871980e2..30d20aeab75 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java @@ -2,6 +2,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + /** * The Tile plug-in creates an overview of important key figures. */ @@ -13,7 +16,72 @@ public class XYTime extends Viz { @JsonProperty(required = true) public String file; + /** + * The radius of the points. + */ + @JsonProperty(required = false) + public Double radius; + + /** + * The name of the color ramp. + */ + @JsonProperty(required = false) + public String colorRamp; + + /** + * The number of buckets of the color ramp. + */ + @JsonProperty(required = false) + public Integer buckets; + + /** + * The exponent of the color ramp. + */ + @JsonProperty(required = false) + public Integer exponent; + + /** + * The minimum value of the color ramp. + */ + @JsonProperty(required = false) + public Integer clipMax; + + /** + * Breakpoints can either be a list of values or a map with colors and values. + */ + @JsonProperty(required = false) + private Object breakpoints; + public XYTime() { super("xytime"); } + + /** + * Sets breakpoints as a map when colors are provided. + *

+ * The number of colors must be one less than the number of values. + */ + public XYTime setBreakpoints(String[] colors, Double[] values) { + this.breakpoints = Map.of( + "colors", colors, + "values", values + ); + return this; + } + + /** + * Get breakpoints. + */ + public Object getBreakpoints() { + return breakpoints; + } + + /** + * Set breakpoints as a simple list. + */ + public XYTime setBreakpoints(Double[] values) { + this.breakpoints = List.of(values); + return this; + } + } From ac71d7aecb7a776d8001322a2b7428becfb75e6b Mon Sep 17 00:00:00 2001 From: frievoe97 Date: Tue, 4 Feb 2025 15:09:23 +0100 Subject: [PATCH 2/4] add XYTime Plot (breakpoints, colorRamp ...) functionality to the simwrapper contrib --- .../src/main/java/org/matsim/simwrapper/viz/XYTime.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java index 30d20aeab75..f3b2a06e378 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java @@ -68,14 +68,7 @@ public XYTime setBreakpoints(String[] colors, Double[] values) { ); return this; } - - /** - * Get breakpoints. - */ - public Object getBreakpoints() { - return breakpoints; - } - + /** * Set breakpoints as a simple list. */ From 1ee0f8a6228fc0b30c6230ca28c601f97c00a077 Mon Sep 17 00:00:00 2001 From: frievoe97 Date: Tue, 4 Feb 2025 15:57:48 +0100 Subject: [PATCH 3/4] add XYTime Plot (breakpoints, colorRamp ...) functionality to the simwrapper contrib --- .../src/main/java/org/matsim/simwrapper/viz/XYTime.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java index f3b2a06e378..8f7657d58d9 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java @@ -61,18 +61,18 @@ public XYTime() { *

* The number of colors must be one less than the number of values. */ - public XYTime setBreakpoints(String[] colors, Double[] values) { + public XYTime setBreakpoints(String[] colors, Double... values) { this.breakpoints = Map.of( "colors", colors, "values", values ); return this; } - + /** * Set breakpoints as a simple list. */ - public XYTime setBreakpoints(Double[] values) { + public XYTime setBreakpoints(Double... values) { this.breakpoints = List.of(values); return this; } From bc3323e9246b954227b1d8043ab9b93377b3c7c5 Mon Sep 17 00:00:00 2001 From: frievoe97 Date: Tue, 4 Feb 2025 15:59:41 +0100 Subject: [PATCH 4/4] add XYTime Plot (breakpoints, colorRamp ...) functionality to the simwrapper contrib --- .../src/main/java/org/matsim/simwrapper/viz/XYTime.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java index 8f7657d58d9..058b578082c 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java @@ -61,7 +61,7 @@ public XYTime() { *

* The number of colors must be one less than the number of values. */ - public XYTime setBreakpoints(String[] colors, Double... values) { + public XYTime setBreakpoints(String[] colors, double... values) { this.breakpoints = Map.of( "colors", colors, "values", values @@ -72,7 +72,7 @@ public XYTime setBreakpoints(String[] colors, Double... values) { /** * Set breakpoints as a simple list. */ - public XYTime setBreakpoints(Double... values) { + public XYTime setBreakpoints(double... values) { this.breakpoints = List.of(values); return this; }