1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-21 12:35:10 +00:00
Arnaud Roques 2023-08-26 10:59:08 +02:00
parent 51e8676c17
commit 86513bfbc8
18 changed files with 285 additions and 147 deletions

View File

@ -248,6 +248,12 @@ stateDiagram {
header {
FontSize 12
}
circle {
start, stop, end {
LineColor #2
BackgroundColor #2
}
}
}
@ -326,18 +332,10 @@ activityDiagram {
LineThickness 1
}
circle {
start {
start, stop, end {
LineColor #2
BackgroundColor #2
}
stop {
LineColor #2
BackgroundColor transparent
}
end {
LineColor #2
BackgroundColor transparent
}
}
activityBar {
BackgroundColor #5
@ -610,18 +608,10 @@ activityDiagram {
LineColor white
}
circle {
start {
start, stop, end {
LineColor #d
BackgroundColor #d
}
stop {
LineColor #d
BackgroundColor transparent
}
end {
LineColor #d
BackgroundColor transparent
}
}
activityBar {
BackgroundColor #a

View File

@ -262,6 +262,12 @@ stateDiagram {
FontStyle plain
}
}
circle {
start, stop, end {
LineColor black
BackgroundColor black
}
}
}
@ -382,18 +388,10 @@ activityDiagram {
FontSize 11
}
circle {
start {
start, stop, end {
LineColor black
BackgroundColor black
}
stop {
LineColor black
BackgroundColor white
}
end {
LineColor black
BackgroundColor white
}
}
activityBar {
Shadowing 3.0

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleEnd;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleEndCross;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleSpot;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStart;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStop;
@ -66,7 +66,6 @@ import net.sourceforge.plantuml.klimt.font.UFont;
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
@ -111,17 +110,13 @@ public class VCompactFactory implements FtileFactory {
@Override
public Ftile start(Swimlane swimlane) {
final Style style = getSignatureCircleStart().getMergedStyle(skinParam.getCurrentStyleBuilder());
final HColor color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
return new FtileCircleStart(skinParam(), color, swimlane, style);
return new FtileCircleStart(skinParam(), swimlane, style);
}
@Override
public Ftile stop(Swimlane swimlane) {
final Style style = getSignatureCircleStop().getMergedStyle(skinParam.getCurrentStyleBuilder());
final HColor borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final HColor backgroundColor = skinParam.getBackgroundColor();
return new FtileCircleStop(skinParam(), backgroundColor, borderColor, swimlane, style);
return new FtileCircleStop(skinParam(), swimlane, style);
}
@Override
@ -134,10 +129,7 @@ public class VCompactFactory implements FtileFactory {
@Override
public Ftile end(Swimlane swimlane) {
final Style style = getSignatureCircleEnd().getMergedStyle(skinParam.getCurrentStyleBuilder());
final HColor borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final HColor backgroundColor = skinParam.getBackgroundColor();
return new FtileCircleEnd(skinParam(), backgroundColor, borderColor, swimlane, style);
return new FtileCircleEndCross(skinParam(), swimlane, style);
}
@Override

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.klimt.UStroke;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
@ -54,12 +55,12 @@ import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
public class FtileCircleEnd extends AbstractFtile {
public class FtileCircleEndCross extends AbstractFtile {
private static final int SIZE = 20;
private HColor borderColor;
private HColor backColor;
private final HColor lineColor;
private final HColor backColor;
private final Swimlane swimlane;
private double shadowing;
@ -68,14 +69,12 @@ public class FtileCircleEnd extends AbstractFtile {
return Collections.emptyList();
}
public FtileCircleEnd(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
public FtileCircleEndCross(ISkinParam skinParam, Swimlane swimlane, Style style) {
super(skinParam);
this.borderColor = borderColor;
this.backColor = backColor;
this.swimlane = swimlane;
this.shadowing = style.value(PName.Shadowing).asDouble();
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.lineColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
}
@ -102,10 +101,11 @@ public class FtileCircleEnd extends AbstractFtile {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug = ug.apply(borderColor);
ug = ug.apply(lineColor).apply(HColors.transparent().bg());
final double thickness = 2.5;
ug.apply(backColor.bg()).apply(UStroke.withThickness(1.5)).apply(new UTranslate(xTheoricalPosition, yTheoricalPosition))
.draw(circle);
ug.apply(UStroke.withThickness(1.5)).apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle);
ug = ug.apply(backColor.bg());
final double size2 = (SIZE - thickness) / Math.sqrt(2);
final double delta = (SIZE - size2) / 2;

View File

@ -43,32 +43,22 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.image.CircleStart;
public class FtileCircleStart extends AbstractFtile {
private static final int SIZE = 20;
private HColor backColor;
private HColor borderColor;
private final CircleStart circle;
private final Swimlane swimlane;
private double shadowing;
public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) {
public FtileCircleStart(ISkinParam skinParam, Swimlane swimlane, Style style) {
super(skinParam);
this.swimlane = swimlane;
this.backColor = backColor;
this.borderColor = HColors.none();
this.shadowing = style.value(PName.Shadowing).asDouble();
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.circle = new CircleStart(skinParam, style, Colors.empty());
}
@Override
@ -92,14 +82,13 @@ public class FtileCircleStart extends AbstractFtile {
}
public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug.apply(borderColor).apply(backColor.bg()).draw(circle);
circle.drawU(ug);
}
@Override
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
return new FtileGeometry(SIZE, SIZE, SIZE / 2, 0, SIZE);
final double size = circle.calculateDimension(stringBounder).getWidth();
return new FtileGeometry(size, size, size / 2, 0, size);
}
}

View File

@ -43,38 +43,29 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.image.CircleEnd;
public class FtileCircleStop extends AbstractFtile {
private static final int SIZE = 22;
private HColor borderColor;
private HColor backColor;
private final Swimlane swimlane;
private double shadowing;
private final CircleEnd circle;
@Override
public Collection<Ftile> getMyChildren() {
return Collections.emptyList();
}
public FtileCircleStop(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
public FtileCircleStop(ISkinParam skinParam, Swimlane swimlane, Style style) {
super(skinParam);
this.borderColor = borderColor;
this.backColor = backColor;
this.swimlane = swimlane;
this.shadowing = style.value(PName.Shadowing).asDouble();
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.circle = new CircleEnd(skinParam, style, Colors.empty());
}
@ -94,18 +85,7 @@ public class FtileCircleStop extends AbstractFtile {
}
public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
circle.setDeltaShadow(shadowing);
ug.apply(borderColor).apply(backColor.bg()).draw(circle);
final double delta = 5;
final UEllipse circleSmall = UEllipse.build(SIZE - delta * 2, SIZE - delta * 2);
// if (skinParam().shadowing(null)) {
// circleSmall.setDeltaShadow(3);
// }
final HColor middle = HColors.middle(borderColor, backColor);
ug.apply(middle).apply(borderColor.bg()).apply(new UTranslate(delta, delta)).draw(circleSmall);
circle.drawU(ug);
}
@Override

View File

@ -148,7 +148,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
public TextBlock toTextBlockInternal(ISkinParam skinParam) {
if (type == BpmElementType.START) {
return new FtileCircleStart(skinParam, HColors.BLACK, null, getStyle(skinParam));
return new FtileCircleStart(skinParam, null, getStyle(skinParam));
}
if (type == BpmElementType.MERGE) {
final HColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder);

View File

@ -58,6 +58,7 @@ public class QuoteUtils {
"Qba'g Cnavp!", "Jung qb lbh zrna? Na Nsevpna be Rhebcrna fjnyybj?",
"V arrq lbhe obbgf lbhe pybgurf naq lbhe zbgbeplpyr", "Lbh sbetbg gb fnl cyrnfr...",
"Lbh unir qvrq bs qlfragrel.", "Jbhyqa'g lbh cersre n avpr tnzr bs purff?",
"Ubj nobhg n avpr tnzr bs purff?",
"Jura lbh unir ryvzvangrq gur vzcbffvoyr, jungrire erznvaf, ubjrire vzcebonoyr, zhfg or gur gehgu.",
"V xabj abj jul lbh pel. Ohg vg'f fbzrguvat V pna arire qb.",
"Erfvfgnapr vf shgvyr. Lbh jvyy or nffvzvyngrq.", "Nalguvat qvssrerag vf tbbq.",
@ -318,7 +319,11 @@ public class QuoteUtils {
"cynaghzy: qvntenzf sbe pbashfvat crbcyr zber", "Ha zbeprnh dhv onynapr qh gbaareer?",
"Pnhtug hc va pvepyrf, pbashfvba vf abguvat arj",
"N pbzcyrk flfgrz qrfvtarq sebz fpengpu arire jbexf naq pnaabg or cngpurq hc gb znxr vg jbex.",
"Gur vagrearg vf pbzvat", "Qba'g lbh xabj guvatf unccra sbe n ernfba");
"Gur vagrearg vf pbzvat", "Qba'g lbh xabj guvatf unccra sbe n ernfba",
"V qba'g ernyyl srry yvxr Oneovr nalzber", "P'rfg gba abz dhr wr cbfr fhe yrf zhef qr Cnevf",
"Lbh qba'g arrq zbarl, qba'g gnxr snzr",
"V qba'g nyjnlf grfg zl pbqr, ohg jura V qb, V qb vg va cebqhpgvba.", "Npgvingr gur Bzrtn Guvegrra.",
"V xabj vg'f Jrqarfqnl, ohg jung n jrrx, uhu?", "Vs Vg Pbzcvyrf, Vg Jbexf", "Unzfgre ng irybpvgl crnx");
private QuoteUtils() {
}

View File

@ -53,6 +53,10 @@ public abstract class TimeHeaderCalendar extends TimeHeader {
this.thParam = thParam;
}
protected final boolean isBold(Day wink) {
return thParam.getVerticalSeparatorBefore().contains(wink);
}
protected final Locale locale() {
return thParam.getLocale();
}

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.project.draw;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
@ -59,16 +58,10 @@ public class TimeHeaderDaily extends TimeHeaderCalendar {
}
private final Map<Day, String> nameDays;
private final Set<Day> verticalSeparators;
public TimeHeaderDaily(TimeHeaderParameters thParam, Map<Day, String> nameDays, Day printStart, Day printEnd) {
super(thParam, new TimeScaleDaily(thParam.getStartingDay(), thParam.getScale(), printStart));
this.nameDays = nameDays;
this.verticalSeparators = thParam.getVerticalSeparatorBefore();
}
private boolean isBold(Day wink) {
return verticalSeparators.contains(wink);
}
@Override

View File

@ -62,11 +62,19 @@ public class TimeHeaderMonthly extends TimeHeaderCalendar {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
drawMonths(ug.apply(UTranslate.dy(16)));
printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, 16);
drawHline(ug, getFullHeaderHeight());
}
private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
if (isBold(wink))
drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
isBold(wink));
}
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));

View File

@ -62,11 +62,19 @@ public class TimeHeaderQuarterly extends TimeHeaderCalendar {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
drawQuarters(ug.apply(UTranslate.dy(16)));
printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, 16);
drawHline(ug, getFullHeaderHeight());
}
private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
if (isBold(wink))
drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
isBold(wink));
}
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));

