1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 19:09:03 +00:00
This commit is contained in:
Arnaud Roques 2022-10-25 22:43:40 +02:00
parent 62c8b26e25
commit 718266f443
30 changed files with 330 additions and 216 deletions

View File

@ -78,9 +78,9 @@ public class FtileIfDown extends AbstractFtile {
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
if (optionalStop == null) { if (optionalStop == null)
return Arrays.asList(thenBlock, diamond1, diamond2); return Arrays.asList(thenBlock, diamond1, diamond2);
}
return Arrays.asList(thenBlock, diamond1, diamond2, optionalStop); return Arrays.asList(thenBlock, diamond1, diamond2, optionalStop);
} }
@ -95,9 +95,9 @@ public class FtileIfDown extends AbstractFtile {
} }
public Swimlane getSwimlaneOut() { public Swimlane getSwimlaneOut() {
if (optionalStop == null) { if (optionalStop == null)
return getSwimlaneIn(); return getSwimlaneIn();
}
return thenBlock.getSwimlaneOut(); return thenBlock.getSwimlaneOut();
} }
@ -163,8 +163,7 @@ public class FtileIfDown extends AbstractFtile {
private XPoint2D getP1(StringBounder stringBounder) { private XPoint2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder);
final XPoint2D p = new XPoint2D(dimDiamond1.getWidth(), final XPoint2D p = new XPoint2D(dimDiamond1.getWidth(), (dimDiamond1.getInY() + dimDiamond1.getOutY()) / 2);
(dimDiamond1.getInY() + dimDiamond1.getOutY()) / 2);
return getTranslateDiamond1(stringBounder).getTranslated(p); return getTranslateDiamond1(stringBounder).getTranslated(p);
} }
@ -244,8 +243,7 @@ public class FtileIfDown extends AbstractFtile {
final FtileGeometry dimDiamond2 = getFtile2().calculateDimension(stringBounder); final FtileGeometry dimDiamond2 = getFtile2().calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth(); final double x = dimDiamond2.getWidth();
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2; final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder) return getTranslateDiamond2(stringBounder).getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
.getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
@ -258,11 +256,10 @@ public class FtileIfDown extends AbstractFtile {
final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown()); final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown());
snake.addPoint(getP1(stringBounder)); snake.addPoint(getP1(stringBounder));
if (conditionEndStyle == ConditionEndStyle.DIAMOND) { if (conditionEndStyle == ConditionEndStyle.DIAMOND)
snake.addPoint(getP2(stringBounder)); snake.addPoint(getP2(stringBounder));
} else if (conditionEndStyle == ConditionEndStyle.HLINE) { else if (conditionEndStyle == ConditionEndStyle.HLINE)
snake.addPoint(getP2hline(stringBounder)); snake.addPoint(getP2hline(stringBounder));
}
ug.draw(snake); ug.draw(snake);
} }
@ -270,9 +267,8 @@ public class FtileIfDown extends AbstractFtile {
@Override @Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false) { if (getFtile1().calculateDimension(ug.getStringBounder()).hasPointOut() == false)
return; return;
}
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final XPoint2D p1 = getP1(stringBounder); final XPoint2D p1 = getP1(stringBounder);
@ -301,25 +297,23 @@ public class FtileIfDown extends AbstractFtile {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = dimDiamond1.getWidth(); final double x = dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2; final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
return getTranslateDiamond1(stringBounder) return getTranslateDiamond1(stringBounder).getTranslated(new XPoint2D(x, dimDiamond1.getInY() + half));
.getTranslated(new XPoint2D(x, dimDiamond1.getInY() + half));
} }
protected XPoint2D getP2(final StringBounder stringBounder) { protected XPoint2D getP2(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder); final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth(); final double x = dimDiamond2.getWidth();
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2; final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder) return getTranslateDiamond2(stringBounder).getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
.getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final XPoint2D p1 = getP1(stringBounder); final XPoint2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false) { if (calculateDimension(stringBounder).hasPointOut() == false)
return; return;
}
final XPoint2D p2 = getP2(stringBounder); final XPoint2D p2 = getP2(stringBounder);
final double x1 = p1.getX(); final double x1 = p1.getX();
@ -331,7 +325,8 @@ public class FtileIfDown extends AbstractFtile {
final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize, final double xmax = Math.max(x1 + Hexagon.hexagonHalfSize,
getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth()); getTranslateForThen(stringBounder).getDx() + thenGeom.getWidth());
final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft()).emphasizeDirection(Direction.DOWN); final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToLeft())
.emphasizeDirection(Direction.DOWN);
snake.addPoint(x1, y1); snake.addPoint(x1, y1);
snake.addPoint(xmax, y1); snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2); snake.addPoint(xmax, y2);
@ -420,16 +415,14 @@ public class FtileIfDown extends AbstractFtile {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = dimDiamond1.getWidth(); final double x = dimDiamond1.getWidth();
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2; final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
return getTranslateDiamond1(stringBounder) return getTranslateDiamond1(stringBounder).getTranslated(new XPoint2D(x, dimDiamond1.getInY() + half));
.getTranslated(new XPoint2D(x, dimDiamond1.getInY() + half));
} }
protected XPoint2D getP2(final StringBounder stringBounder) { protected XPoint2D getP2(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder); final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x = dimDiamond2.getWidth(); final double x = dimDiamond2.getWidth();
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2; final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder) return getTranslateDiamond2(stringBounder).getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
.getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
} }
// the bottom or south point of the diamond that we omitted // the bottom or south point of the diamond that we omitted
@ -477,11 +470,11 @@ public class FtileIfDown extends AbstractFtile {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock); ug.apply(getTranslateForThen(stringBounder)).draw(thenBlock);
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1); ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
if (optionalStop == null) { if (optionalStop == null)
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2); ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
} else { else
ug.apply(getTranslateOptionalStop(stringBounder)).draw(optionalStop); ug.apply(getTranslateOptionalStop(stringBounder)).draw(optionalStop);
}
} }
@Override @Override
@ -493,13 +486,13 @@ public class FtileIfDown extends AbstractFtile {
final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize final double height = geo.getHeight() + 3 * Hexagon.hexagonHalfSize
+ Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder)); + Math.max(Hexagon.hexagonHalfSize * 1, getSouthLabelHeight(stringBounder));
double width = geo.getWidth() + Hexagon.hexagonHalfSize; double width = geo.getWidth() + Hexagon.hexagonHalfSize;
if (optionalStop != null) { if (optionalStop != null)
width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder); width += optionalStop.calculateDimension(stringBounder).getWidth() + getAdditionalWidth(stringBounder);
}
final FtileGeometry result = new FtileGeometry(width, height, geo.getLeft(), geoDiamond1.getInY(), height); final FtileGeometry result = new FtileGeometry(width, height, geo.getLeft(), geoDiamond1.getInY(), height);
if (geoThen.hasPointOut() == false && optionalStop != null) { if (geoThen.hasPointOut() == false && optionalStop != null)
return result.withoutPointOut(); return result.withoutPointOut();
}
return result; return result;
} }
@ -512,39 +505,39 @@ public class FtileIfDown extends AbstractFtile {
} }
private double getSouthLabelHeight(StringBounder stringBounder) { private double getSouthLabelHeight(StringBounder stringBounder) {
if (diamond1 instanceof FtileDiamondInside) { if (diamond1 instanceof FtileDiamondInside)
return ((FtileDiamondInside) diamond1).getSouthLabelHeight(stringBounder); return ((FtileDiamondInside) diamond1).getSouthLabelHeight(stringBounder);
}
if (diamond1 instanceof FtileDiamond) { if (diamond1 instanceof FtileDiamond)
return ((FtileDiamond) diamond1).getSouthLabelHeight(stringBounder); return ((FtileDiamond) diamond1).getSouthLabelHeight(stringBounder);
}
return 0; return 0;
} }
private double getEastLabelWidth(StringBounder stringBounder) { private double getEastLabelWidth(StringBounder stringBounder) {
if (diamond1 instanceof FtileDiamondInside) { if (diamond1 instanceof FtileDiamondInside)
return ((FtileDiamondInside) diamond1).getEastLabelWidth(stringBounder); return ((FtileDiamondInside) diamond1).getEastLabelWidth(stringBounder);
}
if (diamond1 instanceof FtileDiamond) { if (diamond1 instanceof FtileDiamond)
return ((FtileDiamond) diamond1).getEastLabelWidth(stringBounder); return ((FtileDiamond) diamond1).getEastLabelWidth(stringBounder);
}
return 0; return 0;
} }
@Override @Override
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
if (child == thenBlock) { if (child == thenBlock)
return getTranslateForThen(stringBounder); return getTranslateForThen(stringBounder);
}
if (child == diamond1) { if (child == diamond1)
return getTranslateDiamond1(stringBounder); return getTranslateDiamond1(stringBounder);
}
if (child == optionalStop) { if (child == optionalStop)
return getTranslateOptionalStop(stringBounder); return getTranslateOptionalStop(stringBounder);
}
if (child == diamond2) { if (child == diamond2)
return getTranslateDiamond2(stringBounder); return getTranslateDiamond2(stringBounder);
}
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -145,18 +145,18 @@ public class ConditionalBuilder {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow, ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow,
fcTest, url); fcTest, url);
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) { if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false)
return builder.createDown(builder.branch1, builder.branch2); return builder.createDown(builder.branch1, builder.branch2);
}
if (branch1.isEmpty() && branch2.isOnlySingleStopOrSpot()) { if (branch1.isEmpty() && branch2.isOnlySingleStopOrSpot())
return builder.createDown(builder.branch1, builder.branch2); return builder.createDown(builder.branch1, builder.branch2);
}
if (isEmptyOrOnlySingleStopOrSpot(branch1) && isEmptyOrOnlySingleStopOrSpot(branch2) == false) { if (isEmptyOrOnlySingleStopOrSpot(branch1) && isEmptyOrOnlySingleStopOrSpot(branch2) == false)
return builder.createDown(builder.branch2, builder.branch1); return builder.createDown(builder.branch2, builder.branch1);
}
if (branch2.isEmpty() && branch1.isOnlySingleStopOrSpot()) { if (branch2.isEmpty() && branch1.isOnlySingleStopOrSpot())
return builder.createDown(builder.branch2, builder.branch1); return builder.createDown(builder.branch2, builder.branch1);
}
return builder.createWithLinks(); return builder.createWithLinks();
// return builder.createWithDiamonds(); // return builder.createWithDiamonds();
// return builder.createNude(); // return builder.createNude();
@ -173,18 +173,18 @@ public class ConditionalBuilder {
final TextBlock tb2 = getLabelPositive(branch2); final TextBlock tb2 = getLabelPositive(branch2);
final Ftile diamond1 = getShape1(false, tb1, tb2); final Ftile diamond1 = getShape1(false, tb1, tb2);
final Ftile diamond2 = getShape2(branch1, branch2, true); final Ftile diamond2 = getShape2(branch1, branch2, true);
if (branch2.isOnlySingleStopOrSpot()) { if (branch2.isOnlySingleStopOrSpot())
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10),
arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut()); arrowColor, conditionEndStyle, ftileFactory, branch2.getFtile(), branch2.getOut());
}
if (branch1.isOnlySingleStopOrSpot()) { if (branch1.isOnlySingleStopOrSpot())
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(), branch1.getOut()); arrowColor, conditionEndStyle, ftileFactory, branch1.getFtile(), branch1.getOut());
}
if (branch1.isEmpty()) { if (branch1.isEmpty())
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10), return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10),
arrowColor, conditionEndStyle, ftileFactory, null, null); arrowColor, conditionEndStyle, ftileFactory, null, null);
}
return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor, return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor,
conditionEndStyle, ftileFactory, null, branch2.getOut()); conditionEndStyle, ftileFactory, null, branch2.getOut());
} }
@ -211,9 +211,9 @@ public class ConditionalBuilder {
private Ftile createWithLinks() { private Ftile createWithLinks() {
Ftile diamond1 = getDiamond1(true); Ftile diamond1 = getDiamond1(true);
if (url != null) { if (url != null)
diamond1 = new FtileWithUrl(diamond1, url); diamond1 = new FtileWithUrl(diamond1, url);
}
final Ftile diamond2 = getShape2(branch1, branch2, false); final Ftile diamond2 = getShape2(branch1, branch2, false);
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10); final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10); final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
@ -247,29 +247,28 @@ public class ConditionalBuilder {
final Ftile shape1; final Ftile shape1;
if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) { if (conditionStyle == ConditionStyle.INSIDE_HEXAGON) {
if (eastWest) { if (eastWest)
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane) shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
.withWestAndEast(tb1, tb2); .withWestAndEast(tb1, tb2);
} else { else
shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane) shape1 = new FtileDiamondInside(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
.withSouth(tb1).withEast(tb2); .withSouth(tb1).withEast(tb2);
}
} else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) { } else if (conditionStyle == ConditionStyle.EMPTY_DIAMOND) {
if (eastWest) { if (eastWest)
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest) shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
.withWestAndEast(tb1, tb2); .withWestAndEast(tb1, tb2);
} else { else
shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest) shape1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest)
.withSouth(tb1).withEast(tb2); .withSouth(tb1).withEast(tb2);
}
} else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) { } else if (conditionStyle == ConditionStyle.INSIDE_DIAMOND) {
if (eastWest) { if (eastWest)
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane) shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
.withWestAndEast(tb1, tb2); .withWestAndEast(tb1, tb2);
} else { else
shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane) shape1 = new FtileDiamondSquare(tbTest, tile1.skinParam(), backColor, borderColor, swimlane)
.withSouth(tb1).withEast(tb2); .withSouth(tb1).withEast(tb2);
}
} else { } else {
throw new IllegalStateException(); throw new IllegalStateException();
} }
@ -283,9 +282,9 @@ public class ConditionalBuilder {
private Ftile getShape2(Branch branch1, Branch branch2, boolean useNorth) { private Ftile getShape2(Branch branch1, Branch branch2, boolean useNorth) {
final Ftile shape2; final Ftile shape2;
if (conditionEndStyle == ConditionEndStyle.HLINE) { if (conditionEndStyle == ConditionEndStyle.HLINE)
return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane); return new FtileEmpty(tile1.skinParam(), 0, Hexagon.hexagonHalfSize, swimlane);
}
// else use default ConditionEndStyle.DIAMOND // else use default ConditionEndStyle.DIAMOND
if (hasTwoBranches()) { if (hasTwoBranches()) {
final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay(); final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay();

View File

@ -100,9 +100,11 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(),
new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), // new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -189,7 +191,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity); CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity); CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity);
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.getLazzy("TAGS", 0));
if (typeString.contains("STATIC")) if (typeString.contains("STATIC"))
entity.setStatic(true); entity.setStatic(true);

View File

@ -115,9 +115,11 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(),
new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), // new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), // new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -180,7 +182,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
manageExtends("EXTENDS", diagram, line0, entity); manageExtends("EXTENDS", diagram, line0, entity);
manageExtends("IMPLEMENTS", diagram, line0, entity); manageExtends("IMPLEMENTS", diagram, line0, entity);
addTags(entity, line0.get("TAGS", 0)); addTags(entity, line0.getLazzy("TAGS", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -99,13 +99,12 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) // new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
), // ), //
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)")// new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
)), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -130,13 +129,12 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) // new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
), // ), //
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)")// new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
)), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -224,7 +222,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.getLazzy("TAGS", 0));
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {
@ -234,8 +232,8 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
} }
final String s = arg.get("COLOR", 0); final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
: diagram.getSkinParam().getIHtmlColorSet().getColor(s)); s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -82,9 +82,11 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
new RegexLeaf("AS", "([%pLN_.]+)") // new RegexLeaf("AS", "([%pLN_.]+)") //
)), // )), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -146,7 +148,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
p.setUSymbol(usymbol); p.setUSymbol(usymbol);
} }
} }
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(p, arg.getLazzy("TAGS", 0));
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {

View File

@ -92,9 +92,11 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
RegexLeaf.spaceOneOrMore(), partialPattern), // RegexLeaf.spaceOneOrMore(), partialPattern), //
new RegexLeaf("")), // new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -125,9 +127,11 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
partialPattern), // partialPattern), //
new RegexLeaf("")), // new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -149,9 +153,11 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
partialPattern), // partialPattern), //
new RegexLeaf("")), // new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -260,7 +266,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
if (url != null) if (url != null)
note.addUrl(url); note.addUrl(url);
CommandCreateClassMultilines.addTags(note, line0.get("TAGS", 0)); CommandCreateClassMultilines.addTags(note, line0.getLazzy("TAGS", 0));
final Link link; final Link link;

