Commit db08efe1 authored by Robert Smith's avatar Robert Smith
Browse files

Geometry Editor Build fixes and obsolete class removal



Removed some classes which where no longer being used. Also made some
changes to get the product running with JavaFX.
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent 576853ff
......@@ -20,12 +20,13 @@ 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.geometry.widgets.TransformationView;
import org.eclipse.ice.viz.service.jme3.mesh.IMeshSelectionListener;
import org.eclipse.ice.viz.service.jme3.mesh.JME3MeshCanvas;
import org.eclipse.ice.viz.service.jme3.mesh.MeshAppStateMode;
import org.eclipse.ice.viz.service.jme3.mesh.MeshAppStateModeFactory;
import org.eclipse.ice.viz.service.jme3.mesh.MeshSelectionManager;
import org.eclipse.ice.viz.service.jme3.mesh.MeshAppStateModeFactory.Mode;
import org.eclipse.ice.viz.service.jme3.mesh.MeshSelectionManager;
import org.eclipse.ice.viz.service.mesh.datastructures.BezierEdge;
import org.eclipse.ice.viz.service.mesh.datastructures.Edge;
import org.eclipse.ice.viz.service.mesh.datastructures.Hex;
......@@ -36,7 +37,6 @@ import org.eclipse.ice.viz.service.mesh.datastructures.Quad;
import org.eclipse.ice.viz.service.mesh.datastructures.Vertex;
import org.eclipse.ice.viz.service.mesh.datastructures.VizMeshComponent;
import org.eclipse.ice.viz.service.mesh.properties.MeshSelection;
import org.eclipse.ice.viz.service.geometry.widgets.TransformationView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
......@@ -69,9 +69,9 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
*
* @author Taylor Patterson, Jordan H. Deyton
*/
public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
IMeshSelectionListener, ISelectionProvider,
ITabbedPropertySheetPageContributor {
public class ICEMeshPage extends ICEFormPage
implements ISelectionListener, IMeshSelectionListener,
ISelectionProvider, ITabbedPropertySheetPageContributor {
/**
* Eclipse view ID
......@@ -122,7 +122,7 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
* The collection of parts selected in the MeshApplication.
*/
private ArrayList<ICEObject> selectedMeshParts;
private JME3MeshCanvas canvas;
/**
......@@ -208,7 +208,7 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
getSite().getWorkbenchWindow().getActivePage()
.showView(TransformationView.ID);
} catch (PartInitException e) {
logger.error(getClass().getName() + " Exception!",e);
logger.error(getClass().getName() + " Exception!", e);
}
// Create the geometry composite - get the parent
......@@ -220,24 +220,27 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
// Create the tool bar and buttons for the view
toolBar = new ToolBar(parent, SWT.NONE);
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
toolBar.setLayoutData(
new GridData(SWT.FILL, SWT.BEGINNING, true, false));
actionToolBarManager = new ToolBarManager(toolBar);
//Grid data so that the VizCanvas will fill the entire area
// Grid data so that the VizCanvas will fill the entire area
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
//Get the JME3 viz service for meshes
IVizService service = editor.getVizServiceFactory().get("JME3 Mesh Service");
//Create the VizCanvas
// Get the JME3 viz service for meshes
IVizService service = editor.getVizServiceFactory()
.get("JME3 Mesh Service");
// Create the VizCanvas
canvas = null;
try {
canvas = (JME3MeshCanvas) service.createCanvas(meshComp.getMesh());
// canvas = (JME3MeshCanvas)
// service.createCanvas(meshComp.getMesh());
} catch (Exception e) {
logger.error("Mesh Viz Service failed to create mesh Viz Canvas.");
}
//Draw the canvas and set its layout data
// Draw the canvas and set its layout data
try {
Composite composite = canvas.draw(parent);
composite.setLayoutData(gridData);
......@@ -248,7 +251,6 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
// The MeshPage should also listen for changes to the MeshApplication's
// current selection.
canvas.registerListener(this);
// Now that we have a MeshApplication, we need to create the Actions
// that fill the ToolBar with configuration settings for the
......@@ -262,7 +264,6 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
.findView(MeshElementTreeView.ID);
meshElementTreeView.setMeshComponent(meshComp);
// Register this page as a SelectionListener to the MeshElementTreeView
getSite().getWorkbenchWindow().getSelectionService()
.addSelectionListener(MeshElementTreeView.ID, this);
......@@ -281,7 +282,7 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
ActionTree toggleHUDActionTree;
ActionTree toggleAxesActionTree;
ActionTree deleteActionTree;
// Create the drop down for switching between add and modify modes
modesActionTree = new ActionTree("Mode");
// Use a MeshAppStateModeFactory to get the available modes and create
......@@ -306,12 +307,14 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
// TODO create the camera reset action
// Create the toggle switch to show or hide the heads-up display
action = new org.eclipse.ice.viz.service.jme3.mesh.ToggleHUDAction(canvas.getMeshAppState());
action = new org.eclipse.ice.viz.service.jme3.mesh.ToggleHUDAction(
canvas.getMeshAppState());
toggleHUDActionTree = new ActionTree(action);
actions.add(toggleHUDActionTree);
// Create the toggle switch to show or hide the axes.
action = new org.eclipse.ice.viz.service.jme3.mesh.ToggleAxesAction(canvas.getMeshAppState());
action = new org.eclipse.ice.viz.service.jme3.mesh.ToggleAxesAction(
canvas.getMeshAppState());
toggleAxesActionTree = new ActionTree(action);
actions.add(toggleAxesActionTree);
......@@ -319,7 +322,8 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
action = new Action() {
@Override
public void run() {
canvas.getMeshAppState().getSelectionManager().deleteSelection();
canvas.getMeshAppState().getSelectionManager()
.deleteSelection();
}
};
action.setText("Delete");
......@@ -356,8 +360,6 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
return;
}
/**
* This operation overrides the default/abstract implementation of
* ISelectionListener.selectionChanged to capture selections made in the
......@@ -475,7 +477,8 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
* @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
*/
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
public void addSelectionChangedListener(
ISelectionChangedListener listener) {
listeners.add(listener);
return;
}
......@@ -505,9 +508,8 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
public void setSelection(ISelection selection) {
Object[] list = listeners.getListeners();
for (int i = 0; i < list.length; i++) {
((ISelectionChangedListener) list[i])
.selectionChanged(new SelectionChangedEvent(this,
getSelection()));
((ISelectionChangedListener) list[i]).selectionChanged(
new SelectionChangedEvent(this, getSelection()));
}
}
......@@ -527,5 +529,5 @@ public class ICEMeshPage extends ICEFormPage implements ISelectionListener,
return super.getAdapter(adapter);
}
// ----------------------------------------------------------- //
}
/*******************************************************************************
* Copyright (c) 2015 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tony McCrary (tmccrary@l33tlabs.com)
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry;
import org.eclipse.ice.viz.service.geometry.shapes.IShape;
import javafx.scene.Node;
/**
* <p>
* Contains various static utility functions and constants used throughout that
* can't be refactored into specific classes..
* </p>
*
* @author Tony McCrary (tmccrary@l33tlabs.com)
*
*/
public class Util {
/** */
public static final String SHAPE_PROP_KEY = "shape"; //$NON-NLS-1$
/**
* <p>
* Returns the IShape property defined by Util.SHAPE_PROP_KEY from the
* supplied node, if one exists.
* </p>
*
* @param node
* @return
*/
public static IShape getShapeProperty(Node node) {
Object shapeProperty = node.getProperties().get(SHAPE_PROP_KEY);
if (shapeProperty != null && shapeProperty instanceof IShape) {
return (IShape) shapeProperty;
}
return null;
}
}
......@@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.ice.viz.service.geometry.scene.model.IAttachment;
import org.eclipse.ice.viz.service.geometry.scene.model.INode;
import org.eclipse.ice.viz.service.geometry.shapes.Geometry;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.Shape;
......@@ -29,7 +28,8 @@ import org.eclipse.ice.viz.service.modeling.Shape;
* @author Tony McCrary (tmccrary@l33tlabs.com)
*
*/
public abstract class GeometryAttachment extends Attachment implements IGeometry {
public abstract class GeometryAttachment extends Attachment
implements IGeometry {
/**
* Geometry that has been added but has not been integrated as the node
......
/*******************************************************************************
* Copyright (c) 2012, 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry.shapes;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import org.eclipse.ice.viz.service.datastructures.VizObject.VizObject;
import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateableListener;
/**
* <p>
* Implements a number of operations shared between the components in the Shape
* composite pattern
* </p>
*
* @author Jay Jay Billings
*/
@XmlSeeAlso({ PrimitiveShape.class, ComplexShape.class })
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractShape extends VizObject implements IShape {
/**
* <p>
* Stores the list of keys for the property list
* </p>
*
*/
@XmlElement(name = "Keys")
private ArrayList<String> keys;
/**
* <p>
* Stores the list of values for the property list
* </p>
*
*/
@XmlElement(name = "Values")
private ArrayList<String> values;
/**
* <p>
* The matrix transformation applied to the shape
* </p>
* <p>
* In the case of a ComplexShape, each transformation affects its child
* shapes, so in order to calculate the final transformation of an
* individual PrimitiveShape, you must take the matrix product of all of the
* ancestors' transformations.
* </p>
* <p>
* The transformation matrix applied to this node in the CSG tree
* </p>
*
*/
@XmlElement(name = "Transformation")
protected Transformation transformation;
/**
* <p>
* If applicable, the parent of the shape in the CSG tree
* </p>
*
*/
@XmlTransient
private IShape parent;
/**
* <p>
* Initializes the transformation matrix, creates the array containing the
* key/value property pairs, and creates a listeners list
* </p>
*
*/
public AbstractShape() {
// Initialize transformation
transformation = new Transformation();
// Create properties lists
keys = new ArrayList<String>();
values = new ArrayList<String>();
// Create listeners list
listeners = new ArrayList<IVizUpdateableListener>();
}
/**
* <p>
* Returns a copy of the transformation matrix associated with this shape
* node
* </p>
*
* @return
* <p>
* The transformation matrix applied to this node in the CSG tree
* </p>
*/
@Override
public Transformation getTransformation() {
return this.transformation;
}
/**
* <p>
* Replaces the transformation matrix with a copy of the given Matrix4x4
* </p>
* <p>
* Returns whether the setting was successful
* </p>
*
* @param transformation
* <p>
* The transformation matrix to be applied to the shape
* </p>
* @return
* <p>
* True if setting the transformation was successful, false
* otherwise
* </p>
*/
@Override
public boolean setTransformation(Transformation transformation) {
// Fail if null and return false
if (transformation == null) {
return false;
}
// Otherwise set and return true
this.transformation = transformation;
// Notify listeners and return success
notifyListeners();
return true;
}
/**
* <p>
* Returns the value associated with the property key
* </p>
* <p>
* If the key does not exist, this operation returns null.
* </p>
*
* @param key
* <p>
* The key corresponding to the desired value
* </p>
* @return
* <p>
* The value associated with the property key
* </p>
*/
@Override
public String getProperty(String key) {
if (key == null || "".equals(key)) {
return null;
}
// Get index of key
int index = keys.indexOf(key);
if (index < 0) {
return null;
}
// Return the value
try {
return values.get(index);
} catch (IndexOutOfBoundsException e) {
return null;
}
}
/**
* <p>
* Sets the property value associated with the key string
* </p>
* <p>
* If the key does not yet exist, append the key/value pair to the end of
* the property list. If it exists, find and replace the property value with
* the new one.
* </p>
*
* @param key
* <p>
* The new key
* </p>
* @param value
* <p>
* The new value
* </p>
* @return
* <p>
* True if the property setting is valid, false otherwise
* </p>
*/
@Override
public boolean setProperty(String key, String value) {
// Validate parameters
if (key == null || "".equals(key) || value == null) {
return false;
}
// Find index of key
int index = keys.indexOf(key);
// Update
if (index < 0) {
// Insert new value
keys.add(key);
values.add(value);
} else {
// Modify the value
values.set(index, value);
}
// Notify listeners and return success
notifyListeners();
return true;
}
/**
* <p>
* Removes the value associated with the key in the properties list
* </p>
* <p>
* This operation returns whether the key was found and removed.
* </p>
*
* @param key
* <p>
* The key associated with the value to remove
* </p>
* @return
* <p>
* True if the value was found and removed, false otherwise
* </p>
*/
@Override
public boolean removeProperty(String key) {
// Validate parameters
if (key == null) {
return false;
}
// Get index of key
int index = keys.indexOf(key);
if (index < 0) {
return false;
}
keys.remove(index);
values.remove(index);
// Notify listeners and return success
notifyListeners();
return true;
}
/**
* <p>
* This operation returns the hashcode value of the shape.
* </p>
*
* @return
* <p>
* The hashcode of the object
* </p>
*/
@Override
public int hashCode() {
// Get initial hash code
int hash = super.hashCode();
// Hash the transformation
hash = 31 * hash + transformation.hashCode();
// Hash the properties
hash = 31 * hash + keys.hashCode();
hash = 31 * hash + values.hashCode();
return hash;
}
/**
* <p>
* This operation is used to check equality between this shape and another
* shape. It returns true if the shape are equal and false if they are not.
* </p>
*
* @param otherObject
* <p>
* The other ICEObject that should be compared with this one.
* </p>
* @return
* <p>
* True if the ICEObjects are equal, false otherwise.
* </p>
*/
@Override
public boolean equals(Object otherObject) {
// Check if a similar reference
if (this == otherObject) {
return true;
}
// Check that the other object is not null and an instance of the
// PrimitiveShape
if (otherObject == null || !(otherObject instanceof AbstractShape)) {
return false;
}