View File

@ -108,12 +108,17 @@ public class TimeHeaderWeekly extends TimeHeaderCalendar {
}
private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) {
if (wink.getDayOfWeek() == weekNumberStrategy.getFirstDayOfWeek()) {
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
if (wink.getDayOfWeek() == weekNumberStrategy.getFirstDayOfWeek())
drawVbar(ug, getTimeScale().getStartingPosition(wink), Y_POS_ROW16(), totalHeightWithoutFooter, false);
}
}
drawVbar(ug, getTimeScale().getEndingPosition(max), Y_POS_ROW16(), totalHeightWithoutFooter, false);
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
if (isBold(wink))
drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
isBold(wink));
}
private void printDaysOfMonth(final UGraphic ug) {

View File

@ -61,10 +61,18 @@ public class TimeHeaderYearly extends TimeHeaderCalendar {
public void drawTimeHeader(final UGraphic ug, double totalHeightWithoutFooter) {
drawTextsBackground(ug, totalHeightWithoutFooter);
drawYears(ug);
printSmallVbars(ug, totalHeightWithoutFooter);
drawHline(ug, 0);
drawHline(ug, getFullHeaderHeight());
}
private void printSmallVbars(final UGraphic ug, double totalHeightWithoutFooter) {
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment())
if (isBold(wink))
drawVbar(ug, getTimeScale().getStartingPosition(wink), getFullHeaderHeight(), totalHeightWithoutFooter,
isBold(wink));
}
@Override
public void drawTimeFooter(UGraphic ug) {
ug = ug.apply(UTranslate.dy(3));

View File

@ -0,0 +1,104 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.svek.image;
import net.sourceforge.plantuml.klimt.UShape;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
public class CircleEnd implements UDrawable {
private static final int SIZE = 22;
private final ISkinParam skinParam;
private final Style style;
private final Colors colors;
public CircleEnd(ISkinParam skinParam, Style style, Colors colors) {
this.style = style;
this.colors = colors;
this.skinParam = skinParam;
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return new XDimension2D(SIZE, SIZE);
}
final public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
HColor backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
if (colors.getColor(ColorType.BACK) != null) {
lineColor = colors.getColor(ColorType.BACK);
backColor = colors.getColor(ColorType.BACK);
}
final double shadowing = style.value(PName.Shadowing).asDouble();
circle.setDeltaShadow(shadowing);
ug.apply(HColors.none().bg()).apply(lineColor).draw(circle);
final double delta = 5;
final UShape circleSmall = UEllipse.build(SIZE - delta * 2, SIZE - delta * 2);
// This is *really* weird, but because of anti-aliasing we have to use middle
// color when lineColor and backColor are the same (!)
if (lineColor.equals(backColor)) {
final HColor middle = HColors.middle(lineColor, backColor);
ug = ug.apply(backColor.bg());
ug = ug.apply(middle);
} else {
ug = ug.apply(backColor.bg());
ug = ug.apply(lineColor);
}
ug.apply(new UTranslate(delta, delta)).draw(circleSmall);
}
}

View File

@ -0,0 +1,84 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.svek.image;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
public class CircleStart implements UDrawable {
private static final int SIZE = 20;
private final ISkinParam skinParam;
private final Style style;
private final Colors colors;
public CircleStart(ISkinParam skinParam, Style style, Colors colors) {
this.style = style;
this.colors = colors;
this.skinParam = skinParam;
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return new XDimension2D(SIZE, SIZE);
}
final public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
HColor backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
if (colors.getColor(ColorType.BACK) != null) {
lineColor = colors.getColor(ColorType.BACK);
backColor = colors.getColor(ColorType.BACK);
}
final double shadowing = style.value(PName.Shadowing).asDouble();
circle.setDeltaShadow(shadowing);
ug.apply(lineColor).apply(backColor.bg()).draw(circle);
}
}

