Version 1.2022.1

This commit is contained in:
Arnaud Roques 2022-02-01 21:21:45 +01:00
parent cee57b06ba
commit 8ae721e3d2
72 changed files with 1610 additions and 714 deletions

View File

@ -69,8 +69,67 @@ element {
}
}
artifact {
Shadowing 4.0
}
node {
Shadowing 2.0
}
person {
Shadowing 2.0
}
queue {
Shadowing 2.0
}
rectangle {
Shadowing 3.0
}
stack {
Shadowing 3.0
}
storage {
Shadowing 3.0
}
boundary {
Shadowing 4.0
}
card {
Shadowing 3.0
}
cloud {
Shadowing 3.0
}
collections {
Shadowing 3.0
}
component {
Shadowing 4.0
}
database {
Shadowing 3.0
}
file {
Shadowing 3.0
}
frame {
Shadowing 3.0
}
folder {
Shadowing 3.0
}
group {
BackGroundColor white
package {
LineThickness 1.5
LineColor black
}
folder {
LineThickness 1.5
LineColor black
}
}
group {
BackGroundColor transparent
}
sequenceDiagram {
@ -98,6 +157,50 @@ sequenceDiagram {
classDiagram {
}
visibilityIcon {
public {
LineColor #038048
BackgroundColor #84BE84
}
private {
LineColor #C82930
BackgroundColor #F24D5C
}
protected {
LineColor #B38D22
BackgroundColor #FFFF44
}
package {
LineColor #1963A0
BackgroundColor #4177AF
}
IEMandatory {
LineColor black
BackgroundColor black
}
}
spot {
spotAnnotation {
BackgroundColor #E3664A
}
spotAbstractClass {
BackgroundColor #A9DCDF
}
spotClass {
BackgroundColor #ADD1B2
}
spotInterface {
BackgroundColor #B4A7E5
}
spotEnum {
BackgroundColor #EB937F
}
spotEntity {
BackgroundColor #ADD1B2
}
}
stateDiagram {
state {
@ -266,7 +369,8 @@ activityDiagram {
}
activityBar {
BackgroundColor black
Shadowing 3.0
BackgroundColor black
}
circle {

452
skin/plantuml2.skin Normal file
View File

@ -0,0 +1,452 @@
root {
FontName SansSerif
HyperLinkColor blue
FontColor black
FontSize 14
FontStyle plain
HorizontalAlignment left
RoundCorner 0
DiagonalCorner 0
LineThickness 1.0
LineColor #181818
BackGroundColor #f8f8f8
Shadowing 0.0
}
document {
BackGroundColor White
header {
HorizontalAlignment right
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
}
title {
HorizontalAlignment center
FontSize 14
FontStyle bold
Padding 5
Margin 5
LineColor none
BackGroundColor none
}
footer {
HorizontalAlignment center
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
}
legend {
LineColor black
BackGroundColor #DDDDDD
FontSize 14
RoundCorner 15
Padding 6
Margin 8
}
caption {
HorizontalAlignment center
FontSize 14
Padding 0
Margin 1
LineColor none
BackGroundColor none
}
}
stereotype {
FontStyle italic
}
element {
Shadowing 0.0
title {
FontStyle bold
}
}
group {
package {
LineThickness 1.5
LineColor black
}
folder {
LineThickness 1.5
LineColor black
}
}
group {
BackGroundColor transparent
}
sequenceDiagram {
group {
LineColor black
LineThickness 2.0
FontSize 11
FontStyle bold
}
groupHeader {
BackGroundColor #EEEEEE
LineColor black
FontSize 13
FontStyle bold
}
lifeLine {
BackGroundColor white
LineStyle 5
}
}
classDiagram {
}
visibilityIcon {
public {
LineColor #038048
BackgroundColor #84BE84
}
private {
LineColor #C82930
BackgroundColor #F24D5C
}
protected {
LineColor #B38D22
BackgroundColor #FFFF44
}
package {
LineColor #1963A0
BackgroundColor #4177AF
}
IEMandatory {
LineColor black
BackgroundColor black
}
}
spot {
spotAnnotation {
BackgroundColor #E3664A
}
spotAbstractClass {
BackgroundColor #A9DCDF
}
spotClass {
BackgroundColor #ADD1B2
}
spotInterface {
BackgroundColor #B4A7E5
}
spotEnum {
BackgroundColor #EB937F
}
spotEntity {
BackgroundColor #ADD1B2
}
}
stateDiagram {
state {
RoundCorner 25
}
element {
title {
FontStyle plain
}
}
}
destroy {
}
reference {
FontSize 12
LineColor black
BackGroundColor while
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #EEEEEE
FontColor black
FontSize 13
FontStyle bold
LineThickness 2.0
}
box {
BackGroundColor #DDDDDD
FontSize 13
FontStyle bold
}
separator {
LineColor black
LineThickness 2.0
BackGroundColor #EEEEEE
FontSize 13
FontStyle bold
}
delay {
FontSize 11
FontStyle plain
HorizontalAlignment center
}
participant {
LineThickness 1.5
HorizontalAlignment center
}
actor {
LineThickness 2.0
HorizontalAlignment center
}
boundary {
LineThickness 2.0
HorizontalAlignment center
}
control {
LineThickness 2.0
HorizontalAlignment center
}
entity {
LineThickness 2.0
HorizontalAlignment center
}
queue {
LineThickness 2.0
HorizontalAlignment center
}
database {
HorizontalAlignment center
}
collections {
LineThickness 1.5
HorizontalAlignment center
}
swimlane {
BackGroundColor none
LineColor black
LineThickness 2
FontSize 18
}
arrow {
FontSize 13
}
note {
FontSize 13
BackGroundColor #ebebeb
}
partition {
}
circle {
}
mindmapDiagram {
}
mindmapDiagram {
node {
Padding 10
Margin 10
RoundCorner 25
LineThickness 1.5
}
arrow {
LineThickness 1.0
}
}
wbsDiagram {
Padding 10
Margin 15
RoundCorner 0
LineThickness 1.5
FontSize 12
}
activityDiagram {
activity {
LineThickness 1.5
Padding 10
FontSize 12
RoundCorner 25
}
partition {
LineColor black
BackgroundColor none
}
diamond {
FontSize 11
}
arrow {
FontSize 11
}
}
activityBar {
BackgroundColor black
}
circle {
LineColor black
}
task {
FontSize 11
}
milestone {
FontSize 11
BackGroundColor black
LineColor black
}
ganttDiagram {
arrow {
LineThickness 1.5
}
note {
FontSize 9
}
separator {
FontSize 11
FontStyle plain
BackGroundColor transparent
Margin 5
Padding 5
}
timeline {
BackgroundColor transparent
LineColor #C0C0C0
}
closed {
BackGroundColor #E0E8E8
FontColor #909898
}
task {
RoundCorner 0
Margin 2 2 2 2
Padding 0
}
undone {
BackGroundColor white
}
milestone {
Margin 2
Padding 3
}
}
usecase {
HorizontalAlignment center
}
yamlDiagram,jsonDiagram {
BackGroundColor white
FontColor black
LineColor black
arrow {
LineThickness 1
LineStyle 3;3
}
node {
LineThickness 1.5
RoundCorner 10
separator {
LineThickness 1
}
header {
FontStyle bold
}
highlight {
BackGroundColor #ccff02
}
}
}
timingDiagram {
arrow {
LineThickness 1.5
}
constraintArrow {
LineThickness 1.5
}
}
nwdiagDiagram {
network {
FontSize 12
}
server {
FontSize 12
}
group {
FontSize 12
BackGroundColor #ddd
}
arrow {
FontSize 11
}
}
@media (prefers-color-scheme:dark) {
element {
LineColor #e7e7e7
BackGroundColor #070707
FontColor white
}
spot {
spotAnnotation {
BackgroundColor #4A0000
}
spotAbstractClass {
BackgroundColor #2A5D60
}
spotClass {
BackgroundColor #2E5233
}
spotInterface {
BackgroundColor #352866
}
spotEnum {
BackgroundColor #852D19
}
spotEntity {
BackgroundColor #2E5233
}
}
}

View File

@ -55,7 +55,7 @@ public class SkinParamColors extends SkinParamDelegator {
@Override
public String toString() {
return super.toString() + colors;
return "SkinParamColors::" + colors;
}
@Override

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml;
import java.io.IOException;
import java.io.InputStream;
import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder;
@ -55,6 +56,7 @@ import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleLoader;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -118,7 +120,13 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
}
public CommandExecutionResult loadSkin(String newSkin) throws IOException {
getSkinParam().setDefaultSkin(newSkin + ".skin");
final String filename = newSkin + ".skin";
final InputStream is = StyleLoader.getInputStreamForStyle(filename);
if (is == null)
return CommandExecutionResult.error("Cannot find style " + newSkin);
is.close();
getSkinParam().setDefaultSkin(filename);
return CommandExecutionResult.ok();
// final String res = "/skin/" + filename + ".skin";
// final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res);

View File

@ -118,6 +118,12 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
return ColorParser.simpleColor(ColorType.BACK, id);
}
private StyleSignature getDefaultStyleDefinitionPartition(USymbol symbol) {
if (symbol == USymbol.RECTANGLE)
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.rectangle);
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition);
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
@ -131,35 +137,38 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
final String stereo = arg.get("STEREO", 0);
final Stereotype stereotype = stereo == null ? null : Stereotype.build(stereo);
final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype,
false);
HColor backColor;
if (backColorInSkinparam == null) {
backColor = colors.getColor(ColorType.BACK);
} else {
backColor = backColorInSkinparam;
}
HColor titleColor = colors.getColor(ColorType.HEADER);
// Warning : titleColor unused in FTileGroupW
HColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false);
if (borderColor == null) {
borderColor = HColorUtils.BLACK;
}
double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype);
HColor titleColor;
HColor borderColor;
double roundCorner;
if (UseStyle.useBetaStyle()) {
final Style stylePartition = getDefaultStyleDefinitionPartition()
final Style stylePartition = getDefaultStyleDefinitionPartition(symbol).with(stereotype)
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getThemeStyle(),
diagram.getSkinParam().getIHtmlColorSet());
backColor = colors.getColor(ColorType.BACK);
if (backColor == null) {
if (backColor == null)
backColor = stylePartition.value(PName.BackGroundColor).asColor(diagram.getSkinParam().getThemeStyle(),
diagram.getSkinParam().getIHtmlColorSet());
}
titleColor = HColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet());
roundCorner = stylePartition.value(PName.RoundCorner).asDouble();
} else {
final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol),
stereotype, false);
if (backColorInSkinparam == null)
backColor = colors.getColor(ColorType.BACK);
else
backColor = backColorInSkinparam;
titleColor = colors.getColor(ColorType.HEADER);
borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false);
if (borderColor == null)
borderColor = HColorUtils.BLACK;
roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype);
}
diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, symbol,
@ -168,8 +177,4 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
return CommandExecutionResult.ok();
}
final public StyleSignature getDefaultStyleDefinitionPartition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition);
}
}

View File

@ -94,15 +94,23 @@ public class VCompactFactory implements FtileFactory {
this.stringBounder = stringBounder;
}
final public StyleSignature getDefaultStyleDefinitionCircle() {
private StyleSignature getSignatureCircle() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle);
}
private StyleSignature getSignatureCircleEnd() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end);
}
private StyleSignature getSignatureCircleStop() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.stop);
}
public Ftile start(Swimlane swimlane) {
final HColor color;
Style style = null;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
style = getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
color = rose.getHtmlColor(skinParam, ColorParam.activityStart);
@ -115,10 +123,8 @@ public class VCompactFactory implements FtileFactory {
Style style = null;
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
style = getSignatureCircleStop().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor();
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
@ -128,8 +134,6 @@ public class VCompactFactory implements FtileFactory {
}
public Ftile spot(Swimlane swimlane, String spot, HColor color) {
// final HtmlColor color = rose.getHtmlColor(skinParam,
// ColorParam.activityBackground);
final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY);
return new FtileCircleSpot(skinParam(), swimlane, spot, font, color);
}
@ -139,10 +143,8 @@ public class VCompactFactory implements FtileFactory {
Style style = null;
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
style = getSignatureCircleEnd().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor();
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);

View File

@ -108,19 +108,25 @@ public class ConditionalBuilder {
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
if (UseStyle.useBetaStyle()) {
if (backColor == null)
throw new IllegalArgumentException();
if (borderColor == null)
throw new IllegalArgumentException();
if (arrowColor == null)
throw new IllegalArgumentException();
final Style styleArrow = getDefaultStyleDefinitionArrow()
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam.getCurrentStyleBuilder());
this.diamondLineBreak = styleDiamond.wrapWidth();
this.labelLineBreak = styleArrow.wrapWidth();
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
this.arrowColor = Rainbow.fromColor(
this.borderColor = borderColor; /*styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());*/
this.backColor = backColor;/*styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet())*/;
this.arrowColor = arrowColor;/* Rainbow.fromColor(
styleArrow.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()),
null);
null);*/
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {

View File

@ -42,6 +42,7 @@ import java.util.Objects;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -49,6 +50,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -82,17 +87,27 @@ public class FtileBlackBlock extends AbstractFtile {
@Override
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
double supp = label.calculateDimension(stringBounder).getWidth();
if (supp > 0) {
if (supp > 0)
supp += labelMargin;
}
return new FtileGeometry(width + supp, height, width / 2, 0, height);
}
private StyleSignature getDefaultStyleDefinitionBar() {
return StyleSignature.of(SName.root, SName.element, SName.activityBar);
}
public void drawU(UGraphic ug) {
final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX();
if (skinParam().shadowing(null)) {
rect.setDeltaShadow(3);
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionBar().getMergedStyle(skinParam().getCurrentStyleBuilder());
final double shadowing = style.value(PName.Shadowing).asDouble();
rect.setDeltaShadow(shadowing);
} else {
if (skinParam().shadowing(null))
rect.setDeltaShadow(3);
}
ug.apply(colorBar).apply(colorBar.bg()).draw(rect);
final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder());
label.drawU(ug.apply(new UTranslate(width + labelMargin, -dimLabel.getHeight() / 2)));

View File

@ -81,8 +81,8 @@ abstract class FtileDiamondWIP extends AbstractFtile implements Styleable {
super(skinParam);
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.borderColor = borderColor; //style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.backColor = backColor; //style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
this.backColor = backColor;

View File

@ -40,7 +40,10 @@ import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStart;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
@ -50,6 +53,10 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -111,7 +118,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
public Dimension2D calculateDimension(StringBounder stringBounder) {
return raw.calculateDimension(stringBounder);
}
public MinMax getMinMax(StringBounder stringBounder) {
return raw.getMinMax(stringBounder);
}
@ -135,9 +142,20 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
}
}
private StyleSignature getSignatureCircle() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle);
}
private Style getStyle(ISkinParam skinParam) {
if (UseStyle.useBetaStyle())
return getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
return null;
}
public TextBlock toTextBlockInternal(ISkinParam skinParam) {
if (type == BpmElementType.START) {
return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, null);
return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, getStyle(skinParam));
}
if (type == BpmElementType.MERGE) {
final HColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder);

