diff options
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java')
-rw-r--r-- | collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java index 9c91ccc361..e173365f4a 100644 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java @@ -23,26 +23,42 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; public abstract class Wire { - - + public abstract Element addElement(Document document, String svgNs, - Reference aReference, Service aService); //{ + Object a, Object b, int changingFactor, String color); + + public Element setWireAttributes(int x1, int y1, int x2, int y2, + Element polyline, int changingFactor, String color){ + + if(y1 == y2 && x2>x1){ + polyline.setAttributeNS(null, "points", x1+","+ + y1+" "+x2+","+y2 + ); + } + else if(y1 == y2 && x1>x2){ + polyline.setAttributeNS(null, "points", x1+","+ + y1+" "+(x1+changingFactor)+","+y1 + +" "+(x1+changingFactor)+","+(y1-(changingFactor*2)) + +" "+(x2-changingFactor)+","+(y1-(changingFactor*2)) + +" "+(x2-changingFactor)+","+(y1) + +" "+(x2)+","+(y1) + ); + + } + else{ + polyline.setAttributeNS(null, "points", x1+","+ + y1+" "+(x1+changingFactor)+","+y1 + +" "+(x1+changingFactor)+","+y2 + +" "+x2+","+y2 + ); + } + + polyline.setAttributeNS(null, "stroke", color); + polyline.setAttributeNS(null, "stroke-width", "2"); + polyline.setAttributeNS(null, "fill", "none"); -// Element polyline = document.createElementNS(svgNs, "polyline"); -// int x1=aReference.getxCoordinate()+aReference.getHeight()*3/2; -// int y1=aReference.getyCoordinate()+aReference.getHeight()/2; -// -// int x2=aService.getxCoordinate()+aService.getHeight()/2; -// int y2=aService.getyCoordinate()+aService.getHeight()/2; -// //polyline.setAttributeNS(null,"class", "Connect"); -// polyline.setAttributeNS(null, "points", x1+","+ -// y1+" "+x2+","+y2 -// ); -// polyline.setAttributeNS(null, "stroke", "black"); -// polyline.setAttributeNS(null, "stroke-width", "2"); -// -// return polyline; -// } + return polyline; + } } |