Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Adding two classes to help manage drawing the same plot in multiple
Browse files Browse the repository at this point in the history
Composites. Currently, it only works for drawing in one.

Added some code to test this functionality to the MOOSEFormEditor.
Switched the ParaViewPlot to use the new MultiPlot class. I will have to
hook it back up to the ConnectionPlot class later.

Signed-off-by: Jordan <jordan.deyton@gmail.com>
  • Loading branch information
jdeyton committed Mar 5, 2015
1 parent 1420348 commit 0bdee42
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 79 deletions.
4 changes: 2 additions & 2 deletions repository/org.eclipse.ice.repository/ice.product.launch

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/org.eclipse.ice.client.widgets.moose/META-INF/MANIFEST.MF
Expand Up @@ -5,6 +5,7 @@ Bundle-SymbolicName: org.eclipse.ice.client.widgets.moose;singleton:=true
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.jme3.math,
com.kitware.vtk.web,
org.eclipse.core.resources,
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.ice.client.common,
Expand All @@ -20,6 +21,8 @@ Import-Package: com.jme3.math,
org.eclipse.ice.item.nuclear,
org.eclipse.ice.reactor.plant,
org.eclipse.ice.viz.service,
org.eclipse.ice.viz.service.connections,
org.eclipse.ice.viz.service.paraview,
org.eclipse.ice.viz.service.visit,
org.eclipse.ui,
org.eclipse.ui.views.properties,
Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.ice.client.widgets.jme.ViewFactory;
import org.eclipse.ice.client.widgets.moose.components.PlantBlockManager;
import org.eclipse.ice.client.widgets.reactoreditor.plant.PlantAppState;
import org.eclipse.ice.client.widgets.viz.service.IPlot;
import org.eclipse.ice.client.widgets.viz.service.IVizServiceFactory;
import org.eclipse.ice.datastructures.form.DataComponent;
import org.eclipse.ice.datastructures.form.Entry;
Expand All @@ -36,6 +37,8 @@
import org.eclipse.ice.datastructures.resource.ICEResource;
import org.eclipse.ice.item.nuclear.MOOSEModel;
import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.paraview.ParaViewPlot;
import org.eclipse.ice.viz.service.paraview.ParaViewVizService;
import org.eclipse.ice.viz.service.visit.VisItPlot;
import org.eclipse.ice.viz.service.visit.VisItVizService;
import org.eclipse.jface.action.Action;
Expand Down Expand Up @@ -131,12 +134,12 @@ public class MOOSEFormEditor extends ICEFormEditor {
/**
* The visualization service used to render the mesh.
*/
private VisItVizService vizService;
private ParaViewVizService vizService;
/**
* The plot provided from the {@link #vizService}. This should be able to
* render the mesh specified by the {@link #meshURI}.
*/
private VisItPlot plot;
private ParaViewPlot plot;

/**
* The URI of the mesh file. If {@code null}, then the file is assumed to be
Expand Down Expand Up @@ -196,10 +199,10 @@ public void listChanged(ListEvent<ICEResource> listChanges) {
meshURI = null;
}

// If the plot is available, set its URI.
if (plot != null) {
plot.setDataSource(meshURI);
}
// // If the plot is available, set its URI.
// if (plot != null) {
// plot.setDataSource(meshURI);
// }

return;
}
Expand Down Expand Up @@ -892,7 +895,7 @@ private void populateMeshViewSection(Section section, FormToolkit toolkit) {
// Try to get the VisItVizService.
IVizServiceFactory vizFactory = getVizServiceFactory();
if (vizFactory != null) {
vizService = (VisItVizService) vizFactory.get("VisIt");
vizService = (ParaViewVizService) vizFactory.get("ParaView");
}

// Either update the mesh plot or generate an error. Note that if the
Expand All @@ -905,15 +908,39 @@ private void populateMeshViewSection(Section section, FormToolkit toolkit) {

try {
// Create the plot.
plot = (VisItPlot) vizService.createPlot(meshURI);
// Add the plot's Actions to the ToolBar.
for (IAction action : plot.getActions()) {
toolBarManager.add(action);
}
plot = (ParaViewPlot) vizService.createPlot(meshURI);
// // Add the plot's Actions to the ToolBar.
// for (IAction action : plot.getActions()) {
// toolBarManager.add(action);
// }
toolBarManager.update(true);
// TODO We're going to have to do some other things here to
// determine the plot type and category.
plot.draw("", "", meshPlotParent);

// TODO Remove this test code below.
final Composite parent0 = new Composite(meshPlotParent, SWT.NONE);
Composite parent1 = new Composite(meshPlotParent, SWT.NONE);
Composite parent2 = new Composite(meshPlotParent, SWT.NONE);
plot.draw("cat0", "type0", parent0);
plot.draw("cat1", "type1", parent1);
plot.draw("cat2", "type2", parent2);
Thread thread = new Thread() {
@Override
public void run() {
try {
Thread.sleep(4000);
plot.draw("cat1", "type1", parent0);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
};
thread.start();
// end of test code

} catch (Exception e) {
System.err.println("MOOSEFormEditor error: "
+ "Error creating VisIt plot.");
Expand All @@ -923,7 +950,7 @@ private void populateMeshViewSection(Section section, FormToolkit toolkit) {
} else {
// Create an error message to show in the mesh view.
String errorMessage = "There was a problem connecting to "
+ "ICE's VisIt visualization service.";
+ "ICE's available visualization services.";
// To get the image/text side-by-side, use a 2-column GridLayout.
meshPlotParent.setLayout(new GridLayout(2, false));
// Create the label with the error icon.
Expand Down
Expand Up @@ -15,6 +15,7 @@ Import-Package: com.kitware.vtk.web,
org.eclipse.jface.dialogs,
org.eclipse.jface.preference,
org.eclipse.swt,
org.eclipse.swt.graphics,
org.eclipse.swt.layout,
org.eclipse.swt.widgets,
org.eclipse.ui,
Expand Down
Expand Up @@ -12,10 +12,15 @@
package org.eclipse.ice.viz.service.paraview;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import org.eclipse.ice.client.widgets.viz.service.IPlot;
import org.eclipse.ice.viz.service.MultiPlot;
import org.eclipse.ice.viz.service.PlotComposite;
import org.eclipse.ice.viz.service.connections.ConnectionPlot;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;

import com.kitware.vtk.web.VtkWebClient;
Expand All @@ -33,25 +38,7 @@
* @author Jordan Deyton
*
*/
public class ParaViewPlot extends ConnectionPlot<VtkWebClient> implements IPlot {

// ---- Service and Connection ---- //
// -------------------------------- //

// ---- Source and Plot Properties ---- //
// /**
// * The source path required by the VisIt widgets.
// */
// private String sourcePath;
// ------------------------------------ //

// ---- UI Widgets ---- //
// /**
// * The current VisIt widget used to draw VisIt plots. This should only be
// * visible if the connection is open.
// */
// private VisItSwtWidget canvas = null;
// -------------------- //
public class ParaViewPlot extends MultiPlot {

/**
* The default constructor.
Expand All @@ -72,8 +59,9 @@ public ParaViewPlot(ParaViewVizService vizService, URI file) {
*/
@Override
public Map<String, String[]> getPlotTypes() throws Exception {
// TODO Auto-generated method stub
return null;
Map<String, String[]> plotTypes = new HashMap<String, String[]>();
plotTypes.put("", new String[] { "" });
return plotTypes;
}

/*
Expand All @@ -98,44 +86,16 @@ public String getSourceHost() {
return null;
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.connections.ConnectionPlot#getPreferenceNodeID
* ()
*/
@Override
protected String getPreferenceNodeID() {
return "org.eclipse.ice.viz.service.paraview.preferences";
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.connections.ConnectionPlot#createCanvas(org
* .eclipse.swt.widgets.Composite, int, java.lang.Object)
*/
@Override
protected Composite createCanvas(Composite parent, int style,
VtkWebClient connection) {
// TODO Auto-generated method stub
return new Composite(parent, style);
}

/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.connections.ConnectionPlot#updateCanvas(org
* .eclipse.swt.widgets.Composite, java.lang.Object)
*/
@Override
protected void updateCanvas(Composite canvas, VtkWebClient connection)
throws Exception {
// TODO Auto-generated method stub

}
// /*
// * (non-Javadoc)
// *
// * @see
// * org.eclipse.ice.viz.service.connections.ConnectionPlot#getPreferenceNodeID
// * ()
// */
// @Override
// protected String getPreferenceNodeID() {
// return "org.eclipse.ice.viz.service.paraview.preferences";
// }

}
Expand Up @@ -193,7 +193,7 @@ public IPlot createPlot(URI file) throws Exception {
ParaViewPlot plot = null;
if (canOpenFile(file)) {
plot = new ParaViewPlot(this, file);
connections.addClient(plot);
// connections.addClient(plot);
}
return plot;
}
Expand All @@ -207,9 +207,9 @@ public IPlot createPlot(URI file) throws Exception {
*/
private boolean canOpenFile(URI file) {
boolean canOpen = false;
if (file != null) {
// TODO
}
// if (file != null) {
canOpen = true;
// }
return canOpen;
}

Expand Down

0 comments on commit 0bdee42

Please sign in to comment.