View File

@ -139,9 +139,9 @@ public enum LinkDecor {
case NOT_NAVIGABLE:
return new ExtremityFactoryNotNavigable();
case AGREGATION:
return new ExtremityFactoryDiamond(false, backgroundColor);
return new ExtremityFactoryDiamond(false);
case COMPOSITION:
return new ExtremityFactoryDiamond(true, backgroundColor);
return new ExtremityFactoryDiamond(true);
case CIRCLE:
return new ExtremityFactoryCircle(false, backgroundColor);
case CIRCLE_FILL:

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -55,9 +56,13 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockWithUrl;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.PlacementStrategy;
@ -68,6 +73,7 @@ import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Right;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.utils.CharHidder;
public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock, WithPorts {
@ -261,11 +267,23 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
}
};
}
final HColor back = modifier.getBackground() == null ? null
: rose.getHtmlColor(skinParam, modifier.getBackground());
final HColor fore = rose.getHtmlColor(skinParam, modifier.getForeground());
final HColor backColor;
final HColor borderColor;
if (UseStyle.useBetaStyle()) {
final Style style = modifier.getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
final boolean isField = modifier.isField();
backColor = isField ? null
: style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
} else {
borderColor = rose.getHtmlColor(skinParam, modifier.getForeground());
backColor = modifier.getBackground() == null ? null
: rose.getHtmlColor(skinParam, modifier.getBackground());
}
final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back, url != null);
final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), borderColor, backColor,
url != null);
return TextBlockWithUrl.withUrl(uBlock, url);
}

View File

@ -261,7 +261,7 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
final double shadowing;
final UStroke stroke;
if (UseStyle.useBetaStyle()) {
final Style style = Cluster.getDefaultStyleDefinition(umlDiagramType.getStyleName())
final Style style = Cluster.getDefaultStyleDefinition(umlDiagramType.getStyleName(), group.getUSymbol())
.getMergedStyle(skinParam.getCurrentStyleBuilder());
shadowing = style.value(PName.Shadowing).asDouble();
stroke = Cluster.getStrokeInternal(group, skinParam, style);
@ -275,8 +275,8 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
stroke = Cluster.getStrokeInternal(group, skinParam, null);
}
HColor backColor = getBackColor(umlDiagramType);
backColor = Cluster.getBackColor(backColor, skinParam, group.getStereotype(),
umlDiagramType.getStyleName());
backColor = Cluster.getBackColor(backColor, skinParam, group.getStereotype(), umlDiagramType.getStyleName(),
group.getUSymbol());
final double roundCorner = group.getUSymbol() == null ? 0
: group.getUSymbol().getSkinParameter().getRoundCorner(skinParam, group.getStereotype());

View File

