mirror of
https://github.com/octoleo/plantuml.git
synced 2025-01-03 07:12:29 +00:00
This commit is contained in:
parent
442d313a30
commit
5a1147b92e
@ -90,6 +90,7 @@ public class Body3 extends AbstractTextBlock implements TextBlock, WithPorts {
|
|||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
return new Ports();
|
return new Ports();
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TextBlock getArea(StringBounder stringBounder) {
|
final protected TextBlock getArea(StringBounder stringBounder) {
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
@ -226,6 +226,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final TextBlock area = getArea(stringBounder);
|
final TextBlock area = getArea(stringBounder);
|
||||||
if (area instanceof WithPorts) {
|
if (area instanceof WithPorts) {
|
||||||
|
56
src/net/sourceforge/plantuml/cucadiagram/Elected.java
Normal file
56
src/net/sourceforge/plantuml/cucadiagram/Elected.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2020, Arnaud Roques
|
||||||
|
*
|
||||||
|
* Project Info: http://plantuml.com
|
||||||
|
*
|
||||||
|
* If you like this project or if you find it useful, you can support us at:
|
||||||
|
*
|
||||||
|
* http://plantuml.com/patreon (only 1$ per month!)
|
||||||
|
* http://plantuml.com/paypal
|
||||||
|
*
|
||||||
|
* This file is part of PlantUML.
|
||||||
|
*
|
||||||
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PlantUML distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Original Author: Arnaud Roques
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.cucadiagram;
|
||||||
|
|
||||||
|
class Elected {
|
||||||
|
|
||||||
|
private final String shortName;
|
||||||
|
private final int score;
|
||||||
|
|
||||||
|
public Elected(String shortName, int score) {
|
||||||
|
this.shortName = shortName;
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getShortName() {
|
||||||
|
return shortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,100 +0,0 @@
|
|||||||
/* ========================================================================
|
|
||||||
* PlantUML : a free UML diagram generator
|
|
||||||
* ========================================================================
|
|
||||||
*
|
|
||||||
* (C) Copyright 2009-2020, Arnaud Roques
|
|
||||||
*
|
|
||||||
* Project Info: http://plantuml.com
|
|
||||||
*
|
|
||||||
* If you like this project or if you find it useful, you can support us at:
|
|
||||||
*
|
|
||||||
* http://plantuml.com/patreon (only 1$ per month!)
|
|
||||||
* http://plantuml.com/paypal
|
|
||||||
*
|
|
||||||
* This file is part of PlantUML.
|
|
||||||
*
|
|
||||||
* PlantUML is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* PlantUML distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
* USA.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Original Author: Arnaud Roques
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package net.sourceforge.plantuml.cucadiagram;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
class Election {
|
|
||||||
|
|
||||||
private final Map<String, CharSequence> all = new HashMap<String, CharSequence>();
|
|
||||||
|
|
||||||
public void addCandidate(String display, CharSequence candidate) {
|
|
||||||
all.put(display, candidate);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private CharSequence getCandidate(String shortName) {
|
|
||||||
List<CharSequence> list = getAllCandidateContains(shortName);
|
|
||||||
if (list.size() == 1) {
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
list = getAllCandidateContainsStrict(shortName);
|
|
||||||
if (list.size() == 1) {
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CharSequence> getAllCandidateContains(String shortName) {
|
|
||||||
final List<CharSequence> result = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, CharSequence> ent : all.entrySet()) {
|
|
||||||
if (ent.getKey().contains(shortName)) {
|
|
||||||
result.add(ent.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CharSequence> getAllCandidateContainsStrict(String shortName) {
|
|
||||||
final List<CharSequence> result = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, CharSequence> ent : all.entrySet()) {
|
|
||||||
final String key = ent.getKey();
|
|
||||||
if (key.matches(".*\\b" + shortName + "\\b.*")) {
|
|
||||||
result.add(ent.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<CharSequence, String> getAllElected(Collection<String> shortNames) {
|
|
||||||
final Map<CharSequence, String> memberWithPort = new HashMap<CharSequence, String>();
|
|
||||||
for (String shortName : new HashSet<>(shortNames)) {
|
|
||||||
final CharSequence m = getCandidate(shortName);
|
|
||||||
if (m != null) {
|
|
||||||
memberWithPort.put(m, shortName);
|
|
||||||
shortNames.remove(shortName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Collections.unmodifiableMap(memberWithPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -37,7 +37,8 @@ package net.sourceforge.plantuml.cucadiagram;
|
|||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.Map;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.EmbeddedDiagram;
|
import net.sourceforge.plantuml.EmbeddedDiagram;
|
||||||
@ -108,9 +109,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
if (cs instanceof Member == false)
|
if (cs instanceof Member == false)
|
||||||
continue;
|
continue;
|
||||||
final Member m = (Member) cs;
|
final Member m = (Member) cs;
|
||||||
if (m.getVisibilityModifier() != null) {
|
if (m.getVisibilityModifier() != null)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -132,53 +133,68 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
return new Dimension2DDouble(x, y);
|
return new Dimension2DDouble(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final Ports result = new Ports();
|
final Ports result = new Ports();
|
||||||
double y = 0;
|
double y = 0;
|
||||||
final Election election = new Election();
|
|
||||||
for (CharSequence cs : members) {
|
|
||||||
if (cs instanceof Member) {
|
|
||||||
final Member m = (Member) cs;
|
|
||||||
election.addCandidate(m.getDisplay(false), m);
|
|
||||||
} else {
|
|
||||||
election.addCandidate(cs.toString(), cs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final Map<CharSequence, String> memberWithPort = election.getAllElected(leaf.getPortShortNames());
|
|
||||||
for (CharSequence cs : members) {
|
for (CharSequence cs : members) {
|
||||||
final TextBlock bloc = createTextBlock(cs);
|
final TextBlock bloc = createTextBlock(cs);
|
||||||
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
||||||
final String port = memberWithPort.get(cs);
|
final Elected port = getElected(leaf.getPortShortNames(), convert(cs));
|
||||||
if (port != null) {
|
if (port != null)
|
||||||
result.add(port, y, dim.getHeight());
|
result.add(port.getShortName(), port.getScore(), y, dim.getHeight());
|
||||||
}
|
|
||||||
y += dim.getHeight();
|
y += dim.getHeight();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convert(CharSequence cs) {
|
||||||
|
if (cs instanceof Member)
|
||||||
|
return ((Member) cs).getDisplay(false);
|
||||||
|
return cs.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Elected getElected(Collection<String> shortNames, String cs) {
|
||||||
|
for (String shortName : new HashSet<>(shortNames)) {
|
||||||
|
final int score = getScore(shortName, cs);
|
||||||
|
if (score > 0)
|
||||||
|
return new Elected(shortName, score);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getScore(String shortName, String cs) {
|
||||||
|
if (cs.matches(".*\\b" + shortName + "\\b.*"))
|
||||||
|
return 100;
|
||||||
|
|
||||||
|
if (cs.contains(shortName))
|
||||||
|
return 50;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private TextBlock createTextBlock(CharSequence cs) {
|
private TextBlock createTextBlock(CharSequence cs) {
|
||||||
|
|
||||||
FontConfiguration config;
|
FontConfiguration config;
|
||||||
if (style != null) {
|
if (style != null)
|
||||||
config = new FontConfiguration(skinParam, style);
|
config = new FontConfiguration(skinParam, style);
|
||||||
} else {
|
else
|
||||||
config = new FontConfiguration(skinParam, fontParam, stereotype);
|
config = new FontConfiguration(skinParam, fontParam, stereotype);
|
||||||
}
|
|
||||||
|
|
||||||
if (cs instanceof Member) {
|
if (cs instanceof Member) {
|
||||||
final Member m = (Member) cs;
|
final Member m = (Member) cs;
|
||||||
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
|
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
|
||||||
String s = m.getDisplay(withVisibilityChar);
|
String s = m.getDisplay(withVisibilityChar);
|
||||||
if (withVisibilityChar && s.startsWith("#")) {
|
if (withVisibilityChar && s.startsWith("#"))
|
||||||
s = CharHidder.addTileAtBegin(s);
|
s = CharHidder.addTileAtBegin(s);
|
||||||
}
|
|
||||||
if (m.isAbstract()) {
|
if (m.isAbstract())
|
||||||
config = config.italic();
|
config = config.italic();
|
||||||
}
|
|
||||||
if (m.isStatic()) {
|
if (m.isStatic())
|
||||||
config = config.underline();
|
config = config.underline();
|
||||||
}
|
|
||||||
|
|
||||||
TextBlock bloc = Display.getWithNewlines(s).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE,
|
TextBlock bloc = Display.getWithNewlines(s).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE,
|
||||||
skinParam.wrapWidth());
|
skinParam.wrapWidth());
|
||||||
@ -206,13 +222,13 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
if (url != null) {
|
if (url != null)
|
||||||
ug.startUrl(url);
|
ug.startUrl(url);
|
||||||
}
|
|
||||||
bloc.drawU(ug);
|
bloc.drawU(ug);
|
||||||
if (url != null) {
|
if (url != null)
|
||||||
ug.closeUrl();
|
ug.closeUrl();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||||
@ -256,9 +272,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
public boolean contains(String member) {
|
public boolean contains(String member) {
|
||||||
for (CharSequence cs : members) {
|
for (CharSequence cs : members) {
|
||||||
final Member att = (Member) cs;
|
final Member att = (Member) cs;
|
||||||
if (att.getDisplay(false).startsWith(member)) {
|
if (att.getDisplay(false).startsWith(member))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -288,13 +304,13 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PlacementStrategy placementStrategy;
|
final PlacementStrategy placementStrategy;
|
||||||
if (align == HorizontalAlignment.LEFT) {
|
if (align == HorizontalAlignment.LEFT)
|
||||||
placementStrategy = new PlacementStrategyY1Y2Left(stringBounder);
|
placementStrategy = new PlacementStrategyY1Y2Left(stringBounder);
|
||||||
} else if (align == HorizontalAlignment.CENTER) {
|
else if (align == HorizontalAlignment.CENTER)
|
||||||
placementStrategy = new PlacementStrategyY1Y2Center(stringBounder);
|
placementStrategy = new PlacementStrategyY1Y2Center(stringBounder);
|
||||||
} else {
|
else
|
||||||
placementStrategy = new PlacementStrategyY1Y2Right(stringBounder);
|
placementStrategy = new PlacementStrategyY1Y2Right(stringBounder);
|
||||||
}
|
|
||||||
group = new ULayoutGroup(placementStrategy);
|
group = new ULayoutGroup(placementStrategy);
|
||||||
for (CharSequence cs : members) {
|
for (CharSequence cs : members) {
|
||||||
final TextBlock bloc = createTextBlock(cs);
|
final TextBlock bloc = createTextBlock(cs);
|
||||||
|
@ -84,6 +84,7 @@ public class TextBlockMap extends AbstractTextBlock implements WithPorts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final Ports ports = new Ports();
|
final Ports ports = new Ports();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -92,7 +93,7 @@ public class TextBlockMap extends AbstractTextBlock implements WithPorts {
|
|||||||
final TextBlock key = ent.getKey();
|
final TextBlock key = ent.getKey();
|
||||||
final TextBlock value = ent.getValue();
|
final TextBlock value = ent.getValue();
|
||||||
final double height = getHeightOfRow(stringBounder, key, value);
|
final double height = getHeightOfRow(stringBounder, key, value);
|
||||||
ports.add(keys.get(i), y, height);
|
ports.add(keys.get(i), 100, y, height);
|
||||||
y += height;
|
y += height;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -730,8 +730,7 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
public Collection<String> getPortShortNames() {
|
public Collection<String> getPortShortNames() {
|
||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
// return Collections.unmodifiableCollection(portShortNames);
|
return Collections.unmodifiableCollection(portShortNames);
|
||||||
return portShortNames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPortShortName(String portShortName) {
|
public void addPortShortName(String portShortName) {
|
||||||
|
@ -96,6 +96,7 @@ public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock,
|
|||||||
return textBlock.getInnerPosition(member, stringBounder, strategy);
|
return textBlock.getInnerPosition(member, stringBounder, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
return ((WithPorts) textBlock).getPorts(stringBounder);
|
return ((WithPorts) textBlock).getPorts(stringBounder);
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts
|
|||||||
return translate.apply(parent);
|
return translate.apply(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
return ((WithPorts) textBlock).getPorts(stringBounder).translateY(top);
|
return ((WithPorts) textBlock).getPorts(stringBounder).translateY(top);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
double y = 0;
|
double y = 0;
|
||||||
// final Dimension2D dimtotal = calculateDimension(stringBounder);
|
// final Dimension2D dimtotal = calculateDimension(stringBounder);
|
||||||
|
@ -54,6 +54,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I
|
|||||||
this.skinParam = Objects.requireNonNull(skinParam);
|
this.skinParam = Objects.requireNonNull(skinParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return entity.isHidden();
|
return entity.isHidden();
|
||||||
}
|
}
|
||||||
@ -66,6 +67,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I
|
|||||||
return skinParam;
|
return skinParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final HColor getBackcolor() {
|
public final HColor getBackcolor() {
|
||||||
return skinParam.getBackgroundColor();
|
return skinParam.getBackgroundColor();
|
||||||
}
|
}
|
||||||
@ -74,10 +76,12 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I
|
|||||||
return entity.getStereotype();
|
return entity.getStereotype();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Margins getShield(StringBounder stringBounder) {
|
public Margins getShield(StringBounder stringBounder) {
|
||||||
return Margins.NONE;
|
return Margins.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double getOverscanX(StringBounder stringBounder) {
|
public double getOverscanX(StringBounder stringBounder) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -81,11 +81,11 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn
|
|||||||
|
|
||||||
Dimension2D add(Dimension2D orig, Dimension2D other) {
|
Dimension2D add(Dimension2D orig, Dimension2D other) {
|
||||||
if (this == VERTICAL) {
|
if (this == VERTICAL) {
|
||||||
return new Dimension2DDouble(orig.getWidth() + other.getWidth(), Math.max(orig.getHeight(),
|
return new Dimension2DDouble(orig.getWidth() + other.getWidth(),
|
||||||
other.getHeight()));
|
Math.max(orig.getHeight(), other.getHeight()));
|
||||||
}
|
}
|
||||||
return new Dimension2DDouble(Math.max(orig.getWidth(), other.getWidth()), orig.getHeight()
|
return new Dimension2DDouble(Math.max(orig.getWidth(), other.getWidth()),
|
||||||
+ other.getHeight());
|
orig.getHeight() + other.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawSeparator(UGraphic ug, Dimension2D dimTotal) {
|
void drawSeparator(UGraphic ug, Dimension2D dimTotal) {
|
||||||
@ -155,7 +155,7 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn
|
|||||||
public ShapeType getShapeType() {
|
public ShapeType getShapeType() {
|
||||||
return ShapeType.RECTANGLE;
|
return ShapeType.RECTANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getOverscanX(StringBounder stringBounder) {
|
public double getOverscanX(StringBounder stringBounder) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,11 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
|
|||||||
|
|
||||||
Dimension2D add(Dimension2D orig, Dimension2D other) {
|
Dimension2D add(Dimension2D orig, Dimension2D other) {
|
||||||
if (this == VERTICAL) {
|
if (this == VERTICAL) {
|
||||||
return new Dimension2DDouble(orig.getWidth() + other.getWidth(), Math.max(orig.getHeight(),
|
return new Dimension2DDouble(orig.getWidth() + other.getWidth(),
|
||||||
other.getHeight()));
|
Math.max(orig.getHeight(), other.getHeight()));
|
||||||
}
|
}
|
||||||
return new Dimension2DDouble(Math.max(orig.getWidth(), other.getWidth()), orig.getHeight()
|
return new Dimension2DDouble(Math.max(orig.getWidth(), other.getWidth()),
|
||||||
+ other.getHeight());
|
orig.getHeight() + other.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawSeparator(UGraphic ug, Dimension2D dimTotal) {
|
void drawSeparator(UGraphic ug, Dimension2D dimTotal) {
|
||||||
@ -141,7 +141,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
|
|||||||
public HColor getBackcolor() {
|
public HColor getBackcolor() {
|
||||||
return skinParam.getBackgroundColor();
|
return skinParam.getBackgroundColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getOverscanX(StringBounder stringBounder) {
|
public double getOverscanX(StringBounder stringBounder) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -157,4 +157,5 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
|
|||||||
public ShapeType getShapeType() {
|
public ShapeType getShapeType() {
|
||||||
return ShapeType.RECTANGLE;
|
return ShapeType.RECTANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,12 +53,11 @@ public class EntityImageProtected extends AbstractTextBlock implements IEntityIm
|
|||||||
private final double border;
|
private final double border;
|
||||||
private final Bibliotekon bibliotekon;
|
private final Bibliotekon bibliotekon;
|
||||||
private final Neighborhood neighborhood;
|
private final Neighborhood neighborhood;
|
||||||
|
|
||||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EntityImageProtected(IEntityImage orig, double border, Neighborhood neighborhood, Bibliotekon bibliotekon) {
|
public EntityImageProtected(IEntityImage orig, double border, Neighborhood neighborhood, Bibliotekon bibliotekon) {
|
||||||
this.orig = orig;
|
this.orig = orig;
|
||||||
this.border = border;
|
this.border = border;
|
||||||
@ -94,10 +93,9 @@ public class EntityImageProtected extends AbstractTextBlock implements IEntityIm
|
|||||||
public Margins getShield(StringBounder stringBounder) {
|
public Margins getShield(StringBounder stringBounder) {
|
||||||
return orig.getShield(stringBounder);
|
return orig.getShield(stringBounder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getOverscanX(StringBounder stringBounder) {
|
public double getOverscanX(StringBounder stringBounder) {
|
||||||
return orig.getOverscanX(stringBounder);
|
return orig.getOverscanX(stringBounder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -47,7 +47,7 @@ public interface IEntityImage extends Hideable, TextBlockBackcolored {
|
|||||||
public ShapeType getShapeType();
|
public ShapeType getShapeType();
|
||||||
|
|
||||||
public Margins getShield(StringBounder stringBounder);
|
public Margins getShield(StringBounder stringBounder);
|
||||||
|
|
||||||
public double getOverscanX(StringBounder stringBounder);
|
public double getOverscanX(StringBounder stringBounder);
|
||||||
|
|
||||||
}
|
}
|
@ -63,8 +63,7 @@ public final class InnerActivity extends AbstractTextBlock implements IEntityIma
|
|||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
final Dimension2D total = calculateDimension(ug.getStringBounder());
|
final Dimension2D total = calculateDimension(ug.getStringBounder());
|
||||||
|
|
||||||
ug = ug.apply(backColor.bg()).apply(borderColor)
|
ug = ug.apply(backColor.bg()).apply(borderColor).apply(new UStroke(THICKNESS_BORDER));
|
||||||
.apply(new UStroke(THICKNESS_BORDER));
|
|
||||||
final URectangle rect = new URectangle(total.getWidth(), total.getHeight()).rounded(IEntityImage.CORNER);
|
final URectangle rect = new URectangle(total.getWidth(), total.getHeight()).rounded(IEntityImage.CORNER);
|
||||||
rect.setDeltaShadow(shadowing);
|
rect.setDeltaShadow(shadowing);
|
||||||
ug.draw(rect);
|
ug.draw(rect);
|
||||||
|
@ -39,14 +39,16 @@ public class PortGeometry {
|
|||||||
|
|
||||||
private final double position;
|
private final double position;
|
||||||
private final double height;
|
private final double height;
|
||||||
|
private final int score;
|
||||||
|
|
||||||
public PortGeometry(double position, double height) {
|
public PortGeometry(double position, double height, int score) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
this.score = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortGeometry translateY(double deltaY) {
|
public PortGeometry translateY(double deltaY) {
|
||||||
return new PortGeometry(position + deltaY, height);
|
return new PortGeometry(position + deltaY, height, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,4 +68,8 @@ public class PortGeometry {
|
|||||||
return position + height;
|
return position + height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final int getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -37,6 +37,7 @@ package net.sourceforge.plantuml.svek;
|
|||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.SignatureUtils;
|
import net.sourceforge.plantuml.SignatureUtils;
|
||||||
@ -45,10 +46,6 @@ public class Ports {
|
|||||||
|
|
||||||
private final Map<String, PortGeometry> ids = new LinkedHashMap<String, PortGeometry>();
|
private final Map<String, PortGeometry> ids = new LinkedHashMap<String, PortGeometry>();
|
||||||
|
|
||||||
public void addThis(Ports other) {
|
|
||||||
ids.putAll(other.ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String encodePortNameToId(String portName) {
|
public static String encodePortNameToId(String portName) {
|
||||||
return "p" + SignatureUtils.getMD5Hex(portName);
|
return "p" + SignatureUtils.getMD5Hex(portName);
|
||||||
}
|
}
|
||||||
@ -66,9 +63,20 @@ public class Ports {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(String portName, double position, double height) {
|
public void add(String portName, int score, double position, double height) {
|
||||||
final String id = encodePortNameToId(Objects.requireNonNull(portName));
|
final String id = encodePortNameToId(Objects.requireNonNull(portName));
|
||||||
ids.put(id, new PortGeometry(position, height));
|
final PortGeometry already = ids.get(id);
|
||||||
|
if (already == null || already.getScore() < score)
|
||||||
|
ids.put(id, new PortGeometry(position, height, score));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addThis(Ports other) {
|
||||||
|
for (Entry<String, PortGeometry> ent : other.ids.entrySet()) {
|
||||||
|
final String key = ent.getKey();
|
||||||
|
final PortGeometry already = ids.get(key);
|
||||||
|
if (already == null || already.getScore() < ent.getValue().getScore())
|
||||||
|
ids.put(key, ent.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, PortGeometry> getAllWithEncodedPortId() {
|
public Map<String, PortGeometry> getAllWithEncodedPortId() {
|
||||||
|
@ -232,6 +232,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final Dimension2D dimHeader = header.calculateDimension(stringBounder);
|
final Dimension2D dimHeader = header.calculateDimension(stringBounder);
|
||||||
if (body instanceof WithPorts)
|
if (body instanceof WithPorts)
|
||||||
|
@ -129,6 +129,7 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final Dimension2D dimTitle = getTitleDimension(stringBounder);
|
final Dimension2D dimTitle = getTitleDimension(stringBounder);
|
||||||
return ((WithPorts) entries).getPorts(stringBounder).translateY(dimTitle.getHeight());
|
return ((WithPorts) entries).getPorts(stringBounder).translateY(dimTitle.getHeight());
|
||||||
|
@ -49,9 +49,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
|||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
|
||||||
import net.sourceforge.plantuml.style.Style;
|
|
||||||
import net.sourceforge.plantuml.style.StyleSignature;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGroupType;
|
import net.sourceforge.plantuml.ugraphic.UGroupType;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.geom.Dimension2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.FontParam;
|
import net.sourceforge.plantuml.FontParam;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.LineConfigurable;
|
|
||||||
import net.sourceforge.plantuml.SkinParamUtils;
|
import net.sourceforge.plantuml.SkinParamUtils;
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 1;
|
final int beta = 2;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user