mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
Version 7232
This commit is contained in:
parent
7cee7b4601
commit
4af6019e04
2
pom.xml
2
pom.xml
@ -36,7 +36,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>6242-SNAPSHOT</version>
|
||||
<version>7232-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
|
@ -71,5 +71,7 @@ public interface ISkinParam {
|
||||
public GraphvizLayoutStrategy getStrategy();
|
||||
|
||||
public boolean isSvek();
|
||||
|
||||
public boolean shadowing();
|
||||
|
||||
}
|
@ -43,4 +43,17 @@ public class MathUtils {
|
||||
return Math.max(Math.max(a, b), c);
|
||||
}
|
||||
|
||||
public static double limitation(double v, double min, double max) {
|
||||
if (min >= max) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (v < min) {
|
||||
return min;
|
||||
}
|
||||
if (v > max) {
|
||||
return max;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7135 $
|
||||
* Revision $Revision: 7231 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7180 $
|
||||
* Revision $Revision: 7230 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -351,4 +351,12 @@ public class SkinParam implements ISkinParam {
|
||||
return "true".equalsIgnoreCase(value);
|
||||
}
|
||||
|
||||
public boolean shadowing() {
|
||||
final String value = getValue("shadowing");
|
||||
if ("false".equalsIgnoreCase(value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -123,4 +123,8 @@ public class SkinParamBackcolored implements ISkinParam {
|
||||
return skinParam.isSvek();
|
||||
}
|
||||
|
||||
public boolean shadowing() {
|
||||
return skinParam.shadowing();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -119,4 +119,8 @@ public class SkinParamBackcoloredReference implements ISkinParam {
|
||||
return skinParam.isSvek();
|
||||
}
|
||||
|
||||
public boolean shadowing() {
|
||||
return skinParam.shadowing();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,13 +28,14 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6939 $
|
||||
* Revision $Revision: 7221 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
@ -120,25 +121,25 @@ public class Link implements Imaged {
|
||||
// final int x = cl1.getXposition();
|
||||
// cl2.setXposition(x-1);
|
||||
// }
|
||||
final Link result = new Link(cl2, cl1, type.getInv(), label, length, qualifier2, qualifier1, labeldistance,
|
||||
labelangle, specificColor);
|
||||
final Link result = new Link(cl2, cl1, getType().getInv(), label, length, qualifier2, qualifier1,
|
||||
labeldistance, labelangle, specificColor);
|
||||
result.inverted = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Link getDashed() {
|
||||
return new Link(cl1, cl2, type.getDashed(), label, length, qualifier1, qualifier2, labeldistance, labelangle,
|
||||
specificColor);
|
||||
return new Link(cl1, cl2, getType().getDashed(), label, length, qualifier1, qualifier2, labeldistance,
|
||||
labelangle, specificColor);
|
||||
}
|
||||
|
||||
public Link getDotted() {
|
||||
return new Link(cl1, cl2, type.getDotted(), label, length, qualifier1, qualifier2, labeldistance, labelangle,
|
||||
specificColor);
|
||||
return new Link(cl1, cl2, getType().getDotted(), label, length, qualifier1, qualifier2, labeldistance,
|
||||
labelangle, specificColor);
|
||||
}
|
||||
|
||||
public Link getBold() {
|
||||
return new Link(cl1, cl2, type.getBold(), label, length, qualifier1, qualifier2, labeldistance, labelangle,
|
||||
specificColor);
|
||||
return new Link(cl1, cl2, getType().getBold(), label, length, qualifier1, qualifier2, labeldistance,
|
||||
labelangle, specificColor);
|
||||
}
|
||||
|
||||
public String getLabeldistance() {
|
||||
@ -180,7 +181,7 @@ public class Link implements Imaged {
|
||||
if (this.cl1 == ent1 && this.cl2 == ent2) {
|
||||
return this;
|
||||
}
|
||||
return new Link(ent1, ent2, type, label, length, qualifier1, qualifier2, labeldistance, labelangle);
|
||||
return new Link(ent1, ent2, getType(), label, length, qualifier1, qualifier2, labeldistance, labelangle);
|
||||
}
|
||||
|
||||
public boolean isBetween(IEntity cl1, IEntity cl2) {
|
||||
@ -207,6 +208,9 @@ public class Link implements Imaged {
|
||||
}
|
||||
|
||||
public LinkType getType() {
|
||||
if (opale) {
|
||||
return new LinkType(LinkDecor.NONE, LinkDecor.NONE);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -319,13 +323,13 @@ public class Link implements Imaged {
|
||||
|
||||
public double getMarginDecors1(StringBounder stringBounder, UFont fontQualif) {
|
||||
final double q = getQualifierMargin(stringBounder, fontQualif, qualifier1);
|
||||
final LinkDecor decor = type.getDecor1();
|
||||
final LinkDecor decor = getType().getDecor1();
|
||||
return decor.getSize() + q;
|
||||
}
|
||||
|
||||
public double getMarginDecors2(StringBounder stringBounder, UFont fontQualif) {
|
||||
final double q = getQualifierMargin(stringBounder, fontQualif, qualifier2);
|
||||
final LinkDecor decor = type.getDecor2();
|
||||
final LinkDecor decor = getType().getDecor2();
|
||||
return decor.getSize() + q;
|
||||
}
|
||||
|
||||
@ -354,4 +358,24 @@ public class Link implements Imaged {
|
||||
public final void setConstraint(boolean constraint) {
|
||||
this.constraint = constraint;
|
||||
}
|
||||
|
||||
private boolean opale;
|
||||
|
||||
public void setOpale(boolean opale) {
|
||||
this.opale = opale;
|
||||
}
|
||||
|
||||
static public boolean onlyOneLink(IEntity ent, Collection<Link> links) {
|
||||
int nb = 0;
|
||||
for (Link link : links) {
|
||||
if (link.contains(ent)) {
|
||||
nb++;
|
||||
}
|
||||
if (nb > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return nb == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -164,15 +164,15 @@ public class LinkType {
|
||||
sb.append(",arrowsize=1.5");
|
||||
}
|
||||
|
||||
if (style == LinkStyle.DASHED) {
|
||||
sb.append(",style=dashed");
|
||||
}
|
||||
if (style == LinkStyle.DOTTED) {
|
||||
sb.append(",style=dotted,");
|
||||
}
|
||||
if (style == LinkStyle.BOLD) {
|
||||
sb.append(",style=bold,");
|
||||
}
|
||||
// if (style == LinkStyle.DASHED) {
|
||||
// sb.append(",style=dashed");
|
||||
// }
|
||||
// if (style == LinkStyle.DOTTED) {
|
||||
// sb.append(",style=dotted,");
|
||||
// }
|
||||
// if (style == LinkStyle.BOLD) {
|
||||
// sb.append(",style=bold,");
|
||||
// }
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.ShadowManager;
|
||||
import net.sourceforge.plantuml.ugraphic.UGradient;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.USegment;
|
||||
import net.sourceforge.plantuml.ugraphic.USegmentType;
|
||||
|
||||
public class EpsGraphics {
|
||||
|
||||
@ -249,6 +253,57 @@ public class EpsGraphics {
|
||||
}
|
||||
}
|
||||
|
||||
public void epsPath(double x, double y, UPath path) {
|
||||
checkCloseDone();
|
||||
if (fillcolor != null) {
|
||||
appendColor(fillcolor);
|
||||
append("newpath", true);
|
||||
for (USegment seg : path) {
|
||||
final USegmentType type = seg.getSegmentType();
|
||||
final double coord[] = seg.getCoord();
|
||||
if (type == USegmentType.SEG_MOVETO) {
|
||||
movetoNoMacro(coord[0] + x, coord[1] + y);
|
||||
} else if (type == USegmentType.SEG_LINETO) {
|
||||
linetoNoMacro(coord[0] + x, coord[1] + y);
|
||||
} else if (type == USegmentType.SEG_QUADTO) {
|
||||
throw new UnsupportedOperationException();
|
||||
} else if (type == USegmentType.SEG_CUBICTO) {
|
||||
curvetoNoMacro(coord[0] + x, coord[1] + y, coord[2] + x, coord[3] + y, coord[4] + x, coord[5] + y);
|
||||
} else if (type == USegmentType.SEG_CLOSE) {
|
||||
// Nothing
|
||||
} else {
|
||||
System.err.println("unknown " + seg);
|
||||
}
|
||||
}
|
||||
append("closepath eofill", true);
|
||||
}
|
||||
|
||||
if (color != null) {
|
||||
append(strokeWidth + " setlinewidth", true);
|
||||
appendColor(color);
|
||||
append("newpath", true);
|
||||
for (USegment seg : path) {
|
||||
final USegmentType type = seg.getSegmentType();
|
||||
final double coord[] = seg.getCoord();
|
||||
if (type == USegmentType.SEG_MOVETO) {
|
||||
movetoNoMacro(coord[0] + x, coord[1] + y);
|
||||
} else if (type == USegmentType.SEG_LINETO) {
|
||||
linetoNoMacro(coord[0] + x, coord[1] + y);
|
||||
} else if (type == USegmentType.SEG_QUADTO) {
|
||||
throw new UnsupportedOperationException();
|
||||
} else if (type == USegmentType.SEG_CUBICTO) {
|
||||
curvetoNoMacro(coord[0] + x, coord[1] + y, coord[2] + x, coord[3] + y, coord[4] + x, coord[5] + y);
|
||||
} else if (type == USegmentType.SEG_CLOSE) {
|
||||
// Nothing
|
||||
} else {
|
||||
System.err.println("unknown " + seg);
|
||||
}
|
||||
}
|
||||
append("closepath stroke", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void epsPolygon(double... points) {
|
||||
checkCloseDone();
|
||||
double lastX = 0;
|
||||
@ -455,11 +510,11 @@ public class EpsGraphics {
|
||||
body.append(s + "\n");
|
||||
}
|
||||
|
||||
// final public void linetoNoMacro(double x1, double y1) {
|
||||
// append(format(x1) + " " + format(y1) + " lineto", true);
|
||||
// ensureVisible(x1, y1);
|
||||
// }
|
||||
//
|
||||
final public void linetoNoMacro(double x1, double y1) {
|
||||
append(format(x1) + " " + format(y1) + " lineto", true);
|
||||
ensureVisible(x1, y1);
|
||||
}
|
||||
|
||||
final public void movetoNoMacro(double x1, double y1) {
|
||||
append(format(x1) + " " + format(y1) + " moveto", true);
|
||||
ensureVisible(x1, y1);
|
||||
@ -622,4 +677,36 @@ public class EpsGraphics {
|
||||
this.urlArea = new UrlArea(url);
|
||||
}
|
||||
|
||||
// Shadow
|
||||
final private ShadowManager shadowManager = new ShadowManager(50, 200);
|
||||
|
||||
public void epsRectangleShadow(double x, double y, double width, double height, double rx, double ry,
|
||||
double deltaShadow) {
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(shadowManager.getColor(i, deltaShadow));
|
||||
final double diff = i;
|
||||
epsRectangle(x + deltaShadow + diff, y + deltaShadow + diff, width - 2 * diff, height - 2 * diff, rx + 1,
|
||||
ry + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void epsPolygonShadow(double deltaShadow, double... points) {
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(shadowManager.getColor(i, deltaShadow));
|
||||
final double diff = i;
|
||||
epsPolygon(shadowManager.getShadowDeltaPoints(deltaShadow, diff, points));
|
||||
}
|
||||
}
|
||||
|
||||
public void epsEllipseShadow(double x, double y, double xRadius, double yRadius, double deltaShadow) {
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(shadowManager.getColor(i, deltaShadow));
|
||||
final double diff = i;
|
||||
epsEllipse(x + deltaShadow, y + deltaShadow, xRadius - diff, yRadius - diff);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
}
|
||||
|
||||
private boolean hasSmallIcon() {
|
||||
if (skinParam.classAttributeIconSize() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (Member m : members) {
|
||||
if (m.getVisibilityModifier() != null) {
|
||||
return true;
|
||||
@ -87,7 +90,7 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
for (Member m : members) {
|
||||
final String s = m.getDisplayWithoutVisibilityChar();
|
||||
final String s = getDisplay(m);
|
||||
final TextBlock bloc = createTextBlock(s);
|
||||
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
||||
y += dim.getHeight();
|
||||
@ -114,7 +117,7 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
group = new UGroup(new PlacementStrategyVisibility(ug.getStringBounder(), skinParam
|
||||
.getCircledCharacterRadius() + 3));
|
||||
for (Member att : members) {
|
||||
final String s = att.getDisplayWithoutVisibilityChar();
|
||||
final String s = getDisplay(att);
|
||||
final TextBlock bloc = createTextBlock(s);
|
||||
final VisibilityModifier modifier = att.getVisibilityModifier();
|
||||
group.add(getUBlock(modifier));
|
||||
@ -123,7 +126,7 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
} else {
|
||||
group = new UGroup(new PlacementStrategyY1Y2Left(ug.getStringBounder()));
|
||||
for (Member att : members) {
|
||||
final String s = att.getDisplayWithoutVisibilityChar();
|
||||
final String s = getDisplay(att);
|
||||
final TextBlock bloc = createTextBlock(s);
|
||||
group.add(bloc);
|
||||
}
|
||||
@ -132,6 +135,11 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
|
||||
}
|
||||
|
||||
private String getDisplay(Member att) {
|
||||
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
|
||||
return att.getDisplay(withVisibilityChar);
|
||||
}
|
||||
|
||||
private TextBlock getUBlock(final VisibilityModifier modifier) {
|
||||
if (modifier == null) {
|
||||
return new TextBlock() {
|
||||
@ -152,7 +160,7 @@ public class MethodsOrFieldsArea2 implements TextBlock {
|
||||
.getBackground());
|
||||
final HtmlColor fore = rose.getHtmlColor(skinParam, modifier.getForeground());
|
||||
|
||||
final TextBlock uBlock = modifier.getUBlock(skinParam.getCircledCharacterRadius(), fore, back);
|
||||
final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back);
|
||||
return uBlock;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3833 $
|
||||
* Revision $Revision: 7205 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph2;
|
||||
@ -140,7 +140,16 @@ public class GeomUtils {
|
||||
final int x = (int) pt.getX() - 1;
|
||||
final int y = (int) pt.getY() - 1;
|
||||
g2d.fillOval(x, y, 3, 3);
|
||||
|
||||
}
|
||||
|
||||
public static double getOrthoDistance(Line2D.Double seg, Point2D pt) {
|
||||
if (isHorizontal(seg)) {
|
||||
return Math.abs(seg.getP1().getY() - pt.getY());
|
||||
}
|
||||
if (isVertical(seg)) {
|
||||
return Math.abs(seg.getP1().getX() - pt.getX());
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -95,5 +95,10 @@ public class Block implements Clusterable {
|
||||
public final void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -151,5 +151,9 @@ public class Cluster implements Clusterable {
|
||||
return titleHeight;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.USegmentType;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public class DotPath implements UShape {
|
||||
public class DotPath implements UShape, Moveable {
|
||||
|
||||
static class TriPoints {
|
||||
public TriPoints(String p1, String p2, String p, double deltaY) {
|
||||
@ -84,11 +84,72 @@ public class DotPath implements UShape {
|
||||
|
||||
private final List<CubicCurve2D.Double> beziers = new ArrayList<CubicCurve2D.Double>();
|
||||
|
||||
public DotPath() {
|
||||
this(new ArrayList<CubicCurve2D.Double>());
|
||||
}
|
||||
|
||||
public DotPath(DotPath other) {
|
||||
this(new ArrayList<CubicCurve2D.Double>());
|
||||
for (CubicCurve2D.Double c : other.beziers) {
|
||||
this.beziers.add(new CubicCurve2D.Double(c.x1, c.y1, c.ctrlx1, c.ctrly1, c.ctrlx2, c.ctrly2, c.x2, c.y2));
|
||||
}
|
||||
}
|
||||
|
||||
private DotPath(List<CubicCurve2D.Double> beziers) {
|
||||
this.beziers.addAll(beziers);
|
||||
}
|
||||
|
||||
public DotPath(String init, double deltaY) {
|
||||
if (init.startsWith("M") == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final int posC = init.indexOf("C");
|
||||
if (posC == -1) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final StringTokenizer st = new StringTokenizer(init.substring(1, posC), ",");
|
||||
final double startX = Double.parseDouble(st.nextToken());
|
||||
final double startY = Double.parseDouble(st.nextToken()) + deltaY;
|
||||
|
||||
final StringTokenizer st2 = new StringTokenizer(init.substring(posC + 1), " ");
|
||||
final List<TriPoints> triPoints = new ArrayList<TriPoints>();
|
||||
while (st2.hasMoreTokens()) {
|
||||
final String p1 = st2.nextToken();
|
||||
final String p2 = st2.nextToken();
|
||||
final String p = st2.nextToken();
|
||||
triPoints.add(new TriPoints(p1, p2, p, deltaY));
|
||||
}
|
||||
double x = startX;
|
||||
double y = startY;
|
||||
for (TriPoints p : triPoints) {
|
||||
final CubicCurve2D.Double bezier = new CubicCurve2D.Double(x, y, p.x1, p.y1, p.x2, p.y2, p.x, p.y);
|
||||
beziers.add(bezier);
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
// this.print = triPoints.toString();
|
||||
}
|
||||
|
||||
// private final String print;
|
||||
|
||||
public Point2D getStartPoint() {
|
||||
return beziers.get(0).getP1();
|
||||
}
|
||||
|
||||
public void forceStartPoint(double x, double y) {
|
||||
beziers.get(0).x1 = x;
|
||||
beziers.get(0).y1 = y;
|
||||
}
|
||||
|
||||
public Point2D getEndPoint() {
|
||||
return beziers.get(beziers.size() - 1).getP2();
|
||||
}
|
||||
|
||||
public void forceEndPoint(double x, double y) {
|
||||
beziers.get(beziers.size() - 1).x2 = x;
|
||||
beziers.get(beziers.size() - 1).y2 = y;
|
||||
}
|
||||
|
||||
|
||||
public MinMax getMinMax() {
|
||||
final MinMax result = new MinMax();
|
||||
@ -125,14 +186,6 @@ public class DotPath implements UShape {
|
||||
|
||||
}
|
||||
|
||||
public DotPath() {
|
||||
this(new ArrayList<CubicCurve2D.Double>());
|
||||
}
|
||||
|
||||
public Point2D getEndPoint() {
|
||||
return beziers.get(beziers.size() - 1).getP2();
|
||||
}
|
||||
|
||||
public Line2D getEndTangeante() {
|
||||
final CubicCurve2D.Double last = beziers.get(beziers.size() - 1);
|
||||
double dx = last.x2 - last.ctrlx2;
|
||||
@ -191,47 +244,6 @@ public class DotPath implements UShape {
|
||||
return new DotPath(copy);
|
||||
}
|
||||
|
||||
private DotPath(List<CubicCurve2D.Double> beziers) {
|
||||
this.beziers.addAll(beziers);
|
||||
// this.print = super.toString();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return print;
|
||||
// }
|
||||
|
||||
public DotPath(String init, double deltaY) {
|
||||
if (init.startsWith("M") == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final int posC = init.indexOf("C");
|
||||
if (posC == -1) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final StringTokenizer st = new StringTokenizer(init.substring(1, posC), ",");
|
||||
final double startX = Double.parseDouble(st.nextToken());
|
||||
final double startY = Double.parseDouble(st.nextToken()) + deltaY;
|
||||
|
||||
final StringTokenizer st2 = new StringTokenizer(init.substring(posC + 1), " ");
|
||||
final List<TriPoints> triPoints = new ArrayList<TriPoints>();
|
||||
while (st2.hasMoreTokens()) {
|
||||
final String p1 = st2.nextToken();
|
||||
final String p2 = st2.nextToken();
|
||||
final String p = st2.nextToken();
|
||||
triPoints.add(new TriPoints(p1, p2, p, deltaY));
|
||||
}
|
||||
double x = startX;
|
||||
double y = startY;
|
||||
for (TriPoints p : triPoints) {
|
||||
final CubicCurve2D.Double bezier = new CubicCurve2D.Double(x, y, p.x1, p.y1, p.x2, p.y2, p.x, p.y);
|
||||
beziers.add(bezier);
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
// this.print = triPoints.toString();
|
||||
}
|
||||
|
||||
public Map<Point2D, Double> somePoints() {
|
||||
final Map<Point2D, Double> result = new HashMap<Point2D, Double>();
|
||||
for (CubicCurve2D.Double bez : beziers) {
|
||||
@ -429,4 +441,17 @@ public class DotPath implements UShape {
|
||||
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
for (int i = 0; i < beziers.size(); i++) {
|
||||
final CubicCurve2D.Double c = beziers.get(i);
|
||||
beziers.set(i, new CubicCurve2D.Double(c.x1 + deltaX, c.y1 + deltaY, c.ctrlx1 + deltaX, c.ctrly1 + deltaY,
|
||||
c.ctrlx2 + deltaX, c.ctrly2 + deltaY, c.x2 + deltaX, c.y2 + deltaY));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final List<CubicCurve2D.Double> getBeziers() {
|
||||
return Collections.unmodifiableList(beziers);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,5 +81,10 @@ public class Label implements Positionable {
|
||||
public final void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ public class MargedBlock {
|
||||
this.imageBlock = imageBlock;
|
||||
this.marginDecorator = marginDecorator;
|
||||
this.imageDimension = imageBlock.getDimension(stringBounder);
|
||||
this.block = new Block(uid++, imageDimension.getWidth() + 2
|
||||
* marginDecorator, imageDimension.getHeight() + 2
|
||||
this.block = new Block(uid++, imageDimension.getWidth() + 2 * marginDecorator, imageDimension.getHeight() + 2
|
||||
* marginDecorator, parent);
|
||||
}
|
||||
|
||||
@ -63,7 +62,7 @@ public class MargedBlock {
|
||||
public double getMarginDecorator() {
|
||||
return marginDecorator;
|
||||
}
|
||||
|
||||
|
||||
public IEntityImageBlock getImageBlock() {
|
||||
return imageBlock;
|
||||
}
|
||||
@ -77,9 +76,11 @@ public class MargedBlock {
|
||||
|
||||
public Point2D getPosition() {
|
||||
Point2D pos = block.getPosition();
|
||||
return new Point2D.Double(pos.getX() + marginDecorator, pos
|
||||
.getY()
|
||||
+ marginDecorator);
|
||||
return new Point2D.Double(pos.getX() + marginDecorator, pos.getY() + marginDecorator);
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
40
src/net/sourceforge/plantuml/posimo/Moveable.java
Normal file
40
src/net/sourceforge/plantuml/posimo/Moveable.java
Normal file
@ -0,0 +1,40 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* 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 Lesser 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4236 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.posimo;
|
||||
|
||||
public interface Moveable {
|
||||
|
||||
void moveSvek(double deltaX, double deltaY);
|
||||
|
||||
}
|
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.posimo;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
public interface Positionable {
|
||||
public interface Positionable extends Moveable {
|
||||
|
||||
public Dimension2D getSize();
|
||||
|
||||
|
@ -59,4 +59,8 @@ public class PositionableImpl implements Positionable {
|
||||
return dim;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
this.pos.setLocation(pos.getX() + deltaX, pos.getY() + deltaY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,6 +109,10 @@ public class PositionableUtils {
|
||||
public Dimension2D getSize() {
|
||||
return Dimension2DDouble.delta(pos.getSize(), 2 * widthMargin, 2 * heightMargin);
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
pos.moveSvek(deltaX, deltaY);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ public class PostIt {
|
||||
|
||||
final SkinParam param = new SkinParam(null);
|
||||
final UFont fontNote = param.getFont(FontParam.NOTE, null);
|
||||
final ComponentRoseNote note = new ComponentRoseNote(noteBackgroundColor, borderColor, HtmlColor.BLACK, fontNote,
|
||||
text);
|
||||
final ComponentRoseNote note = new ComponentRoseNote(noteBackgroundColor, borderColor, HtmlColor.BLACK,
|
||||
fontNote, text, 0, 0);
|
||||
return note;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (display == null) {
|
||||
display = Arrays.asList(code);
|
||||
// display = Arrays.asList(code);
|
||||
display = StringUtils.getWithNewlines(code);
|
||||
}
|
||||
final Participant result = new Participant(type, code, display);
|
||||
participants.put(code, result);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6494 $
|
||||
* Revision $Revision: 7229 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -60,6 +60,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandNoteSequence;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA2;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA3;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA4;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceMultilinesOverSeveral;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceOverSeveral;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
|
||||
@ -78,6 +79,7 @@ public class SequenceDiagramFactory extends AbstractUmlSystemCommandFactory {
|
||||
addCommand(new CommandParticipantA(system));
|
||||
addCommand(new CommandParticipantA2(system));
|
||||
addCommand(new CommandParticipantA3(system));
|
||||
addCommand(new CommandParticipantA4(system));
|
||||
addCommand(new CommandArrow(system));
|
||||
addCommand(new CommandExoArrowLeft(system));
|
||||
addCommand(new CommandExoArrowRight(system));
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5884 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandActivate extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
public CommandActivate(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, "(?i)^(activate|deactivate|destroy|create)\\s+([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?$");
|
||||
super(sequenceDiagram, "(?i)^(activate|deactivate|destroy|create)\\s+([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(#\\w+)?$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4762 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -45,7 +45,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandActivate2 extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
public CommandActivate2(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, "(?i)^([\\p{L}0-9_.]+)\\s*(\\+\\+|--)\\s*(#\\w+)?$");
|
||||
super(sequenceDiagram, "(?i)^([\\p{L}0-9_.@]+)\\s*(\\+\\+|--)\\s*(#\\w+)?$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,18 +62,18 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
return new RegexConcat(
|
||||
new RegexLeaf("^"), //
|
||||
new RegexOr("PART1", //
|
||||
new RegexLeaf("PART1CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("PART1LONG", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("PART1LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("PART1LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.@]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("ARROW", "(\\$?([=-]+(>>?|//?|\\\\\\\\?)|(<<?|//?|\\\\\\\\?)[=-]+)\\$?)"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexOr("PART2", //
|
||||
new RegexLeaf("PART2CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART2CODE", "([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("PART2LONG", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("PART2LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("PART2LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("MESSAGE", "(?::\\s*(.*))?$"));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class CommandExoArrowLeft extends CommandExoArrowAny {
|
||||
public CommandExoArrowLeft(SequenceDiagram sequenceDiagram) {
|
||||
super(
|
||||
sequenceDiagram,
|
||||
"(?i)^(\\[?[=-]+(?:>>?|//?|\\\\\\\\?)|\\[?(?:<<?|//?|\\\\\\\\?)[=-]+)\\s*([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(?::\\s*(.*))?$",
|
||||
"(?i)^(\\[?[=-]+(?:>>?|//?|\\\\\\\\?)|\\[?(?:<<?|//?|\\\\\\\\?)[=-]+)\\s*([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(?::\\s*(.*))?$",
|
||||
0, 1);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CommandExoArrowRight extends CommandExoArrowAny {
|
||||
|
||||
public CommandExoArrowRight(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram,
|
||||
"(?i)^([\\p{L}0-9_.]+|\"[^\"]+\")\\s*([=-]+(?:>>?|//?|\\\\\\\\?)\\]?|(?:<<?|//?|\\\\\\\\?)[=-]+\\]?)\\s*(?::\\s*(.*))?$", 1, 0);
|
||||
"(?i)^([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*([=-]+(?:>>?|//?|\\\\\\\\?)\\]?|(?:<<?|//?|\\\\\\\\?)[=-]+\\]?)\\s*(?::\\s*(.*))?$", 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7113 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandMultilinesNote extends CommandMultilines<SequenceDiagram> {
|
||||
|
||||
public CommandMultilinesNote(final SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, "(?i)^(note|hnote|rnote)\\s+(right|left|over)\\s+(?:of\\s+)?([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?$", "(?i)^end ?(note|hnote|rnote)$");
|
||||
super(sequenceDiagram, "(?i)^(note|hnote|rnote)\\s+(right|left|over)\\s+(?:of\\s+)?([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(#\\w+)?$", "(?i)^end ?(note|hnote|rnote)$");
|
||||
}
|
||||
|
||||
public CommandExecutionResult execute(List<String> lines) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7113 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -47,7 +47,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandMultilinesNoteOverSeveral extends CommandMultilines<SequenceDiagram> {
|
||||
|
||||
public CommandMultilinesNoteOverSeveral(final SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, "(?i)^(note|hnote|rnote)\\s+over\\s+([\\p{L}0-9_.]+|\"[^\"]+\")\\s*\\,\\s*([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?$", "(?i)^end ?(note|hnote|rnote)$");
|
||||
super(sequenceDiagram, "(?i)^(note|hnote|rnote)\\s+over\\s+([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*\\,\\s*([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(#\\w+)?$", "(?i)^end ?(note|hnote|rnote)$");
|
||||
}
|
||||
|
||||
public CommandExecutionResult execute(List<String> lines) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7113 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -49,7 +49,7 @@ public class CommandNoteOverSeveral extends SingleLineCommand<SequenceDiagram> {
|
||||
public CommandNoteOverSeveral(SequenceDiagram sequenceDiagram) {
|
||||
super(
|
||||
sequenceDiagram,
|
||||
"(?i)^(note|hnote|rnote)\\s+over\\s+([\\p{L}0-9_.]+|\"[^\"]+\")\\s*\\,\\s*([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?\\s*:\\s*(.*)$");
|
||||
"(?i)^(note|hnote|rnote)\\s+over\\s+([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*\\,\\s*([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(#\\w+)?\\s*:\\s*(.*)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7113 $
|
||||
* Revision $Revision: 7225 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
@ -49,7 +49,7 @@ public class CommandNoteSequence extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
public CommandNoteSequence(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram,
|
||||
"(?i)^(note|hnote|rnote)\\s+(right|left|over)\\s+(?:of\\s+)?([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(#\\w+)?\\s*:\\s*(.*)$");
|
||||
"(?i)^(note|hnote|rnote)\\s+(right|left|over)\\s+(?:of\\s+)?([\\p{L}0-9_.@]+|\"[^\"]+\")\\s*(#\\w+)?\\s*:\\s*(.*)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,14 +48,12 @@ import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantType;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
|
||||
|
||||
public abstract class CommandParticipant extends SingleLineCommand2<SequenceDiagram> {
|
||||
|
||||
public CommandParticipant(SequenceDiagram sequenceDiagram, RegexConcat pattern) {
|
||||
super(sequenceDiagram, pattern);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
final protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg2) {
|
||||
final String code = arg2.get("CODE").get(0);
|
||||
@ -65,7 +63,7 @@ public abstract class CommandParticipant extends SingleLineCommand2<SequenceDiag
|
||||
}
|
||||
|
||||
List<String> strings = null;
|
||||
if (arg2.get("FULL").get(0) != null) {
|
||||
if (arg2.get("FULL") != null && arg2.get("FULL").get(0) != null) {
|
||||
strings = StringUtils.getWithNewlines(arg2.get("FULL").get(0));
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CommandParticipantA extends CommandParticipant {
|
||||
new RegexLeaf("TYPE", "(participant|actor)"), //
|
||||
new RegexLeaf("\\s+"), //
|
||||
new RegexLeaf("FULL", "(?:\"([^\"]+)\"\\s+as\\s+)?"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("STEREO", "(?:\\s*(\\<\\<.*\\>\\>))?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("COLOR", "(#\\w+)?"), //
|
||||
|
@ -47,7 +47,7 @@ public class CommandParticipantA2 extends CommandParticipant {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(participant|actor)"), //
|
||||
new RegexLeaf("\\s+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("\\s+as\\s+"), //
|
||||
new RegexLeaf("FULL", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("STEREO", "(?:\\s*(\\<\\<.*\\>\\>))?"), //
|
||||
|
@ -47,8 +47,8 @@ public class CommandParticipantA3 extends CommandParticipant {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(participant|actor)"), //
|
||||
new RegexLeaf("\\s+"), //
|
||||
new RegexLeaf("FULL", "([\\p{L}0-9_.]+)\\s+as\\s+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("FULL", "([\\p{L}0-9_.@]+)\\s+as\\s+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.@]+)"), //
|
||||
new RegexLeaf("STEREO", "(?:\\s*(\\<\\<.*\\>\\>))?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("COLOR", "(#\\w+)?"), //
|
||||
|
@ -0,0 +1,58 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* 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 Lesser 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6109 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.command;
|
||||
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
|
||||
public class CommandParticipantA4 extends CommandParticipant {
|
||||
|
||||
public CommandParticipantA4(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, getRegexConcat());
|
||||
}
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(participant|actor)"), //
|
||||
new RegexLeaf("\\s+"), //
|
||||
new RegexLeaf("CODE", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("STEREO", "(?:\\s*(\\<\\<.*\\>\\>))?"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("COLOR", "(#\\w+)?"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
}
|
@ -51,7 +51,7 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines<Seq
|
||||
public CommandReferenceMultilinesOverSeveral(final SequenceDiagram sequenceDiagram) {
|
||||
super(
|
||||
sequenceDiagram,
|
||||
"(?i)^ref(#\\w+)?\\s+over\\s+((?:[\\p{L}0-9_.]+|\"[^\"]+\")(?:\\s*,\\s*(?:[\\p{L}0-9_.]+|\"[^\"]+\"))*)\\s*(#\\w+)?$",
|
||||
"(?i)^ref(#\\w+)?\\s+over\\s+((?:[\\p{L}0-9_.@]+|\"[^\"]+\")(?:\\s*,\\s*(?:[\\p{L}0-9_.@]+|\"[^\"]+\"))*)\\s*(#\\w+)?$",
|
||||
"(?i)^end ?(ref)?$");
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class CommandReferenceOverSeveral extends SingleLineCommand2<SequenceDiag
|
||||
private static RegexConcat getConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("REF", "ref(#\\w+)?\\s+over\\s+"), //
|
||||
new RegexLeaf("PARTS", "(([\\p{L}0-9_.]+|\"[^\"]+\")(\\s*,\\s*([\\p{L}0-9_.]+|\"[^\"]+\"))*)"), //
|
||||
new RegexLeaf("PARTS", "(([\\p{L}0-9_.@]+|\"[^\"]+\")(\\s*,\\s*([\\p{L}0-9_.@]+|\"[^\"]+\"))*)"), //
|
||||
new RegexLeaf("\\s*:\\s*"), //
|
||||
new RegexLeaf("URL", "(?:\\[\\[([^|]*)(?:\\|([^|]*))?\\]\\])?"), //
|
||||
new RegexLeaf("TEXT", "(.*)"), //
|
||||
|
@ -45,7 +45,7 @@ public class CommandUrl extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
public CommandUrl(SequenceDiagram diagram) {
|
||||
super(diagram,
|
||||
"(?i)^url\\s*(?:of|for)?\\s+([\\p{L}0-9_.]+|\"[^\"]+\")\\s+(?:is)?\\s*\\[\\[([^|]*)(?:\\|([^|]*))?\\]\\]$");
|
||||
"(?i)^url\\s*(?:of|for)?\\s+([\\p{L}0-9_.@]+|\"[^\"]+\")\\s+(?:is)?\\s*\\[\\[([^|]*)(?:\\|([^|]*))?\\]\\]$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7171 $
|
||||
* Revision $Revision: 7203 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -50,12 +50,16 @@ final public class ComponentRoseNote extends AbstractTextualComponent {
|
||||
private final int cornersize = 10;
|
||||
private final HtmlColor back;
|
||||
private final HtmlColor foregroundColor;
|
||||
private final double paddingX;
|
||||
private final double paddingY;
|
||||
|
||||
public ComponentRoseNote(HtmlColor back, HtmlColor foregroundColor, HtmlColor fontColor, UFont font,
|
||||
List<? extends CharSequence> strings) {
|
||||
List<? extends CharSequence> strings, double paddingX, double paddingY) {
|
||||
super(strings, fontColor, font, HorizontalAlignement.LEFT, 6, 15, 5);
|
||||
this.back = back;
|
||||
this.foregroundColor = foregroundColor;
|
||||
this.paddingX = paddingX;
|
||||
this.paddingY = paddingY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,12 +75,12 @@ final public class ComponentRoseNote extends AbstractTextualComponent {
|
||||
|
||||
@Override
|
||||
public double getPaddingX() {
|
||||
return 5;
|
||||
return paddingX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPaddingY() {
|
||||
return 5;
|
||||
return paddingY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7112 $
|
||||
* Revision $Revision: 7203 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -51,6 +51,14 @@ import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
public class Rose implements Skin {
|
||||
|
||||
private final Map<ColorParam, HtmlColor> defaultsColor = new EnumMap<ColorParam, HtmlColor>(ColorParam.class);
|
||||
|
||||
private double paddingX = 5;
|
||||
private double paddingY = 5;
|
||||
|
||||
public void setPaddingNote(double paddingX, double paddingY) {
|
||||
this.paddingX = paddingX;
|
||||
this.paddingY = paddingY;
|
||||
}
|
||||
|
||||
public Rose() {
|
||||
defaultsColor.put(ColorParam.background, HtmlColor.getColorIfValid("white"));
|
||||
@ -208,7 +216,7 @@ public class Rose implements Skin {
|
||||
final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder);
|
||||
final UFont fontNote = param.getFont(FontParam.NOTE, null);
|
||||
return new ComponentRoseNote(noteBackgroundColor, borderColor, getFontColor(param, FontParam.NOTE),
|
||||
fontNote, stringsToDisplay);
|
||||
fontNote, stringsToDisplay, paddingX, paddingY);
|
||||
}
|
||||
if (type == ComponentType.NOTE_HEXAGONAL) {
|
||||
final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground);
|
||||
|
@ -49,17 +49,23 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.OptionFlags;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Group;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.posimo.Moveable;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class Cluster {
|
||||
public class Cluster implements Moveable {
|
||||
|
||||
private final Cluster parent;
|
||||
private final Group group;
|
||||
@ -69,6 +75,28 @@ public class Cluster {
|
||||
private final int color;
|
||||
private final int colorTitle;
|
||||
|
||||
private int titleWidth;
|
||||
private int titleHeight;
|
||||
private TextBlock title;
|
||||
|
||||
private double xTitle;
|
||||
private double yTitle;
|
||||
|
||||
private double minX;
|
||||
private double minY;
|
||||
private double maxX;
|
||||
private double maxY;
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
this.xTitle += deltaX;
|
||||
this.minX += deltaX;
|
||||
this.maxX += deltaX;
|
||||
this.yTitle += deltaY;
|
||||
this.minY += deltaY;
|
||||
this.maxY += deltaY;
|
||||
|
||||
}
|
||||
|
||||
public Cluster(ColorSequence colorSequence) {
|
||||
this(null, null, false, colorSequence);
|
||||
}
|
||||
@ -140,10 +168,6 @@ public class Cluster {
|
||||
return Collections.unmodifiableList(children);
|
||||
}
|
||||
|
||||
private int titleWidth;
|
||||
private int titleHeight;
|
||||
private TextBlock title;
|
||||
|
||||
public Cluster createChild(Group g, int titleWidth, int titleHeight, TextBlock title, boolean special,
|
||||
ColorSequence colorSequence) {
|
||||
final Cluster child = new Cluster(this, g, special, colorSequence);
|
||||
@ -166,9 +190,6 @@ public class Cluster {
|
||||
return titleHeight;
|
||||
}
|
||||
|
||||
private double xTitle;
|
||||
private double yTitle;
|
||||
|
||||
public void setTitlePosition(double x, double y) {
|
||||
this.xTitle = x;
|
||||
this.yTitle = y;
|
||||
@ -180,19 +201,81 @@ public class Cluster {
|
||||
drawUState(ug, x, y, borderColor, dotData);
|
||||
return;
|
||||
}
|
||||
final UShape rect = new URectangle(maxX - minX, maxY - minY);
|
||||
if (title != null) {
|
||||
drawWithTitle(ug, x, y, borderColor, dotData);
|
||||
return;
|
||||
}
|
||||
final URectangle rect = new URectangle(maxX - minX, maxY - minY);
|
||||
if (dotData.getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(3.0);
|
||||
}
|
||||
HtmlColor stateBack = getBackColor();
|
||||
if (stateBack == null) {
|
||||
stateBack = dotData.getSkinParam().getHtmlColor(ColorParam.packageBackground, group.getStereotype());
|
||||
}
|
||||
if (stateBack == null) {
|
||||
stateBack = dotData.getSkinParam().getHtmlColor(ColorParam.background, group.getStereotype());
|
||||
}
|
||||
ug.getParam().setBackcolor(stateBack);
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.getParam().setStroke(new UStroke(2));
|
||||
ug.draw(x + minX, y + minY, rect);
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
if (title != null) {
|
||||
title.drawU(ug, x + xTitle, y + yTitle);
|
||||
}
|
||||
|
||||
private UPolygon getSpecificFrontier(StringBounder stringBounder) {
|
||||
final double width = maxX - minX;
|
||||
final double height = maxY - minY;
|
||||
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
|
||||
final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
||||
final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
||||
final UPolygon shape = new UPolygon();
|
||||
shape.addPoint(0, 0);
|
||||
shape.addPoint(wtitle, 0);
|
||||
shape.addPoint(wtitle + marginTitleX3, htitle);
|
||||
shape.addPoint(width, htitle);
|
||||
shape.addPoint(width, height);
|
||||
shape.addPoint(0, height);
|
||||
shape.addPoint(0, 0);
|
||||
return shape;
|
||||
}
|
||||
|
||||
// private UPolygon specificFrontier;
|
||||
//
|
||||
// public final UPolygon getSpecificFrontier() {
|
||||
// return specificFrontier;
|
||||
// }
|
||||
//
|
||||
private void drawWithTitle(UGraphic ug, double x, double y, HtmlColor borderColor, DotData dotData) {
|
||||
|
||||
// y += marginTitleY0;
|
||||
|
||||
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
|
||||
final double wtitle = dimTitle.getWidth() + marginTitleX1 + marginTitleX2;
|
||||
final double htitle = dimTitle.getHeight() + marginTitleY1 + marginTitleY2;
|
||||
final UPolygon shape = getSpecificFrontier(ug.getStringBounder());
|
||||
if (dotData.getSkinParam().shadowing()) {
|
||||
shape.setDeltaShadow(3.0);
|
||||
}
|
||||
|
||||
HtmlColor stateBack = getBackColor();
|
||||
if (stateBack == null) {
|
||||
stateBack = dotData.getSkinParam().getHtmlColor(ColorParam.packageBackground, group.getStereotype());
|
||||
}
|
||||
if (stateBack == null) {
|
||||
stateBack = dotData.getSkinParam().getHtmlColor(ColorParam.background, group.getStereotype());
|
||||
}
|
||||
if (stateBack == null) {
|
||||
stateBack = HtmlColor.WHITE;
|
||||
}
|
||||
ug.getParam().setBackcolor(stateBack);
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.getParam().setStroke(new UStroke(2));
|
||||
ug.draw(x + minX, y + minY, shape);
|
||||
// specificFrontier = shape.translate(x + minX, y + minY);
|
||||
ug.draw(x + minX, y + minY + htitle, new ULine(wtitle + marginTitleX3, 0));
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
title.drawU(ug, x + minX + marginTitleX1, y + minY + marginTitleY1);
|
||||
}
|
||||
|
||||
private HtmlColor getColor(DotData dotData, ColorParam colorParam, String stereo) {
|
||||
@ -216,11 +299,6 @@ public class Cluster {
|
||||
|
||||
}
|
||||
|
||||
private double minX;
|
||||
private double minY;
|
||||
private double maxX;
|
||||
private double maxY;
|
||||
|
||||
public void setPosition(double minX, double minY, double maxX, double maxY) {
|
||||
this.minX = minX;
|
||||
this.maxX = maxX;
|
||||
@ -291,16 +369,29 @@ public class Cluster {
|
||||
return "za" + getUid2();
|
||||
}
|
||||
|
||||
private int marginTitleX1 = 3;
|
||||
private int marginTitleX2 = 3;
|
||||
private int marginTitleX3 = 7;
|
||||
private int marginTitleY0 = 10;
|
||||
private int marginTitleY1 = 3;
|
||||
private int marginTitleY2 = 3;
|
||||
|
||||
private final boolean protection0 = true;
|
||||
private final boolean protection1 = true;
|
||||
|
||||
private void printInternal(StringBuilder sb, Collection<Line> lines) {
|
||||
if (isSpecial()) {
|
||||
subgraphCluster(sb, "a");
|
||||
}
|
||||
if (protection0) {
|
||||
subgraphCluster(sb, "p0");
|
||||
}
|
||||
sb.append("subgraph " + getClusterId() + " {");
|
||||
sb.append("style=solid;");
|
||||
sb.append("color=\"" + StringUtils.getAsHtml(color) + "\";");
|
||||
|
||||
final int titleWidth = getTitleWidth();
|
||||
final int titleHeight = getTitleHeight();
|
||||
final int titleWidth = getTitleWidth() + marginTitleX1 + marginTitleX2 + marginTitleX3;
|
||||
final int titleHeight = getTitleHeight() + marginTitleY0 + marginTitleY1 + marginTitleY2;
|
||||
if (titleHeight > 0 && titleWidth > 0) {
|
||||
sb.append("label=<");
|
||||
Line.appendTable(sb, titleWidth, titleHeight, colorTitle);
|
||||
@ -318,7 +409,13 @@ public class Cluster {
|
||||
// sb.append("}");
|
||||
subgraphCluster(sb, "i");
|
||||
}
|
||||
if (protection1) {
|
||||
subgraphCluster(sb, "p1");
|
||||
}
|
||||
printCluster(sb, lines);
|
||||
if (protection1) {
|
||||
sb.append("}");
|
||||
}
|
||||
if (isSpecial()) {
|
||||
sb.append("}");
|
||||
// subgraphCluster(sb, "zb");
|
||||
@ -331,6 +428,9 @@ public class Cluster {
|
||||
// sb.append("}");
|
||||
}
|
||||
sb.append("}");
|
||||
if (protection0) {
|
||||
sb.append("}");
|
||||
}
|
||||
if (this.isSpecial()) {
|
||||
// a
|
||||
sb.append("}");
|
||||
@ -359,7 +459,24 @@ public class Cluster {
|
||||
}
|
||||
|
||||
private final HtmlColor getBackColor() {
|
||||
return group.getBackColor();
|
||||
if (group == null) {
|
||||
return null;
|
||||
}
|
||||
final HtmlColor result = group.getBackColor();
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
return parent.getBackColor();
|
||||
}
|
||||
|
||||
public boolean isClusterOf(IEntity ent) {
|
||||
if (ent.getType() != EntityType.GROUP) {
|
||||
return false;
|
||||
}
|
||||
return group.getEntityCluster() == ent;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,65 +88,6 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
return getData().getSkinParam().getFont(fontParam, null);
|
||||
}
|
||||
|
||||
private IEntityImage createEntityImageBlock(DotData dotData, IEntity ent) {
|
||||
if (ent.getType() == EntityType.CLASS || ent.getType() == EntityType.ABSTRACT_CLASS
|
||||
|| ent.getType() == EntityType.INTERFACE || ent.getType() == EntityType.ENUM) {
|
||||
return new EntityImageClass(ent, dotData.getSkinParam(), dotData);
|
||||
}
|
||||
if (ent.getType() == EntityType.NOTE) {
|
||||
return new EntityImageNote(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ACTIVITY) {
|
||||
return new EntityImageActivity(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.STATE) {
|
||||
return new EntityImageState(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_START) {
|
||||
return new EntityImageCircleStart(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_END) {
|
||||
return new EntityImageCircleEnd(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.USECASE) {
|
||||
return new EntityImageUseCase(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.BRANCH) {
|
||||
return new EntityImageBranch(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.LOLLIPOP) {
|
||||
return new EntityImageLollipopInterface(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ACTOR) {
|
||||
return new EntityImageActor(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.COMPONENT) {
|
||||
return new EntityImageComponent(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.OBJECT) {
|
||||
return new EntityImageObject(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.SYNCHRO_BAR) {
|
||||
return new EntityImageSynchroBar(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_INTERFACE) {
|
||||
return new EntityImageCircleInterface(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.POINT_FOR_ASSOCIATION) {
|
||||
return new EntityImageAssociationPoint(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.GROUP) {
|
||||
return new EntityImageGroup(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.EMPTY_PACKAGE) {
|
||||
return new EntityImageEmptyPackage(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ASSOCIATION) {
|
||||
return new EntityImageAssociation(ent, dotData.getSkinParam());
|
||||
}
|
||||
throw new UnsupportedOperationException(ent.getType().toString());
|
||||
}
|
||||
|
||||
private DotStringFactory dotStringFactory;
|
||||
private Map<IEntity, Shape> shapeMap;
|
||||
|
||||
@ -181,7 +122,7 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
printGroups(null);
|
||||
printEntities(getUnpackagedEntities());
|
||||
|
||||
final Map<Link, Line> lineMap = new HashMap<Link, Line>();
|
||||
// final Map<Link, Line> lineMap = new HashMap<Link, Line>();
|
||||
|
||||
for (Link link : dotData.getLinks()) {
|
||||
final String shapeUid1 = getShapeUid(link.getEntity1());
|
||||
@ -200,8 +141,18 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
|
||||
final Line line = new Line(shapeUid1, shapeUid2, link, colorSequence, ltail, lhead, dotData.getSkinParam(),
|
||||
stringBounder, labelFont);
|
||||
// lineMap.put(link, line);
|
||||
dotStringFactory.addLine(line);
|
||||
lineMap.put(link, line);
|
||||
|
||||
if (link.getEntity1().getType() == EntityType.NOTE && onlyOneLink(link.getEntity1())) {
|
||||
final Shape shape = shapeMap.get(link.getEntity1());
|
||||
((EntityImageNote) shape.getImage()).setOpaleLine(line, shape);
|
||||
line.setOpale(true);
|
||||
} else if (link.getEntity2().getType() == EntityType.NOTE && onlyOneLink(link.getEntity2())) {
|
||||
final Shape shape = shapeMap.get(link.getEntity2());
|
||||
((EntityImageNote) shape.getImage()).setOpaleLine(line, shape);
|
||||
line.setOpale(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (dotStringFactory.illegalDotExe()) {
|
||||
@ -215,10 +166,16 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
} else {
|
||||
border = getColor(ColorParam.packageBorder, null);
|
||||
}
|
||||
return new SvekResult(dim, dotData, dotStringFactory, border);
|
||||
final SvekResult result = new SvekResult(dim, dotData, dotStringFactory, border);
|
||||
result.moveSvek(6, 0);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private boolean onlyOneLink(IEntity ent) {
|
||||
return Link.onlyOneLink(ent, dotData.getLinks());
|
||||
}
|
||||
|
||||
protected final HtmlColor getColor(ColorParam colorParam, String stereo) {
|
||||
return new Rose().getHtmlColor(dotData.getSkinParam(), colorParam, stereo);
|
||||
}
|
||||
@ -266,18 +223,11 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
}
|
||||
|
||||
private void printEntity(IEntity ent) {
|
||||
|
||||
final IEntityImage image;
|
||||
if (ent.getSvekImage() == null) {
|
||||
image = createEntityImageBlock(dotData, ent);
|
||||
} else {
|
||||
image = ent.getSvekImage();
|
||||
}
|
||||
final IEntityImage image = Shape.printEntity(ent, dotData);
|
||||
final Dimension2D dim = image.getDimension(stringBounder);
|
||||
final Shape shape = new Shape(image.getShapeType(), dim.getWidth(), dim.getHeight(), colorSequence,
|
||||
ent.isTop(), image.getShield());
|
||||
final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), colorSequence, ent
|
||||
.isTop(), image.getShield());
|
||||
dotStringFactory.addShape(shape);
|
||||
shape.setImage(image);
|
||||
shapeMap.put(ent, shape);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.OptionFlags;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Group;
|
||||
@ -56,8 +55,9 @@ import net.sourceforge.plantuml.cucadiagram.dot.Graphviz;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.posimo.Moveable;
|
||||
|
||||
public class DotStringFactory {
|
||||
public class DotStringFactory implements Moveable {
|
||||
|
||||
private final List<Shape> allShapes = new ArrayList<Shape>();
|
||||
private final List<Cluster> allCluster = new ArrayList<Cluster>();
|
||||
@ -66,7 +66,9 @@ public class DotStringFactory {
|
||||
|
||||
private final ColorSequence colorSequence;
|
||||
private final Cluster root;
|
||||
private final List<Line> lines = new ArrayList<Line>();
|
||||
private final List<Line> lines0 = new ArrayList<Line>();
|
||||
private final List<Line> lines1 = new ArrayList<Line>();
|
||||
private final List<Line> allLines = new ArrayList<Line>();
|
||||
private Cluster current;
|
||||
private final UmlDiagramType type;
|
||||
|
||||
@ -100,7 +102,7 @@ public class DotStringFactory {
|
||||
|
||||
private double getHorizontalDzeta() {
|
||||
double max = 0;
|
||||
for (Line l : lines) {
|
||||
for (Line l : allLines) {
|
||||
final double c = l.getHorizontalDzeta(stringBounder);
|
||||
if (c > max) {
|
||||
max = c;
|
||||
@ -111,7 +113,7 @@ public class DotStringFactory {
|
||||
|
||||
private double getVerticalDzeta() {
|
||||
double max = 0;
|
||||
for (Line l : lines) {
|
||||
for (Line l : allLines) {
|
||||
final double c = l.getVerticalDzeta(stringBounder);
|
||||
if (c > max) {
|
||||
max = c;
|
||||
@ -155,11 +157,14 @@ public class DotStringFactory {
|
||||
sb.append("compound=true;");
|
||||
SvekUtils.println(sb);
|
||||
|
||||
for (Line line : lines0) {
|
||||
line.appendLine(sb);
|
||||
}
|
||||
root.fillRankMin(rankMin);
|
||||
root.printCluster(sb, lines);
|
||||
root.printCluster(sb, allLines);
|
||||
printMinRanking(sb);
|
||||
|
||||
for (Line line : lines) {
|
||||
for (Line line : lines1) {
|
||||
line.appendLine(sb);
|
||||
}
|
||||
SvekUtils.println(sb);
|
||||
@ -193,10 +198,10 @@ public class DotStringFactory {
|
||||
final byte[] result = baos.toByteArray();
|
||||
final String s = new String(result, "UTF-8");
|
||||
|
||||
if (OptionFlags.getInstance().isKeepTmpFiles()) {
|
||||
Log.info("Creating temporary file svek.svg");
|
||||
SvekUtils.traceSvgString(s);
|
||||
}
|
||||
// if (OptionFlags.getInstance().isKeepTmpFiles()) {
|
||||
Log.info("Creating temporary file svek.svg");
|
||||
SvekUtils.traceSvgString(s);
|
||||
// }
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -283,11 +288,11 @@ public class DotStringFactory {
|
||||
|
||||
}
|
||||
|
||||
for (Line line : lines) {
|
||||
for (Line line : allLines) {
|
||||
line.solveLine(svg, fullHeight);
|
||||
}
|
||||
|
||||
for (Line line : lines) {
|
||||
for (Line line : allLines) {
|
||||
line.manageCollision(allShapes);
|
||||
}
|
||||
|
||||
@ -295,7 +300,20 @@ public class DotStringFactory {
|
||||
}
|
||||
|
||||
public void addLine(Line line) {
|
||||
lines.add(line);
|
||||
allLines.add(line);
|
||||
if (first(line)) {
|
||||
lines0.add(line);
|
||||
} else {
|
||||
lines1.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean first(Line line) {
|
||||
final int length = line.getLength();
|
||||
if (length==1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final List<Shape> getShapes() {
|
||||
@ -303,7 +321,7 @@ public class DotStringFactory {
|
||||
}
|
||||
|
||||
public List<Line> getLines() {
|
||||
return Collections.unmodifiableList(lines);
|
||||
return Collections.unmodifiableList(allLines);
|
||||
}
|
||||
|
||||
public void openCluster(Group g, int titleWidth, int titleHeight, TextBlock title, boolean isSpecialGroup) {
|
||||
@ -322,4 +340,17 @@ public class DotStringFactory {
|
||||
return Collections.unmodifiableList(allCluster);
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
for (Shape sh : allShapes) {
|
||||
sh.moveSvek(deltaX, deltaY);
|
||||
}
|
||||
for (Line line : allLines) {
|
||||
line.moveSvek(deltaX, deltaY);
|
||||
}
|
||||
for (Cluster cl : allCluster) {
|
||||
cl.moveSvek(deltaX, deltaY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,7 +79,9 @@ public class EntityImageActivity extends AbstractEntityImage {
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER);
|
||||
rect.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(4);
|
||||
}
|
||||
|
||||
ug.getParam().setStroke(new UStroke(1.5));
|
||||
ug.getParam().setColor(getColor(ColorParam.activityBorder, getStereo()));
|
||||
@ -101,7 +103,7 @@ public class EntityImageActivity extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.ROUND_RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,7 +65,9 @@ public class EntityImageAssociation extends AbstractEntityImage {
|
||||
// final double heightTotal = dimTotal.getHeight();
|
||||
|
||||
final UPolygon diams = new UPolygon();
|
||||
diams.setDeltaShadow(5);
|
||||
if (getSkinParam().shadowing()) {
|
||||
diams.setDeltaShadow(5);
|
||||
}
|
||||
diams.addPoint(SIZE, 0);
|
||||
diams.addPoint(SIZE * 2, SIZE);
|
||||
diams.addPoint(SIZE, SIZE * 2);
|
||||
@ -82,7 +84,7 @@ public class EntityImageAssociation extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.DIAMOND;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,7 +65,9 @@ public class EntityImageBranch extends AbstractEntityImage {
|
||||
// final double heightTotal = dimTotal.getHeight();
|
||||
|
||||
final UPolygon diams = new UPolygon();
|
||||
diams.setDeltaShadow(5);
|
||||
if (getSkinParam().shadowing()) {
|
||||
diams.setDeltaShadow(5);
|
||||
}
|
||||
diams.addPoint(SIZE, 0);
|
||||
diams.addPoint(SIZE * 2, SIZE);
|
||||
diams.addPoint(SIZE, SIZE * 2);
|
||||
@ -82,7 +84,7 @@ public class EntityImageBranch extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.DIAMOND;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -60,7 +60,9 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
|
||||
|
||||
public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
circle.setDeltaShadow(3);
|
||||
if (getSkinParam().shadowing()) {
|
||||
circle.setDeltaShadow(3);
|
||||
}
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
ug.getParam().setBackcolor(null);
|
||||
ug.getParam().setColor(getColor(ColorParam.activityEnd, getStereo()));
|
||||
@ -78,10 +80,9 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.CIRCLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ public class EntityImageCircleStart extends AbstractEntityImage {
|
||||
|
||||
public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
circle.setDeltaShadow(3);
|
||||
if (getSkinParam().shadowing()) {
|
||||
circle.setDeltaShadow(3);
|
||||
}
|
||||
ug.getParam().setColor(null);
|
||||
ug.getParam().setBackcolor(getColor(ColorParam.activityStart, getStereo()));
|
||||
ug.draw(xTheoricalPosition, yTheoricalPosition, circle);
|
||||
|
@ -219,7 +219,9 @@ public class EntityImageClass extends AbstractEntityImage {
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
// final URectangle rect = new URectangle(widthTotal, heightTotal);
|
||||
final Shadowable rect = new URectangle(widthTotal, heightTotal);
|
||||
rect.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(4);
|
||||
}
|
||||
|
||||
ug.getParam().setColor(getColor(ColorParam.classBorder, getStereo()));
|
||||
ug.getParam().setBackcolor(getColor(ColorParam.classBackground, getStereo()));
|
||||
|
@ -77,7 +77,9 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final Shadowable form = new URectangle(widthTotal, heightTotal);
|
||||
form.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
form.setDeltaShadow(4);
|
||||
}
|
||||
|
||||
final UShape small = new URectangle(15, 5);
|
||||
|
||||
@ -97,7 +99,7 @@ public class EntityImageEmptyPackage extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -60,9 +60,8 @@ public class EntityImageLollipopInterface extends AbstractEntityImage {
|
||||
public EntityImageLollipopInterface(IEntity entity, ISkinParam skinParam) {
|
||||
super(entity, skinParam);
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
this.desc = TextBlockUtils.create(entity.getDisplay2(), new FontConfiguration(
|
||||
getFont(FontParam.CLASS, stereotype), getFontColor(FontParam.CLASS, stereotype)),
|
||||
HorizontalAlignement.CENTER);
|
||||
this.desc = TextBlockUtils.create(entity.getDisplay2(), new FontConfiguration(getFont(FontParam.CLASS,
|
||||
stereotype), getFontColor(FontParam.CLASS, stereotype)), HorizontalAlignement.CENTER);
|
||||
|
||||
}
|
||||
|
||||
@ -73,7 +72,9 @@ public class EntityImageLollipopInterface extends AbstractEntityImage {
|
||||
|
||||
public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
circle.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
circle.setDeltaShadow(4);
|
||||
}
|
||||
ug.getParam().setStroke(new UStroke(1.5));
|
||||
ug.getParam().setColor(getColor(ColorParam.classBorder, getStereo()));
|
||||
ug.getParam().setBackcolor(getColor(ColorParam.classBackground, getStereo()));
|
||||
@ -92,10 +93,9 @@ public class EntityImageLollipopInterface extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.CIRCLE_IN_RECT;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,32 +33,69 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek;
|
||||
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.MathUtils;
|
||||
import net.sourceforge.plantuml.SkinParamBackcolored;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graph2.GeomUtils;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockEmpty;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public class EntityImageNote extends AbstractEntityImage {
|
||||
|
||||
private final Component comp;
|
||||
private final int cornersize = 10;
|
||||
private final HtmlColor noteBackgroundColor;
|
||||
private final HtmlColor borderColor;
|
||||
private final int marginX1 = 6;
|
||||
private final int marginX2 = 15;
|
||||
private final int marginY = 5;
|
||||
private final boolean withShadow;
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
public EntityImageNote(IEntity entity, ISkinParam skinParam) {
|
||||
super(entity, getSkin(skinParam, entity));
|
||||
|
||||
final Rose skin = new Rose();
|
||||
this.withShadow = skinParam.shadowing();
|
||||
final List<? extends CharSequence> strings = entity.getDisplay2();
|
||||
|
||||
comp = skin.createComponent(ComponentType.NOTE, getSkinParam(), entity.getDisplay2());
|
||||
final Rose rose = new Rose();
|
||||
|
||||
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
|
||||
borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
|
||||
final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
|
||||
final UFont fontNote = skinParam.getFont(FontParam.NOTE, null);
|
||||
|
||||
if (strings.size() == 1 && strings.get(0).length() == 0) {
|
||||
textBlock = new TextBlockEmpty();
|
||||
} else {
|
||||
textBlock = TextBlockUtils.create(strings, new FontConfiguration(fontNote, fontColor),
|
||||
HorizontalAlignement.LEFT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -81,10 +118,49 @@ public class EntityImageNote extends AbstractEntityImage {
|
||||
return rose.getHtmlColor(skinParam, colorParam, s);
|
||||
}
|
||||
|
||||
final public double getPreferredWidth(StringBounder stringBounder) {
|
||||
final double result = getTextWidth(stringBounder);
|
||||
return result;
|
||||
}
|
||||
|
||||
final public double getPreferredHeight(StringBounder stringBounder) {
|
||||
return getTextHeight(stringBounder);
|
||||
}
|
||||
|
||||
// For cache
|
||||
private Dimension2D size;
|
||||
|
||||
private Dimension2D getSize(StringBounder stringBounder, final TextBlock textBlock) {
|
||||
if (size == null) {
|
||||
size = textBlock.calculateDimension(stringBounder);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
final protected double getTextHeight(StringBounder stringBounder) {
|
||||
final TextBlock textBlock = getTextBlock();
|
||||
final Dimension2D size = getSize(stringBounder, textBlock);
|
||||
return size.getHeight() + 2 * marginY;
|
||||
}
|
||||
|
||||
final protected TextBlock getTextBlock() {
|
||||
return textBlock;
|
||||
}
|
||||
|
||||
final protected double getPureTextWidth(StringBounder stringBounder) {
|
||||
final TextBlock textBlock = getTextBlock();
|
||||
final Dimension2D size = getSize(stringBounder, textBlock);
|
||||
return size.getWidth();
|
||||
}
|
||||
|
||||
final public double getTextWidth(StringBounder stringBounder) {
|
||||
return getPureTextWidth(stringBounder) + marginX1 + marginX2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D getDimension(StringBounder stringBounder) {
|
||||
final double height = comp.getPreferredHeight(stringBounder);
|
||||
final double width = comp.getPreferredWidth(stringBounder);
|
||||
final double height = getPreferredHeight(stringBounder);
|
||||
final double width = getPreferredWidth(stringBounder);
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
@ -92,18 +168,243 @@ public class EntityImageNote extends AbstractEntityImage {
|
||||
final double dx = ug.getTranslateX();
|
||||
final double dy = ug.getTranslateY();
|
||||
ug.translate(xTheoricalPosition, yTheoricalPosition);
|
||||
comp.drawU(ug, getDimension(ug.getStringBounder()), new SimpleContext2D(false, true));
|
||||
if (opaleLine == null || opaleLine.isOpale() == false) {
|
||||
drawNormal(ug, xTheoricalPosition, yTheoricalPosition);
|
||||
} else {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
DotPath path = opaleLine.getDotPath();
|
||||
path.moveSvek(-shape.getMinX(), -shape.getMinY());
|
||||
Point2D p1 = path.getStartPoint();
|
||||
Point2D p2 = path.getEndPoint();
|
||||
final double textWidth = getTextWidth(stringBounder);
|
||||
final double textHeight = getTextHeight(stringBounder);
|
||||
final Point2D center = new Point2D.Double(textWidth / 2, textHeight / 2);
|
||||
if (p1.distance(center) > p2.distance(center)) {
|
||||
path = path.reverse();
|
||||
p1 = path.getStartPoint();
|
||||
p2 = path.getEndPoint();
|
||||
}
|
||||
final Direction strategy = getOpaleStrategy(textWidth, textHeight, p1);
|
||||
drawOpale(ug, xTheoricalPosition, yTheoricalPosition, path, strategy);
|
||||
}
|
||||
ug.setTranslate(dx, dy);
|
||||
}
|
||||
|
||||
// private Point2D translateShape(Point2D pt) {
|
||||
// return new Point2D.Double(pt.getX() - shape.getMinX(), pt.getY() -
|
||||
// shape.getMinY());
|
||||
// }
|
||||
|
||||
private void drawOpale(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition, DotPath path,
|
||||
Direction strategy) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final UPolygon polygon = getPolygonNormal(stringBounder);
|
||||
if (withShadow) {
|
||||
polygon.setDeltaShadow(4);
|
||||
}
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.getParam().setBackcolor(noteBackgroundColor);
|
||||
ug.draw(0, 0, polygon);
|
||||
|
||||
final Point2D pp1 = path.getStartPoint();
|
||||
final Point2D pp2 = path.getEndPoint();
|
||||
|
||||
final UShape polygonOpale;
|
||||
if (strategy == Direction.LEFT) {
|
||||
polygonOpale = getPolygonLeft(stringBounder, pp1, pp2, path);
|
||||
} else if (strategy == Direction.RIGHT) {
|
||||
polygonOpale = getPolygonRight(stringBounder, pp1, pp2, path);
|
||||
} else if (strategy == Direction.UP) {
|
||||
polygonOpale = getPolygonUp(stringBounder, pp1, pp2, path);
|
||||
} else if (strategy == Direction.DOWN) {
|
||||
polygonOpale = getPolygonDown(stringBounder, pp1, pp2, path);
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.getParam().setBackcolor(noteBackgroundColor);
|
||||
ug.draw(0, 0, polygonOpale);
|
||||
|
||||
ug.draw(getTextWidth(stringBounder) - cornersize, 0, new ULine(0, cornersize));
|
||||
ug.draw(getTextWidth(stringBounder), cornersize, new ULine(-cornersize, 0));
|
||||
getTextBlock().drawU(ug, marginX1, marginY);
|
||||
}
|
||||
|
||||
private void drawNormal(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final UPolygon polygon = getPolygonNormal(stringBounder);
|
||||
if (withShadow) {
|
||||
polygon.setDeltaShadow(4);
|
||||
}
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.getParam().setBackcolor(noteBackgroundColor);
|
||||
ug.draw(0, 0, polygon);
|
||||
|
||||
ug.draw(getTextWidth(stringBounder) - cornersize, 0, new ULine(0, cornersize));
|
||||
ug.draw(getTextWidth(stringBounder), cornersize, new ULine(-cornersize, 0));
|
||||
getTextBlock().drawU(ug, marginX1, marginY);
|
||||
|
||||
// if (opaleLine != null) {
|
||||
// ug.getParam().setColor(borderColor);
|
||||
// ug.getParam().setBackcolor(noteBackgroundColor);
|
||||
//
|
||||
// final DotPath path = opaleLine.getDotPath();
|
||||
// final Point2D p1 = path.getStartPoint();
|
||||
// final Point2D p2 = path.getEndPoint();
|
||||
// ug.draw(p1.getX() - shape.getMinX(), p1.getY() - shape.getMinY(), new
|
||||
// UEllipse(2, 2));
|
||||
// ug.draw(p2.getX() - shape.getMinX(), p2.getY() - shape.getMinY(), new
|
||||
// UEllipse(2, 2));
|
||||
// }
|
||||
}
|
||||
|
||||
private UPolygon getPolygonNormal(final StringBounder stringBounder) {
|
||||
final UPolygon polygon = new UPolygon();
|
||||
polygon.addPoint(0, 0);
|
||||
polygon.addPoint(0, getTextHeight(stringBounder));
|
||||
polygon.addPoint(getTextWidth(stringBounder), getTextHeight(stringBounder));
|
||||
polygon.addPoint(getTextWidth(stringBounder), cornersize);
|
||||
polygon.addPoint(getTextWidth(stringBounder) - cornersize, 0);
|
||||
polygon.addPoint(0, 0);
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private final double delta = 4;
|
||||
|
||||
private UShape getPolygonLeft(final StringBounder stringBounder, final Point2D pp1, final Point2D pp2, DotPath path) {
|
||||
final UPath polygon = new UPath();
|
||||
polygon.moveTo(0, 0);
|
||||
|
||||
double y1 = pp1.getY() - delta;
|
||||
y1 = MathUtils.limitation(y1, 0, getTextHeight(stringBounder) - 2 * delta);
|
||||
polygon.lineTo(0, y1);
|
||||
polygon.lineTo(pp2.getX(), pp2.getY());
|
||||
polygon.lineTo(0, y1 + 2 * delta);
|
||||
|
||||
// final DotPath path1 = new DotPath(path);
|
||||
// path1.moveSvek(0, -delta);
|
||||
// path1.forceStartPoint(0, pp1.getY() - delta);
|
||||
// path1.forceEndPoint(pp2.getX(), pp2.getY());
|
||||
// appendPath(polygon, path1);
|
||||
//
|
||||
// final DotPath path2 = new DotPath(path);
|
||||
// path2.reverse();
|
||||
// path2.moveSvek(0, delta);
|
||||
// path2.forceStartPoint(pp2.getX(), pp2.getY());
|
||||
// path2.forceEndPoint(0, pp1.getY() + delta);
|
||||
// appendPath(polygon, path2);
|
||||
|
||||
polygon.lineTo(0, getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), cornersize);
|
||||
polygon.lineTo(getTextWidth(stringBounder) - cornersize, 0);
|
||||
polygon.lineTo(0, 0);
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private void appendPath(UPath polygon, DotPath path) {
|
||||
boolean start = true;
|
||||
for (CubicCurve2D.Double bez : path.getBeziers()) {
|
||||
if (start) {
|
||||
polygon.lineTo(bez.x1, bez.y1);
|
||||
start = false;
|
||||
}
|
||||
polygon.cubicTo(bez.ctrlx1, bez.ctrly1, bez.ctrlx2, bez.ctrly2, bez.x2, bez.y2);
|
||||
}
|
||||
}
|
||||
|
||||
private UShape getPolygonRight(final StringBounder stringBounder, final Point2D pp1, final Point2D pp2, DotPath path) {
|
||||
final UPath polygon = new UPath();
|
||||
polygon.moveTo(0, 0);
|
||||
polygon.lineTo(0, getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), getTextHeight(stringBounder));
|
||||
|
||||
double y1 = pp1.getY() - delta;
|
||||
y1 = MathUtils.limitation(y1, cornersize, getTextHeight(stringBounder) - 2 * delta);
|
||||
polygon.lineTo(getTextWidth(stringBounder), y1 + 2 * delta);
|
||||
polygon.lineTo(pp2.getX(), pp2.getY());
|
||||
polygon.lineTo(getTextWidth(stringBounder), y1);
|
||||
|
||||
polygon.lineTo(getTextWidth(stringBounder), cornersize);
|
||||
polygon.lineTo(getTextWidth(stringBounder) - cornersize, 0);
|
||||
polygon.lineTo(0, 0);
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private UShape getPolygonUp(final StringBounder stringBounder, final Point2D pp1, final Point2D pp2, DotPath path) {
|
||||
final UPath polygon = new UPath();
|
||||
polygon.moveTo(0, 0);
|
||||
polygon.lineTo(0, getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), cornersize);
|
||||
polygon.lineTo(getTextWidth(stringBounder) - cornersize, 0);
|
||||
|
||||
double x1 = pp1.getX() - delta;
|
||||
x1 = MathUtils.limitation(x1, 0, getTextWidth(stringBounder) - cornersize);
|
||||
polygon.lineTo(x1 + 2 * delta, 0);
|
||||
polygon.lineTo(pp2.getX(), pp2.getY());
|
||||
|
||||
polygon.lineTo(x1, 0);
|
||||
polygon.lineTo(0, 0);
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private UShape getPolygonDown(final StringBounder stringBounder, final Point2D pp1, final Point2D pp2, DotPath path) {
|
||||
final UPath polygon = new UPath();
|
||||
polygon.moveTo(0, 0);
|
||||
polygon.lineTo(0, getTextHeight(stringBounder));
|
||||
|
||||
double x1 = pp1.getX() - delta;
|
||||
x1 = MathUtils.limitation(x1, 0, getTextWidth(stringBounder));
|
||||
polygon.lineTo(x1, getTextHeight(stringBounder));
|
||||
polygon.lineTo(pp2.getX(), pp2.getY());
|
||||
polygon.lineTo(x1 + 2 * delta, getTextHeight(stringBounder));
|
||||
|
||||
polygon.lineTo(getTextWidth(stringBounder), getTextHeight(stringBounder));
|
||||
polygon.lineTo(getTextWidth(stringBounder), cornersize);
|
||||
polygon.lineTo(getTextWidth(stringBounder) - cornersize, 0);
|
||||
polygon.lineTo(0, 0);
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private Direction getOpaleStrategy(double width, double height, Point2D pt) {
|
||||
final double d1 = GeomUtils.getOrthoDistance(new Line2D.Double(width, 0, width, height), pt);
|
||||
final double d2 = GeomUtils.getOrthoDistance(new Line2D.Double(0, height, width, height), pt);
|
||||
final double d3 = GeomUtils.getOrthoDistance(new Line2D.Double(0, 0, 0, height), pt);
|
||||
final double d4 = GeomUtils.getOrthoDistance(new Line2D.Double(0, 0, width, 0), pt);
|
||||
if (d3 <= d1 && d3 <= d2 && d3 <= d4) {
|
||||
return Direction.LEFT;
|
||||
}
|
||||
if (d1 <= d2 && d1 <= d3 && d1 <= d4) {
|
||||
return Direction.RIGHT;
|
||||
}
|
||||
if (d4 <= d1 && d4 <= d2 && d4 <= d3) {
|
||||
return Direction.UP;
|
||||
}
|
||||
if (d2 <= d1 && d2 <= d3 && d2 <= d4) {
|
||||
return Direction.DOWN;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Line opaleLine;
|
||||
private Shape shape;
|
||||
|
||||
public void setOpaleLine(Line line, Shape shape) {
|
||||
this.opaleLine = line;
|
||||
this.shape = shape;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -126,7 +126,9 @@ public class EntityImageObject extends AbstractEntityImage {
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final Shadowable rect = new URectangle(widthTotal, heightTotal);
|
||||
rect.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(4);
|
||||
}
|
||||
|
||||
ug.getParam().setColor(getColor(ColorParam.objectBorder, getStereo()));
|
||||
ug.getParam().setBackcolor(getColor(ColorParam.objectBackground, getStereo()));
|
||||
@ -158,10 +160,9 @@ public class EntityImageObject extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -100,7 +100,9 @@ public class EntityImageState extends AbstractEntityImage {
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER);
|
||||
rect.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(4);
|
||||
}
|
||||
|
||||
ug.getParam().setStroke(new UStroke(1.5));
|
||||
ug.getParam().setColor(getColor(ColorParam.stateBorder, getStereo()));
|
||||
@ -130,7 +132,7 @@ public class EntityImageState extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.ROUND_RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ public class EntityImageSynchroBar extends AbstractEntityImage {
|
||||
public void drawU(UGraphic ug, double xTheoricalPosition, double yTheoricalPosition) {
|
||||
final Dimension2D dim = getDimension(ug.getStringBounder());
|
||||
final Shadowable rect = new URectangle(dim.getWidth(), dim.getHeight());
|
||||
rect.setDeltaShadow(4);
|
||||
if (getSkinParam().shadowing()) {
|
||||
rect.setDeltaShadow(4);
|
||||
}
|
||||
ug.getParam().setColor(null);
|
||||
ug.getParam().setBackcolor(getColor(ColorParam.activityBar, getStereo()));
|
||||
ug.draw(xTheoricalPosition, yTheoricalPosition, rect);
|
||||
@ -67,10 +69,9 @@ public class EntityImageSynchroBar extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -97,7 +97,9 @@ public class EntityImageUseCase extends AbstractEntityImage {
|
||||
final double widthTotal = dimTotal.getWidth();
|
||||
final double heightTotal = dimTotal.getHeight();
|
||||
final UEllipse ellipse = new UEllipse(widthTotal, heightTotal);
|
||||
ellipse.setDeltaShadow(3);
|
||||
if (getSkinParam().shadowing()) {
|
||||
ellipse.setDeltaShadow(3);
|
||||
}
|
||||
|
||||
ug.getParam().setStroke(new UStroke(1.5));
|
||||
ug.getParam().setColor(getColor(ColorParam.usecaseBorder, getStereo()));
|
||||
@ -119,7 +121,7 @@ public class EntityImageUseCase extends AbstractEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.OVAL;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.Position;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -52,17 +54,19 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable3;
|
||||
import net.sourceforge.plantuml.posimo.BezierUtils;
|
||||
import net.sourceforge.plantuml.posimo.DotPath;
|
||||
import net.sourceforge.plantuml.posimo.Moveable;
|
||||
import net.sourceforge.plantuml.posimo.Positionable;
|
||||
import net.sourceforge.plantuml.posimo.PositionableUtils;
|
||||
import net.sourceforge.plantuml.svek.SvekUtils.PointListIterator;
|
||||
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class Line {
|
||||
public class Line implements Moveable {
|
||||
|
||||
private final String ltail;
|
||||
private final String lhead;
|
||||
@ -319,6 +323,13 @@ public class Line {
|
||||
this.endHeadColor, fullHeight));
|
||||
}
|
||||
|
||||
if (isOpalisable() == false) {
|
||||
setOpale(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOpalisable() {
|
||||
return dotPath.getBeziers().size() <= 1;
|
||||
}
|
||||
|
||||
private Point2D.Double getXY(String svg, int color, int height) {
|
||||
@ -330,13 +341,77 @@ public class Line {
|
||||
|
||||
}
|
||||
|
||||
// public void patchLineForCluster(List<Cluster> clusters) {
|
||||
// if (clusters != null) {
|
||||
// return;
|
||||
// }
|
||||
// if (link.getEntity1().getType() == EntityType.GROUP) {
|
||||
// final IEntity ent = link.getEntity1();
|
||||
// for (Cluster cl : clusters) {
|
||||
// if (cl.isClusterOf(ent) == false) {
|
||||
// continue;
|
||||
// }
|
||||
// final UPolygon frontier = cl.getSpecificFrontier();
|
||||
// if (frontier == null) {
|
||||
// continue;
|
||||
// }
|
||||
// final double frontierY = frontier.getPoints().get(0).getY();
|
||||
// final double frontierX = frontier.getPoints().get(2).getX();
|
||||
// final Point2D pt = dotPath.getStartPoint();
|
||||
// if (pt.getY() < frontierY) {
|
||||
// System.err.println("frontier = " + frontier);
|
||||
// System.err.println("p1 = " + pt);
|
||||
// final double deltaY = frontierY - pt.getY();
|
||||
// dotPath.forceStartPoint(pt.getX(), frontierY);
|
||||
// if (endHead != null) {
|
||||
// endHead = UGraphicUtils.translate(endHead, 0, deltaY);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (link.getEntity2().getType() == EntityType.GROUP) {
|
||||
// final IEntity ent = link.getEntity2();
|
||||
// for (Cluster cl : clusters) {
|
||||
// if (cl.isClusterOf(ent) == false) {
|
||||
// continue;
|
||||
// }
|
||||
// final UPolygon frontier = cl.getSpecificFrontier();
|
||||
// if (frontier == null) {
|
||||
// continue;
|
||||
// }
|
||||
// final double frontierY = frontier.getPoints().get(0).getY();
|
||||
// final double frontierX = frontier.getPoints().get(2).getX();
|
||||
// final Point2D pt = dotPath.getEndPoint();
|
||||
// if (pt.getY() < frontierY) {
|
||||
// System.err.println("frontier = " + frontier);
|
||||
// System.err.println("p2 = " + pt);
|
||||
// dotPath.forceEndPoint(pt.getX(), frontierY);
|
||||
// final double deltaY = frontierY - pt.getY();
|
||||
// if (startTail != null) {
|
||||
// startTail = UGraphicUtils.translate(startTail, 0, deltaY);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
public void drawU(UGraphic ug, double x, double y, HtmlColor color) {
|
||||
if (opale) {
|
||||
return;
|
||||
}
|
||||
x += dx;
|
||||
y += dy;
|
||||
|
||||
if (link.isInvis()) {
|
||||
return;
|
||||
}
|
||||
if (this.link.getSpecificColor() != null) {
|
||||
color = this.link.getSpecificColor();
|
||||
}
|
||||
|
||||
ug.getParam().setColor(color);
|
||||
ug.getParam().setBackcolor(null);
|
||||
ug.getParam().setStroke(link.getType().getStroke());
|
||||
@ -433,35 +508,6 @@ public class Line {
|
||||
return strategy.getResult() + getDecorDzeta();
|
||||
}
|
||||
|
||||
// private Positionable getStartTailPositionnable() {
|
||||
// if (startTailText == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return new Positionable() {
|
||||
// public Point2D getPosition() {
|
||||
// return startTailLabelXY.;
|
||||
// }
|
||||
//
|
||||
// public Dimension2D getSize() {
|
||||
// return startTailText.calculateDimension(stringBounder);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// private Positionable getEndHeadPositionnable() {
|
||||
// if (endHeadText == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return new Positionable() {
|
||||
// public Point2D getPosition() {
|
||||
// return endHeadLabelXY;
|
||||
// }
|
||||
//
|
||||
// public Dimension2D getSize() {
|
||||
// return endHeadText.calculateDimension(stringBounder);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
|
||||
public void manageCollision(List<Shape> allShapes) {
|
||||
|
||||
@ -569,4 +615,48 @@ public class Line {
|
||||
|
||||
}
|
||||
|
||||
private double dx;
|
||||
private double dy;
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
this.dx += deltaX;
|
||||
this.dy += deltaY;
|
||||
}
|
||||
|
||||
public final DotPath getDotPath() {
|
||||
final DotPath result = new DotPath(dotPath);
|
||||
result.moveSvek(dx, dy);
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return link.getLength();
|
||||
}
|
||||
|
||||
private boolean opale;
|
||||
|
||||
public void setOpale(boolean opale) {
|
||||
this.link.setOpale(opale);
|
||||
this.opale = opale;
|
||||
|
||||
}
|
||||
|
||||
public boolean isOpale() {
|
||||
return opale;
|
||||
}
|
||||
|
||||
// public void moveSvek(double deltaX, double deltaY) {
|
||||
// if (startTailLabelXY != null) {
|
||||
// startTailLabelXY.moveSvek(deltaX, deltaY);
|
||||
// }
|
||||
// if (endHeadLabelXY != null) {
|
||||
// endHeadLabelXY.moveSvek(deltaX, deltaY);
|
||||
// }
|
||||
// if (noteLabelXY != null) {
|
||||
// noteLabelXY.moveSvek(deltaX, deltaY);
|
||||
// }
|
||||
// dotPath.moveSvek(deltaX, deltaY);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.posimo.Positionable;
|
||||
|
||||
public class Shape implements Positionable {
|
||||
@ -65,7 +68,8 @@ public class Shape implements Positionable {
|
||||
this.cluster = cluster;
|
||||
}
|
||||
|
||||
public Shape(ShapeType type, double width, double height, ColorSequence colorSequence, boolean top, int shield) {
|
||||
public Shape(IEntityImage image, ShapeType type, double width, double height, ColorSequence colorSequence, boolean top, int shield) {
|
||||
this.image = image;
|
||||
this.top = top;
|
||||
this.type = type;
|
||||
this.width = width;
|
||||
@ -199,9 +203,9 @@ public class Shape implements Positionable {
|
||||
}
|
||||
|
||||
public final void setMinX(double minX) {
|
||||
if (minX < 0) {
|
||||
minX = 0;
|
||||
}
|
||||
// if (minX < 0) {
|
||||
// minX = 0;
|
||||
// }
|
||||
this.minX = minX;
|
||||
}
|
||||
|
||||
@ -216,11 +220,7 @@ public class Shape implements Positionable {
|
||||
this.minY = minY;
|
||||
}
|
||||
|
||||
private IEntityImage image;
|
||||
|
||||
public void setImage(IEntityImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
private final IEntityImage image;
|
||||
|
||||
public IEntityImage getImage() {
|
||||
return image;
|
||||
@ -278,4 +278,79 @@ public class Shape implements Positionable {
|
||||
return "" + x1 + "," + y1 + "," + x2 + "," + y2;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
this.minX += deltaX;
|
||||
this.minY += deltaY;
|
||||
}
|
||||
|
||||
|
||||
public static IEntityImage printEntity(IEntity ent, DotData dotData) {
|
||||
|
||||
final IEntityImage image;
|
||||
if (ent.getSvekImage() == null) {
|
||||
image = createEntityImageBlock(dotData, ent);
|
||||
} else {
|
||||
image = ent.getSvekImage();
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private static IEntityImage createEntityImageBlock(DotData dotData, IEntity ent) {
|
||||
if (ent.getType() == EntityType.CLASS || ent.getType() == EntityType.ABSTRACT_CLASS
|
||||
|| ent.getType() == EntityType.INTERFACE || ent.getType() == EntityType.ENUM) {
|
||||
return new EntityImageClass(ent, dotData.getSkinParam(), dotData);
|
||||
}
|
||||
if (ent.getType() == EntityType.NOTE) {
|
||||
return new EntityImageNote(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ACTIVITY) {
|
||||
return new EntityImageActivity(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.STATE) {
|
||||
return new EntityImageState(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_START) {
|
||||
return new EntityImageCircleStart(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_END) {
|
||||
return new EntityImageCircleEnd(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.USECASE) {
|
||||
return new EntityImageUseCase(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.BRANCH) {
|
||||
return new EntityImageBranch(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.LOLLIPOP) {
|
||||
return new EntityImageLollipopInterface(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ACTOR) {
|
||||
return new EntityImageActor(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.COMPONENT) {
|
||||
return new EntityImageComponent(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.OBJECT) {
|
||||
return new EntityImageObject(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.SYNCHRO_BAR) {
|
||||
return new EntityImageSynchroBar(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.CIRCLE_INTERFACE) {
|
||||
return new EntityImageCircleInterface(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.POINT_FOR_ASSOCIATION) {
|
||||
return new EntityImageAssociationPoint(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.GROUP) {
|
||||
return new EntityImageGroup(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.EMPTY_PACKAGE) {
|
||||
return new EntityImageEmptyPackage(ent, dotData.getSkinParam());
|
||||
}
|
||||
if (ent.getType() == EntityType.ASSOCIATION) {
|
||||
return new EntityImageAssociation(ent, dotData.getSkinParam());
|
||||
}
|
||||
throw new UnsupportedOperationException(ent.getType().toString());
|
||||
}
|
||||
}
|
||||
|
@ -36,19 +36,21 @@ package net.sourceforge.plantuml.svek;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.posimo.Moveable;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public final class SvekResult implements IEntityImage {
|
||||
public final class SvekResult implements IEntityImage, Moveable {
|
||||
|
||||
private final Rose rose = new Rose();
|
||||
|
||||
private final HtmlColor clusterBorder;
|
||||
private final Dimension2D dim;
|
||||
private Dimension2D dim;
|
||||
private final DotData dotData;
|
||||
private final DotStringFactory dotStringFactory;
|
||||
|
||||
@ -63,7 +65,7 @@ public final class SvekResult implements IEntityImage {
|
||||
for (Cluster cluster : dotStringFactory.getAllSubCluster()) {
|
||||
cluster.drawU(ug, x, y, clusterBorder, dotData);
|
||||
}
|
||||
|
||||
|
||||
for (Shape shape : dotStringFactory.getShapes()) {
|
||||
final double minX = shape.getMinX();
|
||||
final double minY = shape.getMinY();
|
||||
@ -71,6 +73,7 @@ public final class SvekResult implements IEntityImage {
|
||||
}
|
||||
|
||||
for (Line line : dotStringFactory.getLines()) {
|
||||
// line.patchLineForCluster(dotStringFactory.getAllSubCluster());
|
||||
final HtmlColor color = rose.getHtmlColor(dotData.getSkinParam(), getArrowColorParam(), null);
|
||||
line.drawU(ug, x, y, color);
|
||||
}
|
||||
@ -105,10 +108,14 @@ public final class SvekResult implements IEntityImage {
|
||||
public ShapeType getShapeType() {
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
||||
public int getShield() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void moveSvek(double deltaX, double deltaY) {
|
||||
dotStringFactory.moveSvek(deltaX, deltaY);
|
||||
dim = Dimension2DDouble.delta(dim, deltaX > 0 ? deltaX : 0, deltaY > 0 ? deltaY : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,11 +28,12 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6910 $
|
||||
* Revision $Revision: 7216 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svg;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@ -52,7 +53,9 @@ import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.ShadowManager;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.USegment;
|
||||
import net.sourceforge.plantuml.ugraphic.USegmentType;
|
||||
@ -393,15 +396,15 @@ public class SvgGraphics {
|
||||
final USegmentType type = seg.getSegmentType();
|
||||
final double coord[] = seg.getCoord();
|
||||
if (type == USegmentType.SEG_MOVETO) {
|
||||
sb.append("M" + (coord[0] + x) + "," + (coord[1] + y) + " ");
|
||||
sb.append("M" + format(coord[0] + x) + "," + format(coord[1] + y) + " ");
|
||||
} else if (type == USegmentType.SEG_LINETO) {
|
||||
sb.append("L" + (coord[0] + x) + "," + (coord[1] + y) + " ");
|
||||
sb.append("L" + format(coord[0] + x) + "," + format(coord[1] + y) + " ");
|
||||
} else if (type == USegmentType.SEG_QUADTO) {
|
||||
sb.append("Q" + (coord[0] + x) + "," + (coord[1] + y) + " " + (coord[2] + x) + "," + (coord[3] + y)
|
||||
sb.append("Q" + format(coord[0] + x) + "," + format(coord[1] + y) + " " + format(coord[2] + x) + "," + format(coord[3] + y)
|
||||
+ " ");
|
||||
} else if (type == USegmentType.SEG_CUBICTO) {
|
||||
sb.append("C" + (coord[0] + x) + "," + (coord[1] + y) + " " + (coord[2] + x) + "," + (coord[3] + y)
|
||||
+ " " + (coord[4] + x) + "," + (coord[5] + y) + " ");
|
||||
sb.append("C" + format(coord[0] + x) + "," + format(coord[1] + y) + " " + format(coord[2] + x) + "," + format(coord[3] + y)
|
||||
+ " " + format(coord[4] + x) + "," + format(coord[5] + y) + " ");
|
||||
} else if (type == USegmentType.SEG_CLOSE) {
|
||||
// Nothing
|
||||
} else {
|
||||
@ -467,4 +470,38 @@ public class SvgGraphics {
|
||||
|
||||
}
|
||||
|
||||
// Shadow
|
||||
final private ShadowManager shadowManager = new ShadowManager(80, 200);
|
||||
|
||||
public void svgRectangleShadow(double x, double y, double width, double height, double rx, double ry,
|
||||
double deltaShadow) {
|
||||
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(StringUtils.getAsHtml(shadowManager.getColor(i, deltaShadow)));
|
||||
final double diff = i;
|
||||
svgRectangle(x + deltaShadow + diff, y + deltaShadow + diff, width - 2 * diff, height - 2 * diff, rx + 1,
|
||||
ry + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void svgPolygonShadow(double deltaShadow, double... points) {
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(StringUtils.getAsHtml(shadowManager.getColor(i, deltaShadow)));
|
||||
final double diff = i;
|
||||
svgPolygon(shadowManager.getShadowDeltaPoints(deltaShadow, diff, points));
|
||||
}
|
||||
}
|
||||
|
||||
public void svgEllipseShadow(double x, double y, double xRadius, double yRadius, double deltaShadow) {
|
||||
setStrokeColor(null);
|
||||
for (double i = 0; i <= deltaShadow; i += 0.5) {
|
||||
setFillColor(StringUtils.getAsHtml(shadowManager.getColor(i, deltaShadow)));
|
||||
final double diff = i;
|
||||
svgEllipse(x + deltaShadow, y + deltaShadow, xRadius - diff, yRadius - diff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
77
src/net/sourceforge/plantuml/ugraphic/ShadowManager.java
Normal file
77
src/net/sourceforge/plantuml/ugraphic/ShadowManager.java
Normal file
@ -0,0 +1,77 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* 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 Lesser 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 6590 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class ShadowManager {
|
||||
|
||||
// http://www.w3schools.com/svg/svg_feoffset.asp
|
||||
|
||||
private final int c1;
|
||||
private final int c2;
|
||||
|
||||
public ShadowManager(int c1, int c2) {
|
||||
this.c1 = c1;
|
||||
this.c2 = c2;
|
||||
}
|
||||
|
||||
public double[] getShadowDeltaPoints(double deltaShadow, double diff, double[] points) {
|
||||
double cx = 0;
|
||||
double cy = 0;
|
||||
for (int i = 0; i < points.length; i += 2) {
|
||||
cx += points[i];
|
||||
cy += points[i + 1];
|
||||
}
|
||||
final int nbPoints = points.length / 2;
|
||||
|
||||
cx = cx / nbPoints;
|
||||
cy = cy / nbPoints;
|
||||
|
||||
final double[] result = new double[points.length];
|
||||
for (int i = 0; i < result.length; i += 2) {
|
||||
final double diffx = points[i] > cx ? -diff : diff;
|
||||
final double diffy = points[i + 1] > cy ? -diff : diff;
|
||||
result[i] = points[i] + diffx + deltaShadow;
|
||||
result[i + 1] = points[i + 1] + diffy + deltaShadow;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Color getColor(double delta, double total) {
|
||||
final int c = (int) (c2 + 1.0 * delta / total * (c1 - c2));
|
||||
return new Color(c, c, c);
|
||||
}
|
||||
|
||||
}
|
@ -34,9 +34,20 @@
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable3;
|
||||
|
||||
public abstract class UGraphicUtils {
|
||||
|
||||
public static UDrawable3 translate(final UDrawable3 d, final double dx, final double dy) {
|
||||
return new UDrawable3() {
|
||||
@Override
|
||||
public void drawU(UGraphic ug, double x, double y) {
|
||||
d.drawU(ug, x + dx, y + dy);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static UGraphic translate(final UGraphic g, final double tx, final double ty) {
|
||||
return new UGraphic() {
|
||||
|
||||
|
@ -45,6 +45,18 @@ public class UPath implements UShape, Iterable<USegment> {
|
||||
segments.add(new USegment(coord, pathType));
|
||||
}
|
||||
|
||||
public void moveTo(double x, double y) {
|
||||
add(new double[] { x, y }, USegmentType.SEG_MOVETO);
|
||||
}
|
||||
|
||||
public void lineTo(double x, double y) {
|
||||
add(new double[] { x, y }, USegmentType.SEG_LINETO);
|
||||
}
|
||||
|
||||
public void cubicTo(double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2) {
|
||||
add(new double[] { ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2 }, USegmentType.SEG_CUBICTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return segments.toString();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7143 $
|
||||
* Revision $Revision: 7226 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
@ -57,10 +57,23 @@ public class UPolygon extends AbstractShadowable {
|
||||
return all;
|
||||
}
|
||||
|
||||
public UPolygon translate(double dx, double dy) {
|
||||
final UPolygon result = new UPolygon();
|
||||
for (Point2D.Double pt : all) {
|
||||
result.addPoint(pt.x + dx, pt.y + dy);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void rotate(double theta) {
|
||||
final AffineTransform rotate = AffineTransform.getRotateInstance(theta);
|
||||
for (Point2D.Double pt : all) {
|
||||
rotate.transform(pt, pt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + all;
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +41,14 @@ import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
public class DriverEllipseEps implements UDriver<EpsGraphics> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UEllipse rect = (UEllipse) ushape;
|
||||
final double width = rect.getWidth();
|
||||
final double height = rect.getHeight();
|
||||
final UEllipse shape = (UEllipse) ushape;
|
||||
final double width = shape.getWidth();
|
||||
final double height = shape.getHeight();
|
||||
|
||||
// Shadow
|
||||
if (shape.getDeltaShadow() != 0) {
|
||||
eps.epsEllipseShadow(x + width / 2, y + height / 2, width / 2, height / 2, shape.getDeltaShadow());
|
||||
}
|
||||
|
||||
eps.setFillColor(mapper.getMappedColor(param.getBackcolor()));
|
||||
eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
|
54
src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java
Normal file
54
src/net/sourceforge/plantuml/ugraphic/eps/DriverPathEps.java
Normal file
@ -0,0 +1,54 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* 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 Lesser 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.eps;
|
||||
|
||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public class DriverPathEps implements UDriver<EpsGraphics> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
|
||||
eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
eps.setFillColor(mapper.getMappedColor(param.getBackcolor()));
|
||||
eps.setStrokeWidth("" + param.getStroke().getThickness(), param.getStroke().getDashVisible(), param
|
||||
.getStroke().getDashSpace());
|
||||
|
||||
eps.epsPath(x, y, shape);
|
||||
|
||||
}
|
||||
}
|
@ -70,6 +70,11 @@ public class DriverPolygonEps implements UDriver<EpsGraphics> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shape.getDeltaShadow() != 0) {
|
||||
eps.epsPolygonShadow(shape.getDeltaShadow(), points);
|
||||
}
|
||||
|
||||
|
||||
eps.setFillColor(mapper.getMappedColor(param.getBackcolor()));
|
||||
eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
|
@ -65,10 +65,15 @@ public class DriverRectangleEps implements UDriver<EpsGraphics> {
|
||||
width = r.width;
|
||||
height = r.height;
|
||||
}
|
||||
|
||||
|
||||
final double rx = rect.getRx();
|
||||
final double ry = rect.getRy();
|
||||
|
||||
// Shadow
|
||||
if (rect.getDeltaShadow() != 0) {
|
||||
eps.epsRectangleShadow(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow());
|
||||
}
|
||||
|
||||
final UGradient gr = param.getGradient();
|
||||
if (gr == null) {
|
||||
eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
|
@ -53,6 +53,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
@ -77,6 +78,7 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
|
||||
registerDriver(UPolygon.class, new DriverPolygonEps(this));
|
||||
registerDriver(UEllipse.class, new DriverEllipseEps());
|
||||
registerDriver(UImage.class, new DriverImageEps());
|
||||
registerDriver(UPath.class, new DriverPathEps());
|
||||
registerDriver(DotPath.class, new DriverDotPathEps());
|
||||
}
|
||||
|
||||
|
84
src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java
Normal file
84
src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2d.java
Normal file
@ -0,0 +1,84 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* 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 Lesser 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.
|
||||
*
|
||||
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||||
* in the United States and other countries.]
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.g2d;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.USegment;
|
||||
import net.sourceforge.plantuml.ugraphic.USegmentType;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
|
||||
public class DriverPathG2d implements UDriver<Graphics2D> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
DriverLineG2d.manageStroke(param, g2d);
|
||||
|
||||
final GeneralPath p = new GeneralPath();
|
||||
for (USegment seg : shape) {
|
||||
final USegmentType type = seg.getSegmentType();
|
||||
final double coord[] = seg.getCoord();
|
||||
if (type == USegmentType.SEG_MOVETO) {
|
||||
p.moveTo(x + coord[0], y + coord[1]);
|
||||
} else if (type == USegmentType.SEG_LINETO) {
|
||||
p.lineTo(x + coord[0], y + coord[1]);
|
||||
} else if (type == USegmentType.SEG_CUBICTO) {
|
||||
p.curveTo(x + coord[0], y + coord[1], x + coord[2], y + coord[3], x + coord[4], y + coord[5]);
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
// bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x +
|
||||
// bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y
|
||||
// + bez.ctrly2, x + bez.x2, y + bez.y2);
|
||||
// p.append(bez, true);
|
||||
}
|
||||
// p.closePath();
|
||||
|
||||
if (param.getBackcolor() != null) {
|
||||
g2d.setColor(mapper.getMappedColor(param.getBackcolor()));
|
||||
g2d.fill(p);
|
||||
}
|
||||
if (param.getColor() != null) {
|
||||
g2d.setColor(mapper.getMappedColor(param.getColor()));
|
||||
g2d.draw(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7143 $
|
||||
* Revision $Revision: 7211 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.g2d;
|
||||
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPixel;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
@ -83,6 +84,7 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> {
|
||||
registerDriver(UEllipse.class, new DriverEllipseG2d());
|
||||
registerDriver(UImage.class, new DriverImageG2d());
|
||||
registerDriver(DotPath.class, new DriverDotPathG2d());
|
||||
registerDriver(UPath.class, new DriverPathG2d());
|
||||
}
|
||||
|
||||
public StringBounder getStringBounder() {
|
||||
|
@ -42,13 +42,18 @@ import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
public class DriverEllipseSvg implements UDriver<SvgGraphics> {
|
||||
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UEllipse rect = (UEllipse) ushape;
|
||||
final double width = rect.getWidth();
|
||||
final double height = rect.getHeight();
|
||||
final UEllipse shape = (UEllipse) ushape;
|
||||
final double width = shape.getWidth();
|
||||
final double height = shape.getHeight();
|
||||
|
||||
final String color = param.getColor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getColor()));
|
||||
final String backcolor = param.getBackcolor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getBackcolor()));
|
||||
|
||||
// Shadow
|
||||
if (shape.getDeltaShadow() != 0) {
|
||||
svg.svgEllipseShadow(x + width / 2, y + height / 2, width / 2, height / 2, shape.getDeltaShadow());
|
||||
}
|
||||
|
||||
svg.setFillColor(backcolor);
|
||||
svg.setStrokeColor(color);
|
||||
svg.setStrokeWidth(""+param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
|
||||
|
@ -31,6 +31,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.svg;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.svg.SvgGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.ClipContainer;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
@ -50,6 +51,15 @@ public class DriverPathSvg implements UDriver<SvgGraphics> {
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final UPath shape = (UPath) ushape;
|
||||
|
||||
final String color = param.getColor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param
|
||||
.getColor()));
|
||||
final String backcolor = param.getBackcolor() == null ? "none" : StringUtils.getAsHtml(mapper
|
||||
.getMappedColor(param.getBackcolor()));
|
||||
|
||||
svg.setFillColor(backcolor);
|
||||
svg.setStrokeColor(color);
|
||||
svg.setStrokeWidth("" + param.getStroke().getThickness(), param.getStroke().getDasharraySvg());
|
||||
|
||||
svg.svgPath(x, y, shape);
|
||||
|
||||
}
|
||||
|
@ -71,6 +71,11 @@ public class DriverPolygonSvg implements UDriver<SvgGraphics> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shape.getDeltaShadow() != 0) {
|
||||
svg.svgPolygonShadow(shape.getDeltaShadow(), points);
|
||||
}
|
||||
|
||||
|
||||
final String color = param.getColor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getColor()));
|
||||
final String backcolor = param.getBackcolor() == null ? "none" : StringUtils.getAsHtml(mapper.getMappedColor(param.getBackcolor()));
|
||||
|
@ -59,6 +59,12 @@ public class DriverRectangleSvg implements UDriver<SvgGraphics> {
|
||||
final double ry = rect.getRy();
|
||||
double width = rect.getWidth();
|
||||
double height = rect.getHeight();
|
||||
|
||||
// Shadow
|
||||
if (rect.getDeltaShadow() != 0) {
|
||||
svg.svgRectangleShadow(x, y, width, height, rx / 2, ry / 2, rect.getDeltaShadow());
|
||||
}
|
||||
|
||||
|
||||
final UGradient gr = param.getGradient();
|
||||
if (gr == null) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 7178 $
|
||||
* Revision $Revision: 7233 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 7177;
|
||||
return 7232;
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1314897125765L;
|
||||
return 1315477780453L;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user