Commits

tbrugz committed 625ee38

graphml: added NodeXYWH (x, y, width, height)

  • Participants
  • Parent commits e9bcc92

Comments (0)

Files changed (3)

graphml-geo-snippets.properties

 
 node=<data key="d0">\
         <y:ShapeNode>\
-          <y:Geometry height="20.0" width="45" x="{0}" y="{1}"/>\
-          <y:NodeLabel alignment="center" fontFamily="Dialog" fontSize="9">{2}</y:NodeLabel>\
+          <y:Geometry height="20.0" width="45" x="{1}" y="{2}"/>\
+          <y:NodeLabel alignment="center" fontFamily="Dialog" fontSize="9">{0}</y:NodeLabel>\
         </y:ShapeNode>\
       </data>
 
 node.xynode=<data key="d0">\
         <y:ShapeNode>\
-          <y:Geometry height="4000" width="4000" x="{0}" y="{1}"/>\
-          <y:NodeLabel alignment="center" fontFamily="Dialog" fontSize="100">{2}</y:NodeLabel>\
+          <y:Geometry height="4000" width="4000" x="{1}" y="{2}"/>\
+          <y:NodeLabel alignment="center" fontFamily="Dialog" fontSize="100">{0}</y:NodeLabel>\
         </y:ShapeNode>\
       </data>
 

src/tbrugz/graphml/model/NodeXY.java

 
 public class NodeXY extends Node implements Stereotyped {
 	
+	public NodeXY() {
+		setStereotype("xynode");
+	}
+	
 	float x,y;
 	
 	public float getX() {
 	}
 
 	@Override
-	public String getStereotype() {
-		return "xynode";
-	}
-	
 	public String getStereotypeParam(int i) {
 		switch (i) {
 			case 0:
+				return getLabel();
+			case 1:
 				return String.valueOf(x);
-			case 1:
+			case 2:
 				return String.valueOf(y);
-			case 2:
-				return getLabel();
 		}
 		return null;
 	}
 	
+	@Override
 	public int getStereotypeParamCount() {
 		return 3;
 	}

src/tbrugz/graphml/model/NodeXYWH.java

+package tbrugz.graphml.model;
+
+public class NodeXYWH extends NodeXY {
+	
+	public NodeXYWH() {
+		setStereotype("xynode.whnode");
+	}
+	
+	float width, height;
+
+	public float getWidth() {
+		return width;
+	}
+
+	public void setWidth(float width) {
+		this.width = width;
+	}
+
+	public float getHeight() {
+		return height;
+	}
+
+	public void setHeight(float height) {
+		this.height = height;
+	}
+
+	@Override
+	public String getStereotypeParam(int i) {
+		switch (i) {
+			case 3:
+				return String.valueOf(width);
+			case 4:
+				return String.valueOf(height);
+		}
+		return super.getStereotypeParam(i);
+	}
+	
+	@Override
+	public int getStereotypeParamCount() {
+		return 5;
+	}
+	
+}