Commit 60aebfa2 authored by Robert Smith's avatar Robert Smith
Browse files

Updated tests and fixed some Mesh Editor bugs



Updated all tests to function with the newly refactored data types.

Also fixed two Mesh Editor bugs. One, caused by drawing from the generic
FXViewer, was causing its composite not to be drawn to full size. The
second allowed a user to keep adding vertices to a polygon indefinitely
if it was selected through the Mesh Elements view. 
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent 71d1f777
......@@ -37,7 +37,6 @@ Import-Package: com.jme3.app,
org.eclipse.ice.viz.service.javafx.mesh,
org.eclipse.ice.viz.service.jme3.mesh,
org.eclipse.ice.viz.service.mesh.datastructures,
org.eclipse.ice.viz.service.mesh.javafx,
org.eclipse.ice.viz.service.mesh.properties,
org.eclipse.ice.viz.service.modeling,
org.eclipse.ice.viz.service.widgets,
......
......@@ -56,9 +56,10 @@ public class ICEGeometryPage extends ICEFormPage
*
*/
private GeometryComponent geometryComp;
/**
* The visualization service that is providing the graphical implementation for the geometry editor.
* The visualization service that is providing the graphical implementation
* for the geometry editor.
*/
private IVizService service;
......@@ -176,10 +177,9 @@ public class ICEGeometryPage extends ICEFormPage
// Get JME3 Geometry service from factory
IVizServiceFactory factory = editor.getVizServiceFactory();
IVizService service = factory.get("ICE Geometry Editor");
((ShapeTreeView) getSite()
.getWorkbenchWindow().getActivePage()
.findView(ShapeTreeView.ID)).setFactory(service.getFactory());
service = factory.get("ICE Geometry Editor");
((ShapeTreeView) getSite().getWorkbenchWindow().getActivePage()
.findView(ShapeTreeView.ID)).setFactory(service.getFactory());
// Create and draw geometry canvas
try {
......
......@@ -20,8 +20,8 @@ import org.eclipse.ice.client.common.ActionTree;
import org.eclipse.ice.datastructures.ICEObject.ICEObject;
import org.eclipse.ice.datastructures.form.MeshComponent;
import org.eclipse.ice.viz.service.IVizService;
import org.eclipse.ice.viz.service.IVizServiceFactory;
import org.eclipse.ice.viz.service.geometry.widgets.TransformationView;
import org.eclipse.ice.viz.service.javafx.mesh.FXMeshVizService;
import org.eclipse.ice.viz.service.jme3.mesh.IMeshSelectionListener;
import org.eclipse.ice.viz.service.mesh.datastructures.IMeshVizCanvas;
import org.eclipse.jface.action.Action;
......@@ -219,7 +219,9 @@ public class ICEMeshPage extends ICEFormPage
// Get JME3 Geometry service from factory
// IVizServiceFactory factory = editor.getVizServiceFactory();
IVizService service = new FXMeshVizService();
// IVizService service = new FXMeshVizService();
IVizServiceFactory factory = editor.getVizServiceFactory();
IVizService service = factory.get("ICE JavaFX Mesh Editor");
// Composite editorComposite = new Composite(parent, SWT.NONE);
......
......@@ -14,12 +14,16 @@ package org.eclipse.ice.datastructures.test;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.datastructures.ICEObject.IUpdateableListener;
import org.eclipse.ice.viz.service.datastructures.VizObject.IManagedVizUpdateable;
import org.eclipse.ice.viz.service.datastructures.VizObject.IManagedVizUpdateableListener;
import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateable;
import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateableListener;
import org.eclipse.ice.viz.service.datastructures.VizObject.UpdateableSubscriptionType;
/**
* <p>
......@@ -33,7 +37,7 @@ import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateableListen
*
* @author Jay Jay Billings
*/
public class TestComponentListener implements IUpdateableListener,
public class TestComponentListener implements IManagedVizUpdateableListener, IUpdateableListener,
IVizUpdateableListener {
/**
......@@ -133,4 +137,25 @@ public class TestComponentListener implements IUpdateableListener,
return;
}
/*
* (non-Javadoc)
* @see org.eclipse.ice.viz.service.datastructures.VizObject.IManagedVizUpdateableListener#getSubscriptions(org.eclipse.ice.viz.service.datastructures.VizObject.IManagedVizUpdateable)
*/
@Override
public ArrayList<UpdateableSubscriptionType> getSubscriptions(IManagedVizUpdateable source) {
ArrayList<UpdateableSubscriptionType> types = new ArrayList<UpdateableSubscriptionType>();
types.add(UpdateableSubscriptionType.All);
return types;
}
@Override
public void update(IManagedVizUpdateable component, UpdateableSubscriptionType[] type) {
// Update the flag
wasNotified.set(true);
// Dump some debug information
System.out.println("TestComponentListener Message: Updated!");
}
}
\ No newline at end of file
......@@ -120,6 +120,16 @@ public class MeshComponent extends ICEObject
return;
}
/**
* Remove the given polygon from the MeshComponent.
*
* @param polygon The polygon to be removed from the list.
*/
public void removePolygon(Face polygon){
mesh.removeEntity(polygon);
notifyListeners();
}
/**
* <p>
......
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.viz.service.geometry">
<implementation class="org.eclipse.ice.viz.service.javafx.geometry.FXGeometryVizService"/>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.viz.service.mesh">
<implementation class="org.eclipse.ice.viz.service.javafx.mesh.FXMeshVizService"/>
<service>
<provide interface="org.eclipse.ice.viz.service.IVizService"/>
</service>
......
......@@ -168,6 +168,9 @@ public class FXAttachment extends AbstractAttachment {
}
});
// Have the geometry refreshed when it is added
handleUpdate(geom);
knownParts.add(geom);
}
}
......
......@@ -38,7 +38,6 @@ import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.shape.DrawMode;
import javafx.scene.shape.Shape3D;
import javafx.scene.shape.Sphere;
/**
* <p>
......@@ -62,7 +61,7 @@ public class FXViewer extends AbstractViewer {
private Group root;
/** The active scene displayed to the end user. */
private Scene scene;
protected Scene scene;
/**
* The content provider that generates JavaFX scene data from the geometry
......@@ -71,10 +70,10 @@ public class FXViewer extends AbstractViewer {
private FXContentProvider contentProvider;
/** Default camera controller. */
private CameraController cameraController;
protected CameraController cameraController;
/** Default camera. */
private Camera defaultCamera;
protected Camera defaultCamera;
/**
* <p>
......
......@@ -23,6 +23,7 @@ import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
......@@ -77,7 +78,8 @@ public class FXVizCanvas implements IVizCanvas, IVizUpdateableListener {
*/
@Override
public Composite draw(Composite parent) throws Exception {
Composite viewerParent = new Composite(parent, SWT.NONE);
Composite viewerParent = new Composite(parent, SWT.FILL);
viewerParent.setBackground(new Color(null, 255, 0, 255));
viewerParent.setLayout(new FillLayout());
this.viewer = materializeViewer(viewerParent);
......@@ -96,7 +98,7 @@ public class FXVizCanvas implements IVizCanvas, IVizUpdateableListener {
loadPart(root);
return parent;
return viewerParent;
}
/**
......
......@@ -200,7 +200,7 @@ public class FPSController extends CameraController {
mouseDeltaY = (mousePosY - mouseOldY);
double modifier = 1.0;
System.out.println(mouseOldX + "->" + mousePosX + " " + mouseOldY + "->" + mousePosY);
if (arg0.isPrimaryButtonDown()) {
y.setAngle(y.getAngle() - mouseDeltaX);
x.setAngle(x.getAngle() + mouseDeltaY);
......
......@@ -12,6 +12,8 @@ package org.eclipse.ice.viz.service.javafx.mesh;
import org.eclipse.ice.viz.service.javafx.canvas.AbstractViewer;
import org.eclipse.ice.viz.service.javafx.canvas.FXVizCanvas;
import org.eclipse.ice.viz.service.mesh.datastructures.IMeshVizCanvas;
import org.eclipse.ice.viz.service.mesh.properties.MeshSelection;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ice.viz.service.javafx.canvas.AbstractAttachment;
......@@ -221,8 +223,7 @@ public class FXMeshCanvas extends FXVizCanvas implements IMeshVizCanvas {
}
// If the polygon wasn't selected, check each of its children to
// see
// if they were.
// see if they were.
else {
for (AbstractController part : polygon.getEntities()) {
if (((MeshSelection) meshSelection).selectedMeshPart == part) {
......
......@@ -13,11 +13,12 @@ package org.eclipse.ice.viz.service.javafx.mesh;
import java.text.DecimalFormat;
import java.util.ArrayList;
import org.eclipse.ice.viz.service.javafx.canvas.FXContentProvider;
import org.eclipse.ice.viz.service.javafx.canvas.FXAttachment;
import org.eclipse.ice.viz.service.javafx.canvas.FXViewer;
import org.eclipse.ice.viz.service.javafx.internal.model.FXRenderer;
import org.eclipse.ice.viz.service.javafx.internal.scene.camera.CameraController;
import org.eclipse.ice.viz.service.javafx.internal.model.FXCameraAttachment;
import org.eclipse.ice.viz.service.javafx.internal.scene.camera.TopDownController;
import org.eclipse.ice.viz.service.javafx.mesh.datatypes.FXMeshControllerFactory;
import org.eclipse.ice.viz.service.javafx.scene.base.ICamera;
import org.eclipse.ice.viz.service.mesh.datastructures.NekPolygon;
import org.eclipse.ice.viz.service.mesh.datastructures.NekPolygonComponent;
import org.eclipse.ice.viz.service.mesh.properties.MeshSelection;
......@@ -30,7 +31,6 @@ import org.eclipse.ice.viz.service.modeling.FaceEdgeComponent;
import org.eclipse.ice.viz.service.modeling.Vertex;
import org.eclipse.ice.viz.service.modeling.VertexComponent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ice.viz.service.javafx.canvas.FXAttachment;
import javafx.event.EventHandler;
import javafx.scene.AmbientLight;
......@@ -38,7 +38,6 @@ import javafx.scene.Camera;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.PointLight;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
......@@ -65,21 +64,6 @@ public class FXMeshViewer extends FXViewer {
*/
final double SCALE = 3d;
/** The active scene displayed to the end user. */
private Scene scene;
/**
* The content provider that generates JavaFX scene data from the geometry
* editor scene model.
*/
private FXContentProvider contentProvider;
/** Default camera controller. */
private CameraController cameraController;
/** Default camera. */
private Camera defaultCamera;
/**
* A handler which places new polygons on the screen based on mouse clicks.
*/
......@@ -215,8 +199,6 @@ public class FXMeshViewer extends FXViewer {
super(parent);
// Initialize the class variables
renderer = new FXRenderer();
attachmentManager = new FXMeshAttachmentManager();
renderer.register(FXMeshAttachment.class, attachmentManager);
......@@ -278,6 +260,13 @@ public class FXMeshViewer extends FXViewer {
AbstractController modelShape = (AbstractController) nodeParent
.getProperties().get(AbstractController.class);
// If four or more vertices have already been selected
// through some other method, then clear the selection and
// start over
if (selectedVertices.size() >= 4) {
clearSelection();
}
// If the vertex is already in the polygon currently being
// constructed, ignore it
if (selectedVertices.contains(modelShape)) {
......@@ -888,4 +877,29 @@ public class FXMeshViewer extends FXViewer {
}
}
@Override
protected void updateCamera(ICamera camera) {
if (!(camera instanceof FXCameraAttachment)) {
throw new IllegalArgumentException(
"Invalid camera attached to Mesh Viewer.");
}
FXCameraAttachment attachment = (FXCameraAttachment) camera;
Camera fxCamera = attachment.getFxCamera();
if (fxCamera == null) {
throw new NullPointerException(
"No camera was attached to Mesh Viewer");
}
cameraController = new TopDownController(fxCamera, scene, fxCanvas);
scene.setCamera(fxCamera);
defaultCamera = fxCamera;
// ((TopDownController) cameraController).fixToCamera(cursorPosition);
}
}
\ No newline at end of file
......@@ -6,10 +6,12 @@ Bundle-Version: 2.1.7.20150825
Fragment-Host: org.eclipse.ice.viz.service.mesh
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.junit
Import-Package: org.apache.log4j,
Import-Package: junit.framework;version="4.12.0",
org.apache.log4j,
org.eclipse.ice.viz.service.javafx.mesh,
org.eclipse.ice.viz.service.javafx.mesh.datatypes,
org.eclipse.ice.viz.service.mesh.datastructures,
org.eclipse.ice.viz.service.modeling,
org.eclipse.ice.viz.service.visit
Bundle-Vendor: Oak Ridge National Laboratory
Export-Package: org.eclipse.ice.viz.service.mesh.datastructures.test
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: VisIt Visualization Service Plugin
Bundle-SymbolicName: org.eclipse.ice.viz.service.visit;singleton:=true
Bundle-Name: Mesh Visualization Service Plugin
Bundle-SymbolicName: org.eclipse.ice.viz.service.mesh;singleton:=true
Bundle-Version: 2.1.7.20150825
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: gov.lbnl.visit.swt,
gov.lbnl.visit.swt.widgets,
org.eclipse.ice.client.common,
org.eclipse.ice.viz.service,
org.eclipse.ice.viz.service.connections,
org.eclipse.ice.viz.service.connections.preferences,
org.eclipse.ice.viz.service.datastructures,
org.eclipse.ice.viz.service.datastructures.VizObject,
org.eclipse.ice.viz.service.modeling,
org.eclipse.ice.viz.service.preferences,
org.eclipse.ice.viz.service.widgets,
org.eclipse.jface.preference,
org.eclipse.swt,
org.eclipse.swt.graphics,
org.eclipse.swt.widgets,
org.eclipse.ui,
org.eclipse.ui.forms.events,
org.eclipse.ui.forms.widgets,
org.eclipse.ui.views.properties.tabbed,
org.slf4j;version="1.7.2",
visit.java.client
org.eclipse.ui.views.properties.tabbed
Service-Component: OSGI-INF/vizService.xml
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui
......
......@@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.ISection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
/**
......
......@@ -20,7 +20,6 @@ Import-Package: ca.odell.glazedlists,
org.eclipse.ice.viz.service.datastructures.VizObject,
org.eclipse.ice.viz.service.datastructures.resource,
org.eclipse.ice.viz.service.internal,
org.eclipse.ice.viz.service.mesh.datastructures.test,
org.eclipse.ice.viz.service.modeling,
org.eclipse.ice.viz.service.preferences,
org.eclipse.ice.viz.service.styles,
......
......@@ -123,11 +123,11 @@
<module>org.eclipse.ice.viz</module>
<module>org.eclipse.ice.viz.test</module>
<module>org.eclipse.ice.viz.service</module>
<!-- <module>org.eclipse.ice.viz.service.test</module> -->
<module>org.eclipse.ice.viz.service.test</module>
<module>org.eclipse.ice.viz.service.geometry</module>
<module>org.eclipse.ice.viz.service.geometry.javafx</module>
<!-- <module>org.eclipse.ice.viz.service.geometry.test</module> -->
<module>org.eclipse.ice.viz.service.jme3</module>
<module>org.eclipse.ice.viz.service.geometry.test</module>
<module>org.eclipse.ice.viz.service.javafx</module>
<!-- <module>org.eclipse.ice.viz.service.jme3</module> -->
<!-- <module>org.eclipse.ice.viz.service.jme3.test</module> -->
<module>org.eclipse.ice.viz.service.mesh</module>
<module>org.eclipse.ice.viz.service.mesh.test</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