changeset 14:e027d228c455

user fish has problem
author e095732
date Wed, 30 Jan 2013 18:20:48 +0900
parents 5f9709c253f7
children 3458bde834d3
files src/alice/test/topology/aquarium/fx/AddObject.java src/alice/test/topology/aquarium/fx/CheckMyName.java src/alice/test/topology/aquarium/fx/OtherNode.java src/alice/test/topology/aquarium/fx/PositionController.java src/alice/test/topology/aquarium/fx/SetTranslation.java src/alice/test/topology/aquarium/fx/Share.java src/alice/test/topology/aquarium/fx/TopNode.java
diffstat 7 files changed, 39 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/topology/aquarium/fx/AddObject.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/AddObject.java	Wed Jan 30 18:20:48 2013 +0900
@@ -45,7 +45,7 @@
 					new SetTranslation(iv ,iv.getId());
 					list.add(iv);
 					if (mynum == 0) new PositionController(iv.getId());
-					new Share(iv.getId() ,10);
+					new Share(iv.getId() ,5);
 				}
 				System.out.println("Create OBJ " + objCnt);
 				System.out.println(list);
--- a/src/alice/test/topology/aquarium/fx/CheckMyName.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/CheckMyName.java	Wed Jan 30 18:20:48 2013 +0900
@@ -25,6 +25,8 @@
 		
 		ods.put("local", "mynum", num);
 		ods.put("local", "width", 800);
+		ods.put("local", "objCnt", 5);
+		
 		if (num==0) {
 			new TopNode().execute();
 		} else {
--- a/src/alice/test/topology/aquarium/fx/OtherNode.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/OtherNode.java	Wed Jan 30 18:20:48 2013 +0900
@@ -23,7 +23,6 @@
 		int startX = data1.asInteger() * data2.asInteger(); 
 		ods.put("local", "startX", startX);
 		
-		ods.put("local", "objCnt", 5);
 		Aquarium aqua = new Aquarium();
 		aqua.run();
 	}
--- a/src/alice/test/topology/aquarium/fx/PositionController.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/PositionController.java	Wed Jan 30 18:20:48 2013 +0900
@@ -7,7 +7,7 @@
 public class PositionController extends CodeSegment{
 	
 	private Receiver data = ids.create(CommandType.PEEK);
-	double max = 600;
+	double max = 1600;
 	
 	public PositionController(String key){
 		this.data.setKey(key);
@@ -31,7 +31,7 @@
 		FishData fd = data.asClass(FishData.class);
 		if(fd.getX()+2.0>max){
 			System.out.println("over "+this.data.key);
-			fd.SetXYZ(50, fd.getY(), fd.getZ());
+			fd.SetXYZ(0, fd.getY(), fd.getZ());
 			
 		} else {
 			
--- a/src/alice/test/topology/aquarium/fx/SetTranslation.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/SetTranslation.java	Wed Jan 30 18:20:48 2013 +0900
@@ -7,31 +7,41 @@
 
 public class SetTranslation extends CodeSegment {
 	
-	private Receiver data = ids.create(CommandType.PEEK);
+	private Receiver data1 = ids.create(CommandType.PEEK);
+	private Receiver data2 = ids.create(CommandType.PEEK);
+	private Receiver data3 = ids.create(CommandType.PEEK);
+	
 	private ImageView iv;
 
 	public SetTranslation(ImageView iv, String key){
 		ods.put("local", key, new FishData(iv.getTranslateX(),iv.getTranslateY(),iv.getTranslateZ()));
 		this.iv = iv;
-		data.setKey(key);
+		data1.setKey(key);
+		data2.setKey("startX");
+		data3.setKey("width");
+		
 	} 
 	
 	public SetTranslation(ImageView iv, String key, int index) {
 		this.iv = iv;
-		data.setKey(key, index);
+		data1.setKey(key, index);
+		data2.setKey("startX");
+		data3.setKey("width");
 	}
 	
 	@Override
 	public void run() {
-		FishData fd = data.asClass(FishData.class);
-		if (iv!=null){
-			iv.setTranslateX(fd.x);
-			iv.setTranslateY(fd.y);
-			iv.setTranslateZ(fd.z);
+		int startX = data2.asInteger();
+		int width = data3.asInteger();
+		FishData fd = data1.asClass(FishData.class);
+		if (startX<fd.getX()&& fd.getX()<startX+width){
+			iv.setTranslateX(fd.getX() - startX);
+			iv.setTranslateY(fd.getY());
+			iv.setTranslateZ(fd.getZ());
 
-			new SetTranslation(iv, data.key, data.index);
+			
 		}
-
+		new SetTranslation(iv, data1.key, data1.index);
 	}
 
 }
--- a/src/alice/test/topology/aquarium/fx/Share.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/Share.java	Wed Jan 30 18:20:48 2013 +0900
@@ -12,7 +12,7 @@
 	
 	public Share(String key) {
 		list.setKey("list");
-		data.setKey(key ,1);
+		data.setKey(key);
 	}
 	
 	public Share(String key, int index) {
--- a/src/alice/test/topology/aquarium/fx/TopNode.java	Wed Jan 30 17:57:25 2013 +0900
+++ b/src/alice/test/topology/aquarium/fx/TopNode.java	Wed Jan 30 18:20:48 2013 +0900
@@ -1,15 +1,27 @@
 package alice.test.topology.aquarium.fx;
 
 import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
 
 public class TopNode extends CodeSegment{
 
+	private Receiver data1 = ids.create(CommandType.PEEK);
+	private Receiver data2 = ids.create(CommandType.PEEK);
+	
+	public TopNode(){
+		data1.setKey("width");
+		data2.setKey("mynum");
+	}
+	
 	@Override
 	public void run() {
 		ods.put("local", "list", new RoutingTable());
 		new RegistRoutingTable();
 		
-		ods.put("local", "objCnt", 5);
+		int startX = data1.asInteger() * data2.asInteger(); 
+		ods.put("local", "startX", startX);
+		
 		Aquarium aqua = new Aquarium();
 		aqua.run();
 	}