View File

@ -75,9 +75,9 @@ public class GraphvizVersionFinder {
final Pattern p = Pattern.compile("(\\d)\\.(\\d\\d?)"); final Pattern p = Pattern.compile("(\\d)\\.(\\d\\d?)");
final Matcher m = p.matcher(dotVersion); final Matcher m = p.matcher(dotVersion);
final boolean find = m.find(); final boolean find = m.find();
if (find == false) { if (find == false)
return DEFAULT; return DEFAULT;
}
final int major = Integer.parseInt(m.group(1)); final int major = Integer.parseInt(m.group(1));
final int minor = Integer.parseInt(m.group(2)); final int minor = Integer.parseInt(m.group(2));
final int v = 100 * major + minor; final int v = 100 * major + minor;
@ -117,17 +117,17 @@ public class GraphvizVersionFinder {
final ProcessRunner p = new ProcessRunner(cmd); final ProcessRunner p = new ProcessRunner(cmd);
final ProcessState state = p.run(null, null); final ProcessState state = p.run(null, null);
if (state.differs(ProcessState.TERMINATED_OK())) { if (state.differs(ProcessState.TERMINATED_OK()))
return "?"; return "?";
}
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(p.getOut())) { if (StringUtils.isNotEmpty(p.getOut()))
sb.append(p.getOut()); sb.append(p.getOut());
}
if (StringUtils.isNotEmpty(p.getError())) { if (StringUtils.isNotEmpty(p.getError())) {
if (sb.length() > 0) { if (sb.length() > 0)
sb.append(' '); sb.append(' ');
}
sb.append(p.getError()); sb.append(p.getError());
} }
return StringUtils.trin(sb.toString().replace('\n', ' ')); return StringUtils.trin(sb.toString().replace('\n', ' '));

View File

@ -65,6 +65,7 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.SuperGroup; import net.sourceforge.plantuml.cucadiagram.SuperGroup;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
@ -124,6 +125,8 @@ public final class EntityFactory {
folder.setColors(g.getColors()); folder.setColors(g.getColors());
if (g.getUrl99() != null) if (g.getUrl99() != null)
folder.addUrl(g.getUrl99()); folder.addUrl(g.getUrl99());
for (Stereotag tag : g.stereotags())
folder.addStereotag(tag);
// if (UseStyle.useBetaStyle()) { // if (UseStyle.useBetaStyle()) {
// // System.err.println("Backcolor ?"); // // System.err.println("Backcolor ?");
@ -193,6 +196,10 @@ public final class EntityFactory {
} }
public boolean isHidden(ILeaf leaf) { public boolean isHidden(ILeaf leaf) {
final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
if (other instanceof ILeaf)
return isHidden((ILeaf) other);
boolean hidden = false; boolean hidden = false;
for (HideOrShow2 hide : hides2) for (HideOrShow2 hide : hides2)
hidden = hide.apply(hidden, leaf); hidden = hide.apply(hidden, leaf);
@ -201,6 +208,10 @@ public final class EntityFactory {
} }
public boolean isRemoved(ILeaf leaf) { public boolean isRemoved(ILeaf leaf) {
final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
if (other instanceof ILeaf)
return isRemoved((ILeaf) other);
boolean result = false; boolean result = false;
for (HideOrShow2 hide : removed) for (HideOrShow2 hide : removed)
result = hide.apply(result, leaf); result = hide.apply(result, leaf);
@ -208,6 +219,23 @@ public final class EntityFactory {
return result; return result;
} }
private IEntity isNoteWithSingleLinkAttachedTo(ILeaf leaf) {
if (leaf.getLeafType() != LeafType.NOTE)
return null;
IEntity result = null;
for (Link link : this.getLinks()) {
if (link.getType().isInvisible())
continue;
if (link.contains(leaf)) {
if (result != null)
return result;
result = link.getOther(leaf);
}
}
return result;
}
public boolean isRemovedIgnoreUnlinked(ILeaf leaf) { public boolean isRemovedIgnoreUnlinked(ILeaf leaf) {
boolean result = false; boolean result = false;
for (HideOrShow2 hide : removed) for (HideOrShow2 hide : removed)
@ -217,12 +245,6 @@ public final class EntityFactory {
return result; return result;
} }
public void thisIsGoingToBeALeaf(Ident ident) {
}
public void thisIsNotArealGroup(Ident ident) {
}
public ILeaf createLeaf(Ident ident, Code code, Display display, LeafType entityType, IGroup parentContainer, public ILeaf createLeaf(Ident ident, Code code, Display display, LeafType entityType, IGroup parentContainer,
Set<VisibilityModifier> hides, String namespaceSeparator) { Set<VisibilityModifier> hides, String namespaceSeparator) {
final Bodier bodier; final Bodier bodier;

View File

@ -119,13 +119,12 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE4", CODE)) // new RegexLeaf("CODE4", CODE)) //
), // ), //
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)") // new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
)), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -258,7 +257,7 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.getLazzy("TAGS", 0));
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {

View File

@ -117,9 +117,11 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
new RegexLeaf("CODE9", "([^#%s{}%g]*)") // new RegexLeaf("CODE9", "([^#%s{}%g]*)") //
), // ), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
@ -144,11 +146,11 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
display = null; display = null;
} else { } else {
idShort = codeRaw; idShort = codeRaw;
if (displayRaw == null) { if (displayRaw == null)
display = idShort; display = idShort;
} else { else
display = displayRaw; display = displayRaw;
}
} }
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
@ -158,22 +160,22 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
NamespaceStrategy.SINGLE); NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup(); final IEntity p = diagram.getCurrentGroup();
final String symbol = arg.get("SYMBOL", 0); final String symbol = arg.get("SYMBOL", 0);
if ("together".equalsIgnoreCase(symbol)) { if ("together".equalsIgnoreCase(symbol))
p.setThisIsTogether(); p.setThisIsTogether();
}
p.setUSymbol(USymbols.fromString(symbol, diagram.getSkinParam().actorStyle(), p.setUSymbol(USymbols.fromString(symbol, diagram.getSkinParam().actorStyle(),
diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle())); diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()));
final String stereotype = arg.getLazzy("STEREOTYPE", 0); final String stereotype = arg.getLazzy("STEREOTYPE", 0);
if (stereotype != null) { if (stereotype != null)
p.setStereotype(Stereotype.build(stereotype, false)); p.setStereotype(Stereotype.build(stereotype, false));
}
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
final Url url = urlBuilder.getUrl(urlString); final Url url = urlBuilder.getUrl(urlString);
p.addUrl(url); p.addUrl(url);
} }
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(p, arg.getLazzy("TAGS", 0));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors); p.setColors(colors);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -134,6 +134,10 @@ public class Rainbow {
return colors.get(0).getArrowColor(); return colors.get(0).getArrowColor();
} }
public HColor getArrowHeadColor() {
return colors.get(0).getArrowHeadColor();
}
public int getColorArrowSeparationSpace() { public int getColorArrowSeparationSpace() {
return colorArrowSeparationSpace; return colorArrowSeparationSpace;
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
@ -54,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
@ -86,8 +88,12 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
)), // )), //
new RegexLeaf("CODE2", "([%pLN_.]+)"))), // new RegexLeaf("CODE2", "([%pLN_.]+)"))), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
@ -135,8 +141,7 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1); final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
: diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null) if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor); colors = colors.add(ColorType.LINE, lineColor);
@ -144,6 +149,9 @@ public class CommandCreatePackageState extends SingleLineCommand2<StateDiagram>
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
p.setColors(colors); p.setColors(colors);
CommandCreateClassMultilines.addTags(p, arg.getLazzy("TAGS", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
@ -52,6 +53,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
@ -83,8 +85,12 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
new RegexLeaf("CODE3", "([%pLN_.]+)"), // new RegexLeaf("CODE3", "([%pLN_.]+)"), //
new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), // color().getRegex(), //
@ -110,21 +116,21 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
String display = arg.getLazzy("DISPLAY", 0); String display = arg.getLazzy("DISPLAY", 0);
if (display == null) { if (display == null)
display = code.getName(); display = code.getName();
}
final String stereotype = arg.get("STEREOTYPE", 0); final String stereotype = arg.get("STEREOTYPE", 0);
final LeafType type = getTypeFromStereotype(stereotype); final LeafType type = getTypeFromStereotype(stereotype);
if (diagram.checkConcurrentStateOk(ident, code) == false) { if (diagram.checkConcurrentStateOk(ident, code) == false)
return CommandExecutionResult.error("The state " + code.getName() return CommandExecutionResult.error("The state " + code.getName()
+ " has been created in a concurrent state : it cannot be used here."); + " has been created in a concurrent state : it cannot be used here.");
}
final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, null); final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, null);
ent.setDisplay(Display.getWithNewlines(display)); ent.setDisplay(Display.getWithNewlines(display));
if (stereotype != null) { if (stereotype != null)
ent.setStereotype(Stereotype.build(stereotype)); ent.setStereotype(Stereotype.build(stereotype));
}
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
@ -137,12 +143,12 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
final HColor lineColor = s == null ? null final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s); : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null) { if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor); colors = colors.add(ColorType.LINE, lineColor);
}
if (arg.get("LINECOLOR", 0) != null) { if (arg.get("LINECOLOR", 0) != null)
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
}
ent.setColors(colors); ent.setColors(colors);
// ent.setSpecificColorTOBEREMOVED(ColorType.BACK, // ent.setSpecificColorTOBEREMOVED(ColorType.BACK,
@ -154,28 +160,36 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
// ent.applyStroke(arg.get("LINECOLOR", 0)); // ent.applyStroke(arg.get("LINECOLOR", 0));
final String addFields = arg.get("ADDFIELD", 0); final String addFields = arg.get("ADDFIELD", 0);
if (addFields != null) { if (addFields != null)
ent.getBodier().addFieldOrMethod(addFields); ent.getBodier().addFieldOrMethod(addFields);
}
CommandCreateClassMultilines.addTags(ent, arg.getLazzy("TAGS", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
private LeafType getTypeFromStereotype(String stereotype) { private LeafType getTypeFromStereotype(String stereotype) {
if ("<<choice>>".equalsIgnoreCase(stereotype)) { if ("<<choice>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_CHOICE; return LeafType.STATE_CHOICE;
}
if ("<<fork>>".equalsIgnoreCase(stereotype)) { if ("<<fork>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_FORK_JOIN; return LeafType.STATE_FORK_JOIN;
}
if ("<<join>>".equalsIgnoreCase(stereotype)) { if ("<<join>>".equalsIgnoreCase(stereotype))
return LeafType.STATE_FORK_JOIN; return LeafType.STATE_FORK_JOIN;
}
if ("<<start>>".equalsIgnoreCase(stereotype)) { if ("<<start>>".equalsIgnoreCase(stereotype))
return LeafType.CIRCLE_START; return LeafType.CIRCLE_START;
}
if ("<<end>>".equalsIgnoreCase(stereotype)) { if ("<<end>>".equalsIgnoreCase(stereotype))
return LeafType.CIRCLE_END; return LeafType.CIRCLE_END;
}
if ("<<history>>".equalsIgnoreCase(stereotype))
return LeafType.PSEUDO_STATE;
if ("<<history*>>".equalsIgnoreCase(stereotype))
return LeafType.DEEP_HISTORY;
return null; return null;
} }

View File

@ -586,7 +586,6 @@ public final class GeneralImageBuilder {
if (dotData.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { if (dotData.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) {
final ISkinParam skinParam = dotData.getSkinParam(); final ISkinParam skinParam = dotData.getSkinParam();
entityFactory.thisIsGoingToBeALeaf(g.getIdent());
final ILeaf folder = entityFactory.createLeafForEmptyGroup(g, skinParam); final ILeaf folder = entityFactory.createLeafForEmptyGroup(g, skinParam);
printEntity(dotStringFactory, folder); printEntity(dotStringFactory, folder);
} else { } else {

View File

@ -77,6 +77,7 @@ import net.sourceforge.plantuml.cucadiagram.entity.EntityImpl;
import net.sourceforge.plantuml.descdiagram.command.StringWithArrow; import net.sourceforge.plantuml.descdiagram.command.StringWithArrow;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
@ -94,6 +95,7 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.extremity.Extremity; import net.sourceforge.plantuml.svek.extremity.Extremity;
import net.sourceforge.plantuml.svek.extremity.ExtremityArrow;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends;
import net.sourceforge.plantuml.svek.extremity.ExtremityOther; import net.sourceforge.plantuml.svek.extremity.ExtremityOther;
@ -642,7 +644,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
} }
public void drawU(UGraphic ug, UStroke suggestedStroke, HColor color, Set<String> ids) { public void drawU(UGraphic ug, Set<String> ids, UStroke suggestedStroke, Rainbow rainbow) {
if (opale) if (opale)
return; return;
@ -677,12 +679,19 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
x += dx; x += dx;
y += dy; y += dy;
HColor arrowHeadColor = rainbow.getArrowHeadColor();
HColor color = rainbow.getColor();
if (this.link.getColors() != null) { if (this.link.getColors() != null) {
final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE);
if (newColor != null) if (newColor != null) {
color = newColor; color = newColor;
} else if (this.link.getSpecificColor() != null) arrowHeadColor = color;
}
} else if (this.link.getSpecificColor() != null) {
color = this.link.getSpecificColor(); color = this.link.getSpecificColor();
arrowHeadColor = color;
}
ug = ug.apply(HColors.none().bg()).apply(color); ug = ug.apply(HColors.none().bg()).apply(color);
final LinkType linkType = link.getType(); final LinkType linkType = link.getType();
@ -727,7 +736,8 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
final String tmp = uniq(ids, comment); final String tmp = uniq(ids, comment);
todraw.setCommentAndCodeLine(tmp, link.getCodeLine()); todraw.setCommentAndCodeLine(tmp, link.getCodeLine());
drawRainbow(ug.apply(new UTranslate(x, y)), color, todraw, link.getSupplementaryColors(), stroke); drawRainbow(ug.apply(new UTranslate(x, y)), color, arrowHeadColor, todraw, link.getSupplementaryColors(),
stroke);
ug = ug.apply(new UStroke()).apply(color); ug = ug.apply(new UStroke()).apply(color);
@ -820,31 +830,39 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
} }
} }
private void drawRainbow(UGraphic ug, HColor color, DotPath todraw, List<Colors> supplementaryColors, private void drawRainbow(UGraphic ug, HColor color, HColor headColor, DotPath todraw,
UStroke stroke) { List<Colors> supplementaryColors, UStroke stroke) {
ug.draw(todraw); ug.draw(todraw);
final LinkType linkType = link.getType(); final LinkType linkType = link.getType();
if (this.extremity2 != null) { if (headColor.isTransparent()) {
UGraphic ug2 = ug.apply(color).apply(stroke.onlyThickness()); if (this.extremity1 instanceof ExtremityArrow) {
if (linkType.getDecor1().isFill()) final UGraphic ugHead = ug.apply(color).apply(stroke.onlyThickness());
ug2 = ug2.apply(color.bg()); ((ExtremityArrow) this.extremity1).drawLineIfTransparent(ugHead);
else
ug2 = ug2.apply(HColors.none().bg());
// System.err.println("Line::draw EXTREMITY1");
this.extremity2.drawU(ug2);
} }
if (this.extremity1 != null) { } else if (this.extremity1 != null) {
UGraphic ug2 = ug.apply(color).apply(stroke.onlyThickness()); UGraphic ugHead = ug.apply(headColor).apply(stroke.onlyThickness());
if (linkType.getDecor2().isFill()) if (linkType.getDecor2().isFill())
ug2 = ug2.apply(color.bg()); ugHead = ugHead.apply(color.bg());
else else
ug2 = ug2.apply(HColors.none().bg()); ugHead = ugHead.apply(HColors.none().bg());
this.extremity1.drawU(ugHead);
// System.err.println("Line::draw EXTREMITY2");
this.extremity1.drawU(ug2);
} }
if (headColor.isTransparent()) {
if (this.extremity2 instanceof ExtremityArrow) {
final UGraphic ugHead = ug.apply(color).apply(stroke.onlyThickness());
((ExtremityArrow) this.extremity2).drawLineIfTransparent(ugHead);
}
} else if (this.extremity2 != null) {
UGraphic ugHead = ug.apply(headColor).apply(stroke.onlyThickness());
if (linkType.getDecor1().isFill())
ugHead = ugHead.apply(color.bg());
else
ugHead = ugHead.apply(HColors.none().bg());
this.extremity2.drawU(ugHead);
}
int i = 0; int i = 0;
for (Colors colors : supplementaryColors) { for (Colors colors : supplementaryColors) {
ug.apply(new UTranslate(2 * (i + 1), 2 * (i + 1))).apply(colors.getColor(ColorType.LINE)).draw(todraw); ug.apply(new UTranslate(2 * (i + 1), 2 * (i + 1))).apply(colors.getColor(ColorType.LINE)).draw(todraw);

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.cucadiagram.dot.DotData;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
@ -75,8 +76,8 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage
final Style style2 = getDefaultStyleDefinition(null) final Style style2 = getDefaultStyleDefinition(null)
.getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); .getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder());
HColor color = style2.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()); final HColor borderColor = HColors
color = HColors.noGradient(color); .noGradient(style2.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()));
for (SvekNode node : dotStringFactory.getBibliotekon().allNodes()) { for (SvekNode node : dotStringFactory.getBibliotekon().allNodes()) {
final double minX = node.getMinX(); final double minX = node.getMinX();
@ -85,7 +86,7 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage
final IEntityImage image = node.getImage(); final IEntityImage image = node.getImage();
image.drawU(ug2.apply(new UTranslate(minX, minY))); image.drawU(ug2.apply(new UTranslate(minX, minY)));
if (image instanceof Untranslated) if (image instanceof Untranslated)
((Untranslated) image).drawUntranslated(ug.apply(color), minX, minY); ((Untranslated) image).drawUntranslated(ug.apply(borderColor), minX, minY);
} }
@ -98,10 +99,10 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage
final StyleBuilder currentStyleBuilder = line.getCurrentStyleBuilder(); final StyleBuilder currentStyleBuilder = line.getCurrentStyleBuilder();
final Style styleLine = getDefaultStyleDefinition(line.getStereotype()).getMergedStyle(currentStyleBuilder); final Style styleLine = getDefaultStyleDefinition(line.getStereotype()).getMergedStyle(currentStyleBuilder);
color = styleLine.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet());
color = HColors.noGradient(color);
line.drawU(ug2, styleLine.getStroke(), color, ids); final Rainbow rainbow = Rainbow.build(styleLine, dotData.getSkinParam().getIHtmlColorSet());
line.drawU(ug2, ids, styleLine.getStroke(), rainbow);
} }
for (SvekNode node : dotStringFactory.getBibliotekon().allNodes()) for (SvekNode node : dotStringFactory.getBibliotekon().allNodes())

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.svek.extremity; package net.sourceforge.plantuml.svek.extremity;
import net.sourceforge.plantuml.awt.geom.XPoint2D; import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
@ -43,7 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColors; import net.sourceforge.plantuml.ugraphic.color.HColors;
class ExtremityArrow extends Extremity { public class ExtremityArrow extends Extremity {
private UPolygon polygon = new UPolygon(); private UPolygon polygon = new UPolygon();
private final ULine line; private final ULine line;
@ -87,15 +88,23 @@ class ExtremityArrow extends Extremity {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final HColor color = ug.getParam().getColor(); final HColor color = ug.getParam().getColor();
if (color == null) { if (color == null)
ug = ug.apply(HColors.none().bg()); ug = ug.apply(HColors.none().bg());
} else { else
ug = ug.apply(color.bg()); ug = ug.apply(color.bg());
}
ug.draw(polygon); ug.draw(polygon);
if (line != null && line.getLength() > 2) { if (line != null && line.getLength() > 2)
ug.apply(new UTranslate(contact)).draw(line); ug.apply(new UTranslate(contact)).draw(line);
} }
public void drawLineIfTransparent(UGraphic ug) {
final XPoint2D pt1 = polygon.getPoint(0);
final XPoint2D pt2 = polygon.getPoint(2);
final ULine line = new ULine(pt1, pt2);
ug.apply(new UTranslate(pt1)).draw(line);
} }
} }

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -72,7 +73,9 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
final HColor color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); HColor color = getEntity().getColors().getColor(ColorType.BACK);
if (color == null)
color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet());
final double shadowing = style.value(PName.Shadowing).asDouble(); final double shadowing = style.value(PName.Shadowing).asDouble();
circle.setDeltaShadow(shadowing); circle.setDeltaShadow(shadowing);

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.awt.geom.XDimension2D; import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -70,7 +71,10 @@ public class EntityImageCircleStart extends AbstractEntityImage {
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
final HColor color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); HColor color = getEntity().getColors().getColor(ColorType.BACK);
if (color == null)
color = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet());
final double shadowing = style.value(PName.Shadowing).asDouble(); final double shadowing = style.value(PName.Shadowing).asDouble();
circle.setDeltaShadow(shadowing); circle.setDeltaShadow(shadowing);

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -109,7 +110,7 @@ public abstract class Player implements TimeProjected {
public abstract void setState(TimeTick now, String comment, Colors color, String... states); public abstract void setState(TimeTick now, String comment, Colors color, String... states);
public abstract void createConstraint(TimeTick tick1, TimeTick tick2, String message); public abstract void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config);
public abstract TextBlock getPart1(double fullAvailableWidth, double specialVSpace); public abstract TextBlock getPart1(double fullAvailableWidth, double specialVSpace);

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.log.Logme; import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
@ -83,7 +84,14 @@ public class PlayerAnalog extends Player {
if (start != null) if (start != null)
return start; return start;
return 0; double min = 0;
for (Double val : values.values())
min = Math.min(min, val);
if (min == 0)
return 10;
return min;
} }
private double getMax() { private double getMax() {
@ -164,8 +172,8 @@ public class PlayerAnalog extends Player {
} }
@Override @Override
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam)); this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
} }
private double getYpos(StringBounder stringBounder, double value) { private double getYpos(StringBounder stringBounder, double value) {

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
@ -126,8 +127,8 @@ public class PlayerBinary extends Player {
} }
@Override @Override
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam)); this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
} }
private final double ymargin = 8; private final double ymargin = 8;

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint;
@ -107,7 +108,7 @@ public class PlayerClock extends Player {
} }
@Override @Override
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
@ -204,8 +205,9 @@ public final class PlayerRobustConcise extends Player {
return point.translated(translation); return point.translated(translation);
} }
public final void createConstraint(TimeTick tick1, TimeTick tick2, String message) { @Override
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam)); public final void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) {
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config));
} }
public final void addNote(TimeTick now, Display note, Position position) { public final void addNote(TimeTick now, Display note, Position position) {

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -65,13 +66,16 @@ public class TimeConstraint {
private final Display label; private final Display label;
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final StyleBuilder styleBuilder; private final StyleBuilder styleBuilder;
private final ArrowConfiguration config;
public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam) { public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam,
ArrowConfiguration config) {
this.tick1 = Objects.requireNonNull(tick1); this.tick1 = Objects.requireNonNull(tick1);
this.tick2 = Objects.requireNonNull(tick2); this.tick2 = Objects.requireNonNull(tick2);
this.label = Display.getWithNewlines(label); this.label = Display.getWithNewlines(label);
this.skinParam = skinParam; this.skinParam = skinParam;
this.styleBuilder = skinParam.getCurrentStyleBuilder(); this.styleBuilder = skinParam.getCurrentStyleBuilder();
this.config = config;
} }
public final boolean containsStrict(TimeTick other) { public final boolean containsStrict(TimeTick other) {
@ -116,6 +120,9 @@ public class TimeConstraint {
} }
private HColor getArrowColor() { private HColor getArrowColor() {
final HColor configColor = config.getColor();
if (configColor != null)
return configColor;
return getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); return getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
} }

View File

@ -69,9 +69,9 @@ public class CommandAtTime extends SingleLineCommand2<TimingDiagram> {
@Override @Override
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) { final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) {
final TimeTick timeTick = TimeTickBuilder.parseTimeTick("TIME", arg, diagram); final TimeTick timeTick = TimeTickBuilder.parseTimeTick("TIME", arg, diagram);
if (timeTick == null) { if (timeTick == null)
return CommandExecutionResult.error("What time?"); return CommandExecutionResult.error("What time?");
}
final String code = arg.get("CODE", 0); final String code = arg.get("CODE", 0);
diagram.addTime(timeTick, code); diagram.addTime(timeTick, code);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -55,7 +55,7 @@ abstract class CommandChangeState extends SingleLineCommand2<TimingDiagram> {
super(pattern); super(pattern);
} }
static final String STATE_CODE = "([%pLN_][%pLN_.]*)"; static final String STATE_CODE = "([-%pLN_][-%pLN_.]*)";
static ColorParser color() { static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK); return ColorParser.simpleColor(ColorType.BACK);

View File

@ -43,9 +43,12 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.sequencediagram.command.CommandArrow;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.timingdiagram.Player; import net.sourceforge.plantuml.timingdiagram.Player;
import net.sourceforge.plantuml.timingdiagram.TimeTick; import net.sourceforge.plantuml.timingdiagram.TimeTick;
import net.sourceforge.plantuml.timingdiagram.TimingDiagram; import net.sourceforge.plantuml.timingdiagram.TimingDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandConstraint extends SingleLineCommand2<TimingDiagram> { public class CommandConstraint extends SingleLineCommand2<TimingDiagram> {
@ -59,7 +62,9 @@ public class CommandConstraint extends SingleLineCommand2<TimingDiagram> {
TimeTickBuilder.expressionAtWithArobase("TIME1"), // TimeTickBuilder.expressionAtWithArobase("TIME1"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\<"), // new RegexLeaf("\\<"), //
new RegexLeaf("ARROW", "(-+)"), // new RegexLeaf("(-+)"), //
new RegexLeaf("ARROW_STYLE1", CommandArrow.getColorOrStylePattern()), //
new RegexLeaf("(-*)"), //
new RegexLeaf("\\>"), // new RegexLeaf("\\>"), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
TimeTickBuilder.expressionAtWithArobase("TIME2"), // TimeTickBuilder.expressionAtWithArobase("TIME2"), //
@ -74,32 +79,36 @@ public class CommandConstraint extends SingleLineCommand2<TimingDiagram> {
} }
@Override @Override
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) { final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String part1 = arg.get("PART1", 0); final String part1 = arg.get("PART1", 0);
final Player player1; final Player player1;
if (part1 == null) { if (part1 == null) {
player1 = diagram.getLastPlayer(); player1 = diagram.getLastPlayer();
if (player1 == null) { if (player1 == null)
return CommandExecutionResult.error("You have to provide a participant"); return CommandExecutionResult.error("You have to provide a participant");
}
} else { } else {
player1 = diagram.getPlayer(part1); player1 = diagram.getPlayer(part1);
if (player1 == null) { if (player1 == null)
return CommandExecutionResult.error("No such participant " + part1); return CommandExecutionResult.error("No such participant " + part1);
}
} }
final TimeTick tick1 = TimeTickBuilder.parseTimeTick("TIME1", arg, diagram); final TimeTick tick1 = TimeTickBuilder.parseTimeTick("TIME1", arg, diagram);
if (tick1 == null) { if (tick1 == null)
return CommandExecutionResult.error("Unknown time label"); return CommandExecutionResult.error("Unknown time label");
}
final TimeTick restore = diagram.getNow(); final TimeTick restore = diagram.getNow();
diagram.updateNow(tick1); diagram.updateNow(tick1);
final TimeTick tick2 = TimeTickBuilder.parseTimeTick("TIME2", arg, diagram); final TimeTick tick2 = TimeTickBuilder.parseTimeTick("TIME2", arg, diagram);
diagram.updateNow(restore); diagram.updateNow(restore);
if (tick2 == null) { if (tick2 == null)
return CommandExecutionResult.error("Unknown time label"); return CommandExecutionResult.error("Unknown time label");
}
player1.createConstraint(tick1, tick2, arg.get("MESSAGE", 0)); ArrowConfiguration config = ArrowConfiguration.withDirectionBoth();
config = CommandArrow.applyStyle(arg.getLazzy("ARROW_STYLE", 0), config);
player1.createConstraint(tick1, tick2, arg.get("MESSAGE", 0), config);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -81,7 +81,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 0; final int beta = 1;
return beta; return beta;
} }