mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8036
This commit is contained in:
parent
94542f7760
commit
274a1fa43e
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18906 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
@ -38,6 +38,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||||
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
||||||
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
||||||
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
|
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
|
||||||
@ -46,7 +47,7 @@ public class EmptyImageBuilder {
|
|||||||
|
|
||||||
private final BufferedImage im;
|
private final BufferedImage im;
|
||||||
private final Graphics2D g2d;
|
private final Graphics2D g2d;
|
||||||
static final private int LIMIT = 4096;
|
static final private int LIMIT = GraphvizUtils.getenvImageLimit();
|
||||||
|
|
||||||
public EmptyImageBuilder(double width, double height, Color background) {
|
public EmptyImageBuilder(double width, double height, Color background) {
|
||||||
this((int) width, (int) height, background);
|
this((int) width, (int) height, background);
|
||||||
|
@ -127,5 +127,7 @@ public interface ISkinParam extends ISkinSimple {
|
|||||||
public String getSvgLinkTarget();
|
public String getSvgLinkTarget();
|
||||||
|
|
||||||
public int getTabSize();
|
public int getTabSize();
|
||||||
|
|
||||||
|
public int maxAsciiMessageLength();
|
||||||
|
|
||||||
}
|
}
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18910 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
@ -60,6 +60,7 @@ public class OptionFlags {
|
|||||||
static public final boolean USE_INTERFACE_EYE2 = false;
|
static public final boolean USE_INTERFACE_EYE2 = false;
|
||||||
static public final boolean SWI2 = false;
|
static public final boolean SWI2 = false;
|
||||||
static public final boolean USE_COMPOUND = false;
|
static public final boolean USE_COMPOUND = false;
|
||||||
|
static public final boolean OMEGA_CROSSING = false;
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
reset(false);
|
reset(false);
|
||||||
|
51
src/net/sourceforge/plantuml/ScaleMaxHeight.java
Normal file
51
src/net/sourceforge/plantuml/ScaleMaxHeight.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: 5401 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml;
|
||||||
|
|
||||||
|
public class ScaleMaxHeight implements Scale {
|
||||||
|
|
||||||
|
private final double maxHeight;
|
||||||
|
|
||||||
|
public ScaleMaxHeight(double maxHeight) {
|
||||||
|
this.maxHeight = maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getScale(double width, double height) {
|
||||||
|
final double result = maxHeight / height;
|
||||||
|
if (result > 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
51
src/net/sourceforge/plantuml/ScaleMaxWidth.java
Normal file
51
src/net/sourceforge/plantuml/ScaleMaxWidth.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: 5401 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml;
|
||||||
|
|
||||||
|
public class ScaleMaxWidth implements Scale {
|
||||||
|
|
||||||
|
private final double maxWidth;
|
||||||
|
|
||||||
|
public ScaleMaxWidth(double maxWidth) {
|
||||||
|
this.maxWidth = maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getScale(double width, double height) {
|
||||||
|
final double result = maxWidth / width;
|
||||||
|
if (result > 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18309 $
|
* Revision $Revision: 18917 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml;
|
package net.sourceforge.plantuml;
|
||||||
@ -725,4 +725,12 @@ public class SkinParam implements ISkinParam {
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int maxAsciiMessageLength() {
|
||||||
|
final String value = getValue("maxasciimessagelength");
|
||||||
|
if (value != null && value.matches("\\d+")) {
|
||||||
|
return Integer.parseInt(value);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -233,4 +233,8 @@ public class SkinParamDelegator implements ISkinParam {
|
|||||||
return shadowingForNote(stereotype);
|
return shadowingForNote(stereotype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int maxAsciiMessageLength() {
|
||||||
|
return skinParam.maxAsciiMessageLength();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||||
|
|
||||||
import java.awt.geom.Line2D;
|
import java.awt.geom.Line2D;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||||
|
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||||
@ -58,9 +59,11 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
|||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileIfWithLinks;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileIfWithLinks;
|
||||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
|
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||||
@ -180,6 +183,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
|||||||
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
||||||
final HtmlColor horizontalOutColor = LinkRendering.getColor(afterEndwhile, arrowColor);
|
final HtmlColor horizontalOutColor = LinkRendering.getColor(afterEndwhile, arrowColor);
|
||||||
conns.add(result.new ConnectionHline(horizontalOutColor));
|
conns.add(result.new ConnectionHline(horizontalOutColor));
|
||||||
|
// conns.add(result.new ConnectionHline(HtmlColorUtils.BLUE));
|
||||||
|
|
||||||
return FtileUtils.addConnection(result, conns);
|
return FtileUtils.addConnection(result, conns);
|
||||||
}
|
}
|
||||||
@ -304,7 +308,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConnectionVerticalIn extends AbstractConnection {
|
class ConnectionVerticalIn extends AbstractConnection implements ConnectionTranslatable {
|
||||||
|
|
||||||
private final HtmlColor color;
|
private final HtmlColor color;
|
||||||
|
|
||||||
@ -334,6 +338,22 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
|||||||
return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
|
return getTranslate1(getFtile2(), stringBounder).getTranslated(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||||
|
final Point2D p1 = getP1(ug.getStringBounder());
|
||||||
|
final Point2D p2 = getP2(ug.getStringBounder());
|
||||||
|
|
||||||
|
final Snake snake = new Snake(color, Arrows.asToDown());
|
||||||
|
|
||||||
|
final Point2D mp1a = translate1.getTranslated(p1);
|
||||||
|
final Point2D mp2b = translate2.getTranslated(p2);
|
||||||
|
final double middle = mp1a.getY() + 4;
|
||||||
|
snake.addPoint(mp1a);
|
||||||
|
snake.addPoint(mp1a.getX(), middle);
|
||||||
|
snake.addPoint(mp2b.getX(), middle);
|
||||||
|
snake.addPoint(mp2b);
|
||||||
|
ug.draw(snake);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConnectionVerticalOut extends AbstractConnection {
|
class ConnectionVerticalOut extends AbstractConnection {
|
||||||
@ -384,19 +404,37 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
|||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
|
final Dimension2D totalDim = calculateDimensionInternal(stringBounder);
|
||||||
|
|
||||||
|
final Swimlane intoSw;
|
||||||
|
if (ug instanceof UGraphicInterceptorOneSwimlane) {
|
||||||
|
intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
|
||||||
|
} else {
|
||||||
|
intoSw = null;
|
||||||
|
}
|
||||||
|
|
||||||
final List<Ftile> all = new ArrayList<Ftile>(couples);
|
final List<Ftile> all = new ArrayList<Ftile>(couples);
|
||||||
all.add(tile2);
|
all.add(tile2);
|
||||||
double minX = totalDim.getWidth() / 2;
|
double minX = totalDim.getWidth() / 2;
|
||||||
double maxX = totalDim.getWidth() / 2;
|
double maxX = totalDim.getWidth() / 2;
|
||||||
|
boolean atLeastOne = false;
|
||||||
for (Ftile tmp : all) {
|
for (Ftile tmp : all) {
|
||||||
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
|
if (tmp.calculateDimension(stringBounder).hasPointOut() == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (intoSw != null && tmp.getSwimlanes().contains(intoSw) == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (intoSw != null && tmp.getSwimlaneOut() != intoSw) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
atLeastOne = true;
|
||||||
final UTranslate ut = getTranslateFor(tmp, stringBounder);
|
final UTranslate ut = getTranslateFor(tmp, stringBounder);
|
||||||
final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
|
final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
|
||||||
minX = Math.min(minX, out);
|
minX = Math.min(minX, out);
|
||||||
maxX = Math.max(maxX, out);
|
maxX = Math.max(maxX, out);
|
||||||
}
|
}
|
||||||
|
if (atLeastOne == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Snake s = new Snake(arrowColor);
|
final Snake s = new Snake(arrowColor);
|
||||||
s.goUnmergeable();
|
s.goUnmergeable();
|
||||||
|
@ -36,18 +36,17 @@ package net.sourceforge.plantuml.asciiart;
|
|||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||||
import net.sourceforge.plantuml.skin.Area;
|
import net.sourceforge.plantuml.skin.Area;
|
||||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||||
import net.sourceforge.plantuml.skin.Component;
|
|
||||||
import net.sourceforge.plantuml.skin.ComponentType;
|
import net.sourceforge.plantuml.skin.ComponentType;
|
||||||
import net.sourceforge.plantuml.skin.Context2D;
|
import net.sourceforge.plantuml.skin.Context2D;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt;
|
import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
|
||||||
|
|
||||||
public class ComponentTextArrow extends AbstractComponentText {
|
public class ComponentTextArrow extends AbstractComponentText {
|
||||||
|
|
||||||
@ -55,9 +54,11 @@ public class ComponentTextArrow extends AbstractComponentText {
|
|||||||
private final Display stringsToDisplay;
|
private final Display stringsToDisplay;
|
||||||
private final FileFormat fileFormat;
|
private final FileFormat fileFormat;
|
||||||
private final ArrowConfiguration config;
|
private final ArrowConfiguration config;
|
||||||
|
private final int maxAsciiMessageLength;
|
||||||
|
|
||||||
public ComponentTextArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
|
public ComponentTextArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
|
||||||
FileFormat fileFormat) {
|
FileFormat fileFormat, int maxAsciiMessageLength) {
|
||||||
|
this.maxAsciiMessageLength = maxAsciiMessageLength;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.stringsToDisplay = clean(stringsToDisplay);
|
this.stringsToDisplay = clean(stringsToDisplay);
|
||||||
@ -107,6 +108,7 @@ public class ComponentTextArrow extends AbstractComponentText {
|
|||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
// final int position = Math.max(0, (width - textWidth) / 2);
|
||||||
charArea.drawStringsLR(stringsToDisplay.as(), (width - textWidth) / 2, 0);
|
charArea.drawStringsLR(stringsToDisplay.as(), (width - textWidth) / 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +117,11 @@ public class ComponentTextArrow extends AbstractComponentText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getPreferredWidth(StringBounder stringBounder) {
|
public double getPreferredWidth(StringBounder stringBounder) {
|
||||||
return StringUtils.getWidth(stringsToDisplay) + 2;
|
final int width = StringUtils.getWidth(stringsToDisplay) + 2;
|
||||||
|
if (maxAsciiMessageLength > 0) {
|
||||||
|
return Math.min(maxAsciiMessageLength, width);
|
||||||
|
}
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18917 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.asciiart;
|
package net.sourceforge.plantuml.asciiart;
|
||||||
@ -61,7 +61,7 @@ public class TextSkin implements Skin {
|
|||||||
}
|
}
|
||||||
if (type.isArrow()
|
if (type.isArrow()
|
||||||
&& ((config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) || (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE))) {
|
&& ((config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) || (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE))) {
|
||||||
return new ComponentTextArrow(type, config, stringsToDisplay, fileFormat);
|
return new ComponentTextArrow(type, config, stringsToDisplay, fileFormat, param.maxAsciiMessageLength());
|
||||||
}
|
}
|
||||||
if (type.isArrow() && config.isSelfArrow()) {
|
if (type.isArrow() && config.isSelfArrow()) {
|
||||||
return new ComponentTextSelfArrow(type, config, stringsToDisplay, fileFormat);
|
return new ComponentTextSelfArrow(type, config, stringsToDisplay, fileFormat);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18917 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.asciiart;
|
package net.sourceforge.plantuml.asciiart;
|
||||||
@ -84,6 +84,9 @@ public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea {
|
|||||||
|
|
||||||
public void drawStringsLR(Collection<? extends CharSequence> strings, int x, int y) {
|
public void drawStringsLR(Collection<? extends CharSequence> strings, int x, int y) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
if (x < 0) {
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
for (CharSequence s : strings) {
|
for (CharSequence s : strings) {
|
||||||
this.drawStringLR(s.toString(), x, y + i);
|
this.drawStringLR(s.toString(), x, y + i);
|
||||||
i++;
|
i++;
|
||||||
|
@ -49,12 +49,11 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||||
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
|
|
||||||
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ import net.sourceforge.plantuml.skin.VisibilityModifier;
|
|||||||
|
|
||||||
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
|
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
|
||||||
|
|
||||||
private static final String CODE = "(?:\\.|::)?[\\p{L}0-9_]+(?:(?:\\.|::)[\\p{L}0-9_]+)*";
|
private static final String CODE = CommandLinkClass.getSeparator() + "?[\\p{L}0-9_]+" + "(?:"
|
||||||
|
+ CommandLinkClass.getSeparator() + "[\\p{L}0-9_]+)*";
|
||||||
public static final String CODES = CODE + "(?:\\s*,\\s*" + CODE + ")*";
|
public static final String CODES = CODE + "(?:\\s*,\\s*" + CODE + ")*";
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
|
@ -38,7 +38,6 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Direction;
|
import net.sourceforge.plantuml.Direction;
|
||||||
import net.sourceforge.plantuml.FontParam;
|
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.UmlDiagramType;
|
import net.sourceforge.plantuml.UmlDiagramType;
|
||||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||||
@ -57,7 +56,6 @@ import net.sourceforge.plantuml.cucadiagram.Link;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
import net.sourceforge.plantuml.cucadiagram.LinkArrow;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
|
||||||
import net.sourceforge.plantuml.graphic.HtmlColorSet;
|
import net.sourceforge.plantuml.graphic.HtmlColorSet;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||||
@ -118,8 +116,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
|||||||
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])";
|
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getSeparator() {
|
public static String getSeparator() {
|
||||||
return "(?:\\.|::)";
|
return "(?:\\.|::|\\\\|\\\\\\\\)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String optionalKeywords(UmlDiagramType type) {
|
private static String optionalKeywords(UmlDiagramType type) {
|
||||||
|
@ -36,6 +36,7 @@ package net.sourceforge.plantuml.classdiagram.command;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.UmlDiagramType;
|
import net.sourceforge.plantuml.UmlDiagramType;
|
||||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||||
@ -52,7 +53,6 @@ import net.sourceforge.plantuml.cucadiagram.Link;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
|
||||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||||
|
|
||||||
final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
|
final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
|
||||||
|
@ -54,7 +54,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
|||||||
|
|
||||||
private static RegexConcat getRegexConcat() {
|
private static RegexConcat getRegexConcat() {
|
||||||
return new RegexConcat(new RegexLeaf("^namespace[%s]+"), //
|
return new RegexConcat(new RegexLeaf("^namespace[%s]+"), //
|
||||||
new RegexLeaf("NAME", "([\\p{L}0-9_][\\p{L}0-9_.:]*)"), //
|
new RegexLeaf("NAME", "([\\p{L}0-9_][\\p{L}0-9_.:\\\\]*)"), //
|
||||||
new RegexLeaf("[%s]*"), //
|
new RegexLeaf("[%s]*"), //
|
||||||
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
||||||
new RegexLeaf("[%s]*"), //
|
new RegexLeaf("[%s]*"), //
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: 4762 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.ScaleMaxHeight;
|
||||||
|
import net.sourceforge.plantuml.UmlDiagram;
|
||||||
|
|
||||||
|
public class CommandScaleMaxHeight extends SingleLineCommand<UmlDiagram> {
|
||||||
|
|
||||||
|
public CommandScaleMaxHeight() {
|
||||||
|
super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]+height$");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||||
|
final double height = Double.parseDouble(arg.get(0));
|
||||||
|
diagram.setScale(new ScaleMaxHeight(height));
|
||||||
|
return CommandExecutionResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: 4762 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.ScaleMaxWidth;
|
||||||
|
import net.sourceforge.plantuml.UmlDiagram;
|
||||||
|
|
||||||
|
public class CommandScaleMaxWidth extends SingleLineCommand<UmlDiagram> {
|
||||||
|
|
||||||
|
public CommandScaleMaxWidth() {
|
||||||
|
super("(?i)^scale[%s]+max[%s]+([0-9.]+)[%s]+width$");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||||
|
final double width = Double.parseDouble(arg.get(0));
|
||||||
|
diagram.setScale(new ScaleMaxWidth(width));
|
||||||
|
return CommandExecutionResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -281,6 +281,8 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
|||||||
cmds.add(new CommandScale());
|
cmds.add(new CommandScale());
|
||||||
cmds.add(new CommandScaleWidthAndHeight());
|
cmds.add(new CommandScaleWidthAndHeight());
|
||||||
cmds.add(new CommandScaleWidthOrHeight());
|
cmds.add(new CommandScaleWidthOrHeight());
|
||||||
|
cmds.add(new CommandScaleMaxWidth());
|
||||||
|
cmds.add(new CommandScaleMaxHeight());
|
||||||
cmds.add(new CommandScaleMaxWidthAndHeight());
|
cmds.add(new CommandScaleMaxWidthAndHeight());
|
||||||
cmds.add(new CommandAffineTransform());
|
cmds.add(new CommandAffineTransform());
|
||||||
cmds.add(new CommandAffineTransformMultiline());
|
cmds.add(new CommandAffineTransformMultiline());
|
||||||
|
@ -36,6 +36,7 @@ package net.sourceforge.plantuml.creole;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||||
import net.sourceforge.plantuml.graphic.Splitter;
|
import net.sourceforge.plantuml.graphic.Splitter;
|
||||||
|
|
||||||
@ -64,14 +65,12 @@ public class CommandCreoleImg implements Command {
|
|||||||
if (m.find() == false) {
|
if (m.find() == false) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
// final int size = Integer.parseInt(m.group(2));
|
String src = m.group(2);
|
||||||
// final FontConfiguration fc1 = stripe.getActualFontConfiguration();
|
if (src.toLowerCase().startsWith("src=")) {
|
||||||
// final FontConfiguration fc2 = fc1.changeSize(size);
|
src = src.substring(4);
|
||||||
// stripe.setActualFontConfiguration(fc2);
|
}
|
||||||
// stripe.analyzeAndAdd(m.group(3));
|
src = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(src, "\"");
|
||||||
final String src = m.group(2);
|
|
||||||
stripe.addImage(src);
|
stripe.addImage(src);
|
||||||
// stripe.setActualFontConfiguration(fc1);
|
|
||||||
return line.substring(m.group(1).length());
|
return line.substring(m.group(1).length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18909 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||||
@ -87,6 +87,18 @@ public class GraphvizUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getenvImageLimit() {
|
||||||
|
final String env = System.getProperty("PLANTUML_LIMIT_SIZE");
|
||||||
|
if (StringUtils.isNotEmpty(env) && env.matches("\\d+")) {
|
||||||
|
return Integer.parseInt(env);
|
||||||
|
}
|
||||||
|
final String getenv = System.getenv("PLANTUML_LIMIT_SIZE");
|
||||||
|
if (StringUtils.isNotEmpty(getenv) && getenv.matches("\\d+")) {
|
||||||
|
return Integer.parseInt(getenv);
|
||||||
|
}
|
||||||
|
return 4096;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getenvLogData() {
|
public static String getenvLogData() {
|
||||||
final String env = System.getProperty("PLANTUML_LOGDATA");
|
final String env = System.getProperty("PLANTUML_LOGDATA");
|
||||||
if (StringUtils.isNotEmpty(env)) {
|
if (StringUtils.isNotEmpty(env)) {
|
||||||
|
71
src/net/sourceforge/plantuml/cute/CrossingSegment.java
Normal file
71
src/net/sourceforge/plantuml/cute/CrossingSegment.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: 4041 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.cute;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.geom.LineSegmentDouble;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
|
public class CrossingSegment {
|
||||||
|
|
||||||
|
private final Balloon balloon;
|
||||||
|
private final LineSegmentDouble segment;
|
||||||
|
|
||||||
|
public CrossingSegment(Balloon balloon, LineSegmentDouble segment) {
|
||||||
|
this.balloon = balloon;
|
||||||
|
this.segment = segment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Point2D> intersection() {
|
||||||
|
final List<Point2D> result = new ArrayList<Point2D>();
|
||||||
|
|
||||||
|
final UTranslate tr = new UTranslate(balloon.getCenter());
|
||||||
|
final UTranslate trInverse = tr.reverse();
|
||||||
|
|
||||||
|
final CrossingSimple simple = new CrossingSimple(balloon.getRadius(),
|
||||||
|
new InfiniteLine(segment).translate(trInverse));
|
||||||
|
for (Point2D pt : simple.intersection()) {
|
||||||
|
pt = tr.getTranslated(pt);
|
||||||
|
if (segment.isPointOnSegment(pt)) {
|
||||||
|
result.add(pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -35,6 +35,7 @@ package net.sourceforge.plantuml.cute;
|
|||||||
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.geom.AbstractLineSegment;
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
public class InfiniteLine {
|
public class InfiniteLine {
|
||||||
@ -47,6 +48,10 @@ public class InfiniteLine {
|
|||||||
this.b = b;
|
this.b = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InfiniteLine(AbstractLineSegment segment) {
|
||||||
|
this(segment.getP1(), segment.getP2());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{" + a + ";" + b + "}";
|
return "{" + a + ";" + b + "}";
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18930 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.geom;
|
package net.sourceforge.plantuml.geom;
|
||||||
@ -76,7 +76,7 @@ public abstract class AbstractLineSegment extends Line2D {
|
|||||||
} else if (other.isHorizontal()) {
|
} else if (other.isHorizontal()) {
|
||||||
u = getIntersectionHorizontal(other.getP1().getY());
|
u = getIntersectionHorizontal(other.getP1().getY());
|
||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException();
|
return getDichoIntersection(other);
|
||||||
}
|
}
|
||||||
if (java.lang.Double.isNaN(u) || u < 0 || u > 1) {
|
if (java.lang.Double.isNaN(u) || u < 0 || u > 1) {
|
||||||
return null;
|
return null;
|
||||||
@ -88,6 +88,28 @@ public abstract class AbstractLineSegment extends Line2D {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Point2D getDichoIntersection(AbstractLineSegment other) {
|
||||||
|
if (doesIntersect(other) == false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (other.getLength() < 0.01) {
|
||||||
|
return other.getMiddle();
|
||||||
|
}
|
||||||
|
final LineSegmentDouble p1 = new LineSegmentDouble(other.getP1(), other.getMiddle());
|
||||||
|
final LineSegmentDouble p2 = new LineSegmentDouble(other.getMiddle(), other.getP2());
|
||||||
|
if (doesIntersect(p1)) {
|
||||||
|
return getDichoIntersection(p1);
|
||||||
|
}
|
||||||
|
if (doesIntersect(p2)) {
|
||||||
|
return getDichoIntersection(p2);
|
||||||
|
}
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point2D.Double getMiddle() {
|
||||||
|
return getPoint2D(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isBetween(double value, double v1, double v2) {
|
private static boolean isBetween(double value, double v1, double v2) {
|
||||||
if (v1 < v2) {
|
if (v1 < v2) {
|
||||||
return value >= v1 && value <= v2;
|
return value >= v1 && value <= v2;
|
||||||
@ -164,6 +186,10 @@ public abstract class AbstractLineSegment extends Line2D {
|
|||||||
return Math.abs(a1 - a2) < 0.0001;
|
return Math.abs(a1 - a2) < 0.0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPointOnSegment(Point2D pt) {
|
||||||
|
return equals(pt.distance(getP1()) + pt.distance(getP2()), getLength());
|
||||||
|
}
|
||||||
|
|
||||||
private double getDistanceInternal(AbstractLineSegment other) {
|
private double getDistanceInternal(AbstractLineSegment other) {
|
||||||
double result = this.getDistance(other.getP1());
|
double result = this.getDistance(other.getP1());
|
||||||
result += this.getDistance(other.getP2());
|
result += this.getDistance(other.getP2());
|
||||||
@ -237,8 +263,7 @@ public abstract class AbstractLineSegment extends Line2D {
|
|||||||
|
|
||||||
public double determinant(AbstractLineSegment other) {
|
public double determinant(AbstractLineSegment other) {
|
||||||
return determinant(this.getP1().getX() - this.getP2().getX(), this.getP1().getY() - this.getP2().getY(), other
|
return determinant(this.getP1().getX() - this.getP2().getX(), this.getP1().getY() - this.getP2().getY(), other
|
||||||
.getP1().getX()
|
.getP1().getX() - other.getP2().getX(), other.getP1().getY() - other.getP2().getY());
|
||||||
- other.getP2().getX(), other.getP1().getY() - other.getP2().getY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double determinant(double x1, double y1, double x2, double y2) {
|
private static double determinant(double x1, double y1, double x2, double y2) {
|
||||||
|
@ -28,11 +28,12 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18930 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.geom;
|
package net.sourceforge.plantuml.geom;
|
||||||
|
|
||||||
|
import java.awt.geom.CubicCurve2D;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -47,8 +48,8 @@ public class LineSegmentDouble extends AbstractLineSegment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format(Locale.US, "( %.2f,%.2f - %.2f,%.2f )", getP1().getX(), getP1().getY(), getP2().getX(), getP2()
|
return String.format(Locale.US, "( %.2f,%.2f - %.2f,%.2f )", getP1().getX(), getP1().getY(), getP2().getX(),
|
||||||
.getY());
|
getP2().getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LineSegmentDouble(double x1, double y1, double x2, double y2) {
|
public LineSegmentDouble(double x1, double y1, double x2, double y2) {
|
||||||
@ -66,6 +67,14 @@ public class LineSegmentDouble extends AbstractLineSegment {
|
|||||||
assert this.getDistance(this) == 0;
|
assert this.getDistance(this) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LineSegmentDouble(CubicCurve2D.Double curve) {
|
||||||
|
this(curve.getP1(), curve.getP2());
|
||||||
|
}
|
||||||
|
|
||||||
|
public LineSegmentDouble translate(UTranslate translate) {
|
||||||
|
return new LineSegmentDouble(translate.getTranslated(getP1()), translate.getTranslated(getP2()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point2D getP1() {
|
public Point2D getP1() {
|
||||||
return p1;
|
return p1;
|
||||||
@ -103,7 +112,8 @@ public class LineSegmentDouble extends AbstractLineSegment {
|
|||||||
final double y2 = p2.getY();
|
final double y2 = p2.getY();
|
||||||
ug = ug.apply(new UTranslate(x1, y1));
|
ug = ug.apply(new UTranslate(x1, y1));
|
||||||
ug.draw(new ULine(x2 - x1, y2 - y1));
|
ug.draw(new ULine(x2 - x1, y2 - y1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ import java.awt.geom.Line2D;
|
|||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -52,6 +51,7 @@ import net.sourceforge.plantuml.EnsureVisible;
|
|||||||
import net.sourceforge.plantuml.OptionFlags;
|
import net.sourceforge.plantuml.OptionFlags;
|
||||||
import net.sourceforge.plantuml.asciiart.BasicCharArea;
|
import net.sourceforge.plantuml.asciiart.BasicCharArea;
|
||||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||||
|
import net.sourceforge.plantuml.geom.LineSegmentDouble;
|
||||||
import net.sourceforge.plantuml.svek.Cluster;
|
import net.sourceforge.plantuml.svek.Cluster;
|
||||||
import net.sourceforge.plantuml.svek.ClusterPosition;
|
import net.sourceforge.plantuml.svek.ClusterPosition;
|
||||||
import net.sourceforge.plantuml.svek.MinFinder;
|
import net.sourceforge.plantuml.svek.MinFinder;
|
||||||
@ -621,4 +621,24 @@ public class DotPath implements UShape, Moveable {
|
|||||||
return curve.getP1().distance(curve.getP2());
|
return curve.getP1().distance(curve.getP2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLine() {
|
||||||
|
for (CubicCurve2D.Double curve : beziers) {
|
||||||
|
if (curve.getFlatnessSq() > 0.001) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LineSegmentDouble> getLineSegments() {
|
||||||
|
final List<LineSegmentDouble> result = new ArrayList<LineSegmentDouble>();
|
||||||
|
for (CubicCurve2D.Double curve : beziers) {
|
||||||
|
if (curve.getFlatnessSq() <= 0.001) {
|
||||||
|
result.add(new LineSegmentDouble(curve));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Collections.unmodifiableList(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
* Modified by: Nicolas Jouanin
|
* Modified by: Nicolas Jouanin
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18896 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.preproc;
|
package net.sourceforge.plantuml.preproc;
|
||||||
@ -176,7 +176,8 @@ class PreprocessorInclude implements ReadLine {
|
|||||||
if (f.exists() == false) {
|
if (f.exists() == false) {
|
||||||
return CharSequence2Impl.errorPreprocessor("Cannot include " + f.getAbsolutePath(), lineLocation);
|
return CharSequence2Impl.errorPreprocessor("Cannot include " + f.getAbsolutePath(), lineLocation);
|
||||||
} else if (filesUsedCurrent.contains(f2)) {
|
} else if (filesUsedCurrent.contains(f2)) {
|
||||||
return CharSequence2Impl.errorPreprocessor("File already included " + f.getAbsolutePath(), lineLocation);
|
// return CharSequence2Impl.errorPreprocessor("File already included " + f.getAbsolutePath(), lineLocation);
|
||||||
|
return this.readLine();
|
||||||
} else {
|
} else {
|
||||||
filesUsedCurrent.add(f2);
|
filesUsedCurrent.add(f2);
|
||||||
filesUsedGlobal.add(f2);
|
filesUsedGlobal.add(f2);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18917 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||||
@ -598,7 +598,8 @@ class DrawableSetInitializer {
|
|||||||
drawableSet.getSkinParam(), participantDisplay);
|
drawableSet.getSkinParam(), participantDisplay);
|
||||||
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE, null,
|
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE, null,
|
||||||
drawableSet.getSkinParam(), participantDisplay);
|
drawableSet.getSkinParam(), participantDisplay);
|
||||||
final ParticipantBox box = new ParticipantBox(head, line, tail, delayLine, this.freeX);
|
final ParticipantBox box = new ParticipantBox(head, line, tail, delayLine, this.freeX,
|
||||||
|
skinParam.maxAsciiMessageLength() > 0 ? 1 : 5);
|
||||||
|
|
||||||
final Component comp = drawableSet.getSkin().createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null,
|
final Component comp = drawableSet.getSkin().createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null,
|
||||||
drawableSet.getSkinParam(), null);
|
drawableSet.getSkinParam(), null);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18280 $
|
* Revision $Revision: 18917 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||||
@ -51,7 +51,7 @@ public class ParticipantBox implements Pushable {
|
|||||||
|
|
||||||
private static int CPT = 0;
|
private static int CPT = 0;
|
||||||
|
|
||||||
private final int outMargin = 5;
|
private final int outMargin;
|
||||||
|
|
||||||
private double startingX;
|
private double startingX;
|
||||||
|
|
||||||
@ -62,7 +62,8 @@ public class ParticipantBox implements Pushable {
|
|||||||
|
|
||||||
private int cpt = CPT++;
|
private int cpt = CPT++;
|
||||||
|
|
||||||
public ParticipantBox(Component head, Component line, Component tail, Component delayLine, double startingX) {
|
public ParticipantBox(Component head, Component line, Component tail, Component delayLine, double startingX, int outMargin) {
|
||||||
|
this.outMargin = outMargin;
|
||||||
this.startingX = startingX;
|
this.startingX = startingX;
|
||||||
this.head = head;
|
this.head = head;
|
||||||
this.line = line;
|
this.line = line;
|
||||||
|
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.EmptyImageBuilder;
|
|||||||
import net.sourceforge.plantuml.FileFormat;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
import net.sourceforge.plantuml.FileFormatOption;
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.FileUtils;
|
import net.sourceforge.plantuml.FileUtils;
|
||||||
|
import net.sourceforge.plantuml.OptionFlags;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.anim.AffineTransformation;
|
import net.sourceforge.plantuml.anim.AffineTransformation;
|
||||||
@ -71,6 +72,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorTransparent;
|
|||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||||
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
|
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.crossing.UGraphicCrossing;
|
||||||
import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps;
|
import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps;
|
||||||
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
|
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
|
||||||
import net.sourceforge.plantuml.ugraphic.hand.UGraphicHandwritten;
|
import net.sourceforge.plantuml.ugraphic.hand.UGraphicHandwritten;
|
||||||
@ -142,8 +144,9 @@ public class ImageBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final UGraphic2 ug = createUGraphic(fileFormatOption, dim, affineTransforms, dx, dy);
|
final UGraphic2 ug = createUGraphic(fileFormatOption, dim, affineTransforms, dx, dy);
|
||||||
udrawable.drawU(handwritten(ug.apply(new UTranslate(margin1, margin1))));
|
final UGraphic ugDecored = handwritten(ug.apply(new UTranslate(margin1, margin1)));
|
||||||
ug.flushUg();
|
udrawable.drawU(ugDecored);
|
||||||
|
ugDecored.flushUg();
|
||||||
ug.writeImageTOBEMOVED(os, metadata, 96);
|
ug.writeImageTOBEMOVED(os, metadata, 96);
|
||||||
os.flush();
|
os.flush();
|
||||||
|
|
||||||
@ -162,7 +165,11 @@ public class ImageBuilder {
|
|||||||
if (useHandwritten) {
|
if (useHandwritten) {
|
||||||
return new UGraphicHandwritten(ug);
|
return new UGraphicHandwritten(ug);
|
||||||
}
|
}
|
||||||
return ug;
|
if (OptionFlags.OMEGA_CROSSING) {
|
||||||
|
return new UGraphicCrossing(ug);
|
||||||
|
} else {
|
||||||
|
return ug;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImageData writeImageMjpeg(OutputStream os) throws IOException {
|
private ImageData writeImageMjpeg(OutputStream os) throws IOException {
|
||||||
@ -234,8 +241,8 @@ public class ImageBuilder {
|
|||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim, Animation affineTransforms,
|
private UGraphic2 createUGraphic(FileFormatOption fileFormatOption, final Dimension2D dim,
|
||||||
double dx, double dy) {
|
Animation affineTransforms, double dx, double dy) {
|
||||||
final FileFormat fileFormat = fileFormatOption.getFileFormat();
|
final FileFormat fileFormat = fileFormatOption.getFileFormat();
|
||||||
switch (fileFormat) {
|
switch (fileFormat) {
|
||||||
case PNG:
|
case PNG:
|
||||||
@ -257,7 +264,8 @@ public class ImageBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor, String svgLinkTarget) {
|
private UGraphic2 createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor,
|
||||||
|
String svgLinkTarget) {
|
||||||
Color backColor = Color.WHITE;
|
Color backColor = Color.WHITE;
|
||||||
if (mybackcolor instanceof HtmlColorSimple) {
|
if (mybackcolor instanceof HtmlColorSimple) {
|
||||||
backColor = colorMapper.getMappedColor(mybackcolor);
|
backColor = colorMapper.getMappedColor(mybackcolor);
|
||||||
|
@ -0,0 +1,191 @@
|
|||||||
|
/* ========================================================================
|
||||||
|
* PlantUML : a free UML diagram generator
|
||||||
|
* ========================================================================
|
||||||
|
*
|
||||||
|
* (C) Copyright 2009-2017, 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 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: Adrian Vogt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.sourceforge.plantuml.ugraphic.crossing;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.Url;
|
||||||
|
import net.sourceforge.plantuml.cute.Balloon;
|
||||||
|
import net.sourceforge.plantuml.cute.CrossingSegment;
|
||||||
|
import net.sourceforge.plantuml.geom.LineSegmentDouble;
|
||||||
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||||
|
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||||
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.posimo.DotPath;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||||
|
|
||||||
|
public class UGraphicCrossing implements UGraphic {
|
||||||
|
|
||||||
|
private final UGraphic ug;
|
||||||
|
private final List<Pending> lines;
|
||||||
|
private final UTranslate translate;
|
||||||
|
|
||||||
|
static class Pending {
|
||||||
|
final UGraphic ug;
|
||||||
|
final LineSegmentDouble segment;
|
||||||
|
final UTranslate translate;
|
||||||
|
|
||||||
|
Pending(UGraphic ug, UTranslate translate, LineSegmentDouble segment) {
|
||||||
|
this.ug = ug;
|
||||||
|
this.segment = segment;
|
||||||
|
this.translate = translate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawNow(HtmlColor color) {
|
||||||
|
if (color == null) {
|
||||||
|
segment.draw(ug);
|
||||||
|
} else {
|
||||||
|
segment.draw(ug.apply(new UChangeColor(color)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Point2D> getCollisionsWith(List<Pending> others) {
|
||||||
|
final List<Point2D> result = new ArrayList<Point2D>();
|
||||||
|
for (Pending other : others) {
|
||||||
|
if (isClose(segment.getP1(), other.segment.getP1()) || isClose(segment.getP1(), other.segment.getP2())
|
||||||
|
|| isClose(segment.getP2(), other.segment.getP1())
|
||||||
|
|| isClose(segment.getP2(), other.segment.getP2())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final Point2D inter = segment.getSegIntersection(other.segment);
|
||||||
|
if (inter != null) {
|
||||||
|
result.add(inter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UGraphicCrossing(UGraphic ug) {
|
||||||
|
this(ug, new UTranslate(), new ArrayList<Pending>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isClose(Point2D p1, Point2D p2) {
|
||||||
|
return p1.distance(p2) < 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UGraphicCrossing(UGraphic ug, UTranslate translate, List<Pending> lines) {
|
||||||
|
this.ug = ug;
|
||||||
|
this.translate = translate;
|
||||||
|
this.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StringBounder getStringBounder() {
|
||||||
|
return ug.getStringBounder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UParam getParam() {
|
||||||
|
return ug.getParam();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(UShape shape) {
|
||||||
|
if (shape instanceof DotPath) {
|
||||||
|
drawDotPath((DotPath) shape);
|
||||||
|
} else {
|
||||||
|
ug.draw(shape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawDotPath(DotPath dotPath) {
|
||||||
|
if (dotPath.isLine()) {
|
||||||
|
for (LineSegmentDouble seg : dotPath.getLineSegments()) {
|
||||||
|
lines.add(new Pending(ug.apply(translate.reverse()), translate, seg.translate(translate)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ug.draw(dotPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UGraphic apply(UChange change) {
|
||||||
|
if (change instanceof UTranslate) {
|
||||||
|
return new UGraphicCrossing(ug.apply(change), translate.compose((UTranslate) change), lines);
|
||||||
|
} else {
|
||||||
|
return new UGraphicCrossing(ug.apply(change), translate, lines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColorMapper getColorMapper() {
|
||||||
|
return ug.getColorMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startUrl(Url url) {
|
||||||
|
ug.startUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeAction() {
|
||||||
|
ug.closeAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flushUg() {
|
||||||
|
final List<Pending> pendings = new ArrayList<Pending>();
|
||||||
|
final List<Balloon> balloons = new ArrayList<Balloon>();
|
||||||
|
for (Pending p : lines) {
|
||||||
|
final List<Point2D> tmp = p.getCollisionsWith(lines);
|
||||||
|
for (Point2D pt : tmp) {
|
||||||
|
balloons.add(new Balloon(pt, 5));
|
||||||
|
}
|
||||||
|
// if (tmp.size() == 0) {
|
||||||
|
// p.drawNow(null);
|
||||||
|
// } else {
|
||||||
|
// pendings.add(p);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
for (Balloon b : balloons) {
|
||||||
|
b.drawU(ug.apply(new UChangeBackColor(HtmlColorUtils.GREEN)).apply(new UChangeColor(HtmlColorUtils.GREEN)));
|
||||||
|
}
|
||||||
|
for (Pending p : lines) {
|
||||||
|
for (Balloon b : balloons) {
|
||||||
|
List<Point2D> pts = new CrossingSegment(b, p.segment).intersection();
|
||||||
|
for (Point2D pt : pts) {
|
||||||
|
final Balloon s2 = new Balloon(pt, 2);
|
||||||
|
s2.drawU(ug.apply(new UChangeBackColor(HtmlColorUtils.BLUE)).apply(new UChangeColor(HtmlColorUtils.BLUE)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ug.flushUg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpecialTxt() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
* Revision $Revision: 18828 $
|
* Revision $Revision: 18947 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.version;
|
package net.sourceforge.plantuml.version;
|
||||||
@ -39,7 +39,7 @@ import java.util.Date;
|
|||||||
public class Version {
|
public class Version {
|
||||||
|
|
||||||
public static int version() {
|
public static int version() {
|
||||||
return 8035;
|
return 8036;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String versionString() {
|
public static String versionString() {
|
||||||
@ -63,7 +63,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static long compileTime() {
|
private static long compileTime() {
|
||||||
return 1454151644150L;
|
return 1454874605178L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String compileTimeString() {
|
public static String compileTimeString() {
|
||||||
|
Loading…
Reference in New Issue
Block a user