本文整理汇总了Java中net.sourceforge.plantuml.cucadiagram.Link.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java Link.getLength方法的具体用法?Java Link.getLength怎么用?Java Link.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.plantuml.cucadiagram.Link
的用法示例。
在下文中一共展示了Link.getLength方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureLayer
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
private boolean ensureLayer(Link link) {
final int lenght = link.getLength();
final int l1 = link.getEntity1().getHectorLayer();
final int l2 = link.getEntity2().getHectorLayer();
if (lenght == 1) {
if (l1 < l2) {
link.getEntity1().setHectorLayer(l2);
return true;
} else if (l2 < l1) {
link.getEntity2().setHectorLayer(l1);
return true;
}
} else {
final int l2theoric = l1 + lenght - 1;
if (l2 < l2theoric) {
link.getEntity2().setHectorLayer(l2theoric);
return true;
}
}
return false;
}
示例2: createEdge
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
private Agedge_s createEdge(final Agraph_s g, Link link) {
final Agnode_s n = getAgnodeFromLeaf(link.getEntity1());
final Agnode_s m = getAgnodeFromLeaf(link.getEntity2());
if (n == null) {
return null;
}
if (m == null) {
return null;
}
final Agedge_s e = agedge(g, n, m, null, true);
agsafeset(e, new CString("arrowtail"), new CString("none"), new CString(""));
agsafeset(e, new CString("arrowhead"), new CString("none"), new CString(""));
int length = link.getLength();
// System.err.println("length=" + length);
// if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() || */link.isInvis() || length != 1) {
agsafeset(e, new CString("minlen"), new CString("" + (length - 1)), new CString(""));
// }
// System.err.print("EDGE " + link.getEntity1().getUid() + "->" + link.getEntity2().getUid() + " minlen="
// + (length - 1) + " ");
final TextBlock label = getLabel(link);
if (TextBlockUtils.isEmpty(label, stringBounder) == false) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
// System.err.println("dimLabel = " + dimLabel);
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
(int) dimLabel.getHeight());
agsafeset(e, new CString("label"), hackDim, new CString(""));
// System.err.print("label=" + hackDim.getContent());
}
// System.err.println();
return e;
}
示例3: insertBetween
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
final public boolean insertBetween(IEntity entity1, IEntity entity2, IEntity node) {
final Link link = foundLink(entity1, entity2);
if (link == null) {
return false;
}
final Link l1 = new Link(entity1, node, link.getType(), link.getLabel(), link.getLength(),
link.getQualifier1(), null, link.getLabeldistance(), link.getLabelangle());
final Link l2 = new Link(node, entity2, link.getType(), link.getLabel(), link.getLength(), null,
link.getQualifier2(), link.getLabeldistance(), link.getLabelangle());
addLink(l1);
addLink(l2);
removeLink(link);
return true;
}
示例4: getNbOfHozizontalLollipop
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
public int getNbOfHozizontalLollipop(IEntity entity) {
if (entity.getEntityType() == LeafType.LOLLIPOP) {
throw new IllegalArgumentException();
}
int result = 0;
for (Link link : getLinks()) {
if (link.getLength() == 1 && link.contains(entity) && link.containsType(LeafType.LOLLIPOP)) {
result++;
}
}
return result;
}
示例5: checkFinalError
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
@Override
public String checkFinalError() {
for (Link link : this.getLinks()) {
final int len = link.getLength();
if (len == 1) {
for (Link link2 : this.getLinks()) {
if (link2.sameConnections(link) && link2.getLength() != 1) {
link2.setLength(1);
}
}
}
}
this.applySingleStrategy();
return super.checkFinalError();
}
示例6: createPng
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
public void createPng(OutputStream os) throws IOException {
final Zoda2 zoda2 = new Zoda2();
for (Link link : diagram.getLinks()) {
final String s = link.getEntity1().getCode() + "->" + link.getEntity2().getCode();
// Log.error("CucaDiagramPngMaker3:: " + s);
final int diffHeight = link.getLength() - 1;
// Log.error("CucaDiagramPngMaker3:: " + s + " " + diffHeight);
zoda2.addLink(s, diffHeight, link);
}
for (IEntity ent : diagram.getLeafsvalues()) {
ANode n = zoda2.getNode(ent.getCode().getFullName());
if (n == null) {
n = zoda2.createAloneNode(ent.getCode().getFullName());
}
((ANodeImpl) n).setUserData(ent);
}
final List<Graph5> graphs = getGraphs3(zoda2.getHeaps());
final Dimension2D totalDim = getTotalDimension(graphs);
final EmptyImageBuilder im = new EmptyImageBuilder(totalDim.getWidth(), totalDim.getHeight(),
Color.WHITE);
double x = 0;
final Graphics2D g2d = im.getGraphics2D();
for (Graph5 g : graphs) {
g2d.setTransform(new AffineTransform());
g2d.translate(x, 0);
g.draw(g2d);
x += g.getDimension().getWidth();
}
ImageIO.write(im.getBufferedImage(), "png", os);
}
示例7: checkFinalError
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
@Override
public String checkFinalError(AbstractPSystem sys) {
final ClassDiagram system = (ClassDiagram) sys;
for (Link link : system.getLinks()) {
final int len = link.getLength();
if (len == 1) {
for (Link link2 : system.getLinks()) {
if (link2.sameConnections(link) && link2.getLength() != 1) {
link2.setLength(1);
}
}
}
}
system.applySingleStrategy();
// for (IGroup g : system.getGroups(true)) {
// final List<ILeaf> standalones = new ArrayList<ILeaf>();
// for (ILeaf ent : g.getLeafsDirect()) {
// if (system.isStandalone(ent)) {
// standalones.add(ent);
// }
// }
// if (standalones.size() < 3) {
// continue;
// }
// final Magma magma = new Magma(system, standalones);
// magma.putInSquare();
// }
return super.checkFinalError(system);
}
示例8: createPinLink
import net.sourceforge.plantuml.cucadiagram.Link; //导入方法依赖的package包/类
public PinLink createPinLink(Link link) {
final PinLink result = new PinLink(create(link.getEntity1()), create(link.getEntity2()), link.getLength(), link);
return result;
}