diff options
author | smcauliffe <smcauliffe@cb376a5e-1013-0410-a455-b6b1f9ac8223> | 2006-05-07 10:31:42 +0000 |
---|---|---|
committer | smcauliffe <smcauliffe@cb376a5e-1013-0410-a455-b6b1f9ac8223> | 2006-05-07 10:31:42 +0000 |
commit | fa12baf6fb9369ae0ab151ed119073a51097b971 (patch) | |
tree | 7f1750b7f023dd29b9b9c94697b27251abb12551 | |
parent | c316b60517939ea60e5ef39a641acb6d004541eb (diff) | |
download | reprap-backup-fa12baf6fb9369ae0ab151ed119073a51097b971.tar.gz reprap-backup-fa12baf6fb9369ae0ab151ed119073a51097b971.zip |
Reverting to earlier version before accidental commit... ooops.
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@285 cb376a5e-1013-0410-a455-b6b1f9ac8223
23 files changed, 75 insertions, 336 deletions
diff --git a/trunk/reprap/host/.settings/org.eclipse.jdt.core.prefs b/trunk/reprap/host/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9703373e..00000000 --- a/trunk/reprap/host/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Sun May 07 00:33:08 NZST 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/trunk/reprap/host/src/org/reprap/comms/CommsTest.java b/trunk/reprap/host/src/org/reprap/comms/CommsTest.java deleted file mode 100644 index a0a8c9ab..00000000 --- a/trunk/reprap/host/src/org/reprap/comms/CommsTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.reprap.comms;
-
-import org.testng.Assert;
-
-public class CommsTest {
-
- public void setup() {
- }
-
- public void teardown() {
-
- }
- /**
- * @testng.test groups = "comms,all,all-offline"
- */
- public void testXXX() {
-
- }
-}
diff --git a/trunk/reprap/host/src/org/reprap/comms/IncomingMessage.java b/trunk/reprap/host/src/org/reprap/comms/IncomingMessage.java index 04e6b0bb..4d63bdac 100755 --- a/trunk/reprap/host/src/org/reprap/comms/IncomingMessage.java +++ b/trunk/reprap/host/src/org/reprap/comms/IncomingMessage.java @@ -45,14 +45,14 @@ public abstract class IncomingMessage { /** * Called by the framework to provide data to the IncomingMessage. * This should not normally be called by a user. - * @param payloadData The completed message to insert into the IncomingMessage + * @param payload The completed message to insert into the IncomingMessage * @return true is the data was accepted, otherwise false. */ - public boolean receiveData(byte [] payloadData) { + public boolean receiveData(byte [] payload) { // We assume the packet was for us, etc. But we need to // know it contains the correct contents - if (isExpectedPacketType(payloadData[0])) { - this.payload = (byte[])payloadData.clone(); + if (isExpectedPacketType(payload[0])) { + this.payload = (byte[])payload.clone(); return true; } else { // That's not what we were after, so discard and wait for more diff --git a/trunk/reprap/host/src/org/reprap/comms/port/Port.java b/trunk/reprap/host/src/org/reprap/comms/port/Port.java deleted file mode 100644 index 9fd530f5..00000000 --- a/trunk/reprap/host/src/org/reprap/comms/port/Port.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.reprap.comms.port;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public interface Port {
- public OutputStream getOutputStream() throws IOException;
- public InputStream getInputStream() throws IOException;
- public void close();
-}
diff --git a/trunk/reprap/host/src/org/reprap/comms/port/SerialPort.java b/trunk/reprap/host/src/org/reprap/comms/port/SerialPort.java deleted file mode 100644 index cff2e373..00000000 --- a/trunk/reprap/host/src/org/reprap/comms/port/SerialPort.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.reprap.comms.port;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import javax.comm.CommPortIdentifier;
-import javax.comm.NoSuchPortException;
-
-public class SerialPort implements Port {
-
- private javax.comm.SerialPort port;
-
- public SerialPort(String portName, int baudRate) throws Exception {
- try {
- CommPortIdentifier commId = CommPortIdentifier.getPortIdentifier(portName);
- port = (javax.comm.SerialPort)commId.open(portName, 30000);
- }
- catch (NoSuchPortException ex) {
- }
-
- // Workround for javax.comm bug.
- // See http://forum.java.sun.com/thread.jspa?threadID=673793
- try {
- port.setSerialPortParams(baudRate,
- javax.comm.SerialPort.DATABITS_8,
- javax.comm.SerialPort.STOPBITS_1,
- javax.comm.SerialPort.PARITY_NONE);
- }
- catch (Exception e) {
- port.setSerialPortParams(baudRate,
- javax.comm.SerialPort.DATABITS_8,
- javax.comm.SerialPort.STOPBITS_1,
- javax.comm.SerialPort.PARITY_NONE);
- }
- // End of workround
-
- try {
- port.setFlowControlMode(javax.comm.SerialPort.FLOWCONTROL_NONE);
- } catch (Exception e) {
- // Um, Linux USB ports don't do this. What can I do about it?
- }
-
- }
-
- public OutputStream getOutputStream() throws IOException {
- return port.getOutputStream();
- }
-
- public InputStream getInputStream() throws IOException {
- return port.getInputStream();
- }
-
- public void close() {
- port.close();
- }
-}
diff --git a/trunk/reprap/host/src/org/reprap/comms/port/TestPort.java b/trunk/reprap/host/src/org/reprap/comms/port/TestPort.java deleted file mode 100644 index 3d3848ad..00000000 --- a/trunk/reprap/host/src/org/reprap/comms/port/TestPort.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.reprap.comms.port;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.reprap.comms.snap.SNAPAddress;
-import org.reprap.devices.TestDevice;
-
-public class TestPort implements Port {
-
- private HashMap deviceMap;
-
- public TestPort() {
- deviceMap = new HashMap();
- }
-
- public OutputStream getOutputStream() throws IOException {
- return System.out;
- }
-
- public InputStream getInputStream() throws IOException {
- return System.in;
- }
-
- public void close() {
- }
-
- /**
- * Called by a device to register itself on the TestPort
- * @param device
- * @param address
- */
- public void addDevice(TestDevice device, SNAPAddress address) {
- deviceMap.put(address, device);
- }
-
-}
diff --git a/trunk/reprap/host/src/org/reprap/comms/snap/SNAPCommunicator.java b/trunk/reprap/host/src/org/reprap/comms/snap/SNAPCommunicator.java index 7f4d73f8..32e7799e 100755 --- a/trunk/reprap/host/src/org/reprap/comms/snap/SNAPCommunicator.java +++ b/trunk/reprap/host/src/org/reprap/comms/snap/SNAPCommunicator.java @@ -6,19 +6,24 @@ import java.io.OutputStream; import java.net.URL; import java.util.Properties; +import javax.comm.CommPortIdentifier; +import javax.comm.NoSuchPortException; +import javax.comm.PortInUseException; +import javax.comm.SerialPort; +import javax.comm.UnsupportedCommOperationException; + import org.reprap.Device; import org.reprap.comms.Address; import org.reprap.comms.Communicator; import org.reprap.comms.IncomingContext; import org.reprap.comms.IncomingMessage; import org.reprap.comms.OutgoingMessage; -import org.reprap.comms.port.Port; public class SNAPCommunicator implements Communicator { private Address localAddress; - private Port port; + private SerialPort port; private OutputStream writeStream; private InputStream readStream; @@ -26,11 +31,39 @@ public class SNAPCommunicator implements Communicator { private CommsLock lock = new CommsLock(); - public SNAPCommunicator(Port port, Address localAddress) - throws Exception { + public SNAPCommunicator(String portName, int baudRate, Address localAddress) + throws NoSuchPortException, PortInUseException, IOException, UnsupportedCommOperationException { this.localAddress = localAddress; - this.port = port; + CommPortIdentifier commId = CommPortIdentifier.getPortIdentifier(portName); + port = (SerialPort)commId.open(portName, 30000); + + + // Workround for javax.comm bug. + // See http://forum.java.sun.com/thread.jspa?threadID=673793 + + try { + port.setSerialPortParams(baudRate, + SerialPort.DATABITS_8, + SerialPort.STOPBITS_1, + SerialPort.PARITY_NONE); + } + catch (Exception e) { + + } + + port.setSerialPortParams(baudRate, + SerialPort.DATABITS_8, + SerialPort.STOPBITS_1, + SerialPort.PARITY_NONE); + // End of workround + + try { + port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); + } catch (Exception e) { + // Um, Linux USB ports don't do this. What can I do about it? + } + writeStream = port.getOutputStream(); readStream = port.getInputStream(); diff --git a/trunk/reprap/host/src/org/reprap/comms/snap/SNAPTest.java b/trunk/reprap/host/src/org/reprap/comms/snap/SNAPTest.java deleted file mode 100644 index 1cf97621..00000000 --- a/trunk/reprap/host/src/org/reprap/comms/snap/SNAPTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.reprap.comms.snap;
-
-import org.reprap.comms.port.Port;
-import org.reprap.comms.port.TestPort;
-import org.reprap.devices.TestDevice;
-import org.testng.Assert;
-
-public class SNAPTest {
-
- private Port port;
-
- public void setup() {
- TestPort testport;
- port = testport = new TestPort();
-
- //new TestDevice(testport, new SNAPAddress(2));
- }
-
- public void teardown() {
-
- }
-
- /**
- * @testng.test groups = "comms,all,all-offline"
- */
- public void testXXX() {
-
- }
-
-
-}
diff --git a/trunk/reprap/host/src/org/reprap/devices/GenericExtruder.java b/trunk/reprap/host/src/org/reprap/devices/GenericExtruder.java index 1ac25b30..755a9bbf 100644 --- a/trunk/reprap/host/src/org/reprap/devices/GenericExtruder.java +++ b/trunk/reprap/host/src/org/reprap/devices/GenericExtruder.java @@ -307,7 +307,7 @@ public class GenericExtruder extends Device { * @param ref Set reference voltage (0-63) * @throws IOException */ - protected void setVref(int ref) throws IOException { + private void setVref(int ref) throws IOException { lock(); try { sendMessage(new OutgoingByteMessage(MSG_SetVRef, (byte)ref)); @@ -324,7 +324,7 @@ public class GenericExtruder extends Device { * @param scale * @throws IOException */ - protected void setTempScaler(int scale) throws IOException { + private void setTempScaler(int scale) throws IOException { lock(); try { sendMessage(new OutgoingByteMessage(MSG_SetTempScaler, (byte)scale)); diff --git a/trunk/reprap/host/src/org/reprap/devices/TestDevice.java b/trunk/reprap/host/src/org/reprap/devices/TestDevice.java deleted file mode 100644 index 5119ab10..00000000 --- a/trunk/reprap/host/src/org/reprap/devices/TestDevice.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.reprap.devices;
-
-import org.reprap.Device;
-import org.reprap.comms.Address;
-import org.reprap.comms.Communicator;
-import org.reprap.comms.port.TestPort;
-import org.reprap.comms.snap.SNAPAddress;
-
-public class TestDevice extends Device {
-
- private TestPort port;
-
- public TestDevice(Communicator communicator, Address address) {
- super(communicator, address);
- this.port = port;
- //port.addDevice(this, address);
- }
-
-}
diff --git a/trunk/reprap/host/src/org/reprap/devices/pseudo/LinePrinter.java b/trunk/reprap/host/src/org/reprap/devices/pseudo/LinePrinter.java index d8a4b0a6..4dfe456e 100644 --- a/trunk/reprap/host/src/org/reprap/devices/pseudo/LinePrinter.java +++ b/trunk/reprap/host/src/org/reprap/devices/pseudo/LinePrinter.java @@ -44,7 +44,7 @@ public class LinePrinter { GenericStepperMotor master, slave; - int x1, y0, y1; + int x0, x1, y0, y1; // Whichever is the greater distance will be the master // From an algorithmic point of view, we'll just consider @@ -53,12 +53,14 @@ public class LinePrinter { if (Math.abs(endX - currentX) > Math.abs(endY - currentY)) { master = motorX; slave = motorY; + x0 = currentX; x1 = endX; y0 = currentY; y1 = endY; } else { master = motorY; slave = motorX; + x0 = currentY; x1 = endY; y0 = currentX; y1 = endX; diff --git a/trunk/reprap/host/src/org/reprap/geometry/LayerProducer.java b/trunk/reprap/host/src/org/reprap/geometry/LayerProducer.java index 625c34c5..d984466d 100644 --- a/trunk/reprap/host/src/org/reprap/geometry/LayerProducer.java +++ b/trunk/reprap/host/src/org/reprap/geometry/LayerProducer.java @@ -31,6 +31,10 @@ public class LayerProducer { private RrPolygonList borderPolygons; private RrCSGPolygon csg_p; + private double scale; + private Rr2Point p_0; + private Rr2Point pos; + /** * @param reprap @@ -52,22 +56,24 @@ public class LayerProducer { csg_p = null; - //RrBox big = hatchedPolygons.box.scale(1.1); + RrBox big = hatchedPolygons.box.scale(1.1); - //double width = big.x().length(); - //double height = big.y().length(); + double width = big.x().length(); + double height = big.y().length(); } private void plot(Rr2Point a) throws ReprapException, IOException { if (printer.isCancelled()) return; printer.printTo(a.x(), a.y(), printer.getZ()); + pos = a; } private void move(Rr2Point a) throws ReprapException, IOException { if (printer.isCancelled()) return; printer.moveTo(a.x(), a.y(), printer.getZ()); + pos = a; } diff --git a/trunk/reprap/host/src/org/reprap/geometry/polygons/PolygonTest.java b/trunk/reprap/host/src/org/reprap/geometry/polygons/PolygonTest.java deleted file mode 100644 index e171bace..00000000 --- a/trunk/reprap/host/src/org/reprap/geometry/polygons/PolygonTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.reprap.geometry.polygons;
-
-import org.testng.Assert;
-
-public class PolygonTest {
-
- /**
- * @testng.test groups = "geometry,all,all-offline"
- */
- public void testPoint() {
- Rr2Point testPoint = new Rr2Point(10, 5);
- Assert.assertEquals(testPoint.x(), 10.0, 0.0, "x");
- Assert.assertEquals(testPoint.y(), 5.0, 0.0, "y");
-
- Rr2Point negPoint = testPoint.neg();
- Assert.assertEquals(negPoint.x(), -10.0, 0.0, "neg x");
- Assert.assertEquals(negPoint.y(), -5.0, 0.0, "neg x");
- }
-
-}
diff --git a/trunk/reprap/host/src/org/reprap/geometry/polygons/RrCSG.java b/trunk/reprap/host/src/org/reprap/geometry/polygons/RrCSG.java index 1c7bfcc0..280f92f1 100755 --- a/trunk/reprap/host/src/org/reprap/geometry/polygons/RrCSG.java +++ b/trunk/reprap/host/src/org/reprap/geometry/polygons/RrCSG.java @@ -601,17 +601,17 @@ public class RrCSG case RrCSGOp.UNION: case RrCSGOp.INTERSECTION: - RrHalfPlane halfPlane = leaf.hp; + RrHalfPlane hp = leaf.hp; if(c1.op == RrCSGOp.LEAF) { - if(RrHalfPlane.same(halfPlane, c1.hp, tolerance)) + if(RrHalfPlane.same(hp, c1.hp, tolerance)) c1 = leaf; } else c1.replace_all_same_leaves(leaf, tolerance); if(c2.op == RrCSGOp.LEAF) { - if(RrHalfPlane.same(halfPlane, c2.hp, tolerance)) + if(RrHalfPlane.same(hp, c2.hp, tolerance)) c2 = leaf; } else c2.replace_all_same_leaves(leaf, tolerance); diff --git a/trunk/reprap/host/src/org/reprap/geometry/polygons/TestMain.java b/trunk/reprap/host/src/org/reprap/geometry/polygons/TestMain.java index 6aeb20bd..546f3706 100644 --- a/trunk/reprap/host/src/org/reprap/geometry/polygons/TestMain.java +++ b/trunk/reprap/host/src/org/reprap/geometry/polygons/TestMain.java @@ -53,6 +53,7 @@ public class TestMain Rr2Point pp = new Rr2Point(0.35, 0.62); Rr2Point qq = new Rr2Point(0.55, 0.95); Rr2Point rr = new Rr2Point(0.45, 0.5); + Rr2Point ss = new Rr2Point(0.4, 0.3); RrLine x = new RrLine(new Rr2Point(-1, -1), new Rr2Point(1, 1)); RrHalfPlane ph = new RrHalfPlane(p, q); diff --git a/trunk/reprap/host/src/org/reprap/gui/Panel3D.java b/trunk/reprap/host/src/org/reprap/gui/Panel3D.java index 001465b0..6d9ed229 100644 --- a/trunk/reprap/host/src/org/reprap/gui/Panel3D.java +++ b/trunk/reprap/host/src/org/reprap/gui/Panel3D.java @@ -267,7 +267,7 @@ abstract public class Panel3D extends JPanel { javax.media.j3d.Locale locale = createLocale(universe); - BranchGroup sceneBG = createSceneBranchGroup(); + BranchGroup sceneBranchGroup = createSceneBranchGroup(); ViewPlatform vp = createViewPlatform(); BranchGroup viewBranchGroup = createViewBranchGroup( @@ -278,9 +278,9 @@ abstract public class Panel3D extends JPanel { Background background = createBackground(); if (background != null) - sceneBG.addChild(background); + sceneBranchGroup.addChild(background); - locale.addBranchGraph(sceneBG); + locale.addBranchGraph(sceneBranchGroup); addViewBranchGroup(locale, viewBranchGroup); } diff --git a/trunk/reprap/host/src/org/reprap/gui/PreviewPanel.java b/trunk/reprap/host/src/org/reprap/gui/PreviewPanel.java index 241ee037..28e82a43 100644 --- a/trunk/reprap/host/src/org/reprap/gui/PreviewPanel.java +++ b/trunk/reprap/host/src/org/reprap/gui/PreviewPanel.java @@ -114,14 +114,6 @@ public class PreviewPanel extends Panel3D implements Previewer { public void setMaterial(int index) { material = index; } - - /** - * Get the current extrusion material - * @return The current extrusion material as an integer index - */ - public int getMaterial() { - return material; - } /** * Called to add a new segment of extruded material to the preview diff --git a/trunk/reprap/host/src/org/reprap/gui/STLObject.java b/trunk/reprap/host/src/org/reprap/gui/STLObject.java index eb44c7e8..08fda822 100644 --- a/trunk/reprap/host/src/org/reprap/gui/STLObject.java +++ b/trunk/reprap/host/src/org/reprap/gui/STLObject.java @@ -226,7 +226,7 @@ public class STLObject // method to recursively set the user data for objects in the scenegraph tree // we also set the capabilites on Shape3D and Morph objects required by the PickTool - void recursiveSetUserData( Object value, Object key, String nameToSet) + void recursiveSetUserData( Object value, Object key , String name) { if( value instanceof SceneGraphObject != false ) { @@ -243,11 +243,11 @@ public class STLObject java.util.Enumeration enumKids = g.getAllChildren( ); while( enumKids.hasMoreElements( ) != false ) - recursiveSetUserData( enumKids.nextElement( ), key, nameToSet ); + recursiveSetUserData( enumKids.nextElement( ), key, name ); } else if ( sg instanceof Shape3D || sg instanceof Morph ) { if ( sg instanceof Shape3D) - ((Shape3D)sg).setUserData(nameToSet); + ((Shape3D)sg).setUserData(name); PickTool.setCapabilities( (Node) sg, PickTool.INTERSECT_FULL ); } } diff --git a/trunk/reprap/host/src/org/reprap/gui/extrudertest/Main.java b/trunk/reprap/host/src/org/reprap/gui/extrudertest/Main.java index 15b51445..d48509c9 100644 --- a/trunk/reprap/host/src/org/reprap/gui/extrudertest/Main.java +++ b/trunk/reprap/host/src/org/reprap/gui/extrudertest/Main.java @@ -18,8 +18,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.reprap.comms.Communicator; -import org.reprap.comms.port.Port; -import org.reprap.comms.port.SerialPort; import org.reprap.comms.snap.SNAPAddress; import org.reprap.comms.snap.SNAPCommunicator; import org.reprap.devices.GenericExtruder; @@ -81,8 +79,7 @@ public class Main extends javax.swing.JDialog { SNAPAddress myAddress = new SNAPAddress(localNodeNumber); this.setResizable(false); - Port port = new SerialPort(commPortName, baudRate); - communicator = new SNAPCommunicator(port, myAddress); + communicator = new SNAPCommunicator(commPortName, baudRate, myAddress); extruder = new GenericExtruder(communicator, new SNAPAddress(props.getProperty("Extruder1Address")), diff --git a/trunk/reprap/host/src/org/reprap/gui/steppertest/Main.java b/trunk/reprap/host/src/org/reprap/gui/steppertest/Main.java index 6216ea93..cb11d980 100644 --- a/trunk/reprap/host/src/org/reprap/gui/steppertest/Main.java +++ b/trunk/reprap/host/src/org/reprap/gui/steppertest/Main.java @@ -23,8 +23,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.reprap.comms.Communicator; -import org.reprap.comms.port.Port; -import org.reprap.comms.port.SerialPort; import org.reprap.comms.snap.SNAPAddress; import org.reprap.comms.snap.SNAPCommunicator; import org.reprap.devices.GenericExtruder; @@ -64,8 +62,7 @@ public class Main extends javax.swing.JDialog implements ChangeListener { String commPortName = props.getProperty("Port"); SNAPAddress myAddress = new SNAPAddress(localNodeNumber); - Port port = new SerialPort(commPortName, baudRate); - communicator = new SNAPCommunicator(port, myAddress); + communicator = new SNAPCommunicator(commPortName, baudRate, myAddress); extruder = new GenericExtruder(communicator, new SNAPAddress(props.getProperty("Extruder1Address")), diff --git a/trunk/reprap/host/src/org/reprap/machines/MachineFactory.java b/trunk/reprap/host/src/org/reprap/machines/MachineFactory.java index 1b267f63..cfcd782a 100644 --- a/trunk/reprap/host/src/org/reprap/machines/MachineFactory.java +++ b/trunk/reprap/host/src/org/reprap/machines/MachineFactory.java @@ -16,11 +16,15 @@ public class MachineFactory { private MachineFactory() { } - static public Printer create(Properties props) throws Exception { + static public Printer create() throws Exception { // Currently this just always assumes we're building // a 3-axis cartesian printer. It should build an // appropriate type based on the local configuration. + Properties props = new Properties(); + URL url = ClassLoader.getSystemResource("reprap.properties"); + props.load(url.openStream()); + String geometry = props.getProperty("Geometry"); if (geometry.compareToIgnoreCase("cartesian") == 0) @@ -30,15 +34,6 @@ public class MachineFactory { else throw new ReprapException("Invalid geometry in properties file"); - - } - - static public Printer create() throws Exception { - Properties props = new Properties(); - URL url = ClassLoader.getSystemResource("reprap.properties"); - props.load(url.openStream()); - - return create(props); } } diff --git a/trunk/reprap/host/src/org/reprap/machines/Reprap.java b/trunk/reprap/host/src/org/reprap/machines/Reprap.java index 3a6abe46..8cca8c06 100644 --- a/trunk/reprap/host/src/org/reprap/machines/Reprap.java +++ b/trunk/reprap/host/src/org/reprap/machines/Reprap.java @@ -6,8 +6,6 @@ import java.util.Properties; import org.reprap.CartesianPrinter; import org.reprap.ReprapException; import org.reprap.comms.Communicator; -import org.reprap.comms.port.Port; -import org.reprap.comms.port.SerialPort; import org.reprap.comms.snap.SNAPAddress; import org.reprap.comms.snap.SNAPCommunicator; import org.reprap.devices.GenericExtruder; @@ -55,9 +53,8 @@ public class Reprap implements CartesianPrinter { String commPortName = config.getProperty("Port"); - SNAPAddress myAddress = new SNAPAddress(localNodeNumber); - Port port = new SerialPort(commPortName, baudRate); - communicator = new SNAPCommunicator(port, myAddress); + SNAPAddress myAddress = new SNAPAddress(localNodeNumber); + communicator = new SNAPCommunicator(commPortName, baudRate, myAddress); motorX = new GenericStepperMotor(communicator, new SNAPAddress(config.getProperty("Axis1Address")), diff --git a/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java b/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java deleted file mode 100644 index 48350e14..00000000 --- a/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.reprap.machines;
-
-import java.util.Properties;
-
-import org.reprap.Printer;
-import org.testng.Assert;
-
-public class ReprapTest {
-
- Printer reprap;
-
- public void setup() throws Exception {
- Properties props = new Properties();
- props.setProperty("Geometry", "cartesian");
- reprap = MachineFactory.create(props);
- }
-
- public void teardown() {
-
- }
- /**
- * @testng.test groups = "geometry,comms,all,all-offline"
- */
- public void testXXX() {
-
- }
-
-}
|