Commit 7cfcb00f authored by Robert Smith's avatar Robert Smith
Browse files

Created conversion for PlantComposites



Finished bringing in the modeling data structures from the reactor
analyzer branch, including breaking the HeatExchanger into its own set
of classes. Added code to convert from the generic PlantComposite to the
unified modeling data types and replaced PlantAppState references in the
MOOSEFormEditor with a generic IPlantView interface.
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent d71961ec
......@@ -26,19 +26,14 @@ Import-Package: com.jme3.math,
org.eclipse.ice.client.common,
org.eclipse.ice.client.common.properties,
org.eclipse.ice.client.widgets,
org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.client.widgets.reactoreditor.plant,
org.eclipse.ice.datastructures.form,
org.eclipse.ice.iclient.uiwidgets,
org.eclipse.ice.item,
org.eclipse.ice.item.jobLauncher,
org.eclipse.ice.item.nuclear,
org.eclipse.ice.materials,
org.eclipse.ice.persistence.xml,
org.eclipse.ice.reactor.plant,
org.eclipse.ice.viz.service,
org.eclipse.ice.viz.service.geometry.plantView,
org.eclipse.ice.viz.service.jme3.application,
org.eclipse.ice.viz.service.javafx.geometry,
org.eclipse.jgit.api;version="4.0.0",
org.eclipse.jgit.api.errors;version="4.0.0",
org.eclipse.ui,
......@@ -48,7 +43,8 @@ Import-Package: com.jme3.math,
org.slf4j;version="1.7.2"
Require-Bundle: org.eclipse.ice.client.compatibility;bundle-version="2.0.0",
org.eclipse.ice.datastructures,
org.eclipse.core.runtime;bundle-version="3.11.0"
org.eclipse.core.runtime;bundle-version="3.11.0",
org.eclipse.swt
Service-Component: OSGI-INF/MOOSEEditorComponent.xml
Export-Package: org.eclipse.ice.client.widgets.moose
Bundle-Vendor: Oak Ridge National Laboratory
......
......@@ -27,7 +27,6 @@ import org.eclipse.ice.client.widgets.ICEFormEditor;
import org.eclipse.ice.client.widgets.ICEFormInput;
import org.eclipse.ice.client.widgets.ICEFormPage;
import org.eclipse.ice.client.widgets.moose.components.PlantBlockManager;
import org.eclipse.ice.client.widgets.reactoreditor.plant.PlantAppState;
import org.eclipse.ice.datastructures.form.DataComponent;
import org.eclipse.ice.datastructures.form.Entry;
import org.eclipse.ice.datastructures.form.Form;
......@@ -36,8 +35,9 @@ import org.eclipse.ice.datastructures.form.TreeComposite;
import org.eclipse.ice.datastructures.resource.ICEResource;
import org.eclipse.ice.item.nuclear.MOOSE;
import org.eclipse.ice.item.nuclear.MOOSEModel;
import org.eclipse.ice.reactor.plant.IPlantView;
import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.geometry.plantView.IPlantView;
import org.eclipse.ice.viz.service.javafx.geometry.ViewFactory;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
......
......@@ -4,8 +4,7 @@ Bundle-Name: Eclipse Widgets RCP Bundle
Bundle-SymbolicName: org.eclipse.ice.client.widgets.rcp;singleton:=true
Bundle-Version: 2.1.8
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.client.widgets.reactoreditor.plant
Export-Package: org.eclipse.ice.client.widgets.reactoreditor.plant
Import-Package: com.jme3.animation,
com.jme3.app,
com.jme3.app.state,
......@@ -113,7 +112,6 @@ Import-Package: com.jme3.animation,
org.eclipse.core.runtime.jobs,
org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.reactor.plant,
org.eclipse.ice.viz.service.geometry.plantView,
org.eclipse.ice.viz.service.geometry.shapes,
org.eclipse.ice.viz.service.jme3.application,
org.eclipse.ice.viz.service.jme3.internal,
......
......@@ -19,9 +19,9 @@ import java.util.concurrent.Callable;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.datastructures.ICEObject.IUpdateableListener;
import org.eclipse.ice.reactor.plant.IPlantCompositeListener;
import org.eclipse.ice.reactor.plant.IPlantView;
import org.eclipse.ice.reactor.plant.PlantComponent;
import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.geometry.plantView.IPlantView;
import org.eclipse.ice.viz.service.jme3.application.EmbeddedView;
import org.eclipse.ice.viz.service.jme3.application.FlightCamera;
import org.eclipse.ice.viz.service.jme3.application.ViewAppState;
......@@ -452,6 +452,14 @@ public class PlantAppState extends ViewAppState
return;
}
@Override
public void dispose() {
stop();
return;
}
/**
* Resets the plant view's camera to its default position and orientation.
*
......@@ -502,6 +510,7 @@ public class PlantAppState extends ViewAppState
* @param plant
* The new plant.
*/
@Override
public void setPlant(final PlantComposite plant) {
if (plant != null && plant != this.plant) {
......
......@@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.gef;bundle-version="3.9.0",
Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.ice.analysistool,
org.eclipse.ice.client.common,
org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.client.widgets.moose,
org.eclipse.ice.client.widgets.reactoreditor,
org.eclipse.ice.client.widgets.reactoreditor.grid,
org.eclipse.ice.client.widgets.reactoreditor.plant,
......@@ -23,6 +23,7 @@ Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.ice.reactor.bwr,
org.eclipse.ice.reactor.plant,
org.eclipse.ice.reactor.pwr,
org.eclipse.ice.viz.service.javafx.geometry,
org.eclipse.ice.viz.service.jme3.application,
org.eclipse.ui,
org.osgi.framework;version="1.7.0",
......
......@@ -13,12 +13,11 @@
package org.eclipse.ice.client.widgets.reactoreditor.lwr;
import org.eclipse.ice.client.common.ActionTree;
import org.eclipse.ice.client.widgets.moose.ViewFactory;
import org.eclipse.ice.client.widgets.reactoreditor.AnalysisView;
import org.eclipse.ice.client.widgets.reactoreditor.DataSource;
import org.eclipse.ice.client.widgets.reactoreditor.plant.PlantAppState;
import org.eclipse.ice.reactor.plant.IPlantView;
import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.jme3.application.ViewAppState;
import org.eclipse.ice.viz.service.javafx.geometry.ViewFactory;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
......@@ -52,7 +51,7 @@ public class PlantAnalysisView extends AnalysisView {
* The jME3 <code>ViewAppState</code> used to display a 3D view of an LWR
* plant.
*/
private final PlantAppState plantApp;
private final IPlantView plantApp;
/**
* The ActionTree that lets the user select the plant to display its
* properties.
......@@ -221,8 +220,8 @@ public class PlantAnalysisView extends AnalysisView {
@Override
public void update(String key, Object value) {
logger.info("PlantAnalysisView message: "
+ "Receiving update for key " + key + ": " + value.toString());
logger.info("PlantAnalysisView message: " + "Receiving update for key "
+ key + ": " + value.toString());
// Currently, the only value this class listens to is the one that holds
// the current PlantComposite.
......
......@@ -23,7 +23,6 @@ Import-Package: com.jme3.app,
org.eclipse.ice.client.common,
org.eclipse.ice.client.common.internal,
org.eclipse.ice.client.common.properties,
org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.iclient,
org.eclipse.ice.iclient.uiwidgets,
org.eclipse.ice.reactor,
......
......@@ -9,6 +9,9 @@ Export-Package: org.eclipse.ice.reactor.plant
Import-Package: ncsa.hdf.hdf5lib,
ncsa.hdf.hdf5lib.exceptions,
org.eclipse.ice.io.hdf,
org.eclipse.ice.viz.service.datastructures.VizObject,
org.eclipse.ice.viz.service.modeling,
org.eclipse.swt.widgets,
org.slf4j;version="1.7.2"
Service-Component: OSGI-INF/PlantIOFactory.xml
Bundle-Vendor: Oak Ridge National Laboratory
......@@ -8,12 +8,10 @@
* Contributors:
* Robert Smith
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry.plantView;
package org.eclipse.ice.reactor.plant;
import org.eclipse.swt.widgets.Composite;
import com.jme3.math.Vector3f;
/**
* An interface for classes which create the graphical representations for Plant
* Views and maintain their current state.
......@@ -37,6 +35,11 @@ public interface IPlantView {
*/
public Composite createComposite(Composite parent);
/**
* Dispose the plant view and its resources.
*/
public void dispose();
/**
* Exports the view to an image file. The user is prompted for the image
* location.
......@@ -110,6 +113,8 @@ public interface IPlantView {
// */
// public void setDefaultCameraPosition(float x, float y, float z);
public void setPlant(PlantComposite plant);
/**
* Sets all rendered plant components to be viewed as wireframes or as solid
* objects.
......
......@@ -109,7 +109,8 @@ public class PlantComponent extends ICEObject implements IReactorComponent {
* <p>
* The other Object to compare against.
* </p>
* @return <p>
* @return
* <p>
* Returns true if the two objects are equal, otherwise false.
* </p>
*/
......@@ -142,7 +143,8 @@ public class PlantComponent extends ICEObject implements IReactorComponent {
* Performs a deep copy and returns a newly instantiated Object.
* </p>
*
* @return <p>
* @return
* <p>
* The newly instantiated Object.
* </p>
*/
......@@ -186,7 +188,8 @@ public class PlantComponent extends ICEObject implements IReactorComponent {
* Returns the hashCode of the object.
* </p>
*
* @return <p>
* @return
* <p>
* The hashCode of the Object.
* </p>
*/
......@@ -203,10 +206,12 @@ public class PlantComponent extends ICEObject implements IReactorComponent {
* <!-- begin-UML-doc --> Gets a String representation of the
* PlantComponent. <!-- end-UML-doc -->
*
* @return <p>
* @return
* <p>
* The name of the PlantComponent as a String.
* </p>
* @see <p>
* @see
* <p>
* IReactorComponent#toString()
* </p>
*/
......
......@@ -18,6 +18,8 @@ import java.util.TreeMap;
import org.eclipse.ice.datastructures.ICEObject.Component;
import org.eclipse.ice.datastructures.ICEObject.Composite;
import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateable;
import org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateableListener;
/**
* A PlantComposite is a container for {@link PlantComponent}s. Duplicate
......@@ -26,7 +28,8 @@ import org.eclipse.ice.datastructures.ICEObject.Composite;
* @author Jordan H. Deyton
*
*/
public class PlantComposite extends PlantComponent implements Composite {
public class PlantComposite extends PlantComponent
implements Composite, IVizUpdateable {
/**
* A map of all PlantComponents contained by this PlantComposite, keyed on
......@@ -40,6 +43,12 @@ public class PlantComposite extends PlantComponent implements Composite {
*/
private final List<IPlantCompositeListener> listeners;
/**
* A list of IVizUpdateableListeners who are to be updated when changes
* occur to this object.
*/
private List<IVizUpdateableListener> basicListeners;
/**
* The default, nullary constructor. Initializes all default values.
*/
......@@ -53,8 +62,9 @@ public class PlantComposite extends PlantComponent implements Composite {
// Initialize the map of PlantComponents.
components = new TreeMap<Integer, PlantComponent>();
// Initialize the list of listeners.
// Initialize the lists of listeners.
listeners = new ArrayList<IPlantCompositeListener>();
basicListeners = new ArrayList<IVizUpdateableListener>();
return;
}
......@@ -178,7 +188,8 @@ public class PlantComposite extends PlantComponent implements Composite {
* The listener to register. <b>Duplicate listeners are not
* accepted.</b>
*/
public void registerPlantCompositeListener(IPlantCompositeListener listener) {
public void registerPlantCompositeListener(
IPlantCompositeListener listener) {
if (listener != null) {
......@@ -252,6 +263,10 @@ public class PlantComposite extends PlantComponent implements Composite {
components);
}
}
for (IVizUpdateableListener listener : basicListeners) {
listener.update(PlantComposite.this);
}
}
};
notifierThread.start();
......@@ -263,9 +278,8 @@ public class PlantComposite extends PlantComponent implements Composite {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.reactor.plant.PlantComponent#accept(org.eclipse.ice.reactor
* .plant.IPlantComponentVisitor)
* @see org.eclipse.ice.reactor.plant.PlantComponent#accept(org.eclipse.ice.
* reactor .plant.IPlantComponentVisitor)
*/
@Override
public void accept(IPlantComponentVisitor visitor) {
......@@ -360,4 +374,28 @@ public class PlantComposite extends PlantComponent implements Composite {
return;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateable#
* register(org.eclipse.ice.viz.service.datastructures.VizObject.
* IVizUpdateableListener)
*/
@Override
public void register(IVizUpdateableListener listener) {
basicListeners.add(listener);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.viz.service.datastructures.VizObject.IVizUpdateable#
* unregister(org.eclipse.ice.viz.service.datastructures.VizObject.
* IVizUpdateableListener)
*/
@Override
public void unregister(IVizUpdateableListener listener) {
basicListeners.remove(listener);
}
}
......@@ -7,9 +7,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.ice.reactor,
org.eclipse.ice.reactor.bwr,
org.eclipse.ice.reactor.pwr
Import-Package: org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.reactor.pwr,
org.slf4j;version="1.7.2"
Import-Package: org.slf4j;version="1.7.2"
Require-Bundle: org.eclipse.ice.datastructures,
org.eclipse.ice.io;visibility:=reexport,
org.eclipse.ice.analysistool;bundle-version="2.0.0"
......
......@@ -5,22 +5,7 @@ Bundle-SymbolicName: org.eclipse.ice.viz.service.geometry;singleton:=true
Bundle-Version: 2.1.8
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Service-Component: OSGI-INF/ControllerFactory.xml
Import-Package: com.jme3.app,
com.jme3.asset,
com.jme3.export,
com.jme3.font,
com.jme3.input,
com.jme3.light,
com.jme3.material,
com.jme3.math,
com.jme3.renderer,
com.jme3.renderer.queue,
com.jme3.scene,
com.jme3.scene.mesh,
com.jme3.scene.shape,
com.jme3.system,
com.jme3.util,
gov.lbnl.visit.swt,
Import-Package: gov.lbnl.visit.swt,
gov.lbnl.visit.swt.widgets,
javafx.embed.swt;version="2.2.0",
org.eclipse.ice.viz.service,
......@@ -30,8 +15,7 @@ Import-Package: com.jme3.app,
org.eclipse.jface.databinding.swt,
org.slf4j;version="1.7.2",
visit.java.client
Export-Package: org.eclipse.ice.viz.service.geometry.plantView,
org.eclipse.ice.viz.service.geometry.reactor,
Export-Package: org.eclipse.ice.viz.service.geometry.reactor,
org.eclipse.ice.viz.service.geometry.shapes,
org.eclipse.ice.viz.service.geometry.widgets
Bundle-Vendor: Oak Ridge National Laboratory
......
/*******************************************************************************
* Copyright (c) 2016 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:
* Robert Smith
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry.reactor;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.AbstractView;
/**
* The internal data representation for a Heat Exchanger part.
*
* @author Robert Smith
*
*/
public class HeatExchangerController extends AbstractController {
/**
* The nullary constructor.
*/
public HeatExchangerController() {
super();
}
/**
* The default constructor.
*
* @param model
* The part's internal representation.
* @param view
* The part's graphical representation in the rendering program.
*/
public HeatExchangerController(HeatExchangerMesh model, AbstractView view) {
super(model, view);
}
/**
* Convenience getter method for the primary pipe.
*
* @return The Heat Exchanger's primary pipe, or null if it does not have
* one.
*/
public PipeController getPrimaryPipe() {
return ((HeatExchangerMesh) model).getPrimaryPipe();
}
/**
* Convenience getter method for the secondary pipe.
*
* @return The Heat Exchanger's secondary pipe, or null if it does not have
* one.
*/
public PipeController getSecondaryPipe() {
return ((HeatExchangerMesh) model).getSecondaryPipe();
}
/**
* Set the heat exchanger's primary pipe, removing any other primary pipe as
* necessary.
*
* @param pipe
* The Heat Exchanger's new primary pipe.
*/
public void setPrimaryPipe(PipeController pipe) {
((HeatExchangerMesh) model).setPrimaryPipe(pipe);
}
/**
* Set the heat exchanger's secondary pipe, removing any other secondary
* pipe as necessary.
*
* @param pipe
* The Heat Exchanger's new secondary pipe.
*/
public void setSecondaryPipe(PipeController pipe) {
((HeatExchangerMesh) model).setSecondaryPipe(pipe);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
// Create a copy of the model
HeatExchangerController clone = new HeatExchangerController();
clone.copy(this);
// Refresh the view to be in sync with the model
clone.refresh();
return clone;
}
}
/*******************************************************************************
* Copyright (c) 2015 UT-Battelle, LLC.
* Copyright (c) 2016 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
......@@ -36,10 +36,20 @@ public class HeatExchangerMesh extends AbstractMesh {
* @return The Heat Exchanger's primary pipe, or null if it does not have
* one.
*/
public PipeController GetPrimaryPipe() {
public PipeController getPrimaryPipe() {
return (PipeController) entities.get("Primary Pipe").get(0);
}
/**
* Convenience getter method for the secondary pipe.
*
* @return The Heat Exchanger's secondary pipe, or null if it does not have
* one.
*/
public PipeController getSecondaryPipe() {
return (PipeController) entities.get("Secondary Pipe").get(0);
}
/**
* Set the heat exchanger's primary pipe, removing any other primary pipe as
* necessary.
......
......@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry.reactor;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.AbstractView;
import org.eclipse.ice.viz.service.modeling.IWireFramePart;
import org.eclipse.ice.viz.service.modeling.TubeController;
......@@ -139,4 +140,44 @@ public class PipeController extends TubeController implements IWireFramePart {
((IWireFramePart) view).setWireFrameMode(on);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ice.viz.service.modeling.AbstractController#clone()
*/
@Override
public Object clone() {
// Create a new shape from clones of the model and view
PipeController clone = new PipeController();
// Copy any other data into the clone
clone.copy(this);
return clone;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.modeling.AbstractController#copy(org.eclipse.
* ice.viz.service.modeling.AbstractController)
*/
@Override
public void copy(AbstractController source) {
// Create the model and give it a reference to this
model = new PipeMesh();
model.setController(this);
// Copy the other object's data members
model.copy(source.getModel());
view = (AbstractView) source.getView().clone();
// Register as a listener to the model and view
model.register(this);
view.register(this);
}
}