Commit 514252fa authored by Robert Smith's avatar Robert Smith
Browse files

Working build



Fixed various errors that were causing test failures. 
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent 17607532
......@@ -145,7 +145,7 @@ public class MeshComponentTester {
polygon = new NekPolygonController(new NekPolygonMesh(),
new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "1");
allShapes.add(polygon);
......@@ -200,7 +200,7 @@ public class MeshComponentTester {
polygon = new NekPolygonController(new NekPolygonMesh(),
new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "2");
allShapes.add(polygon);
......@@ -252,7 +252,7 @@ public class MeshComponentTester {
polygon = new NekPolygonController(new NekPolygonMesh(),
new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "3");
allShapes.add(polygon);
......@@ -305,7 +305,7 @@ public class MeshComponentTester {
polygon = new NekPolygonController(new NekPolygonMesh(),
new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "4");
allShapes.add(polygon);
......@@ -506,7 +506,7 @@ public class MeshComponentTester {
NekPolygonController polygon = new NekPolygonController(
new NekPolygonMesh(), new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "1");
......@@ -538,7 +538,7 @@ public class MeshComponentTester {
polygon = new NekPolygonController(new NekPolygonMesh(),
new AbstractView());
for (AbstractController edge : edges) {
polygon.addEntity(edge);
polygon.addEntityByCategory(edge, "Edges");
}
polygon.setProperty("Id", "1");
unequalObject.addPolygon(polygon);
......@@ -610,7 +610,7 @@ public class MeshComponentTester {
NekPolygonController shape = new NekPolygonController(
new NekPolygonMesh(), new AbstractView());
for (AbstractController edge : edges) {
shape.addEntity(edge);
shape.addEntityByCategory(edge, "Edges");
}
shape.setProperty("Id", "1");
......@@ -631,7 +631,7 @@ public class MeshComponentTester {
NekPolygonController shape2 = new NekPolygonController(
new NekPolygonMesh(), new AbstractView());
for (AbstractController edge : edges) {
shape2.addEntity(edge);
shape2.addEntityByCategory(edge, "Edges");
}
shape2.setProperty("Id", "2");
......@@ -782,15 +782,16 @@ public class MeshComponentTester {
.getEntitiesByCategory("Edges")) {
switch (edge.getProperty("Id")) {
case "1":
assertEquals(3f, ((EdgeController) edge).getLength(), 1e-7f);
assertEquals(1f, ((EdgeController) edge).getLength(), 1e-7f);
break;
case "2":
assertEquals(5f, ((EdgeController) edge).getLength(), 1e-7f);
assertEquals(1.4142135, ((EdgeController) edge).getLength(),
1e-7f);
break;
case "3":
assertEquals(4f, ((EdgeController) edge).getLength(), 1e-7f);
assertEquals(1f, ((EdgeController) edge).getLength(), 1e-7f);
break;
default:
......
......@@ -828,7 +828,7 @@ public class NekReader {
.createController(quadComponent);
for (EdgeController e : edges) {
quad.addEntity(e);
quad.addEntityByCategory(e, "Edges");
}
quad.setPolygonProperties(materialId, groupNum);
......
This diff is collapsed.
......@@ -32,19 +32,19 @@ public class ExtremaTester {
public void checkConstruction() {
// Create some extrema and check the initial values.
Extrema first = new Extrema(-1d, 0d, 0.5d, 0.5d, 0d, 1d);
Extrema first = new Extrema(-1d, 0d, -0.5d, 0.5d, 0d, 1d);
assertTrue(first.getMinX() == -1d);
assertTrue(first.getMinY() == -0.5d);
assertTrue(first.getMaxY() == 0.5d);
assertTrue(first.getMaxZ() == 1d);
Extrema second = new Extrema(0d, 1d, -1d, 0d, 0.5d, 0.5d);
Extrema second = new Extrema(0d, 1d, -1d, 0d, -0.5d, 0.5d);
assertTrue(second.getMinY() == -1d);
assertTrue(second.getMinZ() == -0.5d);
assertTrue(second.getMaxZ() == 0.5d);
assertTrue(second.getMaxX() == 1d);
Extrema third = new Extrema(0.5d, 0.5d, 0d, 1d, -1d, 0d);
Extrema third = new Extrema(-0.5d, 0.5d, 0d, 1d, -1d, 0d);
assertTrue(third.getMinZ() == -1d);
assertTrue(third.getMinX() == -0.5d);
assertTrue(third.getMaxX() == 0.5d);
......
......@@ -152,8 +152,7 @@ public class PipeMesh extends TubeMesh {
entities.put(category, catList);
// Notify listeners of the new child
SubscriptionType[] eventTypes = {
SubscriptionType.CHILD };
SubscriptionType[] eventTypes = { SubscriptionType.CHILD };
updateManager.notifyListeners(eventTypes);
}
......@@ -195,4 +194,19 @@ public class PipeMesh extends TubeMesh {
// outer radii are identical
return getRadius();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.viz.service.modeling.AbstractMeshComponent#clone()
*/
@Override
public Object clone() {
// Make a new shape component and copy the data into it
PipeMesh clone = new PipeMesh();
clone.copy(this);
return clone;
}
}
......@@ -97,10 +97,10 @@ public class MeshTester {
polygon = new NekPolygonController(new EdgeAndVertexFaceMesh(),
new AbstractView());
for (EdgeController e : edges) {
polygon.addEntity(e);
polygon.addEntityByCategory(e, "Edges");
}
for (VertexController v : vertices) {
polygon.addEntity(v);
polygon.addEntityByCategory(v, "Vertices");
}
polygon.setProperty("Id", Integer.toString(counter++));
......@@ -141,10 +141,10 @@ public class MeshTester {
polygon = new NekPolygonController(new EdgeAndVertexFaceMesh(),
new AbstractView());
for (EdgeController e : edges) {
polygon.addEntity(e);
polygon.addEntityByCategory(e, "Edges");
}
for (VertexController v : vertices) {
polygon.addEntity(v);
polygon.addEntityByCategory(v, "Vertices");
}
polygon.setProperty("Id", Integer.toString(counter++));
......@@ -203,10 +203,10 @@ public class MeshTester {
polygon = new NekPolygonController(new EdgeAndVertexFaceMesh(),
new AbstractView());
for (EdgeController e : edges) {
polygon.addEntity(e);
polygon.addEntityByCategory(e, "Edges");
}
for (VertexController v : vertices) {
polygon.addEntity(v);
polygon.addEntityByCategory(v, "Vertices");
}
polygon.setProperty("Id", Integer.toString(counter++));
......@@ -239,11 +239,11 @@ public class MeshTester {
// Check the length of the first edge. Make sure it's been updated.
assertTrue(((TestEdge) edges.get(0)).wasUpdated());
assertEquals(2.82843, edges.get(0).getLength(), 1e-5f);
assertEquals(1.41421, edges.get(0).getLength(), 1e-5f);
// Check the length of the fourth edge. Make sure it's been updated.
assertTrue(((TestEdge) edges.get(2)).wasUpdated());
assertEquals(2.23606797, edges.get(2).getLength(), 1e-5f);
assertEquals(1d, edges.get(2).getLength(), 1e-5f);
/* ------------------------ */
return;
......
......@@ -13,8 +13,8 @@ package org.eclipse.ice.viz.service.mesh.datastructures;
import java.util.List;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.EdgeController;
import org.eclipse.ice.viz.service.modeling.EdgeAndVertexFaceMesh;
import org.eclipse.ice.viz.service.modeling.EdgeController;
import org.eclipse.ice.viz.service.modeling.FaceEdgeController;
/**
......@@ -96,7 +96,7 @@ public class NekPolygonMesh extends EdgeAndVertexFaceMesh {
updateManager.enqueue();
for (AbstractController edge : edges) {
edge.addEntity(controller);
edge.addEntityByCategory(controller, "Edges");
}
// Send messages from all changed edges
......
......@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.AbstractView;
import org.eclipse.ice.viz.service.modeling.EdgeAndVertexFaceMesh;
import org.eclipse.ice.viz.service.modeling.EdgeController;
import org.eclipse.ice.viz.service.modeling.EdgeMesh;
import org.eclipse.ice.viz.service.modeling.LinearEdgeMesh;
......@@ -60,9 +59,9 @@ public class EdgeControllerTester {
new AbstractView());
// Add all three vertices to the edge.
edge.addEntity(vertex1);
edge.addEntity(vertex2);
edge.addEntity(vertex3);
edge.addEntityByCategory(vertex1, "Vertices");
edge.addEntityByCategory(vertex2, "Vertices");
edge.addEntityByCategory(vertex3, "Vertices");
// Check the Vertices category to ensure that the edge accepted the
// first two vertices and ignored the third
......@@ -75,7 +74,7 @@ public class EdgeControllerTester {
// Replace the second vertex with the third
edge.removeEntity(vertex2);
edge.addEntity(vertex3);
edge.addEntityByCategory(vertex3, "Vertices");
// Check the Vertices category to ensure that the last vertex was
// replaced
......@@ -84,19 +83,20 @@ public class EdgeControllerTester {
assertFalse(vertices.contains(vertex2));
assertTrue(vertices.contains(vertex3));
}
/**
* Check that the part is cloned correctly.
*/
@Test
public void checkClone(){
//Create an edge
EdgeController edge = new EdgeController(new EdgeMesh(), new AbstractView());
public void checkClone() {
// Create an edge
EdgeController edge = new EdgeController(new EdgeMesh(),
new AbstractView());
edge.setProperty("Test", "Property");
//Clone it and check that they are identical
// Clone it and check that they are identical
EdgeController clone = (EdgeController) edge.clone();
assertTrue(edge.equals(clone));
}
}
}
......@@ -18,6 +18,7 @@ import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.junit.Ignore;
/**
* This abstract class provides a basic framework for performing SWTBot tests
......@@ -46,6 +47,7 @@ import org.eclipse.swtbot.swt.finder.SWTBot;
* @author Jordan Deyton
*
*/
@Ignore
public class AbstractSWTTester extends AbstractICEUITester<SWTBot> {
/**
......
......@@ -16,8 +16,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.ice.viz.service.datastructures.VizObject.IManagedUpdateable;
import org.eclipse.ice.viz.service.datastructures.VizObject.IManagedUpdateableListener;
import org.eclipse.ice.viz.service.datastructures.VizObject.UpdateableSubscriptionManager;
import org.eclipse.ice.viz.service.datastructures.VizObject.SubscriptionType;
import org.eclipse.ice.viz.service.datastructures.VizObject.UpdateableSubscriptionManager;
/**
* A class which is responsible for user interactions with the underlying data
......@@ -513,14 +513,15 @@ public class AbstractController
* UpdateableSubscriptionType[])
*/
@Override
public void update(IManagedUpdateable component,
SubscriptionType[] type) {
public void update(IManagedUpdateable component, SubscriptionType[] type) {
// Queue any messages from the view refresh
updateManager.enqueue();
// Refresh the view
view.refresh(model);
// Refresh the view, if one exists
if (view != null) {
view.refresh(model);
}
// Notify own listeners of the change.
updateManager.notifyListeners(type);
......
......@@ -85,9 +85,9 @@ public class EdgeAndVertexFaceMesh extends FaceMesh {
// consistent with the Edges category
if (!getEntitiesByCategory("Vertices").contains(entity)) {
//Queue messages from all the removals
// Queue messages from all the removals
updateManager.enqueue();
// If the entity is an edge, also remove its vertices
if (getEntitiesByCategory("Edges").contains(entity)) {
for (AbstractController vertex : entity
......@@ -117,8 +117,8 @@ public class EdgeAndVertexFaceMesh extends FaceMesh {
// Remove the entity as normal
super.removeEntity(entity);
//Flush the message queue
// Flush the message queue
updateManager.flushQueue();
}
......@@ -191,13 +191,14 @@ public class EdgeAndVertexFaceMesh extends FaceMesh {
for (AbstractController vertex : entities
.get("Vertices"))
if (tempVertex.equals(vertex)) {
newEdge.addEntity(vertex);
newEdge.addEntityByCategory(vertex,
"Vertices");
}
}
// Save the cloned edge to the map
addEntity(newEdge);
addEntityByCategory(newEdge, "Edges");
}
}
......
......@@ -59,25 +59,27 @@ public class EdgeController extends AbstractController {
public double getLength() {
return ((EdgeMesh) model).getLength();
}
/*
* (non-Javadoc)
* @see org.eclipse.ice.viz.service.modeling.AbstractController#update(org.eclipse.ice.viz.service.datastructures.VizObject.IManagedUpdateable, org.eclipse.ice.viz.service.datastructures.VizObject.SubscriptionType[])
*
* @see org.eclipse.ice.viz.service.modeling.AbstractController#update(org.
* eclipse.ice.viz.service.datastructures.VizObject.IManagedUpdateable,
* org.eclipse.ice.viz.service.datastructures.VizObject.SubscriptionType[])
*/
@Override
public void update(IManagedUpdateable component,
SubscriptionType[] type) {
public void update(IManagedUpdateable component, SubscriptionType[] type) {
//If the vertices were changed, recalculate the edge's length
for(SubscriptionType event : type){
if(event == SubscriptionType.CHILD){
((EdgeMesh) model).calculateLength();
// If the vertices were changed, recalculate the edge's length
for (SubscriptionType event : type) {
if (event == SubscriptionType.CHILD) {
((EdgeMesh) model).calculateLength();
}
}
super.update(component, type);
}
/*
* (non-Javadoc)
*
......
......@@ -193,9 +193,11 @@ public class EdgeMesh extends AbstractMesh {
type = otherObject.type;
properties = new HashMap<String, String>(otherObject.properties);
// Calculate the new length
calculateLength();
// Notify listeners of the change
SubscriptionType[] eventTypes = {
SubscriptionType.ALL };
SubscriptionType[] eventTypes = { SubscriptionType.ALL };
updateManager.notifyListeners(eventTypes);
// Release all queued messages
......
......@@ -45,7 +45,7 @@ public class LinearEdgeMesh extends EdgeMesh {
public double calculateLength() {
// If the edge has two vertices, calculate its length
if (entities.get("Vertices").size() == 2) {
if (getEntitiesByCategory("Vertices").size() == 2) {
// Calculate the distance between the start and end points
double[] startPoint = ((VertexController) entities.get("Vertices")
......
......@@ -87,7 +87,7 @@
<module>org.eclipse.ice.core</module>
<module>org.eclipse.ice.core.test</module>
<module>org.eclipse.ice.item</module>
<module>org.eclipse.ice.item.test</module>
<module>org.eclipse.ice.item.test</module>
<module>org.eclipse.ice.persistence.xml</module>
<module>org.eclipse.ice.persistence.xml.test</module>
<module>org.eclipse.ice.io</module>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment