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

Commit

Permalink
Added a basic implementation of ParaViewVizService and skeleton code for
Browse files Browse the repository at this point in the history
ParaViewPlot.

Signed-off-by: Jordan Deyton <deytonjh@ornl.gov>
  • Loading branch information
Jordan Deyton committed Mar 4, 2015
1 parent 947f3b3 commit 35c2198
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 15 deletions.
Expand Up @@ -15,8 +15,12 @@
import java.util.Map;

import org.eclipse.ice.client.widgets.viz.service.IPlot;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.viz.service.connections.ConnectionClient;
import org.eclipse.swt.widgets.Composite;

import com.kitware.vtk.web.VtkWebClient;

/**
* This class is responsible for embedding ParaView-supported graphics inside
* client {@link Composite}s.
Expand All @@ -30,8 +34,12 @@
* @author Jordan Deyton
*
*/
public class ParaViewPlot implements IPlot {
public class ParaViewPlot extends ConnectionClient<VtkWebClient> implements IPlot {

public ParaViewPlot(ParaViewVizService vizService, URI file) {

}

/*
* (non-Javadoc)
*
Expand Down Expand Up @@ -124,4 +132,11 @@ public boolean isSourceRemote() {
return false;
}


@Override
public void update(IUpdateable component) {
// TODO Auto-generated method stub

}

}
Expand Up @@ -13,9 +13,17 @@

import java.net.URI;
import java.util.Map;
import java.util.Set;

import org.eclipse.ice.client.widgets.viz.service.IPlot;
import org.eclipse.ice.client.widgets.viz.service.IVizService;
import org.eclipse.ice.viz.service.AbstractVizService;
import org.eclipse.ice.viz.service.connections.ConnectionManager;
import org.eclipse.ice.viz.service.connections.ConnectionTable;
import org.eclipse.ice.viz.service.connections.IConnectionAdapter;
import org.eclipse.ice.viz.service.connections.paraview.ParaViewConnectionAdapter;
import org.eclipse.ice.viz.service.preferences.CustomScopedPreferenceStore;

import com.kitware.vtk.web.VtkWebClient;

/**
* This class is responsible for providing a service to connect to (or launch)
Expand All @@ -29,7 +37,74 @@
* @author Jordan Deyton
*
*/
public class ParaViewVizService implements IVizService {
public class ParaViewVizService extends AbstractVizService {

/**
* The current instance of the viz service. This instance was created when
* the OSGi viz service was instantiated.
*/
private static ParaViewVizService instance;

/**
* The manager for all of the ParaView connections.
*/
private final ConnectionManager<VtkWebClient> connections;

/**
* The default constructor.
* <p>
* <b>Note:</b> Only OSGi should call this method!
* </p>
*/
public ParaViewVizService() {
// Update the instance to point to this viz service (there should be
// only one).
instance = this;

// Set up the connection manager.
connections = new ConnectionManager<VtkWebClient>() {
@Override
protected CustomScopedPreferenceStore getPreferenceStore() {
return (CustomScopedPreferenceStore) ParaViewVizService.this
.getPreferenceStore();
}

@Override
protected ConnectionTable createConnectionTable() {
return new ConnectionTable();
}

@Override
protected IConnectionAdapter<VtkWebClient> createConnectionAdapter() {
return new ParaViewConnectionAdapter();
}
};

return;
}

/**
* Gets the current instance of the viz service. This instance was created
* by OSGi.
* <p>
* <b>Note:</b> This method is only intended to be used by the preference
* page to notify the service when the preferences have changed.
* </p>
*
* @return The current instance of the viz service.
*/
protected static ParaViewVizService getInstance() {
return instance;
}

/**
* This method notifies the service that the preferences have changed. Any
* connections that have changed should be reset.
*/
protected void preferencesChanged(Map<String, String> changedKeys,
Set<String> addedKeys, Set<String> removedKeys) {
connections.preferencesChanged(changedKeys, addedKeys, removedKeys);
}

/*
* (non-Javadoc)
Expand All @@ -48,8 +123,7 @@ public String getName() {
*/
@Override
public String getVersion() {
// TODO Update this value.
return "";
return "0.0";
}

/*
Expand All @@ -60,7 +134,7 @@ public String getVersion() {
*/
@Override
public boolean hasConnectionProperties() {
// TODO Auto-generated method stub
// Do nothing yet.
return false;
}

Expand All @@ -72,7 +146,7 @@ public boolean hasConnectionProperties() {
*/
@Override
public Map<String, String> getConnectionProperties() {
// TODO Auto-generated method stub
// Do nothing yet.
return null;
}

Expand All @@ -84,8 +158,7 @@ public Map<String, String> getConnectionProperties() {
*/
@Override
public void setConnectionProperties(Map<String, String> props) {
// TODO Auto-generated method stub

// Do nothing yet.
}

/*
Expand All @@ -95,8 +168,7 @@ public void setConnectionProperties(Map<String, String> props) {
*/
@Override
public boolean connect() {
// TODO Auto-generated method stub
return false;
return connections.connect();
}

/*
Expand All @@ -106,8 +178,7 @@ public boolean connect() {
*/
@Override
public boolean disconnect() {
// TODO Auto-generated method stub
return false;
return connections.disconnect();
}

/*
Expand All @@ -119,8 +190,27 @@ public boolean disconnect() {
*/
@Override
public IPlot createPlot(URI file) throws Exception {
// TODO Auto-generated method stub
return null;
ParaViewPlot plot = null;
if (canOpenFile(file)) {
plot = new ParaViewPlot(this, file);
connections.addClient(plot);
}
return plot;
}

/**
* Determines whether or not the file can be opened in ParaView.
*
* @param file
* The file to test. May be {@code null}.
* @return True if the file can be opened in VisIt, false otherwise.
*/
private boolean canOpenFile(URI file) {
boolean canOpen = false;
if (file != null) {
// TODO
}
return canOpen;
}

}

0 comments on commit 35c2198

Please sign in to comment.