Permalink
Browse files

Added points to paths

  • Loading branch information...
bzim committed Jun 24, 2016
1 parent 96e802f commit 06fe756ee3cf34f0bff35042c1bbfafccfebd5a2
@@ -16,6 +16,9 @@
*/
package de.graphml.writer.yed.graphics;
import java.util.ArrayList;
import java.util.List;
import de.graphml.writer.model.ElementWriter;
import de.graphml.writer.yed.YedConstants;
@@ -24,6 +27,17 @@
public Double sy=0d;
public Double tx=0d;
public Double ty=0d;
private List<Point>points;
public static class Point{
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double x;
public double y;
}
@Override
public void writeTo(ElementWriter w) {
@@ -32,7 +46,26 @@ public void writeTo(ElementWriter w) {
w.writeAttribute("sy", sy);
w.writeAttribute("tx", tx);
w.writeAttribute("ty", ty);
if (points != null){
for (Point point: points){
w.startElement(Y, "Point");
w.writeAttribute("x", point.x);
w.writeAttribute("y", point.y);
w.endElement();
}
}
w.endElement();
}
public void addPoint(double x, double y){
if (points == null){
points = new ArrayList<>();
}
points.add(new Point(x,y));
}
public void clearPoints(){
if (points != null){
points.clear();
}
}
}
@@ -118,6 +118,8 @@ public void writeFlowChart() throws Exception {
graphWriter.edge(edge, graphWriter.getNextId(), "1", "2");
graphWriter.edge(edge, graphWriter.getNextId(), "2", "3");
edge.edgeGraphics.path.addPoint(200d, 220d);
edge.edgeGraphics.path.addPoint(200d, 320d);
graphWriter.edge(edge, graphWriter.getNextId(), "3", "4");
graphWriter.endGraph(BaseGraph.DIRECTED);
graphWriter.endDocument();

0 comments on commit 06fe756

Please sign in to comment.