diff options
author | nirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-06 18:20:14 +0000 |
---|---|---|
committer | nirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-06 18:20:14 +0000 |
commit | 94ef23a1a25f056e0bf8f96d4bb97312ebc86f8b (patch) | |
tree | 826dcc8ec895387eecec1be765c0b73f2f02d7b1 /collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java | |
parent | 3b3beac5adfa1995a9a4c92fd92a881f024be08e (diff) |
added support to inclusion, added a test case to demonstrate layout algorithm
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1154566 13f79535-47bb-0310-9956-ffa450edef68
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; + } } |