1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-07 10:50:53 +00:00
This commit is contained in:
Arnaud Roques 2021-12-21 18:23:17 +01:00
parent 180b8eddd1
commit 3cbd4924f2
5 changed files with 39 additions and 18 deletions

View File

@ -117,6 +117,14 @@ public class PicoWebServer implements Runnable {
return;
if (request.getPath().startsWith("/plantuml/svg/") && handleGET(request, out, FileFormat.SVG))
return;
if (request.getPath().startsWith("/txt/") && handleGET(request, out, FileFormat.ATXT))
return;
if (request.getPath().startsWith("/plantuml/txt/") && handleGET(request, out, FileFormat.ATXT))
return;
if (request.getPath().startsWith("/utxt/") && handleGET(request, out, FileFormat.UTXT))
return;
if (request.getPath().startsWith("/plantuml/utxt/") && handleGET(request, out, FileFormat.UTXT))
return;
} else if (request.getMethod().equals("POST") && request.getPath().equals("/render")) {
handleRenderRequest(request, out);
return;

View File

@ -94,42 +94,50 @@ public class GanttArrow implements UDrawable {
}
private TaskDraw getSource() {
return toTaskDraw.getTaskDraw((Task) source.getMoment());
if (source.getMoment() instanceof Task)
return toTaskDraw.getTaskDraw((Task) source.getMoment());
return null;
}
private TaskDraw getDestination() {
return toTaskDraw.getTaskDraw((Task) dest.getMoment());
if (dest.getMoment() instanceof Task)
return toTaskDraw.getTaskDraw((Task) dest.getMoment());
return null;
}
public void drawU(UGraphic ug) {
ug = style.applyStrokeAndLineColor(ug, colorSet, styleBuilder.getSkinParam().getThemeStyle());
double x1 = getX(source.getAttribute(), getSource(), atStart);
final TaskDraw start = getSource();
final TaskDraw end = getDestination();
if (start == null || end == null)
return;
double x1 = getX(source.getAttribute(), start, atStart);
final StringBounder stringBounder = ug.getStringBounder();
double y1 = getSource().getY(stringBounder, atStart);
double y1 = start.getY(stringBounder, atStart);
final double x2 = getX(dest.getAttribute(), getDestination(), atEnd.getInv());
final double y2 = getDestination().getY(stringBounder, atEnd);
final double x2 = getX(dest.getAttribute(), end, atEnd.getInv());
final double y2 = end.getY(stringBounder, atEnd);
if (atStart == Direction.DOWN && y2 < y1) {
y1 = getSource().getY(stringBounder, atStart.getInv());
}
if (atStart == Direction.DOWN && y2 < y1)
y1 = start.getY(stringBounder, atStart.getInv());
final double minimalWidth = 8;
// final Style style = getStyleSignatureTask().getMergedStyle(styleBuilder);
// final ClockwiseTopRightBottomLeft margin = style.getMargin();
// final ClockwiseTopRightBottomLeft padding = style.getPadding();
if (this.atStart == Direction.DOWN && this.atEnd == Direction.RIGHT) {
if (x2 > x1) {
if (x2 - x1 < minimalWidth) {
if (x2 - x1 < minimalWidth)
x1 = x2 - minimalWidth;
}
drawLine(ug, x1, y1, x1, y2, x2, y2);
} else {
x1 = getX(source.getAttribute(), getSource(), Direction.RIGHT);
y1 = getSource().getY(stringBounder, Direction.RIGHT);
final double y1b = getDestination().getY(stringBounder).getCurrentValue();
x1 = getX(source.getAttribute(), start, Direction.RIGHT);
y1 = start.getY(stringBounder, Direction.RIGHT);
final double y1b = end.getY(stringBounder).getCurrentValue();
drawLine(ug, x1, y1, x1 + 6, y1, x1 + 6, y1b, x2 - 8, y1b, x2 - 8, y2, x2, y2);
}
} else if (this.atStart == Direction.RIGHT && this.atEnd == Direction.LEFT) {

View File

@ -89,6 +89,8 @@ public class TimingRuler {
}
public void scaleInPixels(long tick, long pixel) {
if (pixel <= 0 || tick <= 0)
throw new IllegalArgumentException();
this.tickIntervalInPixels = pixel;
this.tickUnitary = tick;
}

View File

@ -68,6 +68,9 @@ public class CommandScalePixel extends SingleLineCommand2<TimingDiagram> {
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) {
final long tick = Long.parseLong(arg.get("TICK", 0));
final long pixel = Long.parseLong(arg.get("PIXEL", 0));
if (tick <= 0 || pixel <= 0)
return CommandExecutionResult.error("Bad value");
diagram.scaleInPixels(tick, pixel);
return CommandExecutionResult.ok();
}

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 3;
final int beta = 4;
return beta;
}