Skip to content

Commit 7b3a4dc

Browse files
committed
Adding unit testing for all of the CSG configurations that need to be
pruned from the serialized objects,a nd syncing the history on the way back out.
1 parent f4918d2 commit 7b3a4dc

3 files changed

Lines changed: 35 additions & 16 deletions

File tree

src/main/java/eu/mihosoft/vrl/v3d/CSG.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public CSG setTemporaryColor(Color color) {
264264
* @param manipulator the manipulator
265265
* @return the affine
266266
*/
267-
public CSG setManipulator(Affine manipulator) {
267+
public CSG setManipulator(javafx.scene.transform.Affine manipulator) {
268268
if (manipulator == null)
269269
return this;
270270
Affine old = manipulator;
@@ -2498,15 +2498,15 @@ public CSG setManufacturing(PrepForManufacturing manufactuing) {
24982498
return this;
24992499
}
25002500

2501-
@Deprecated
2502-
public PrepForManufacturing getManufactuing() {
2503-
return getManufacturing();
2504-
}
2501+
// @Deprecated
2502+
// public PrepForManufacturing getManufactuing() {
2503+
// return getManufacturing();
2504+
// }
25052505

2506-
@Deprecated
2507-
public CSG setManufactuing(PrepForManufacturing manufactuing) {
2508-
return setManufacturing(manufactuing);
2509-
}
2506+
// @Deprecated
2507+
// public CSG setManufactuing(PrepForManufacturing manufactuing) {
2508+
// return setManufacturing(manufactuing);
2509+
// }
25102510

25112511
public CSG setParameter(Parameter w, IParametric function) {
25122512
if (w == null)

src/main/java/eu/mihosoft/vrl/v3d/CSGClient.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,18 @@ private ArrayList<CSG> performOperation(List<CSG> csgList, CSGRemoteOperation op
131131
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
132132
System.out.println("Running Operation on server: " + hostname + " " + operation);
133133
// Create and send request
134-
ArrayList<PropertyStorage> store =new ArrayList<PropertyStorage>();
134+
135+
ArrayList <CSG> toSend = new ArrayList<CSG>();
135136
for(CSG c:csgList) {
136-
store.add(c.getStorage());
137-
// Do not attempt to send properties because they may contain lambda functions that can not serialize
138-
c.setStorage(new PropertyStorage());
137+
CSG tmp = c.clone();
138+
tmp.setStorage(new PropertyStorage());
139+
tmp.setManipulator(null);
140+
tmp.setManufacturing(null);
141+
tmp.getMapOfparametrics().clear();
142+
tmp.setRegenerate(null);
143+
toSend.add(tmp);
139144
}
140-
CSGRequest request = new CSGRequest(csgList, operation);
145+
CSGRequest request = new CSGRequest(toSend, operation);
141146
if (key != null)
142147
request.setAPIKEY(key);
143148
oos.writeObject(request);
@@ -152,8 +157,8 @@ private ArrayList<CSG> performOperation(List<CSG> csgList, CSGRemoteOperation op
152157
// Return results as ArrayList
153158
back = new ArrayList<>(response.getCsgList());
154159
for(CSG c:back) {
155-
for(PropertyStorage s:store) {
156-
c.getStorage().syncProperties(s);// Keep the Lambdas in the memory space where they came from
160+
for(CSG s:csgList) {
161+
c.historySync(s);
157162
}
158163
}
159164
} catch (Throwable t) {

src/test/java/eu/mihosoft/vrl/v3d/ServerClientTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import org.junit.Test;
1010

11+
import eu.mihosoft.vrl.v3d.parametrics.LengthParameter;
12+
1113
public class ServerClientTest {
1214

1315
@Test
@@ -42,6 +44,17 @@ public void test() throws Exception {
4244

4345
CSG a = new Cube(20).toCSG();
4446
a.getBounds();
47+
a.setManipulator(new javafx.scene.transform.Affine());
48+
a.setManufacturing(new PrepForManufacturing() {
49+
@Override
50+
public CSG prep(CSG incoming) {
51+
// TODO Auto-generated method stub
52+
return incoming;
53+
}
54+
});
55+
LengthParameter param = new LengthParameter("parameter", (double) 35, new ArrayList<Double>());
56+
a.setParameter(param);
57+
4558
CSG b = new Cube(20, 30, 5).toCSG();
4659
b.getBounds();
4760
CSG c = new Cube(10, 10, 10).toCSG();
@@ -54,6 +67,7 @@ public void test() throws Exception {
5467
} catch (Exception e) {
5568
System.err.println("Communication error: " + e.getMessage());
5669
e.printStackTrace();
70+
fail();
5771
}
5872

5973
server.stop();

0 commit comments

Comments
 (0)