static Builder create() { return create(0, ImmutableSet.<VizOptions>of()); }
updatedConnections = new CopyOnWriteArrayList<>(); margin = b.margin(); showNodes = b.vizOptions().contains(VizOptions.NODE_CIRCLES); showNodeCoordinates = b.vizOptions().contains(VizOptions.NODE_COORDS); showDirectionArrows = b.vizOptions().contains(VizOptions.DIR_ARROWS); showRelativeSpeedStatic = b.vizOptions().contains(VizOptions.REL_SPEED_S); showRelativeSpeedDynamic = b.vizOptions().contains(VizOptions.REL_SPEED_D); helper = new RenderHelper();
.withMargin(CANVAS_MARGIN)) .with(BoxRenderer.builder()) .with(
.withMargin(CANVAS_MARGIN)) .with(BoxRenderer.builder()) .with(
.addModel(View.builder() .withTitleAppendix("Wrapped GraphRoadModel UI test") .with(GraphRoadModelRenderer.builder().withMargin(1)) .with(RoadUserRenderer.builder()) .withSimulatorEndTime(30 * 1000)
.withNodes()) .with(GraphRoadModelRenderer.builder() .withDirectionArrows() .withNodeCoordinates() .withMargin(1) .withNodeCircles()) .withAutoPlay() .withAutoClose()
.withVehicleOrigin()) .with(GraphRoadModelRenderer.builder() .withDirectionArrows() .withNodeCoordinates() .withMargin(1) .withNodeCircles()) .withAutoPlay() .withSimulatorEndTime(300 * 1000L)
Builder() { setDependencies(GraphRoadModel.class, RenderController.class); }
/** * @return A new {@link Builder} for creating {@link GraphRoadModelRenderer} * instances. */ @CheckReturnValue public static Builder builder() { return Builder.create(); }
/** * Shows a label with coordinates next to each node in the graph. * @return A new builder instance. */ @CheckReturnValue public Builder withNodeCoordinates() { return create(margin(), VizOptions.NODE_COORDS, vizOptions()); }
static Builder create(int margin, VizOptions opt, ImmutableSet<VizOptions> opts) { return create(margin, Sets.immutableEnumSet(opt, opts.toArray(new VizOptions[] {}))); }
/** * Sets the margin to display around the graph. * @param m The margin, in the same unit as * {@link GraphRoadModel#getDistanceUnit()}. * @return A new builder instance. */ @CheckReturnValue public Builder withMargin(int m) { checkArgument(m >= 0); return create(m, vizOptions()); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof GraphRoadModelRenderer.Builder) { GraphRoadModelRenderer.Builder that = (GraphRoadModelRenderer.Builder) o; return (this.margin == that.margin()) && (this.vizOptions.equals(that.vizOptions())); } return false; }
/** * Shows relative speed to theoretical maximal allowed speed. The * theoretical maximum speed is an attribute of a graph. This attribute is * found in {@link MultiAttributeData} under the * "THEORETICAL_SPEED_ATTRIBUTE". (updates constantly) * @return A new builder instance. */ @CheckReturnValue public Builder withDynamicRelativeSpeedVisualization() { return create(margin(), VizOptions.REL_SPEED_D, vizOptions()); }
/** * Draws a circle for each node in the graph. * @return A new builder instance. */ @CheckReturnValue public Builder withNodeCircles() { return create(margin(), VizOptions.NODE_CIRCLES, vizOptions()); }
/** * Shows relative speed to theoretical maximal allowed speed. The * theoretical maximum speed is an attribute of a graph. This attribute is * found in {@link MultiAttributeData} under the * "THEORETICAL_SPEED_ATTRIBUTE". (updates only when zooming in or out) * @return A new builder instance. */ @CheckReturnValue public Builder withStaticRelativeSpeedVisualization() { return create(margin(), VizOptions.REL_SPEED_S, vizOptions()); }
/** * Shows arrows for each connection in the graph, indicating the allowed * driving direction(s). * @return A new builder instance. */ @CheckReturnValue public Builder withDirectionArrows() { return create(margin(), VizOptions.DIR_ARROWS, vizOptions()); }