summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-13 06:03:58 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-13 06:03:58 +0000
commita8bf783d679577a3bfdf14e09dc9251c4ee258a5 (patch)
treea5751c88ec7fcf0de2fa3bfaad7579acf5040639 /collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
parente5e2ec296c123604eae67c0763d8ab3b91f692f1 (diff)
TUSCANY-3496: Add Nirmal's prototype code for the composite diagram GSoC project to the collaboration area
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1102569 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java')
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
new file mode 100644
index 0000000000..912dc08944
--- /dev/null
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
@@ -0,0 +1,77 @@
+package org.apache.tuscany.sca.impl.artifacts;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Reference extends Artifact {
+
+//private static final int COMMON_LENGTH = 20 ;
+
+// public static Element addReferenceElement(Document document, String svgNs, int midX, int midY) {
+//
+// // Create the rectangle.
+// Element polygon = document.createElementNS(svgNs, "polygon");
+// polygon.setAttributeNS(null, "points",
+// ""+ (midX-COMMON_LENGTH) +","+midY+" " +
+// ""+ (midX+(COMMON_LENGTH/2)) +","+midY+" " +
+// ""+ (midX+COMMON_LENGTH) +","+(midY-COMMON_LENGTH)+" " +
+// ""+ (midX+(COMMON_LENGTH/2)) +","+(midY-COMMON_LENGTH*2)+" " +
+// ""+ (midX-COMMON_LENGTH) +","+(midY-COMMON_LENGTH*2)+" " +
+// ""+ (midX-(COMMON_LENGTH/2)) +","+(midY-COMMON_LENGTH)+" "
+// );
+// polygon.setAttributeNS(null, "fill", "#BF3EFF");
+// polygon.setAttributeNS(null, "stroke", "#68228B");
+// //rectangle.setAttributeNS(null, "alignment-baseline", "central");
+//
+// return polygon;
+// }
+//
+
+
+ public Element addElement(Document document, String svgNs, int x, int y,
+ int height, int width) {
+ return this.addElement(document, svgNs, x, y, height);
+ }
+
+ /**
+ * In a Reference the (x,y) coordinates refers to the outer edge of the polygon
+ * ______
+ * \ \
+ * \ \ ___ outer edge
+ * / /
+ * /____ /
+ *
+ * @param document
+ * @param svgNs
+ * @param x
+ * @param y
+ * @param height
+ * @return
+ */
+ public Element addElement(Document document, String svgNs, int x, int y,
+ int height) {
+
+ this.setHeight(height);
+ this.setWidth(height);
+ this.setxCoordinate(x);
+ this.setyCoordinate(y);
+
+ int length = height/2;
+
+ Element polygon = document.createElementNS(svgNs, "polygon");
+ polygon.setAttributeNS(null, "points",
+ ""+ x +","+y+" " +
+ ""+ (x-length) +","+(y+length)+" " +
+ ""+ (x-length*3) +","+(y+length)+" " +
+ ""+ (x-length*2) +","+(y)+" " +
+ ""+ (x-length*3) +","+(y-length)+" " +
+ ""+ (x-length) +","+(y-length)+" "
+ );
+
+ polygon.setAttributeNS(null, "fill", "#BF3EFF");
+ polygon.setAttributeNS(null, "stroke", "#68228B");
+
+ return polygon;
+ }
+
+}