View File

@ -36,17 +36,10 @@
package net.sourceforge.plantuml.svek.image;
import net.sourceforge.plantuml.abel.Entity;
import net.sourceforge.plantuml.klimt.UShape;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
@ -55,7 +48,8 @@ import net.sourceforge.plantuml.svek.ShapeType;
public class EntityImageCircleEnd extends AbstractEntityImage {
private static final int SIZE = 20;
private static final int SIZE = 22;
private final CircleEnd circle;
public StyleSignatureBasic getDefaultStyleDefinitionCircle() {
return StyleSignatureBasic.of(SName.root, SName.element, getSkinParam().getUmlDiagramType().getStyleName(),
@ -64,6 +58,8 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
public EntityImageCircleEnd(Entity entity, ISkinParam skinParam) {
super(entity, skinParam);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
this.circle = new CircleEnd(skinParam, style, entity.getColors());
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
@ -71,20 +67,7 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
}
final public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
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();
circle.setDeltaShadow(shadowing);
ug.apply(HColors.none().bg()).apply(color).draw(circle);
final double delta = 4;
final UShape circleSmall = UEllipse.build(SIZE - delta * 2, SIZE - delta * 2);
ug.apply(color.bg()).apply(HColors.none()).apply(new UTranslate(delta + 0.5, delta + 0.5)).draw(circleSmall);
circle.drawU(ug);
}
public ShapeType getShapeType() {

View File

@ -36,15 +36,10 @@
package net.sourceforge.plantuml.svek.image;
import net.sourceforge.plantuml.abel.Entity;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
@ -53,7 +48,7 @@ import net.sourceforge.plantuml.svek.ShapeType;
public class EntityImageCircleStart extends AbstractEntityImage {
private static final int SIZE = 20;
private final CircleStart circle;
public StyleSignatureBasic getDefaultStyleDefinitionCircle() {
return StyleSignatureBasic.of(SName.root, SName.element, getSkinParam().getUmlDiagramType().getStyleName(),
@ -62,24 +57,16 @@ public class EntityImageCircleStart extends AbstractEntityImage {
public EntityImageCircleStart(Entity entity, ISkinParam skinParam) {
super(entity, skinParam);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
this.circle = new CircleStart(skinParam, style, entity.getColors());
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return new XDimension2D(SIZE, SIZE);
return circle.calculateDimension(stringBounder);
}
final public void drawU(UGraphic ug) {
final UEllipse circle = UEllipse.build(SIZE, SIZE);
final Style style = getDefaultStyleDefinitionCircle().getMergedStyle(getSkinParam().getCurrentStyleBuilder());
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();
circle.setDeltaShadow(shadowing);
ug.apply(color.bg()).apply(HColors.none()).draw(circle);
circle.drawU(ug);
}
public ShapeType getShapeType() {