Author: paperwing
Date: 2012-01-31 09:00:56 -0800 (Tue, 31 Jan 2012)
New Revision: 28164
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngineFactory.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
Log:
in process of integrating with VizMapper's default style previewer/editor, the
preview image is now clickable, but work remains to be done to update the
preview
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
2012-01-31 15:23:54 UTC (rev 28163)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
2012-01-31 17:00:56 UTC (rev 28164)
@@ -14,6 +14,7 @@
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
+import javax.swing.JPanel;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.service.util.CyServiceRegistrar;
@@ -54,6 +55,8 @@
/** Whether or not the current rendering engine is active */
private boolean active;
+ private GLJPanel panel;
+
private CyServiceRegistrar serviceRegistrar;
private NetworkViewAboutToBeDestroyedListener
networkViewDestroyedListener;
@@ -64,14 +67,16 @@
this.viewModel = viewModel;
this.visualLexicon = visualLexicon;
this.active = false;
+
+// setUpCanvas(container);
}
// Needs to be called before setUpCanvas
- public void setUpNetworkView(CyNetworkViewManager networkViewManager) {
- if (networkViewManager != null) {
- this.networkView =
networkViewManager.getNetworkView(viewModel.getModel());
- }
- }
+// public void setUpNetworkView(CyNetworkViewManager networkViewManager) {
+// if (networkViewManager != null) {
+// this.networkView =
networkViewManager.getNetworkView(viewModel.getModel());
+// }
+// }
/** Set up the canvas by creating and placing it, along with a Graphics
* object, into the container
@@ -80,8 +85,15 @@
* the rendered results
*/
public void setUpCanvas(Object container) {
+
+ // TODO: The current presentation API seems to require this
cast, check
+ // if there's a way around it
+ this.networkView = (CyNetworkView) viewModel;
+
if (networkView != null) {
- if (container instanceof JComponent) {
+
+ if (container instanceof JComponent) {
+
JComponent component = (JComponent) container;
Container focus = component;
@@ -93,7 +105,7 @@
capabilities.setDoubleBuffered(true);
// TODO: check whether to use GLCanvas or
GLJPanel
- GLJPanel panel = new GLJPanel(capabilities);
+ panel = new GLJPanel(capabilities);
// TODO: check if negative effects produced by
this
panel.setIgnoreRepaint(true);
@@ -207,8 +219,9 @@
@Override
public Image createImage(int width, int height) {
// TODO Auto-generated method stub
- return null;
- //return new BufferedImage(0, width, height);
+
+ return panel.createImage(width, height);
+
}
@Override
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngineFactory.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngineFactory.java
2012-01-31 15:23:54 UTC (rev 28163)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngineFactory.java
2012-01-31 17:00:56 UTC (rev 28164)
@@ -53,7 +53,7 @@
//TODO: NetworkViewManager does not contain all instances of
CyNetworkView, so wait
WindRenderingEngine engine = getNewRenderingEngine(container,
viewModel, visualLexicon);
- engine.setUpNetworkView(networkViewManager);
+// engine.setUpNetworkView(networkViewManager);
engine.setUpCanvas(container);
engine.setUpNetworkViewDestroyedListener(serviceRegistrar);
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
2012-01-31 15:23:54 UTC (rev 28163)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/view/WindNetworkView.java
2012-01-31 17:00:56 UTC (rev 28164)
@@ -19,10 +19,13 @@
import org.cytoscape.model.events.AddedEdgesListener;
import org.cytoscape.model.events.AddedNodesEvent;
import org.cytoscape.model.events.AddedNodesListener;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+import org.cytoscape.paperwing.internal.tools.NetworkToolkit;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.presentation.property.RichVisualLexicon;
public class WindNetworkView extends VisualPropertyKeeper<CyNetwork>
implements CyNetworkView {
@@ -108,9 +111,22 @@
return views;
}
+ /**
+ * Center the network
+ */
@Override
public void fitContent() {
+ Vector3 networkCenter = NetworkToolkit.findNetworkCenter(this,
1);
+ // Shift the nodes to place the center of the network at the
origin
+ for (View<CyNode> nodeView : getNodeViews()) {
+
nodeView.setVisualProperty(RichVisualLexicon.NODE_X_LOCATION,
+
nodeView.getVisualProperty(RichVisualLexicon.NODE_X_LOCATION) -
networkCenter.x());
+
nodeView.setVisualProperty(RichVisualLexicon.NODE_Y_LOCATION,
+
nodeView.getVisualProperty(RichVisualLexicon.NODE_Y_LOCATION) -
networkCenter.y());
+
nodeView.setVisualProperty(RichVisualLexicon.NODE_Z_LOCATION,
+
nodeView.getVisualProperty(RichVisualLexicon.NODE_Z_LOCATION) -
networkCenter.z());
+ }
}
@Override
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.