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

Commit

Permalink
Added a ParaView widget inside the ParaViewPlotRender. It successfully
Browse files Browse the repository at this point in the history
appears in the ParaViewPlot.

Signed-off-by: Jordan Deyton <deytonjh@ornl.gov>
  • Loading branch information
Jordan Deyton committed Mar 10, 2015
1 parent 4ef2343 commit 618a9f4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/org.eclipse.ice.viz.service.paraview/META-INF/MANIFEST.MF
Expand Up @@ -5,6 +5,7 @@ Bundle-SymbolicName: org.eclipse.ice.viz.service.paraview;singleton:=true
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.kitware.vtk.web,
com.kitware.vtk.web.util,
org.eclipse.core.runtime.preferences;version="3.3.0",
org.eclipse.ice.client.widgets.viz.service,
org.eclipse.ice.datastructures.ICEObject,
Expand All @@ -15,6 +16,8 @@ Import-Package: com.kitware.vtk.web,
org.eclipse.jface.dialogs,
org.eclipse.jface.preference,
org.eclipse.swt,
org.eclipse.swt.awt,
org.eclipse.swt.events,
org.eclipse.swt.graphics,
org.eclipse.swt.layout,
org.eclipse.swt.widgets,
Expand Down
@@ -1,15 +1,22 @@
package org.eclipse.ice.viz.service.paraview;

import java.util.Random;
import java.awt.BorderLayout;
import java.awt.Frame;

import org.eclipse.ice.viz.service.connections.ConnectionPlotRender;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.widgets.Composite;

import com.kitware.vtk.web.VtkWebClient;
import com.kitware.vtk.web.util.InteractiveRenderPanel;

public class ParaViewPlotRender extends ConnectionPlotRender<VtkWebClient> {

// TODO Use a thread to throttle the resize events.

/**
* The default constructor.
*
Expand All @@ -34,7 +41,33 @@ public ParaViewPlotRender(Composite parent, ParaViewPlot plot) {
@Override
protected Composite createPlotComposite(Composite parent, int style,
VtkWebClient connection) throws Exception {
return new Composite(parent, style);

// Since the ParaView widget is built on AWT, we will need to use the
// SWT_AWT bridge below.

// Create the Composite that will contain the embedded ParaView widget.
final Composite composite = new Composite(parent, SWT.EMBEDDED
| SWT.DOUBLE_BUFFERED);

// Create the ParaView widget.
final InteractiveRenderPanel renderPanel = new InteractiveRenderPanel(
connection, 4, 100, 1);

// Create an AWT Frame to contain the ParaView widget.
Frame frame = SWT_AWT.new_Frame(composite);
frame.setLayout(new BorderLayout());
frame.add(renderPanel, BorderLayout.CENTER);

// When the Composite is resized, the ParaView widget will need to be
// refreshed.
composite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
renderPanel.dirty();
}
});

return composite;
}

/*
Expand All @@ -47,11 +80,7 @@ protected Composite createPlotComposite(Composite parent, int style,
protected void updatePlotComposite(Composite plotComposite,
VtkWebClient connection) throws Exception {

// TODO Hook this up to the ParaView widgets.
int seed = (getPlotCategory() + getPlotType()).hashCode();
Random r = new Random(seed);
plotComposite.setBackground(new Color(plotComposite.getDisplay(), r
.nextInt(255), r.nextInt(255), r.nextInt(255)));
// TODO Update the contents of the ParaView widget if necessary.

return;
}
Expand Down

0 comments on commit 618a9f4

Please sign in to comment.