summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
diff options
context:
space:
mode:
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.java58
1 files changed, 31 insertions, 27 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
index 5f49b39ba2..6a3f7ff9d1 100644
--- 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
@@ -24,6 +24,9 @@ import org.w3c.dom.Element;
public class Reference extends Artifact {
+ public static final int MAXIMUM_HEIGHT = 30 ; //default value
+ public static final int SPACING = 10 ; //default value
+
//private static final int COMMON_LENGTH = 20 ;
// public static Element addReferenceElement(Document document, String svgNs, int midX, int midY) {
@@ -46,45 +49,33 @@ public class Reference extends Artifact {
// }
//
-
- 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
+ * In a Reference the (x,y) coordinates refers to the top corner edge of the polygon
+ * (x,y)______
+ * \ \
+ * \ \
+ * / /
+ * /____ /
*/
public Element addElement(Document document, String svgNs, int x, int y,
- int height) {
+ int height, int width) {
+
this.setHeight(height);
- this.setWidth(height);
+ this.setWidth(width);
this.setxCoordinate(x);
this.setyCoordinate(y);
- int length = height/2;
+ int halfOfHeight = 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)+" "
+ ""+ (x+2*halfOfHeight) +","+(y)+" " +
+ ""+ (x+3*halfOfHeight) +","+(y-halfOfHeight)+" " +
+ ""+ (x+2*halfOfHeight) +","+(y-2*halfOfHeight)+" " +
+ ""+ (x) +","+(y-2*halfOfHeight)+" " +
+ ""+ (x+halfOfHeight) +","+(y-halfOfHeight)+" "
);
polygon.setAttributeNS(null, "fill", "#BF3EFF");
@@ -92,5 +83,18 @@ public class Reference extends Artifact {
return polygon;
}
+
+
+ public Element addElement(Document document, String svgNs, int x, int y,
+ int height) {
+
+ return this.addElement(document, svgNs, x, y, height, height*3/2);
+ }
+
+
+ public Element addElement(Document document, String svgNs, int x, int y) {
+
+ return this.addElement(document, svgNs, x, y, MAXIMUM_HEIGHT);
+ }
}