Browse Source

Added debug console

Thomas Buck 12 years ago
parent
commit
688f9d909e
3 changed files with 51 additions and 9 deletions
  1. 1
    1
      Cube Control/cubeWorker.java
  2. 48
    6
      Cube Control/frame.java
  3. 2
    2
      Cube Control/makefile

+ 1
- 1
Cube Control/cubeWorker.java View File

@@ -289,7 +289,7 @@ public class cubeWorker {
289 289
 		}
290 290
 		String[] arg = {"p"};
291 291
 		String portLines = HelperUtility.runHelper(arg);
292
-		System.out.println("Output: " + portLines);
292
+		// System.out.println("Output: " + portLines);
293 293
 		if (portLines == null) {
294 294
 			return ports;
295 295
 		}

+ 48
- 6
Cube Control/frame.java View File

@@ -49,7 +49,7 @@ class Led3D {
49 49
 
50 50
 	private Point3d eye = new Point3d(3.5, 3.5, -13.0);
51 51
 	private Point3d look = new Point3d(3.5, 3.5, 0.0);
52
-	private Vector3d lookVect = new Vector3d(1.0, 1.0, 0.0);
52
+	private Vector3d lookVect = new Vector3d(1.0, 1.0, 1.0);
53 53
 
54 54
   Led3D(Canvas3D canv) {
55 55
 
@@ -58,8 +58,8 @@ class Led3D {
58 58
     // Position viewer, so we are looking at object
59 59
     trans3D = new Transform3D();
60 60
     trans3D.lookAt(eye, look, lookVect);
61
-    trans3D.invert();
62
-    //transGroup = new TransformGroup(trans3D);
61
+	trans3D.invert();
62
+	transGroup = new TransformGroup(trans3D);
63 63
     transGroup = new TransformGroup();
64 64
     ViewingPlatform viewingPlatform = new ViewingPlatform();
65 65
     transGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
@@ -71,7 +71,8 @@ class Led3D {
71 71
     universe = new SimpleUniverse(viewingPlatform, viewer);
72 72
     group.addChild(transGroup);
73 73
     universe.getViewingPlatform().getViewPlatformTransform().setTransform(trans3D);
74
-    universe.addBranchGraph(group); // Add group to universe
74
+    // universe.getViewingPlatform().setNominalViewingTransform();
75
+	universe.addBranchGraph(group); // Add group to universe
75 76
 
76 77
     BoundingBox boundBox = new BoundingBox(new Point3d(-5.0, -5.0, -5.0), new Point3d(13.0, 13.0, 13.0));
77 78
     // roration with left mouse button
@@ -146,6 +147,15 @@ class Led3D {
146 147
     inBetween.addChild(fffuuuuu);
147 148
   }
148 149
 
150
+  	public void printTranslationData() {
151
+		Matrix4d mat = new Matrix4d();
152
+		Transform3D t = new Transform3D();
153
+		transGroup.getTransform(t);
154
+		t.get(mat);
155
+		String s = mat.toString();
156
+		System.out.println(s.replaceAll(", ", "\t"));
157
+	}
158
+
149 159
 	// 64 Element byte array
150 160
 	public void setData(short[] data) {
151 161
 		for (int y = 0; y < 8; y++) {
@@ -897,10 +907,42 @@ public class frame extends JFrame implements ListSelectionListener {
897 907
          }
898 908
   }
899 909
 
910
+  public Led3D get3D() {
911
+	  return ledView;
912
+  }
913
+
900 914
   // Ende Ereignisprozeduren
901 915
 
902 916
   public static void main(String[] args) {
903
-    new frame("Cube Control");
917
+    frame f = new frame("Cube Control");
918
+	Led3D l = f.get3D();
919
+	java.util.Scanner sc = new java.util.Scanner(System.in);
920
+
921
+	System.out.println("## Cube Control Debug Console ##");
922
+	System.out.println("Enter a Command ('h' for help)\n");
923
+	
924
+	System.out.print("$> ");
925
+
926
+	do {
927
+		if (sc.hasNext()) {
928
+			String s = sc.next();
929
+			
930
+			if (s.equals("p") || (s.equals("print")))
931
+				l.printTranslationData();
932
+
933
+			if (s.equals("q") || s.equals("quit"))
934
+				System.exit(0);
935
+
936
+			if (s.equals("h") || (s.equals("help"))) {
937
+				System.out.println("Commands:");
938
+				System.out.println("\t'print' / 'p'\t:\tPrint 3D Translation Matrix Data");
939
+				System.out.println("\t'help' / 'h'\t:\tShow this message");
940
+				System.out.println("\t'quit' / 'q'\t:\tExit Cube Control");
941
+			}
942
+
943
+			System.out.print("$> ");
944
+		}
945
+	} while (true);
904 946
   }
905 947
   // Ende Methoden
906
-}
948
+}

+ 2
- 2
Cube Control/makefile View File

@@ -1,7 +1,7 @@
1 1
 JAVAC = javac
2 2
 CC = gcc
3
-#TARGET = unix
4
-TARGET = win
3
+TARGET = unix
4
+#TARGET = win
5 5
 
6 6
 # Java files to be compiled
7 7
 ifeq ($(TARGET),win)

Loading…
Cancel
Save