@ -44,36 +44,35 @@ import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic;
public class CircledCharacter extends AbstractTextBlock implements TextBlock {
private final String c;
private final UFont font;
private final HColor innerCircle;
private final HColor circle;
private final HColor spotBackColor;
private final HColor spotBorder;
private final HColor fontColor;
private final double radius;
public CircledCharacter(char c, double radius, UFont font, HColor innerCircle, HColor circle,
public CircledCharacter(char c, double radius, UFont font, HColor spotBackColor, HColor spotBorder,
HColor fontColor) {
this.c = "" + c;
this.radius = radius;
this.font = font;
this.innerCircle = innerCircle;
this.circle = circle;
this.fontColor = fontColor;
this.spotBackColor = spotBackColor;
this.spotBorder = spotBorder;
if (fontColor instanceof HColorAutomatic)
this.fontColor = ((HColorAutomatic) fontColor).getAppropriateColor(spotBackColor);
else
this.fontColor = fontColor;
}
// public void draw(ColorMapper colorMapper, Graphics2D g2d, int x, int y, double dpiFactor) {
// drawU(new UGraphicG2d(colorMapper, g2d, null, 1.0), x, y);
// }
public void drawU(UGraphic ug) {
if (circle != null) {
ug = ug.apply(circle);
}
// final HtmlColor back = ug.getParam().getBackcolor();
ug = ug.apply(innerCircle.bg());
if (spotBorder != null)
ug = ug.apply(spotBorder);
ug = ug.apply(spotBackColor.bg());
ug.draw(new UEllipse(radius * 2, radius * 2));
ug = ug.apply(fontColor);
ug = ug.apply(new UTranslate(radius, radius));

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.PackageStyle;
public abstract class USymbol {
@ -96,6 +97,7 @@ public abstract class USymbol {
public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether());
abstract public SkinParameter getSkinParameter();
abstract public SName getSName();
// public USymbol withStereoAlignment(HorizontalAlignment alignment) {
// return this;

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.skin.ActorStyle;
import net.sourceforge.plantuml.style.SName;
class USymbolActor extends USymbolSimpleAbstract {
@ -50,6 +51,11 @@ class USymbolActor extends USymbolSimpleAbstract {
public SkinParameter getSkinParameter() {
return SkinParameter.ACTOR;
}
@Override
public SName getSName() {
return SName.actor;
}
@Override
protected TextBlock getDrawing(SymbolContext symbolContext) {

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -51,14 +52,18 @@ class USymbolArtifact extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.ARTIFACT;
}
@Override
public SName getSName() {
return SName.artifact;
}
private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing,
private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, double shadowing,
double roundCorner) {
final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
if (shadowing) {
form.setDeltaShadow(4);
}
form.setDeltaShadow(shadowing);
ug.draw(form);
@ -88,6 +93,7 @@ class USymbolArtifact extends USymbol {
private Margin getMargin() {
return new Margin(10, 10 + 10, 10 + 3, 10);
}
@Override
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
@ -97,7 +103,7 @@ class USymbolArtifact extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
@ -121,7 +127,7 @@ class USymbolArtifact extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.Boundary;
class USymbolBoundary extends USymbolSimpleAbstract {
@ -43,6 +44,12 @@ class USymbolBoundary extends USymbolSimpleAbstract {
public SkinParameter getSkinParameter() {
return SkinParameter.BOUNDARY;
}
@Override
public SName getSName() {
return SName.boundary;
}
@Override
protected TextBlock getDrawing(SymbolContext symbolContext) {

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.ULine;
@ -51,17 +52,22 @@ class USymbolCard extends USymbol {
public USymbolCard(SkinParameter skinParameter) {
this.skinParameter = skinParameter;
}
@Override
public SName getSName() {
return SName.card;
}
@Override
public SkinParameter getSkinParameter() {
return skinParameter;
}
private void drawCard(UGraphic ug, double width, double height, boolean shadowing, double top, double roundCorner) {
private void drawCard(UGraphic ug, double width, double height, double shadowing, double top, double roundCorner) {
final URectangle shape = new URectangle(width, height).rounded(roundCorner);
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
if (top != 0) {
ug.apply(UTranslate.dy(top)).draw(ULine.hline(width));
@ -81,7 +87,7 @@ class USymbolCard extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), 0,
drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), 0,
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
@ -107,7 +113,7 @@ class USymbolCard extends USymbol {
ug = symbolContext.apply(ug);
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
dimTitle.getHeight() + dimStereo.getHeight() + 4, symbolContext.getRoundCorner());
final double posStereo = (width - dimStereo.getWidth()) / 2;
stereotype.drawU(ug.apply(new UTranslate(posStereo, 2)));

View File

@ -42,6 +42,7 @@ import java.util.List;
import java.util.Random;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UPath;
@ -60,12 +61,17 @@ class USymbolCloud extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.CLOUD;
}
@Override
public SName getSName() {
return SName.cloud;
}
private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) {
private void drawCloud(UGraphic ug, double width, double height, double shadowing) {
final UPath shape = getSpecificFrontierForCloud(width, height);
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.apply(UTranslate.dy(0)).draw(shape);
}
@ -226,7 +232,7 @@ class USymbolCloud extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
@ -249,7 +255,7 @@ class USymbolCloud extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;
stereotype.drawU(ug.apply(new UTranslate(posStereo, 13)));

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -62,13 +63,18 @@ class USymbolCollections extends USymbol {
public SkinParameter getSkinParameter() {
return skinParameter;
}
@Override
public SName getSName() {
return SName.collections;
}
private void drawCollections(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
private void drawCollections(UGraphic ug, double width, double height, double shadowing, double roundCorner) {
final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection())
.rounded(roundCorner);
if (shadowing) {
small.setDeltaShadow(3.0);
}
small.setDeltaShadow(shadowing);
ug.apply(new UTranslate(getDeltaCollection(), getDeltaCollection())).draw(small);
small.setDeltaShadow(0);
ug.apply(UTranslate.dy(0)).draw(small);
@ -91,7 +97,7 @@ class USymbolCollections extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
@ -115,7 +121,7 @@ class USymbolCollections extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereoX;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -50,14 +51,18 @@ class USymbolComponent1 extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.COMPONENT1;
}
@Override
public SName getSName() {
return SName.component;
}
private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing,
private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, double shadowing,
double roundCorner) {
final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
if (shadowing) {
form.setDeltaShadow(4);
}
form.setDeltaShadow(shadowing);
ug.draw(form);
final UShape small = new URectangle(10, 5);
@ -82,7 +87,7 @@ class USymbolComponent1 extends USymbol {
final Dimension2D dimTotal = calculateDimension(stringBounder);
ug = UGraphicStencil.create(ug, dimTotal);
ug = symbolContext.apply(ug);
drawComponent1(ug, dimTotal.getWidth(), dimTotal.getHeight(), symbolContext.isShadowing(),
drawComponent1(ug, dimTotal.getWidth(), dimTotal.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -50,14 +51,18 @@ class USymbolComponent2 extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.COMPONENT2;
}
@Override
public SName getSName() {
return SName.component;
}
private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing,
private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, double shadowing,
double roundCorner) {
final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
if (shadowing) {
form.setDeltaShadow(4);
}
form.setDeltaShadow(shadowing);
final UShape small = new URectangle(15, 10);
final UShape tiny = new URectangle(4, 2);
@ -84,7 +89,7 @@ class USymbolComponent2 extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
@ -110,7 +115,7 @@ class USymbolComponent2 extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.Control;
class USymbolControl extends USymbolSimpleAbstract {
@ -43,6 +44,12 @@ class USymbolControl extends USymbolSimpleAbstract {
public SkinParameter getSkinParameter() {
return SkinParameter.CONTROL;
}
@Override
public SName getSName() {
return SName.control;
}
@Override
protected TextBlock getDrawing(final SymbolContext symbolContext) {

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -53,12 +54,17 @@ class USymbolDatabase extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.DATABASE;
}
@Override
public SName getSName() {
return SName.database;
}
private void drawDatabase(UGraphic ug, double width, double height, boolean shadowing) {
private void drawDatabase(UGraphic ug, double width, double height, double shadowing) {
final UPath shape = new UPath();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
shape.moveTo(0, 10);
shape.cubicTo(0, 0, width / 2, 0, width / 2, 0);
shape.cubicTo(width / 2, 0, width, 0, width, 10);
@ -74,7 +80,8 @@ class USymbolDatabase extends USymbol {
if (UseStyle.useBetaStyle()) {
ug.apply(new UTranslate(width, height)).draw(new UEmpty(10, 10));
// ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new URectangle(10, 10));
// ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new
// URectangle(10, 10));
}
}
@ -126,7 +133,7 @@ class USymbolDatabase extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
final UGraphic ug2 = new MyUGraphicDatabase(ug, dim.getWidth());
@ -150,7 +157,7 @@ class USymbolDatabase extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;
stereotype.drawU(ug.apply(new UTranslate(posStereo, 2 + 20)));

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.EntityDomain;
class USymbolEntityDomain extends USymbolSimpleAbstract {
@ -43,6 +44,12 @@ class USymbolEntityDomain extends USymbolSimpleAbstract {
public SkinParameter getSkinParameter() {
return SkinParameter.ENTITY;
}
@Override
public SName getSName() {
return SName.entity;
}
@Override
protected TextBlock getDrawing(final SymbolContext symbolContext) {

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
@ -54,8 +55,14 @@ class USymbolFile extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.FILE;
}
@Override
public SName getSName() {
return SName.file;
}
private void drawFile(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
private void drawFile(UGraphic ug, double width, double height, double shadowing, double roundCorner) {
final int cornersize = 10;
final Shadowable out;
if (roundCorner == 0) {
@ -81,9 +88,7 @@ class USymbolFile extends USymbol {
out = path;
}
if (shadowing) {
out.setDeltaShadow(3.0);
}
out.setDeltaShadow(shadowing);
ug.draw(out);
final UPath path = new UPath();
@ -111,7 +116,7 @@ class USymbolFile extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
@ -135,7 +140,7 @@ class USymbolFile extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereoX;

View File

@ -40,6 +40,7 @@ import java.awt.geom.Point2D;
import java.util.Objects;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
@ -74,8 +75,14 @@ public class USymbolFolder extends USymbol {
public SkinParameter getSkinParameter() {
return skinParameter;
}
@Override
public SName getSName() {
return SName.folder;
}
private void drawFolder(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing,
private void drawFolder(UGraphic ug, double width, double height, Dimension2D dimTitle, double shadowing,
double roundCorner) {
final double wtitle;
@ -116,9 +123,8 @@ public class USymbolFolder extends USymbol {
path.closePath();
shape = path;
}
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
ug.apply(UTranslate.dy(htitle)).draw(ULine.hline(wtitle + marginTitleX3));
}
@ -148,7 +154,7 @@ public class USymbolFolder extends USymbol {
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
final Dimension2D dimName = getDimName(ug.getStringBounder());
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.isShadowing(),
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
@ -182,7 +188,7 @@ public class USymbolFolder extends USymbol {
final Dimension2D dim = calculateDimension(stringBounder);
ug = symbolContext.apply(ug);
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimTitle, symbolContext.isShadowing(),
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimTitle, symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
title.drawU(ug.apply(new UTranslate(4, 2)));
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
@ -53,13 +54,16 @@ class USymbolFrame extends USymbol {
return SkinParameter.FRAME;
}
private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing,
@Override
public SName getSName() {
return SName.frame;
}
private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, double shadowing,
double roundCorner) {
final Shadowable shape = new URectangle(width, height).rounded(roundCorner).ignoreForCompressionOnX()
.ignoreForCompressionOnY();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
@ -87,9 +91,9 @@ class USymbolFrame extends USymbol {
}
private double getYpos(Dimension2D dimTitle) {
if (dimTitle.getWidth() == 0) {
if (dimTitle.getWidth() == 0)
return 12;
}
return dimTitle.getHeight() + 3;
}
@ -106,8 +110,8 @@ class USymbolFrame extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), symbolContext.isShadowing(),
symbolContext.getRoundCorner());
drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0),
symbolContext.getDeltaShadow(), symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
@ -133,16 +137,15 @@ class USymbolFrame extends USymbol {
ug = symbolContext.apply(ug);
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
final double widthFull = dim.getWidth();
drawFrame(ug, widthFull, dim.getHeight(), dimTitle, symbolContext.isShadowing(),
drawFrame(ug, widthFull, dim.getHeight(), dimTitle, symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final double widthTitle = title.calculateDimension(stringBounder).getWidth();
// Temporary hack...
if (widthFull - widthTitle < 25) {
if (widthFull - widthTitle < 25)
title.drawU(ug.apply(new UTranslate(3, 1)));
} else {
else
ug.apply(new UTranslate(3, 1)).draw(new SpecialText(title));
}
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
final double posStereo = (width - dimStereo.getWidth()) / 2;

View File

@ -38,8 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.USymbol.Margin;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -50,6 +49,12 @@ public class USymbolHexagon extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.HEXAGON;
}
@Override
public SName getSName() {
return SName.hexagon;
}
private final double marginY = 5;
@ -76,7 +81,7 @@ public class USymbolHexagon extends USymbol {
};
}
private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner,
private void drawRect(UGraphic ug, double width, double height, double shadowing, double roundCorner,
double diagonalCorner) {
// final UShape shape = new URectangle(width, height);
final UPath shape = new UPath();
@ -89,17 +94,16 @@ public class USymbolHexagon extends USymbol {
shape.lineTo(dx, height);
shape.lineTo(0, height / 2);
shape.closePath();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
}
private Margin getMargin() {
return new Margin(10, 10, 10, 10);
}
@Override
public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext,
@ -108,7 +112,7 @@ public class USymbolHexagon extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner(), 0);
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereoX;

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.CircleInterface2;
public class USymbolInterface extends USymbolSimpleAbstract {
@ -44,6 +45,12 @@ public class USymbolInterface extends USymbolSimpleAbstract {
return SkinParameter.INTERFACE;
}
@Override
public SName getSName() {
return SName.interface_;
}
@Override
protected TextBlock getDrawing(SymbolContext symbolContext) {
return new CircleInterface2(symbolContext.getBackColor(), symbolContext.getForeColor(),

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -49,6 +50,12 @@ class USymbolLabel extends USymbol {
public USymbolLabel(SkinParameter skinParameter) {
this.skinParameter = skinParameter;
}
@Override
public SName getSName() {
return SName.label;
}
@Override
public SkinParameter getSkinParameter() {

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -56,6 +57,12 @@ class USymbolNode extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.NODE;
}
@Override
public SName getSName() {
return SName.node;
}
// public USymbolNode(HorizontalAlignment stereotypeAlignement) {
// this.stereotypeAlignement = stereotypeAlignement;
@ -66,7 +73,7 @@ class USymbolNode extends USymbol {
// return new USymbolNode(alignment);
// }
private void drawNode(UGraphic ug, double width, double height, boolean shadowing) {
private void drawNode(UGraphic ug, double width, double height, double shadowing) {
final UPolygon shape = new UPolygon();
shape.addPoint(0, 10);
shape.addPoint(10, 0);
@ -75,14 +82,13 @@ class USymbolNode extends USymbol {
shape.addPoint(width - 10, height);
shape.addPoint(0, height);
shape.addPoint(0, 10);
if (shadowing) {
shape.setDeltaShadow(2);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(10, -10));
ug.apply(UTranslate.dy(10)).draw(ULine.hline(width - 10));
ug.apply(new UTranslate(width - 10, 10)).draw(ULine.vline(height - 10));
if (UseStyle.useBetaStyle()) {
@ -135,7 +141,7 @@ class USymbolNode extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
final UGraphic ug2 = new MyUGraphicNode(ug, dim.getWidth());
@ -152,13 +158,14 @@ class USymbolNode extends USymbol {
@Override
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
final double width, final double height, final SymbolContext symbolContext,
final HorizontalAlignment stereoAlignment) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
ug = ug.apply(new UTranslate(-4, 11));
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
@ -50,14 +51,20 @@ class USymbolPerson extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.PERSON;
}
@Override
public SName getSName() {
return SName.person;
}
private void drawHeadAndBody(UGraphic ug, boolean shadowing, Dimension2D dimBody, double headSize) {
private void drawHeadAndBody(UGraphic ug, double shadowing, Dimension2D dimBody, double headSize) {
final UEllipse head = new UEllipse(headSize, headSize);
final URectangle body = new URectangle(dimBody).rounded(headSize);
if (shadowing) {
body.setDeltaShadow(3.0);
head.setDeltaShadow(1.0);
}
body.setDeltaShadow(shadowing);
head.setDeltaShadow(shadowing);
final double posx = (dimBody.getWidth() - headSize) / 2;
ug.apply(UTranslate.dx(posx)).draw(head);
ug.apply(UTranslate.dy(headSize)).draw(body);
@ -83,7 +90,7 @@ class USymbolPerson extends USymbol {
ug = UGraphicStencil.create(ug, dimFull);
ug = symbolContext.apply(ug);
final double headSize = headSize(dimBody);
drawHeadAndBody(ug, symbolContext.isShadowing(), dimBody, headSize);
drawHeadAndBody(ug, symbolContext.getDeltaShadow(), dimBody, headSize);
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
final Margin margin = getMargin();
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + headSize)));

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
@ -52,14 +53,19 @@ class USymbolQueue extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.QUEUE;
}
@Override
public SName getSName() {
return SName.queue;
}
private final double dx = 5;
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) {
private void drawQueue(UGraphic ug, double width, double height, double shadowing) {
final UPath shape = new UPath();
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
shape.moveTo(dx, 0);
shape.lineTo(width - dx, 0);
shape.cubicTo(width, 0, width, height / 2, width, height / 2);
@ -135,7 +141,7 @@ class USymbolQueue extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx,
@ -153,13 +159,14 @@ class USymbolQueue extends USymbol {
@Override
public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype,
final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
final double width, final double height, final SymbolContext symbolContext,
final HorizontalAlignment stereoAlignment) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;
stereotype.drawU(ug.apply(new UTranslate(posStereo, 2)));

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
@ -52,18 +53,21 @@ class USymbolRectangle extends USymbol {
this.skinParameter = skinParameter;
}
@Override
public SName getSName() {
return SName.rectangle;
}
@Override
public SkinParameter getSkinParameter() {
return skinParameter;
}
private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner,
private void drawRect(UGraphic ug, double width, double height, double shadowing, double roundCorner,
double diagonalCorner) {
final URectangle rect = new URectangle(width, height);
final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner) : rect.rounded(roundCorner);
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
}
@ -80,7 +84,7 @@ class USymbolRectangle extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner(), symbolContext.getDiagonalCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
@ -103,7 +107,7 @@ class USymbolRectangle extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner(), 0);
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereoX;

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.UPath;
@ -52,8 +53,14 @@ class USymbolStack extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.STACK;
}
@Override
public SName getSName() {
return SName.stack;
}
private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) {
private void drawQueue(UGraphic ug, double width, double height, double shadowing, double roundCorner) {
final double border = 15;
final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner);
@ -79,9 +86,7 @@ class USymbolStack extends USymbol {
path.arcTo(new Point2D.Double(width - border + roundCorner / 2, 0), roundCorner / 2, 0, 1);
path.lineTo(width, 0);
}
if (shadowing) {
path.setDeltaShadow(3.0);
}
path.setDeltaShadow(shadowing);
ug.apply(new HColorNone().bg()).draw(path);
}
@ -98,7 +103,7 @@ class USymbolStack extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
@ -122,7 +127,7 @@ class USymbolStack extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(),
symbolContext.getRoundCorner());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -50,11 +51,15 @@ class USymbolStorage extends USymbol {
return SkinParameter.STORAGE;
}
private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) {
@Override
public SName getSName() {
return SName.storage;
}
private void drawStorage(UGraphic ug, double width, double height, double shadowing) {
final URectangle shape = new URectangle(width, height).rounded(70);
if (shadowing) {
shape.setDeltaShadow(3.0);
}
shape.setDeltaShadow(shadowing);
ug.draw(shape);
}
@ -71,7 +76,7 @@ class USymbolStorage extends USymbol {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = UGraphicStencil.create(ug, dim);
ug = symbolContext.apply(ug);
drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Margin margin = getMargin();
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
@ -94,7 +99,7 @@ class USymbolStorage extends USymbol {
public void drawU(UGraphic ug) {
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug = symbolContext.apply(ug);
drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow());
final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
final double posStereo = (width - dimStereo.getWidth()) / 2;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.ugraphic.UGraphic;
class USymbolTogether extends USymbol {
@ -46,6 +47,12 @@ class USymbolTogether extends USymbol {
public SkinParameter getSkinParameter() {
return SkinParameter.STORAGE;
}
@Override
public SName getSName() {
return SName.storage;
}
@Override
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,

View File

@ -65,9 +65,8 @@ public abstract class Grouping implements Event, WithStyle {
public Style[] getUsedStyles() {
return new Style[] {
style,
styleHeader == null ? styleHeader : styleHeader.eventuallyOverride(PName.BackGroundColor,
backColorElement) };
style == null ? null : style.eventuallyOverride(PName.BackGroundColor, getBackColorGeneral()),
styleHeader == null ? null : styleHeader.eventuallyOverride(PName.BackGroundColor, backColorElement) };
}
public Grouping(String title, String comment, GroupingType type, HColor backColorElement,

View File

@ -39,6 +39,7 @@ import java.io.IOException;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -62,6 +63,7 @@ public class CommandSkin extends SingleLineCommand2<TitledDiagram> {
@Override
protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
try {
UseStyle.setBetaStyle(true);
return diagram.loadSkin(arg.get("SKIN", 0));
} catch (IOException e) {
return CommandExecutionResult.error("Skin read error");

View File

@ -46,6 +46,8 @@ import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
@ -105,9 +107,9 @@ public enum VisibilityModifier {
}
public void drawU(UGraphic ug) {
if (withInvisibleRectanble) {
if (withInvisibleRectanble)
ug.apply(new HColorNone()).draw(new URectangle(size * 2, size));
}
drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0);
}
};
@ -115,11 +117,11 @@ public enum VisibilityModifier {
private void drawInternal(UGraphic ug, int size, final HColor foregroundColor, final HColor backgoundColor,
double x, double y) {
if (backgoundColor == null) {
if (backgoundColor == null)
ug = ug.apply(new HColorNone().bg());
} else {
else
ug = ug.apply(backgoundColor.bg());
}
ug = ug.apply(foregroundColor);
size = ensureEven(size);
switch (this) {
@ -173,9 +175,8 @@ public enum VisibilityModifier {
}
static private int ensureEven(int n) {
if (n % 2 == 1) {
if (n % 2 == 1)
n--;
}
return n;
}
@ -199,97 +200,96 @@ public enum VisibilityModifier {
}
public static boolean isVisibilityCharacter(CharSequence s) {
if (s.length() <= 2) {
if (s.length() <= 2)
return false;
}
final char c = s.charAt(0);
if (s.charAt(1) == c) {
if (s.charAt(1) == c)
return false;
}
if (c == '-') {
if (c == '-')
return true;
}
if (c == '#') {
if (c == '#')
return true;
}
if (c == '+') {
if (c == '+')
return true;
}
if (c == '~') {
if (c == '~')
return true;
}
if (c == '*') {
if (c == '*')
return true;
}
return false;
}
public static VisibilityModifier getByUnicode(char c) {
for (VisibilityModifier modifier : VisibilityModifier.values()) {
if (modifier.unicode == c) {
for (VisibilityModifier modifier : VisibilityModifier.values())
if (modifier.unicode == c)
return modifier;
}
}
return null;
}
public static String replaceVisibilityModifierByUnicodeChar(String s, boolean isField) {
final VisibilityModifier modifier = getVisibilityModifier(s, isField);
if (modifier == null) {
if (modifier == null)
return s;
}
return "" + modifier.unicode + s.substring(1);
}
public static VisibilityModifier getVisibilityModifier(CharSequence s, boolean isField) {
if (s.length() <= 2) {
if (s.length() <= 2)
return null;
}
final char c = s.charAt(0);
if (s.charAt(1) == c) {
if (s.charAt(1) == c)
return null;
}
if (isField) {
if (isField)
return getVisibilityModifierForField(c);
}
return getVisibilityModifierForMethod(c);
}
private static VisibilityModifier getVisibilityModifierForField(char c) {
if (c == '-') {
if (c == '-')
return VisibilityModifier.PRIVATE_FIELD;
}
if (c == '#') {
if (c == '#')
return VisibilityModifier.PROTECTED_FIELD;
}
if (c == '+') {
if (c == '+')
return VisibilityModifier.PUBLIC_FIELD;
}
if (c == '~') {
if (c == '~')
return VisibilityModifier.PACKAGE_PRIVATE_FIELD;
}
if (c == '*') {
if (c == '*')
return VisibilityModifier.IE_MANDATORY;
}
return null;
}
private static VisibilityModifier getVisibilityModifierForMethod(char c) {
if (c == '-') {
if (c == '-')
return VisibilityModifier.PRIVATE_METHOD;
}
if (c == '#') {
if (c == '#')
return VisibilityModifier.PROTECTED_METHOD;
}
if (c == '+') {
if (c == '+')
return VisibilityModifier.PUBLIC_METHOD;
}
if (c == '~') {
if (c == '~')
return VisibilityModifier.PACKAGE_PRIVATE_METHOD;
}
if (c == '*') {
if (c == '*')
return VisibilityModifier.IE_MANDATORY;
}
return null;
}
@ -302,18 +302,44 @@ public enum VisibilityModifier {
}
public String getXmiVisibility() {
if (this == PUBLIC_FIELD || this == PUBLIC_METHOD) {
if (this == PUBLIC_FIELD || this == PUBLIC_METHOD)
return "public";
}
if (this == PRIVATE_FIELD || this == PRIVATE_METHOD) {
if (this == PRIVATE_FIELD || this == PRIVATE_METHOD)
return "private";
}
if (this == PROTECTED_FIELD || this == PROTECTED_METHOD) {
if (this == PROTECTED_FIELD || this == PROTECTED_METHOD)
return "protected";
}
if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD) {
if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD)
return "package";
}
throw new IllegalStateException();
}
public boolean isField() {
if (this == PUBLIC_FIELD || this == PRIVATE_FIELD || this == PROTECTED_FIELD || this == PACKAGE_PRIVATE_FIELD)
return true;
return false;
}
public StyleSignature getStyleSignature() {
if (this == IE_MANDATORY)
return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.IEMandatory);
if (this == PUBLIC_FIELD || this == PUBLIC_METHOD)
return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.public_);
if (this == PRIVATE_FIELD || this == PRIVATE_METHOD)
return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.private_);
if (this == PROTECTED_FIELD || this == PROTECTED_METHOD)
return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.protected_);
if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD)
return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.package_);
throw new IllegalStateException();
}

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorBackground;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class ComponentRoseGroupingElse extends AbstractTextualComponent {
@ -73,10 +74,11 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
if (UseStyle.useBetaStyle()) {
this.roundCorner = style.value(PName.RoundCorner).asInt();
if (spriteContainer instanceof SkinParamBackcolored) {
style = style.eventuallyOverride(PName.BackGroundColor,
((SkinParamBackcolored) spriteContainer).getBackgroundColor());
}
// if (spriteContainer instanceof SkinParamBackcolored) {
// final HColor backgroundColor2 = ((SkinParamBackcolored) spriteContainer).getBackgroundColor();
// System.err.println("toto2=" + backgroundColor2);
// style = style.eventuallyOverride(PName.BackGroundColor, backgroundColor2);
// }
this.groupBorder = style.value(PName.LineColor).asColor(spriteContainer.getThemeStyle(),
getIHtmlColorSet());
this.backgroundColor = style.value(PName.BackGroundColor).asColor(spriteContainer.getThemeStyle(),
@ -90,9 +92,12 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
@Override
protected void drawBackgroundInternalU(UGraphic ug, Area area) {
if (backgroundColor instanceof HColorBackground) {
if (backgroundColor instanceof HColorBackground)
return;
}
if (HColorUtils.isTransparent(backgroundColor))
return;
final Dimension2D dimensionToUse = area.getDimensionToUse();
ug = ug.apply(new HColorNone()).apply(backgroundColor.bg());
final double width = dimensionToUse.getWidth();

View File

@ -180,4 +180,4 @@ public class CommandCreateState extends SingleLineCommand2<StateDiagram> {
return null;
}
}
}

View File

@ -71,6 +71,8 @@ public class FromSkinparamToStyle {
addConFont("header", SName.header);
addConFont("footer", SName.footer);
addConvert("defaultFontSize", PName.FontSize, SName.element);
addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
@ -114,6 +116,8 @@ public class FromSkinparamToStyle {
addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root);
addConvert("activityStartColor", PName.LineColor, SName.circle);
addConvert("activityEndColor", PName.LineColor, SName.circle, SName.end);
addConvert("activityStopColor", PName.LineColor, SName.circle, SName.stop);
addConvert("activityBarColor", PName.LineColor, SName.activityBar);
addConvert("activityBorderColor", PName.LineColor, SName.activity);
addConvert("activityBorderThickness", PName.LineThickness, SName.activity);

View File

@ -68,6 +68,8 @@ public enum SName {
document, //
element, //
entity, //
end, //
stop, //
file, //
folder, //
footer, //
@ -121,6 +123,20 @@ public enum SName {
undone, //
unstarted, //
usecase, //
visibilityIcon, //
private_, //
protected_, //
public_, //
IEMandatory, //
spot, //
spotAnnotation, //
spotInterface, //
spotEnum, //
spotEntity, //
spotClass, //
spotAbstractClass, //
wbsDiagram, //
yamlDiagram; //

View File

@ -106,7 +106,18 @@ public class Style {
final Value resultDark = map.get(PName.DARK_BackGroundColor);
if (resultDark != null)
return new ValueForDark(result, resultDark);
} else if (name == PName.LineColor) {
final Value resultDark = map.get(PName.DARK_LineColor);
if (resultDark != null)
return new ValueForDark(result, resultDark);
} else if (name == PName.FontColor) {
final Value resultDark = map.get(PName.DARK_FontColor);
if (resultDark != null)
return new ValueForDark(result, resultDark);
} else if (name == PName.HyperLinkColor) {
final Value resultDark = map.get(PName.DARK_HyperLinkColor);
if (resultDark != null)
return new ValueForDark(result, resultDark);
}
return result;
@ -130,20 +141,6 @@ public class Style {
return new Style(this.signature.mergeWith(other.getSignature()), both);
}
// private Style mergeIfUnknownWith(Style other) {
// if (other == null) {
// return this;
// }
// final EnumMap<PName, Value> both = new EnumMap<PName, Value>(this.map);
// for (Entry<PName, Value> ent : other.map.entrySet()) {
// final Value previous = this.map.get(ent.getKey());
// if (previous == null)
// both.put(ent.getKey(), ent.getValue());
//
// }
// return new Style(this.signature.mergeWith(other.getSignature()), both, this.scheme);
// }
public Style eventuallyOverride(PName param, HColor color) {
if (color == null)
return this;

View File

@ -47,13 +47,13 @@ import net.sourceforge.plantuml.SkinParam;
public class StyleBuilder implements AutomaticCounter {
private final Map<StyleSignature, Style> styles = new LinkedHashMap<StyleSignature, Style>();
private final Map<StyleSignature, Style> stylesMap = new LinkedHashMap<StyleSignature, Style>();
private final Set<StyleSignature> printedForLog;
private final SkinParam skinParam;
private int counter;
public void printMe() {
for (Entry<StyleSignature, Style> ent : styles.entrySet())
for (Entry<StyleSignature, Style> ent : stylesMap.entrySet())
ent.getValue().printMe();
}
@ -77,7 +77,7 @@ public class StyleBuilder implements AutomaticCounter {
name = name.toLowerCase();
final StyleSignature signature = new StyleSignature(name);
final Style result = styles.get(signature);
final Style result = stylesMap.get(signature);
if (result == null)
return new Style(signature, new EnumMap<PName, Value>(PName.class));
@ -85,26 +85,32 @@ public class StyleBuilder implements AutomaticCounter {
}
public StyleBuilder muteStyle(Style modifiedStyle) {
final Map<StyleSignature, Style> copy = new LinkedHashMap<StyleSignature, Style>(styles);
final Map<StyleSignature, Style> copy = new LinkedHashMap<StyleSignature, Style>(stylesMap);
final StyleSignature signature = modifiedStyle.getSignature();
final Style orig = copy.get(signature);
if (orig == null) {
copy.put(signature, modifiedStyle);
} else {
final Style newStyle = orig.mergeWith(modifiedStyle);
copy.put(signature, newStyle);
final Style tmp = orig.mergeWith(modifiedStyle);
copy.put(signature, tmp);
}
final StyleBuilder result = new StyleBuilder(skinParam, this.printedForLog);
result.styles.putAll(copy);
result.stylesMap.putAll(copy);
result.counter = this.counter;
return result;
}
public void loadInternal(StyleSignature styleName, Style newStyle) {
if (styleName.isStarred())
public void loadInternal(StyleSignature signature, Style newStyle) {
if (signature.isStarred())
throw new IllegalArgumentException();
this.styles.put(styleName, newStyle);
final Style orig = this.stylesMap.get(signature);
if (orig == null) {
this.stylesMap.put(signature, newStyle);
} else {
final Style tmp = orig.mergeWith(newStyle);
this.stylesMap.put(signature, tmp);
}
}
public int getNextInt() {
@ -117,7 +123,7 @@ public class StyleBuilder implements AutomaticCounter {
Log.info("Using style " + signature);
Style result = null;
for (Entry<StyleSignature, Style> ent : styles.entrySet()) {
for (Entry<StyleSignature, Style> ent : stylesMap.entrySet()) {
final StyleSignature key = ent.getKey();
if (key.matchAll(signature) == false)
continue;
@ -137,7 +143,7 @@ public class StyleBuilder implements AutomaticCounter {
Log.info("Using style " + signature);
Style result = null;
for (Entry<StyleSignature, Style> ent : styles.entrySet()) {
for (Entry<StyleSignature, Style> ent : stylesMap.entrySet()) {
final StyleSignature key = ent.getKey();
if (key.matchAll(signature) == false)
continue;

View File

@ -43,6 +43,7 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.sourceforge.plantuml.FileSystem;
import net.sourceforge.plantuml.LineLocationImpl;
@ -68,23 +69,7 @@ public class StyleLoader {
public StyleBuilder loadSkin(String filename) throws IOException {
this.styleBuilder = new StyleBuilder(skinParam);
InputStream internalIs = null;
SFile localFile = new SFile(filename);
Log.info("Trying to load style " + filename);
if (localFile.exists() == false)
localFile = FileSystem.getInstance().getFile(filename);
if (localFile.exists()) {
Log.info("File found : " + localFile.getPrintablePath());
internalIs = localFile.openFile();
} else {
Log.info("File not found : " + localFile.getPrintablePath());
final String res = "/skin/" + filename;
internalIs = StyleLoader.class.getResourceAsStream(res);
if (internalIs != null) {
Log.info("... but " + filename + " found inside the .jar");
}
}
final InputStream internalIs = getInputStreamForStyle(filename);
if (internalIs == null) {
Log.error("No .skin file seems to be available");
throw new NoStyleAvailableException();
@ -98,14 +83,35 @@ public class StyleLoader {
return this.styleBuilder;
}
public static InputStream getInputStreamForStyle(String filename) throws IOException {
InputStream internalIs = null;
SFile localFile = new SFile(filename);
Log.info("Trying to load style " + filename);
if (localFile.exists() == false)
localFile = FileSystem.getInstance().getFile(filename);
if (localFile.exists()) {
Log.info("File found : " + localFile.getPrintablePath());
internalIs = localFile.openFile();
} else {
Log.info("File not found : " + localFile.getPrintablePath());
final String res = "/skin/" + filename;
internalIs = StyleLoader.class.getResourceAsStream(res);
if (internalIs != null)
Log.info("... but " + filename + " found inside the .jar");
}
return internalIs;
}
private void loadSkinInternal(final BlocLines lines) {
for (Style newStyle : getDeclaredStyles(lines, styleBuilder))
this.styleBuilder.loadInternal(newStyle.getSignature(), newStyle);
}
private final static String KEYNAMES = "[\\w(), ]+?";
private final static Pattern2 keyName = MyPattern.cmpile("^[.:]?(" + KEYNAMES + ")([%s]+\\*)?[%s]*\\{$");
private final static String KEYNAMES = "[.\\w(), ]+?";
private final static Pattern2 keyName = MyPattern.cmpile("^[:]?(" + KEYNAMES + ")([%s]+\\*)?[%s]*\\{$");
private final static Pattern2 propertyAndValue = MyPattern.cmpile("^([\\w]+):?[%s]+(.*?);?$");
private final static Pattern2 closeBracket = MyPattern.cmpile("^\\}$");
@ -169,8 +175,13 @@ public class StyleLoader {
if (context.size() > 0) {
final Collection<StyleSignature> signatures = context.toSignatures();
for (StyleSignature signature : signatures) {
final Style style = new Style(signature, maps.get(maps.size() - 1));
result.add(style);
Map<PName, Value> tmp = maps.get(maps.size() - 1);
if (signature.isWithDot())
tmp = addPriority(tmp);
if (tmp.size() > 0) {
final Style style = new Style(signature, tmp);
result.add(style);
}
}
context = context.pop();
maps.remove(maps.size() - 1);
@ -184,4 +195,12 @@ public class StyleLoader {
}
private static Map<PName, Value> addPriority(Map<PName, Value> tmp) {
final Map<PName, Value> result = new EnumMap<>(PName.class);
for (Entry<PName, Value> ent : tmp.entrySet())
result.put(ent.getKey(), ((ValueImpl) ent.getValue()).addPriority(1000));
return result;
}
}

View File

@ -49,23 +49,27 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
public class StyleSignature {
private final Set<String> names = new LinkedHashSet<>();
private final boolean withDot;
public StyleSignature(String s) {
if (s.contains("*") || s.contains("&") || s.contains("-"))
throw new IllegalArgumentException();
this.withDot = s.contains(".");
this.names.add(clean(s));
}
public static StyleSignature empty() {
return new StyleSignature();
return new StyleSignature(false);
}
private StyleSignature() {
private StyleSignature(boolean withDot) {
this.withDot = withDot;
}
private StyleSignature(Collection<String> copy) {
private StyleSignature(boolean withDot, Collection<String> copy) {
this.names.addAll(copy);
this.withDot = withDot;
}
public StyleSignature addClickable(Url url) {
@ -74,7 +78,7 @@ public class StyleSignature {
final Set<String> result = new LinkedHashSet<>(names);
result.add(SName.clickable.name());
return new StyleSignature(result);
return new StyleSignature(withDot, result);
}
@ -87,7 +91,7 @@ public class StyleSignature {
final Set<String> result = new LinkedHashSet<>(names);
result.add(clean(s));
return new StyleSignature(result);
return new StyleSignature(withDot || s.contains("."), result);
}
public StyleSignature add(SName name) {
@ -97,7 +101,7 @@ public class StyleSignature {
public StyleSignature addStar() {
final Set<String> result = new LinkedHashSet<>(names);
result.add("*");
return new StyleSignature(result);
return new StyleSignature(withDot, result);
}
public boolean isStarred() {
@ -124,7 +128,7 @@ public class StyleSignature {
result.append(n);
}
return result.toString();
return result.toString() + " " + withDot;
}
public boolean matchAll(StyleSignature other) {
@ -151,7 +155,7 @@ public class StyleSignature {
for (SName name : names)
result.add(name.name().toLowerCase().replace("_", ""));
return new StyleSignature(result);
return new StyleSignature(false, result);
}
public StyleSignature forStereotypeItself(Stereotype stereotype) {
@ -161,7 +165,7 @@ public class StyleSignature {
result.add(clean(name));
result.add(SName.stereotype.name().toLowerCase().replace("_", ""));
return new StyleSignature(result);
return new StyleSignature(false, result);
}
public StyleSignature with(Stereotype stereotype) {
@ -170,7 +174,7 @@ public class StyleSignature {
for (String name : stereotype.getStyleNames())
result.add(clean(name));
return new StyleSignature(result);
return new StyleSignature(true, result);
}
public StyleSignature with(Stereostyles stereostyles) {
@ -180,11 +184,11 @@ public class StyleSignature {
for (String name : stereostyles.getStyleNames())
result.add(clean(name));
return new StyleSignature(result);
return new StyleSignature(true, result);
}
private String clean(String name) {
return name.toLowerCase().replace("_", "");
return name.toLowerCase().replace("_", "").replace(".", "");
}
public StyleSignature mergeWith(List<Style> others) {
@ -193,13 +197,13 @@ public class StyleSignature {
for (String s : other.getSignature().getNames())
copy.add(s);
return new StyleSignature(copy);
return new StyleSignature(withDot, copy);
}
public StyleSignature mergeWith(StyleSignature other) {
final List<String> copy = new ArrayList<>(names);
copy.addAll(other.names);
return new StyleSignature(copy);
return new StyleSignature(withDot || other.withDot, copy);
}
public Style getMergedStyle(StyleBuilder styleBuilder) {
@ -210,12 +214,15 @@ public class StyleSignature {
}
public boolean match(Stereotype stereotype) {
for (String s : stereotype.getMultipleLabels()) {
for (String s : stereotype.getMultipleLabels())
if (names.contains(clean(s)))
return true;
}
return false;
}
public final boolean isWithDot() {
return withDot;
}
}

View File

@ -43,6 +43,11 @@ public class ValueColor extends ValueAbstract {
private final HColor color;
private final int priority;
@Override
public String toString() {
return color.toString();
}
public ValueColor(HColor color, int priority) {
this.color = color;

View File

@ -59,6 +59,10 @@ public class ValueImpl implements Value {
this.priority = priority;
}
public Value addPriority(int delta) {
return new ValueImpl(value, delta + priority);
}
@Override
public String toString() {
return value + " (" + priority + ")";

View File

@ -130,11 +130,10 @@ public class Cluster implements Moveable {
private Set<EntityPosition> entityPositionsExceptNormal() {
final Set<EntityPosition> result = EnumSet.<EntityPosition>noneOf(EntityPosition.class);
for (SvekNode sh : nodes) {
if (sh.getEntityPosition() != EntityPosition.NORMAL) {
for (SvekNode sh : nodes)
if (sh.getEntityPosition() != EntityPosition.NORMAL)
result.add(sh.getEntityPosition());
}
}
return Collections.unmodifiableSet(result);
}
@ -145,14 +144,14 @@ public class Cluster implements Moveable {
private ColorParam border;
private Cluster(Cluster parentCluster, ColorSequence colorSequence, ISkinParam skinParam, IGroup group) {
if (group == null) {
if (group == null)
throw new IllegalStateException();
}
this.parentCluster = parentCluster;
this.group = group;
if (group.getUSymbol() != null) {
if (group.getUSymbol() != null)
border = group.getUSymbol().getColorParamBorder();
}
this.color = colorSequence.getValue();
this.colorTitle = colorSequence.getValue();
this.skinParam = group.getColors().mute(skinParam);
@ -193,16 +192,14 @@ public class Cluster implements Moveable {
for (SvekLine l : lines) {
if (tops.contains(l.getStartUidPrefix())) {
final SvekNode sh = shs.get(l.getEndUidPrefix());
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) {
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL)
firsts.add(0, sh);
}
}
if (l.isInverted()) {
final SvekNode sh = shs.get(l.getStartUidPrefix());
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) {
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL)
firsts.add(0, sh);
}
}
}
@ -230,16 +227,14 @@ public class Cluster implements Moveable {
for (SvekLine l : lines) {
if (tops.contains(l.getStartUidPrefix())) {
final SvekNode sh = shs.get(l.getEndUidPrefix());
if (sh != null) {
if (sh != null)
all.remove(sh);
}
}
if (l.isInverted()) {
final SvekNode sh = shs.get(l.getStartUidPrefix());
if (sh != null) {
if (sh != null)
all.remove(sh);
}
}
}
@ -294,10 +289,12 @@ public class Cluster implements Moveable {
return SkinParamUtils.getColor(skinParam, stereotype, colorParam);
}
static public StyleSignature getDefaultStyleDefinition(SName styleName) {
if (styleName == SName.stateDiagram)
static public StyleSignature getDefaultStyleDefinition(SName diagramStyleName, USymbol symbol) {
if (diagramStyleName == SName.stateDiagram)
return StyleSignature.of(SName.root, SName.element, SName.stateDiagram, SName.state, SName.group);
return StyleSignature.of(SName.root, SName.element, styleName, SName.group);
if (symbol == null)
return StyleSignature.of(SName.root, SName.element, diagramStyleName, SName.group);
return StyleSignature.of(SName.root, SName.element, diagramStyleName, SName.group, symbol.getSName());
}
static public StyleSignature getDefaultStyleDefinitionStateGroup(Stereotype stereotype) {
@ -308,52 +305,56 @@ public class Cluster implements Moveable {
}
public void drawU(UGraphic ug, UStroke strokeForState, UmlDiagramType umlDiagramType, ISkinParam skinParam2) {
if (group.isHidden()) {
if (group.isHidden())
return;
}
final String fullName = group.getCodeGetName();
if (fullName.startsWith("##") == false) {
if (fullName.startsWith("##") == false)
ug.draw(new UComment("cluster " + fullName));
}
HColor borderColor;
Style style = null;
final double rounded;
final double shadowing;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinition(umlDiagramType.getStyleName()).with(group.getStereotype())
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final USymbol uSymbol = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol();
final StyleSignature tmp = getDefaultStyleDefinition(umlDiagramType.getStyleName(), uSymbol);
style = tmp.with(group.getStereotype()).getMergedStyle(skinParam.getCurrentStyleBuilder());
shadowing = style.value(PName.Shadowing).asDouble();
borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(),
skinParam2.getIHtmlColorSet());
if (group.getColors().getColor(ColorType.LINE) != null)
borderColor = group.getColors().getColor(ColorType.LINE);
else
borderColor = style.value(PName.LineColor).asColor(skinParam2.getThemeStyle(),
skinParam2.getIHtmlColorSet());
if (umlDiagramType == UmlDiagramType.STATE)
rounded = style.value(PName.RoundCorner).asDouble();
else
rounded = IEntityImage.CORNER;
} else {
if (group.getUSymbol() == null) {
if (group.getUSymbol() == null)
shadowing = skinParam2.shadowing2(group.getStereotype(), USymbol.PACKAGE.getSkinParameter()) ? 3 : 0;
} else {
else
shadowing = skinParam2.shadowing2(group.getStereotype(), group.getUSymbol().getSkinParameter()) ? 3 : 0;
}
rounded = IEntityImage.CORNER;
if (umlDiagramType == UmlDiagramType.STATE) {
if (umlDiagramType == UmlDiagramType.STATE)
borderColor = getColor(ColorParam.stateBorder, skinParam, group.getStereotype());
} else if (umlDiagramType == UmlDiagramType.ACTIVITY) {
else if (umlDiagramType == UmlDiagramType.ACTIVITY)
borderColor = getColor(ColorParam.packageBorder, skinParam, group.getStereotype());
} else {
else
borderColor = getColor(ColorParam.packageBorder, skinParam, group.getStereotype());
}
}
final Url url = group.getUrl99();
if (url != null) {
if (url != null)
ug.startUrl(url);
}
try {
if (entityPositionsExceptNormal().size() > 0) {
if (entityPositionsExceptNormal().size() > 0)
manageEntryExitPoint(ug.getStringBounder());
}
if (skinParam.useSwimlanes(umlDiagramType)) {
drawSwinLinesState(ug, borderColor);
return;
@ -361,34 +362,34 @@ public class Cluster implements Moveable {
final boolean isState = umlDiagramType == UmlDiagramType.STATE;
if (isState && group.getUSymbol() == null) {
if (group.getColors().getSpecificLineStroke() != null) {
if (group.getColors().getSpecificLineStroke() != null)
strokeForState = group.getColors().getSpecificLineStroke();
}
if (group.getColors().getColor(ColorType.LINE) != null) {
if (group.getColors().getColor(ColorType.LINE) != null)
borderColor = group.getColors().getColor(ColorType.LINE);
}
drawUState(ug, borderColor, skinParam2, strokeForState, umlDiagramType, rounded, shadowing);
return;
}
PackageStyle packageStyle = group.getPackageStyle();
if (packageStyle == null) {
if (packageStyle == null)
packageStyle = skinParam2.packageStyle();
}
if (border != null) {
final HColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false);
if (tmp != null) {
if (tmp != null)
borderColor = tmp;
}
}
final UStroke stroke;
if (UseStyle.useBetaStyle()) {
if (UseStyle.useBetaStyle())
stroke = getStrokeInternal(group, skinParam2, style);
} else {
else
stroke = getStrokeInternal(group, skinParam2, null);
}
HColor backColor = getBackColor(umlDiagramType, style);
backColor = getBackColor(backColor, skinParam2, group.getStereotype(), umlDiagramType.getStyleName());
backColor = getBackColor(backColor, skinParam2, group.getStereotype(), umlDiagramType.getStyleName(),
group.getUSymbol());
if (ztitle != null || zstereo != null) {
final double roundCorner = group.getUSymbol() == null ? 0
: group.getUSymbol().getSkinParameter().getRoundCorner(skinParam, group.getStereotype());
@ -406,44 +407,42 @@ public class Cluster implements Moveable {
ug.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect);
} finally {
if (url != null) {
if (url != null)
ug.closeUrl();
}
}
}
static public UStroke getStrokeInternal(IGroup group, ISkinParam skinParam, Style style) {
final Colors colors = group.getColors();
if (colors.getSpecificLineStroke() != null) {
if (colors.getSpecificLineStroke() != null)
return colors.getSpecificLineStroke();
}
if (style != null) {
if (style != null)
return style.getStroke();
}
if (group.getUSymbol() != null && group.getUSymbol() != USymbol.PACKAGE) {
if (group.getUSymbol() != null && group.getUSymbol() != USymbol.PACKAGE)
return group.getUSymbol().getSkinParameter().getStroke(skinParam, group.getStereotype());
}
return GeneralImageBuilder.getForcedStroke(group.getStereotype(), skinParam);
}
public void manageEntryExitPoint(StringBounder stringBounder) {
final Collection<ClusterPosition> insides = new ArrayList<>();
final List<Point2D> points = new ArrayList<>();
for (SvekNode sh : nodes) {
if (sh.getEntityPosition() == EntityPosition.NORMAL) {
for (SvekNode sh : nodes)
if (sh.getEntityPosition() == EntityPosition.NORMAL)
insides.add(sh.getClusterPosition());
} else {
else
points.add(sh.getClusterPosition().getPointCenter());
}
}
for (Cluster in : children) {
for (Cluster in : children)
insides.add(in.getClusterPosition());
}
final FrontierCalculator frontierCalculator = new FrontierCalculator(getClusterPosition(), insides, points);
if (titleAndAttributeHeight > 0 && titleAndAttributeWidth > 0) {
if (titleAndAttributeHeight > 0 && titleAndAttributeWidth > 0)
frontierCalculator.ensureMinWidth(titleAndAttributeWidth + 10);
}
final ClusterPosition forced = frontierCalculator.getSuggestedPosition();
xTitle += ((forced.getMinX() - minX) + (forced.getMaxX() - maxX)) / 2;
minX = forced.getMinX();
@ -456,9 +455,9 @@ public class Cluster implements Moveable {
}
private void drawSwinLinesState(UGraphic ug, HColor borderColor) {
if (ztitle != null) {
if (ztitle != null)
ztitle.drawU(ug.apply(UTranslate.dx(xTitle)));
}
final ULine line = ULine.vline(maxY - minY);
ug = ug.apply(borderColor);
ug.apply(UTranslate.dx(minX)).draw(line);
@ -474,20 +473,19 @@ public class Cluster implements Moveable {
UmlDiagramType umlDiagramType, double rounded, double shadowing) {
final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY);
final double suppY;
if (ztitle == null) {
if (ztitle == null)
suppY = 0;
} else {
else
suppY = ztitle.calculateDimension(ug.getStringBounder()).getHeight() + IEntityImage.MARGIN
+ IEntityImage.MARGIN_LINE;
}
final Style styleGroup = getDefaultStyleDefinitionStateGroup(group.getStereotype())
.getMergedStyle(skinParam.getCurrentStyleBuilder());
HColor stateBack = getBackColor(umlDiagramType, styleGroup);
if (stateBack == null) {
if (stateBack == null)
stateBack = getColorLegacy(skinParam2, ColorParam.stateBackground, group.getStereotype());
}
final HColor background = getColorLegacy(skinParam2, ColorParam.background, null);
// final Style style = getStyle(FontParam.STATE_ATTRIBUTE, skinParam2);
@ -503,20 +501,17 @@ public class Cluster implements Moveable {
stroke, rounded, shadowing);
r.drawU(ug.apply(new UTranslate(minX, minY)));
if (ztitle != null) {
if (ztitle != null)
ztitle.drawU(ug.apply(new UTranslate(xTitle, yTitle)));
}
if (attributeHeight > 0) {
if (attributeHeight > 0)
attribute.drawU(
ug.apply(new UTranslate(minX + IEntityImage.MARGIN, minY + suppY + IEntityImage.MARGIN / 2.0)));
}
final Stereotype stereotype = group.getStereotype();
final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol();
if (withSymbol) {
if (withSymbol)
EntityImageState.drawSymbol(ug.apply(borderColor), maxX, maxY);
}
}
@ -532,18 +527,17 @@ public class Cluster implements Moveable {
}
private boolean isThereALinkFromOrToGroup(Collection<SvekLine> lines) {
for (SvekLine line : lines) {
if (line.isLinkFromOrTo(group)) {
for (SvekLine line : lines)
if (line.isLinkFromOrTo(group))
return true;
}
}
return false;
}
public void printCluster1(StringBuilder sb, Collection<SvekLine> lines, StringBounder stringBounder) {
for (SvekNode node : getNodesOrderedTop(lines)) {
for (SvekNode node : getNodesOrderedTop(lines))
node.appendShape(sb, stringBounder);
}
}
private List<IShapePseudo> addProtection(List<? extends IShapePseudo> entries, double width) {
@ -561,9 +555,9 @@ public class Cluster implements Moveable {
double result = -Double.MAX_VALUE;
for (IShapePseudo node : entries) {
final double w = getMaxWidthFromLabelForEntryExit(node, stringBounder);
if (w > result) {
if (w > result)
result = w;
}
}
return result;
}
@ -576,22 +570,22 @@ public class Cluster implements Moveable {
StringBounder stringBounder) {
if (entries.size() > 0) {
sb.append("{rank=" + rank + ";");
for (IShapePseudo sh1 : entries) {
for (IShapePseudo sh1 : entries)
sb.append(sh1.getUid() + ";");
}
sb.append("}");
SvekUtils.println(sb);
for (IShapePseudo sh2 : entries) {
for (IShapePseudo sh2 : entries)
sh2.appendShape(sb, stringBounder);
}
SvekUtils.println(sb);
if (hasPort()) {
boolean arrow = false;
String node = null;
for (IShapePseudo sh : entries) {
if (arrow) {
if (arrow)
sb.append("->");
}
arrow = true;
node = sh.getUid();
sb.append(node);
@ -609,9 +603,9 @@ public class Cluster implements Moveable {
final List<SvekNode> result = withPosition(targets);
final double maxWith = getMaxWidthFromLabelForEntryExit(result, stringBounder);
final double naturalSpace = 70;
if (maxWith > naturalSpace) {
if (maxWith > naturalSpace)
return addProtection(result, maxWith - naturalSpace);
}
return result;
}
@ -619,9 +613,9 @@ public class Cluster implements Moveable {
final List<SvekNode> result = new ArrayList<>();
for (final Iterator<SvekNode> it = nodes.iterator(); it.hasNext();) {
final SvekNode sh = it.next();
if (positions.contains(sh.getEntityPosition())) {
if (positions.contains(sh.getEntityPosition()))
result.add(sh);
}
}
return result;
}
@ -642,13 +636,11 @@ public class Cluster implements Moveable {
}
if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL
&& graphvizVersion.ignoreHorizontalLinks() == false) {
&& graphvizVersion.ignoreHorizontalLinks() == false)
appendRankSame(sb, lines);
}
for (Cluster child : getChildren()) {
for (Cluster child : getChildren())
child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type);
}
return added;
}
@ -663,39 +655,36 @@ public class Cluster implements Moveable {
private Set<String> getRankSame(Collection<SvekLine> lines) {
final Set<String> rankSame = new HashSet<>();
for (SvekLine l : lines) {
if (l.hasEntryPoint()) {
if (l.hasEntryPoint())
continue;
}
final String startUid = l.getStartUidPrefix();
final String endUid = l.getEndUidPrefix();
if (isInCluster(startUid) && isInCluster(endUid)) {
final String same = l.rankSame();
if (same != null) {
if (same != null)
rankSame.add(same);
}
}
}
return rankSame;
}
public void fillRankMin(Set<String> rankMin) {
for (SvekNode sh : getNodes()) {
if (sh.isTop()) {
for (SvekNode sh : getNodes())
if (sh.isTop())
rankMin.add(sh.getUid());
}
}
for (Cluster child : getChildren()) {
for (Cluster child : getChildren())
child.fillRankMin(rankMin);
}
}
private boolean isInCluster(String uid) {
for (SvekNode node : nodes) {
if (node.getUid().equals(uid)) {
for (SvekNode node : nodes)
if (node.getUid().equals(uid))
return true;
}
}
return false;
}
@ -708,47 +697,47 @@ public class Cluster implements Moveable {
}
private boolean protection0(UmlDiagramType type) {
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return false;
}
return true;
}
private boolean protection1(UmlDiagramType type) {
if (group.getUSymbol() == USymbol.NODE) {
if (group.getUSymbol() == USymbol.NODE)
return true;
}
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return false;
}
return true;
}
public String getMinPoint(UmlDiagramType type) {
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return "minPoint" + color;
}
return null;
}
public String getMaxPoint(UmlDiagramType type) {
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return "maxPoint" + color;
}
return null;
}
private String getSourceInPoint(UmlDiagramType type) {
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return "sourceIn" + color;
}
return null;
}
private String getSinkInPoint(UmlDiagramType type) {
if (skinParam.useSwimlanes(type)) {
if (skinParam.useSwimlanes(type))
return "sinkIn" + color;
}
return null;
}
@ -758,21 +747,19 @@ public class Cluster implements Moveable {
boolean thereALinkFromOrToGroup1 = thereALinkFromOrToGroup2;
final boolean useProtectionWhenThereALinkFromOrToGroup = graphvizVersion
.useProtectionWhenThereALinkFromOrToGroup();
if (useProtectionWhenThereALinkFromOrToGroup == false) {
if (useProtectionWhenThereALinkFromOrToGroup == false)
thereALinkFromOrToGroup1 = false;
}
// final boolean thereALinkFromOrToGroup1 = false;
if (thereALinkFromOrToGroup1) {
if (thereALinkFromOrToGroup1)
subgraphClusterNoLabel(sb, "a");
}
final Set<EntityPosition> entityPositionsExceptNormal = entityPositionsExceptNormal();
if (entityPositionsExceptNormal.size() > 0) {
for (SvekLine line : lines) {
if (line.isLinkFromOrTo(group)) {
if (entityPositionsExceptNormal.size() > 0)
for (SvekLine line : lines)
if (line.isLinkFromOrTo(group))
line.setProjectionCluster(this);
}
}
}
boolean protection0 = protection0(type);
boolean protection1 = protection1(type);
if (entityPositionsExceptNormal.size() > 0 || useProtectionWhenThereALinkFromOrToGroup == false) {
@ -783,9 +770,9 @@ public class Cluster implements Moveable {
// protection0 = false;
// protection1 = false;
// }
if (protection0) {
if (protection0)
subgraphClusterNoLabel(sb, "p0");
}
sb.append("subgraph " + getClusterId() + " {");
sb.append("style=solid;");
sb.append("color=\"" + DotStringFactory.sharp000000(color) + "\";");
@ -805,25 +792,25 @@ public class Cluster implements Moveable {
if (entityPositionsExceptNormal.size() > 0) {
printClusterEntryExit(sb, stringBounder);
if (hasPort()) {
if (hasPort())
subgraphClusterNoLabel(sb, ID_EE);
} else {
else
subgraphClusterWithLabel(sb, ID_EE, label);
}
} else {
sb.append("label=" + label + ";");
SvekUtils.println(sb);
}
if (thereALinkFromOrToGroup2) {
if (thereALinkFromOrToGroup2)
sb.append(getSpecialPointId(group) + " [shape=point,width=.01,label=\"\"];");
}
if (thereALinkFromOrToGroup1) {
if (thereALinkFromOrToGroup1)
subgraphClusterNoLabel(sb, "i");
}
if (protection1) {
if (protection1)
subgraphClusterNoLabel(sb, "p1");
}
if (skinParam.useSwimlanes(type)) {
sb.append("{rank = source; ");
sb.append(getSourceInPoint(type));
@ -842,7 +829,7 @@ public class Cluster implements Moveable {
printCluster1(sb, lines, stringBounder);
final SvekNode added = printCluster2(sb, lines, stringBounder, dotMode, graphvizVersion, type);
if (entityPositionsExceptNormal.size() > 0) {
if (entityPositionsExceptNormal.size() > 0)
if (hasPort()) {
sb.append(empty() + " [shape=rect,width=.01,height=.01,label=");
sb.append(label);
@ -850,32 +837,30 @@ public class Cluster implements Moveable {
} else if (added == null) {
sb.append(empty() + " [shape=point,width=.01,label=\"\"];");
}
SvekUtils.println(sb);
}
SvekUtils.println(sb);
sb.append("}");
if (protection1) {
if (protection1)
sb.append("}");
}
if (thereALinkFromOrToGroup1) {
sb.append("}");
sb.append("}");
}
if (entityPositionsExceptNormal.size() > 0) {
if (entityPositionsExceptNormal.size() > 0)
sb.append("}");
}
if (protection0) {
if (protection0)
sb.append("}");
}
SvekUtils.println(sb);
}
private boolean hasPort() {
for (EntityPosition pos : entityPositionsExceptNormal()) {
if (pos.isPort()) {
for (EntityPosition pos : entityPositionsExceptNormal())
if (pos.isPort())
return true;
}
}
return false;
}
@ -909,57 +894,58 @@ public class Cluster implements Moveable {
}
private final HColor getBackColor(UmlDiagramType umlDiagramType, Style style) {
if (EntityUtils.groupRoot(group)) {
if (EntityUtils.groupRoot(group))
return null;
}
final HColor result = group.getColors().getColor(ColorType.BACK);
if (result != null) {
if (result != null)
return result;
}
final Stereotype stereo = group.getStereotype();
if (UseStyle.useBetaStyle()) {
if (UseStyle.useBetaStyle())
return style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
}
final USymbol sym = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol();
final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground
: sym.getColorParamBack();
final HColor c1 = skinParam.getHtmlColor(backparam, stereo, false);
if (c1 != null) {
if (c1 != null)
return c1;
}
if (parentCluster == null) {
if (parentCluster == null)
return null;
}
return parentCluster.getBackColor(umlDiagramType, style);
}
public boolean isClusterOf(IEntity ent) {
if (ent.isGroup() == false) {
if (ent.isGroup() == false)
return false;
}
return group == ent;
}
public static HColor getBackColor(HColor backColor, ISkinParam skinParam, Stereotype stereotype, SName styleName) {
public static HColor getBackColor(HColor backColor, ISkinParam skinParam, Stereotype stereotype, SName styleName,
USymbol symbol) {
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinition(styleName).getMergedStyle(skinParam.getCurrentStyleBuilder());
if (backColor == null) {
final Style style = getDefaultStyleDefinition(styleName, symbol)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
if (backColor == null)
backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
}
if (backColor == null || backColor.equals(HColorUtils.transparent())) {
if (backColor == null || backColor.equals(HColorUtils.transparent()))
backColor = new HColorBackground(skinParam.getBackgroundColor());
}
return backColor;
}
if (backColor == null) {
if (backColor == null)
backColor = skinParam.getHtmlColor(ColorParam.packageBackground, stereotype, false);
}
if (backColor == null) {
if (backColor == null)
backColor = skinParam.getHtmlColor(ColorParam.background, stereotype, false);
}
if (backColor == null
|| backColor.equals(HColorUtils.transparent()) /* || stateBack instanceof HtmlColorTransparent */) {
final HColor tmp = skinParam.getBackgroundColor();
@ -970,14 +956,13 @@ public class Cluster implements Moveable {
public double checkFolderPosition(Point2D pt, StringBounder stringBounder) {
if (getClusterPosition().isPointJustUpper(pt)) {
if (ztitle == null) {
if (ztitle == null)
return 0;
}
final Dimension2D dimTitle = ztitle.calculateDimension(stringBounder);
if (pt.getX() < getClusterPosition().getMinX() + dimTitle.getWidth()) {
if (pt.getX() < getClusterPosition().getMinX() + dimTitle.getWidth())
return 0;
}
return getClusterPosition().getMinY() - pt.getY() + dimTitle.getHeight();
}

View File

@ -39,7 +39,7 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
class ExtremityDiamond extends Extremity {
@ -47,16 +47,14 @@ class ExtremityDiamond extends Extremity {
private UPolygon polygon = new UPolygon();
private final boolean fill;
private final Point2D contact;
private final HColor backgroundColor;
@Override
public Point2D somePoint() {
return contact;
}
public ExtremityDiamond(Point2D p1, double angle, boolean fill, HColor backgroundColor) {
public ExtremityDiamond(Point2D p1, double angle, boolean fill) {
this.fill = fill;
this.backgroundColor = backgroundColor;
this.contact = new Point2D.Double(p1.getX(), p1.getY());
angle = manageround(angle);
polygon.addPoint(0, 0);
@ -71,22 +69,21 @@ class ExtremityDiamond extends Extremity {
}
public void drawU(UGraphic ug) {
if (fill) {
if (fill)
ug = ug.apply(HColorUtils.changeBack(ug));
} else {
ug = ug.apply(backgroundColor.bg());
}
else
ug = ug.apply(new HColorNone().bg());
ug.draw(polygon);
}
@Override
public Point2D isTooSmallSoGiveThePointCloserToThisOne(Point2D pt) {
Point2D result = null;
for (Point2D p : polygon.getPoints()) {
if (result == null || p.distance(pt) < result.distance(pt)) {
for (Point2D p : polygon.getPoints())
if (result == null || p.distance(pt) < result.distance(pt))
result = p;
}
}
return result;
}

View File

@ -40,26 +40,23 @@ import java.awt.geom.Point2D;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.svek.AbstractExtremityFactory;
import net.sourceforge.plantuml.svek.Side;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class ExtremityFactoryDiamond extends AbstractExtremityFactory implements ExtremityFactory {
private final boolean fill;
private final HColor backgroundColor;
@Override
public UDrawable createUDrawable(Point2D p0, double angle, Side side) {
return new ExtremityDiamond(p0, angle - Math.PI / 2, fill, backgroundColor);
return new ExtremityDiamond(p0, angle - Math.PI / 2, fill);
}
public ExtremityFactoryDiamond(boolean fill, HColor backgroundColor) {
public ExtremityFactoryDiamond(boolean fill) {
this.fill = fill;
this.backgroundColor = backgroundColor;
}
public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2, Side side) {
final double ortho = atan2(p0, p2);
return new ExtremityDiamond(p1, ortho, fill, backgroundColor);
return new ExtremityDiamond(p1, ortho, fill);
}
}

View File

@ -161,8 +161,12 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
final double heightTotal = dimTotal.getHeight();
final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner)
.withCommentAndCodeLine(getEntity().getCodeGetName(), getEntity().getCodeLine());
if (getSkinParam().shadowing(getEntity().getStereotype())) {
rect.setDeltaShadow(4);
if (UseStyle.useBetaStyle()) {
rect.setDeltaShadow(getStyle().value(PName.Shadowing).asDouble());
} else {
if (getSkinParam().shadowing(getEntity().getStereotype())) {
rect.setDeltaShadow(4);
}
}
HColor classBorder = lineConfig.getColors().getColor(ColorType.LINE);
@ -197,8 +201,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
if (headerBackcolor == null) {
if (UseStyle.useBetaStyle())
headerBackcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
headerBackcolor = backcolor;
else
headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false);
}

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
@ -94,13 +95,14 @@ public class EntityImageClassHeader extends AbstractEntityImage {
} else {
fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype);
}
if (italic) {
if (italic)
fontConfigurationName = fontConfigurationName.italic();
}
Display display = entity.getDisplay();
if (displayGenericWithOldFashion && entity.getGeneric() != null) {
if (displayGenericWithOldFashion && entity.getGeneric() != null)
display = display.addGeneric(entity.getGeneric());
}
TextBlock name = display.createWithNiceCreoleMode(fontConfigurationName, HorizontalAlignment.CENTER, skinParam);
final VisibilityModifier modifier = entity.getVisibilityModifier();
if (modifier == null) {
@ -117,13 +119,12 @@ public class EntityImageClassHeader extends AbstractEntityImage {
final TextBlock stereo;
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false)
stereo = null;
} else {
else
stereo = TextBlockUtils.withMargin(Display.create(stereotype.getLabels(skinParam.guillemet())).create(
new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype),
HorizontalAlignment.CENTER, skinParam), 1, 0);
}
TextBlock genericBlock;
if (generic == null) {
@ -142,43 +143,78 @@ public class EntityImageClassHeader extends AbstractEntityImage {
}
final TextBlock circledCharacter;
if (portionShower.showPortion(EntityPortion.CIRCLED_CHARACTER, (ILeaf) getEntity())) {
if (portionShower.showPortion(EntityPortion.CIRCLED_CHARACTER, (ILeaf) getEntity()))
circledCharacter = TextBlockUtils.withMargin(getCircledCharacter(entity, skinParam), 4, 0, 5, 5);
} else {
else
circledCharacter = null;
}
this.headerLayout = new HeaderLayout(circledCharacter, stereo, name, genericBlock);
}
private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) {
final Stereotype stereotype = entity.getStereotype();
if (stereotype != null && stereotype.getSprite(skinParam) != null) {
if (stereotype != null && stereotype.getSprite(skinParam) != null)
return stereotype.getSprite(skinParam);
}
final UFont font = SkinParamUtils.getFont(getSkinParam(), FontParam.CIRCLED_CHARACTER, null);
final HColor classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder);
final HColor fontColor = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CIRCLED_CHARACTER, null);
if (stereotype != null && stereotype.getCharacter() != 0) {
final LeafType leafType = entity.getLeafType();
final HColor spotBackColor;
HColor spotBorder;
final HColor classBorder;
final HColor fontColor;
if (UseStyle.useBetaStyle()) {
final Style style = spotStyleSignature(leafType).getMergedStyle(skinParam.getCurrentStyleBuilder());
spotBorder = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
spotBackColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder);
fontColor = style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
spotBackColor = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBackground(leafType));
spotBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBorder(leafType));
classBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.classBorder);
fontColor = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CIRCLED_CHARACTER, null);
}
if (stereotype != null && stereotype.getCharacter() != 0)
return new CircledCharacter(stereotype.getCharacter(), getSkinParam().getCircledCharacterRadius(), font,
stereotype.getHtmlColor(), classBorder, fontColor);
}
final LeafType leafType = entity.getLeafType();
final HColor spotBackColor = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBackground(leafType));
HColor spotBorder = SkinParamUtils.getColor(getSkinParam(), stereotype, spotBorder(leafType));
if (spotBorder == null) {
if (spotBorder == null)
spotBorder = classBorder;
}
char circledChar = 0;
if (stereotype != null) {
if (stereotype != null)
circledChar = getSkinParam().getCircledCharacter(stereotype);
}
if (circledChar == 0) {
if (circledChar == 0)
circledChar = getCircledChar(leafType);
}
return new CircledCharacter(circledChar, getSkinParam().getCircledCharacterRadius(), font, spotBackColor,
spotBorder, fontColor);
}
private StyleSignature spotStyleSignature(LeafType leafType) {
switch (leafType) {
case ANNOTATION:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotAnnotation);
case ABSTRACT_CLASS:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotAbstractClass);
case CLASS:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotClass);
case INTERFACE:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotInterface);
case ENUM:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotEnum);
case ENTITY:
return StyleSignature.of(SName.root, SName.element, SName.spot, SName.spotEntity);
}
throw new IllegalStateException();
}
private ColorParam spotBackground(LeafType leafType) {
switch (leafType) {
case ANNOTATION:

View File

@ -115,16 +115,16 @@ public class EntityImageDescription extends AbstractEntityImage {
this.links = links;
final Stereotype stereotype = entity.getStereotype();
USymbol symbol = getUSymbol(entity);
if (symbol == USymbol.FOLDER) {
if (symbol == USymbol.FOLDER)
this.shapeType = ShapeType.FOLDER;
} else if (symbol == USymbol.HEXAGON) {
else if (symbol == USymbol.HEXAGON)
this.shapeType = ShapeType.HEXAGON;
} else if (symbol == USymbol.INTERFACE) {
else if (symbol == USymbol.INTERFACE)
this.shapeType = getSkinParam().fixCircleLabelOverlapping() ? ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE
: ShapeType.RECTANGLE;
} else {
else
this.shapeType = ShapeType.RECTANGLE;
}
this.hideText = symbol == USymbol.INTERFACE;
this.url = entity.getUrl99();
@ -150,10 +150,10 @@ public class EntityImageDescription extends AbstractEntityImage {
.getMergedStyle(getSkinParam().getCurrentStyleBuilder());
forecolor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
if (backcolor == null) {
if (backcolor == null)
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
}
roundCorner = style.value(PName.RoundCorner).asDouble();
diagonalCorner = style.value(PName.DiagonalCorner).asDouble();
deltaShadow = style.value(PName.Shadowing).asDouble();
@ -164,9 +164,9 @@ public class EntityImageDescription extends AbstractEntityImage {
defaultAlign = style.getHorizontalAlignment();
} else {
forecolor = SkinParamUtils.getColor(getSkinParam(), stereotype, symbol.getColorParamBorder());
if (backcolor == null) {
if (backcolor == null)
backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBack());
}
roundCorner = symbol.getSkinParameter().getRoundCorner(getSkinParam(), stereotype);
diagonalCorner = symbol.getSkinParameter().getDiagonalCorner(getSkinParam(), stereotype);
deltaShadow = getSkinParam().shadowing2(getEntity().getStereotype(), symbol.getSkinParameter()) ? 3 : 0;
@ -193,24 +193,22 @@ public class EntityImageDescription extends AbstractEntityImage {
stereo = TextBlockUtils.empty(0, 0);
if (stereotype != null && stereotype.getSprite(getSkinParam()) != null) {
// symbol = symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
if (stereotype != null && stereotype.getSprite(getSkinParam()) != null)
stereo = stereotype.getSprite(getSkinParam());
} else if (stereotype != null && stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) != null
&& portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) {
else if (stereotype != null && stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) != null
&& portionShower.showPortion(EntityPortion.STEREOTYPE, entity))
stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create(fcStereo,
HorizontalAlignment.CENTER, getSkinParam());
}
name = BodyFactory.create2(getSkinParam().getDefaultTextAlignment(HorizontalAlignment.CENTER), codeDisplay,
symbol.getFontParam(), getSkinParam(), stereotype, entity, style);
if (hideText) {
if (hideText)
asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
ctx, getSkinParam().getStereotypeAlignment());
} else {
else
asSmall = symbol.asSmall(name, desc, stereo, ctx, getSkinParam().getStereotypeAlignment());
}
}
private USymbol getUSymbol(ILeaf entity) {
@ -220,9 +218,9 @@ public class EntityImageDescription extends AbstractEntityImage {
}
public Dimension2D getNameDimension(StringBounder stringBounder) {
if (hideText) {
if (hideText)
return new Dimension2DDouble(0, 0);
}
return name.calculateDimension(stringBounder);
}
@ -232,39 +230,35 @@ public class EntityImageDescription extends AbstractEntityImage {
@Override
public Margins getShield(StringBounder stringBounder) {
if (hideText == false) {
if (hideText == false)
return Margins.NONE;
}
// if (useRankSame && hasSomeHorizontalLink((ILeaf) getEntity(), links)) {
// return Margins.NONE;
// }
if (isThereADoubleLink((ILeaf) getEntity(), links)) {
if (isThereADoubleLink((ILeaf) getEntity(), links))
return Margins.NONE;
}
if (fixCircleLabelOverlapping == false && hasSomeHorizontalLinkVisible((ILeaf) getEntity(), links)) {
if (fixCircleLabelOverlapping == false && hasSomeHorizontalLinkVisible((ILeaf) getEntity(), links))
return Margins.NONE;
}
if (hasSomeHorizontalLinkDoubleDecorated((ILeaf) getEntity(), links)) {
if (hasSomeHorizontalLinkDoubleDecorated((ILeaf) getEntity(), links))
return Margins.NONE;
}
final Dimension2D dimStereo = stereo.calculateDimension(stringBounder);
final Dimension2D dimDesc = desc.calculateDimension(stringBounder);
final Dimension2D dimSmall = asSmall.calculateDimension(stringBounder);
final double x = Math.max(dimStereo.getWidth(), dimDesc.getWidth());
double suppX = x - dimSmall.getWidth();
if (suppX < 1) {
if (suppX < 1)
suppX = 1;
}
final double y = MathUtils.max(1, dimDesc.getHeight(), dimStereo.getHeight());
return new Margins(suppX / 2, suppX / 2, y, y);
}
private boolean hasSomeHorizontalLinkVisible(ILeaf leaf, Collection<Link> links) {
for (Link link : links) {
if (link.getLength() == 1 && link.contains(leaf) && link.isInvis() == false) {
for (Link link : links)
if (link.getLength() == 1 && link.contains(leaf) && link.isInvis() == false)
return true;
}
}
return false;
}
@ -274,20 +268,19 @@ public class EntityImageDescription extends AbstractEntityImage {
if (link.contains(leaf)) {
final IEntity other = link.getOther(leaf);
final boolean changed = others.add(other);
if (changed == false) {
if (changed == false)
return true;
}
}
}
return false;
}
private boolean hasSomeHorizontalLinkDoubleDecorated(ILeaf leaf, Collection<Link> links) {
for (Link link : links) {
if (link.getLength() == 1 && link.contains(leaf) && link.getType().isDoubleDecorated()) {
for (Link link : links)
if (link.getLength() == 1 && link.contains(leaf) && link.getType().isDoubleDecorated())
return true;
}
}
return false;
}
@ -295,12 +288,12 @@ public class EntityImageDescription extends AbstractEntityImage {
ug.draw(new UComment("entity " + getEntity().getCodeGetName()));
ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected");
if (url != null) {
if (url != null)
ug.startUrl(url);
}
if (shapeType == ShapeType.HEXAGON) {
if (shapeType == ShapeType.HEXAGON)
drawHexagon(ctx.apply(ug));
}
asSmall.drawU(ug);
if (hideText) {
@ -318,17 +311,16 @@ public class EntityImageDescription extends AbstractEntityImage {
stereo.drawU(ug.apply(new UTranslate(posx2, -space - dimStereo.getHeight())));
}
if (url != null) {
if (url != null)
ug.closeUrl();
}
ug.closeGroup();
}
private void drawHexagon(UGraphic ug) {
if (bibliotekon == null) {
if (bibliotekon == null)
throw new IllegalStateException();
}
final SvekNode node = bibliotekon.getNode(getEntity());
final Shadowable hexagon = node.getPolygon();
if (hexagon != null) {

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName;
@ -130,7 +131,7 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
this.shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0;
this.stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam());
this.roundCorner = 0;
this.back = Cluster.getBackColor(specificBackColor, skinParam, stereotype, styleName);
this.back = Cluster.getBackColor(specificBackColor, skinParam, stereotype, styleName, USymbol.PACKAGE);
titleFontConfiguration = new FontConfiguration(getSkinParam(), FontParam.PACKAGE, stereotype);
titleHorizontalAlignment = HorizontalAlignment.CENTER;
}

View File

@ -66,9 +66,7 @@ public class EntityImageSynchroBar extends AbstractEntityImage {
// this.styleName = styleName;
}
public StyleSignature getDefaultStyleDefinitionBar() {
// return StyleSignature.of(SName.root, SName.element, styleName,
// SName.activityBar);
private StyleSignature getDefaultStyleDefinitionBar() {
return StyleSignature.of(SName.root, SName.element, SName.activityBar);
}

View File

@ -112,6 +112,7 @@ public class SvgGraphics {
private String fillDark = "black";
private Collection<String> classesForDarkness = new LinkedHashSet<>();
private String stroke = "black";
private String strokeDark = "black";
private String strokeWidth;
private String strokeDasharray = null;
private final String backcolor;
@ -201,8 +202,15 @@ public class SvgGraphics {
throw new IllegalStateException();
final String color1 = m.group(2);
final String color2 = m.group(3);
text1.append("*." + s + " {fill:#" + color1 + ";}");
text2.append("*." + s + " {fill:#" + color2 + ";}");
final String type = m.group(1);
if ("f".equals(type)) {
text1.append("*." + s + " {fill:#" + color1 + ";}");
text2.append("*." + s + " {fill:#" + color2 + ";}");
} else if ("s".equals(type)) {
text1.append("*." + s + " {stroke:#" + color1 + ";}");
text2.append("*." + s + " {stroke:#" + color2 + ";}");
} else
throw new IllegalStateException();
}
text2.append("}");
final CDATASection cdata = document.createCDATASection(text1.toString() + text2.toString());
@ -298,6 +306,7 @@ public class SvgGraphics {
elt.setAttribute("ry", format(yRadius));
fillMe(elt);
elt.setAttribute("style", getStyle());
manageDarkStroke(elt);
addFilterShadowId(elt, deltaShadow);
getG().appendChild(elt);
}
@ -376,6 +385,12 @@ public class SvgGraphics {
public final void setStrokeColor(String stroke) {
this.stroke = stroke == null ? "none" : stroke;
this.strokeDark = stroke;
}
public final void setStrokeColor(String stroke, String strokeDark) {
this.stroke = stroke == null ? "none" : stroke;
this.strokeDark = strokeDark == null ? "none" : strokeDark;
}
public final void setStrokeWidth(double strokeWidth, String strokeDasharray) {
@ -426,9 +441,20 @@ public class SvgGraphics {
elt.setAttribute("height", format(height));
fillMe(elt);
elt.setAttribute("style", getStyleSpecial());
manageDarkStroke(elt);
return elt;
}
private void manageDarkStroke(final Element elt) {
if (strokeDark != null && stroke.equals(strokeDark) == false) {
final String attribute = elt.getAttribute("class");
if (attribute == null || attribute.length() == 0)
elt.setAttribute("class", getStrokeClassForDark());
else
elt.setAttribute("class", attribute + " " + getStrokeClassForDark());
}
}
public void svgLine(double x1, double y1, double x2, double y2, double deltaShadow) {
manageShadow(deltaShadow);
if (hidden == false) {
@ -438,6 +464,7 @@ public class SvgGraphics {
elt.setAttribute("x2", format(x2));
elt.setAttribute("y2", format(y2));
elt.setAttribute("style", getStyle());
manageDarkStroke(elt);
addFilterShadowId(elt, deltaShadow);
getG().appendChild(elt);
}
@ -447,7 +474,8 @@ public class SvgGraphics {
private String getStyle() {
final StringBuilder style = new StringBuilder();
style.append("stroke:" + stroke + ";");
if (stroke.equals(strokeDark))
style.append("stroke:" + stroke + ";");
style.append("stroke-width:" + strokeWidth + ";");
if (fill.equals("#00000000"))
style.append("fill:none;");
@ -461,7 +489,8 @@ public class SvgGraphics {
// https://forum.plantuml.net/12469/package-background-transparent-package-default-background?show=12479#c12479
private String getStyleSpecial() {
final StringBuilder style = new StringBuilder();
style.append("stroke:" + stroke + ";");
if (stroke.equals(strokeDark))
style.append("stroke:" + stroke + ";");
style.append("stroke-width:" + strokeWidth + ";");
if (fill.equals("#00000000"))
style.append("fill:none;");
@ -487,6 +516,7 @@ public class SvgGraphics {
elt.setAttribute("points", sb.toString());
fillMe(elt);
elt.setAttribute("style", getStyleSpecial());
manageDarkStroke(elt);
addFilterShadowId(elt, deltaShadow);
getG().appendChild(elt);
}
@ -529,14 +559,14 @@ public class SvgGraphics {
if (fontFamily != null) {
// http://plantuml.sourceforge.net/qa/?qa=5432/svg-monospace-output-has-wrong-font-family
if ("monospaced".equalsIgnoreCase(fontFamily)) {
if ("monospaced".equalsIgnoreCase(fontFamily))
fontFamily = "monospace";
}
elt.setAttribute("font-family", fontFamily);
if (fontFamily.equalsIgnoreCase("monospace") || fontFamily.equalsIgnoreCase("courier")) {
if (fontFamily.equalsIgnoreCase("monospace") || fontFamily.equalsIgnoreCase("courier"))
text = text.replace(' ', (char) 160);
}
}
if (textBackColor != null) {
final String backFilterId = getFilterBackColor(textBackColor);
@ -706,6 +736,7 @@ public class SvgGraphics {
final Element elt = (Element) document.createElement("path");
elt.setAttribute("d", sb.toString());
elt.setAttribute("style", getStyle());
manageDarkStroke(elt);
fillMe(elt);
final String id = path.getComment();
if (id != null)
@ -727,6 +758,13 @@ public class SvgGraphics {
return result;
}
private String getStrokeClassForDark() {
final String result = "s_" + stroke.toLowerCase().replaceAll("\\#", "") + "_"
+ strokeDark.toLowerCase().replaceAll("\\#", "");
this.classesForDarkness.add(result);
return result;
}
private void fillMe(Element elt) {
if (fill.equals("#00000000"))
return;

View File

@ -45,10 +45,12 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class DriverCenteredCharacterSvg implements UDriver<UCenteredCharacter, SvgGraphics> {
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
public void draw(UCenteredCharacter characterCircled, double x, double y, ColorMapper mapper, UParam param,
SvgGraphics svg) {
final char c = characterCircled.getChar();
final UFont font = characterCircled.getFont();
final UnusedSpace unusedSpace = UnusedSpace.getUnusedSpace(font, c);
@ -57,7 +59,13 @@ public class DriverCenteredCharacterSvg implements UDriver<UCenteredCharacter, S
final double ypos = y - unusedSpace.getCenterY() - 0.5;
final TextLayout t = createTextLayout(font, "" + c);
svg.setFillColor(mapper.toRGB(param.getColor()));
final HColor textColor = param.getColor();
final HColor dark = textColor == null ? null : textColor.darkSchemeTheme();
if (dark == textColor)
svg.setFillColor(mapper.toSvg(textColor));
else
svg.setFillColor(mapper.toSvg(textColor), mapper.toSvg(dark));
svg.drawPathIterator(xpos, ypos, t.getOutline(null).getPathIterator(null));
}
}

View File

@ -47,8 +47,8 @@ public class DriverDotPathSvg implements UDriver<DotPath, SvgGraphics> {
// DriverLineG2d.manageStroke(param, g2d);
if (param.getColor() != null) {
final String color = mapper.toSvg(param.getColor());
svg.setStrokeColor(color);
DriverRectangleSvg.applyStrokeColor(svg, mapper, param);
svg.setFillColor(null);
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());

View File

@ -41,9 +41,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorBackground;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverEllipseSvg implements UDriver<UEllipse, SvgGraphics> {
@ -67,20 +64,9 @@ public class DriverEllipseSvg implements UDriver<UEllipse, SvgGraphics> {
}
}
final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) back;
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()), mapper.toRGB(gr.getColor2()),
gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
} else if (back == null || back instanceof HColorBackground) {
svg.setFillColor("#00000000");
} else {
final String backcolor = mapper.toSvg(back);
svg.setFillColor(backcolor);
}
DriverRectangleSvg.applyStrokeColor(svg, mapper, param);
// svg.setStrokeColor(StringUtils.getAsSvg(mapper, param.getColor()));
DriverRectangleSvg.applyFillColor(svg, mapper, param);
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
double start = shape.getStart();

View File

@ -80,7 +80,11 @@ public class DriverLineSvg implements UDriver<ULine, SvgGraphics> {
final HColorGradient gr = (HColorGradient) color;
svg.setStrokeColor(mapper.toSvg(gr.getColor1()));
} else {
svg.setStrokeColor(mapper.toSvg(color));
final HColor dark = color == null ? null : color.darkSchemeTheme();
if (dark == color)
svg.setStrokeColor(mapper.toSvg(color));
else
svg.setStrokeColor(mapper.toSvg(color), mapper.toSvg(dark));
}
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
svg.svgLine(x, y, x2, y2, shape.getDeltaShadow());

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPath;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
import net.sourceforge.plantuml.ugraphic.g2d.DriverShadowedG2d;
public class DriverPathSvg extends DriverShadowedG2d implements UDriver<UPath, SvgGraphics> {
@ -55,27 +54,22 @@ public class DriverPathSvg extends DriverShadowedG2d implements UDriver<UPath, S
public void draw(UPath shape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UClip clip = clipContainer.getClip();
if (clip != null && clip.isInside(x, y, shape) == false) {
if (clip != null && clip.isInside(x, y, shape) == false)
return;
}
final String color = mapper.toSvg(param.getColor());
if (shape.isOpenIconic()) {
svg.setFillColor(color);
final HColor color = param.getColor();
final HColor dark = color == null ? null : color.darkSchemeTheme();
if (dark == color)
svg.setFillColor(mapper.toSvg(color));
else
svg.setFillColor(mapper.toSvg(color), mapper.toSvg(dark));
svg.setStrokeColor("");
svg.setStrokeWidth(0, "");
} else {
final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) back;
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
mapper.toRGB(gr.getColor2()), gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
} else {
final String backcolor = mapper.toSvg(back);
svg.setFillColor(backcolor);
}
svg.setStrokeColor(color);
DriverRectangleSvg.applyFillColor(svg, mapper, param);
DriverRectangleSvg.applyStrokeColor(svg, mapper, param);
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
}

View File

@ -41,8 +41,6 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
public class DriverPolygonSvg implements UDriver<UPolygon, SvgGraphics> {
@ -56,27 +54,14 @@ public class DriverPolygonSvg implements UDriver<UPolygon, SvgGraphics> {
final double points[] = shape.getPointArray(x, y);
assert points.length % 2 == 0;
final UClip clip = clipContainer.getClip();
if (clip != null) {
for (int j = 0; j < points.length; j += 2) {
if (clip.isInside(points[j], points[j + 1]) == false) {
if (clip != null)
for (int j = 0; j < points.length; j += 2)
if (clip.isInside(points[j], points[j + 1]) == false)
return;
}
}
}
final String color = mapper.toSvg(param.getColor());
final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) back;
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()),
mapper.toRGB(gr.getColor2()), gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
} else {
final String backcolorString = mapper.toSvg(back);
svg.setFillColor(backcolorString);
}
DriverRectangleSvg.applyFillColor(svg, mapper, param);
DriverRectangleSvg.applyStrokeColor(svg, mapper, param);
svg.setStrokeColor(color);
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
svg.svgPolygon(shape.getDeltaShadow(), points);

View File

@ -60,24 +60,8 @@ public class DriverRectangleSvg implements UDriver<URectangle, SvgGraphics> {
double width = rect.getWidth();
double height = rect.getHeight();
final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) back;
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()), mapper.toRGB(gr.getColor2()),
gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
applyStrokeColor(svg, mapper, param);
} else {
final String backcolor = mapper.toSvg(back);
final HColor dark = back == null ? null : back.darkSchemeTheme();
if (dark == back) {
svg.setFillColor(backcolor);
} else {
final String darkcolor = mapper.toSvg(dark);
svg.setFillColor(backcolor, darkcolor);
}
applyStrokeColor(svg, mapper, param);
}
applyFillColor(svg, mapper, param);
applyStrokeColor(svg, mapper, param);
svg.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
@ -96,6 +80,22 @@ public class DriverRectangleSvg implements UDriver<URectangle, SvgGraphics> {
rect.getCodeLine());
}
public static void applyFillColor(SvgGraphics svg, ColorMapper mapper, UParam param) {
final HColor background = param.getBackcolor();
if (background instanceof HColorGradient) {
final HColorGradient gr = (HColorGradient) background;
final String id = svg.createSvgGradient(mapper.toRGB(gr.getColor1()), mapper.toRGB(gr.getColor2()),
gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
} else {
final HColor dark = background == null ? null : background.darkSchemeTheme();
if (dark == background)
svg.setFillColor(mapper.toSvg(background));
else
svg.setFillColor(mapper.toSvg(background), mapper.toSvg(dark));
}
}
public static void applyStrokeColor(SvgGraphics svg, ColorMapper mapper, UParam param) {
final HColor color = param.getColor();
if (color instanceof HColorGradient) {
@ -104,7 +104,12 @@ public class DriverRectangleSvg implements UDriver<URectangle, SvgGraphics> {
gr.getPolicy());
svg.setStrokeColor("url(#" + id + ")");
} else {
svg.setStrokeColor(mapper.toSvg(color));
final HColor dark = color == null ? null : color.darkSchemeTheme();
if (dark == color)
svg.setStrokeColor(mapper.toSvg(color));
else
svg.setStrokeColor(mapper.toSvg(color), mapper.toSvg(dark));
}
}
}

View File

@ -124,7 +124,13 @@ public class DriverTextSvg implements UDriver<UText, SvgGraphics> {
}
}
svg.setFillColor(mapper.toSvg(fontConfiguration.getColor()));
final HColor textColor = fontConfiguration.getColor();
final HColor dark = textColor == null ? null : textColor.darkSchemeTheme();
if (dark == textColor)
svg.setFillColor(mapper.toSvg(textColor));
else
svg.setFillColor(mapper.toSvg(textColor), mapper.toSvg(dark));
svg.text(text, x, y, font.getFamily(UFontContext.SVG), font.getSize(), fontWeight, fontStyle, textDecoration,
width, fontConfiguration.getAttributes(), backColor);
}

View File

@ -122,11 +122,11 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
private void register() {
registerDriver(URectangle.class, new DriverRectangleSvg(this));
if (textAsPath2) {
if (textAsPath2)
registerDriver(UText.class, new DriverTextAsPathSvg(this));
} else {
else
registerDriver(UText.class, new DriverTextSvg(getStringBounder(), this));
}
registerDriver(ULine.class, new DriverLineSvg(this));
registerDriver(UPixel.class, new DriverPixelSvg());
registerDriver(UPolygon.class, new DriverPolygonSvg(this));
@ -145,9 +145,9 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
@Override
public void writeToStream(OutputStream os, String metadata, int dpi) throws IOException {
try {
if (metadata != null) {
if (metadata != null)
getGraphicObject().addComment(metadata);
}
getGraphicObject().createXml(os);
} catch (TransformerException e) {
throw new IOException(e.toString());
@ -181,9 +181,9 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
@Override
public boolean matchesProperty(String propertyName) {
if (propertyName.equalsIgnoreCase("SVG")) {
if (propertyName.equalsIgnoreCase("SVG"))
return true;
}
return super.matchesProperty(propertyName);
}

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1202200;
return 1202201;
}
public static int versionPatched() {
@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 9;
final int beta = 0;
return beta;
}
@ -93,7 +93,7 @@ public class Version {
}
public static long compileTime() {
return 1641917802534L;
return 1643739598174L;
}
public static String compileTimeString() {

View File

@ -40,7 +40,7 @@ PATH:
- type: SEG_LINETO
pt1: [ 0.0000 ; 0.0000 ]
stroke: 0.0-0.0-1.0
shadow: 4
shadow: 3
color: ffa80036
backcolor: fffbfb77
@ -100,7 +100,7 @@ PATH:
- type: SEG_LINETO
pt1: [ 0.0000 ; 0.0000 ]
stroke: 0.0-0.0-1.0
shadow: 4
shadow: 3
color: ffa80036
backcolor: fffbfb77
@ -388,7 +388,7 @@ RECTANGLE:
xCorner: 25
yCorner: 25
stroke: 0.0-0.0-1.5
shadow: 4
shadow: 3
color: ffa80036
backcolor: fffefece
@ -449,7 +449,7 @@ PATH:
sweepFlag: false
dest: [ 0.0000 ; 0.0000 ]
stroke: 0.0-0.0-1.0
shadow: 4
shadow: 3
color: ffa80036
backcolor: fffbfb77
@ -745,7 +745,7 @@ RECTANGLE:
xCorner: 25
yCorner: 25
stroke: 0.0-0.0-1.5
shadow: 4
shadow: 3
color: ffa80036
backcolor: fffefece