Author: kono
Date: 2009-07-24 16:55:43 -0700 (Fri, 24 Jul 2009)
New Revision: 17568

Added:
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5EdgeRenderer.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Cube.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Line.java
Removed:
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/P5Renderer.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyDrawableFactoryImpl.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyNodePresentationBuilder.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/GestaltFactoryImpl.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GCube.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GLPoint.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/ShapeFactory.java
Modified:
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5NodeRenderer.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingNetworkRenderer.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingPresentationFactory.java
Log:


Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/P5Renderer.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/P5Renderer.java
   2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/P5Renderer.java
   2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,30 +0,0 @@
-package org.cytoscape.view.presentation.processing;
-
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.presentation.VisualItemRenderer;
-
-/**
- * Base interface for all renderers.  This will be used by:
- * <ul>
- *  <li>Node Renderer</li>
- *  <li>Edge Renderer</li>
- *  <li>Network Renderer</li>
- *  <li>Decoration Renderer</li>
- * </ul>
- * 
- * @author kono
- *
- * @param <T>
- */
-public interface P5Renderer <T> extends VisualItemRenderer<View<T>> {
-       
-       /**
-        * Get top-level Drawable Object.
-        * 
-        * @return Gestalt's Drawable object with Cytoscape dependent 
properties.
-        */
-       public CyDrawable getCyDrawable();
-       
-       public void render(View<T> viewModel, CyDrawable drawable);
-       
-}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyDrawableFactoryImpl.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyDrawableFactoryImpl.java
       2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyDrawableFactoryImpl.java
       2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,33 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal;
-
-import gestalt.impl.jogl.shape.JoglDrawableFactory;
-import gestalt.render.Drawable;
-import gestalt.shape.Cube;
-
-import org.cytoscape.view.presentation.processing.internal.shape.GCube;
-
-
-
-/**
- * Factory for shapes.
- * 
- * @author kono
- *
- */
-public class CyDrawableFactoryImpl extends JoglDrawableFactory implements
-               CyDrawableFactory {
-       
-       public CyDrawableFactoryImpl() {
-               super();
-       }
-
-       public Drawable getDrawable(Class<? extends Drawable> type) {
-               return null;
-       }
-       
-       public Cube cube() {
-               System.out.println("@@@@@@@@@@ GCube");
-               return null;
-       }
-
-}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyNodePresentationBuilder.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyNodePresentationBuilder.java
   2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/CyNodePresentationBuilder.java
   2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,43 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal;
-
-import static 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon.NODE_STYLE;
-
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.processing.CyDrawable;
-import org.cytoscape.view.presentation.processing.P5Renderer;
-import org.cytoscape.view.presentation.processing.internal.shape.GCube;
-import 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon;
-
-public class CyNodePresentationBuilder {
-
-       private ProcessingVisualLexicon lexicon;
-       
-       public CyNodePresentationBuilder(ProcessingVisualLexicon lexicon) {
-               this.lexicon = lexicon;
-       }
-
-       public P5Renderer<CyNode> buildPresentation(View<CyNode> nodeView) 
throws InstantiationException, IllegalAccessException {
-
-               // First, check the Drawable type
-               CyDrawable value = nodeView.getVisualProperty(NODE_STYLE);
-
-               // If not available, use default
-               if (value == null)
-                       value = new GCube(lexicon);
-
-               VisualLexicon vpSet = lexicon.getSubLexicon(value.getClass());
-
-               // Customize Drawable
-               for (VisualProperty<?> vp : vpSet.getAllVisualProperties()) {
-
-               }
-
-               final P5Renderer<CyNode> presentation = new P5NodeRenderer(
-                               nodeView, value);
-
-               return presentation;
-       }
-}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/GestaltFactoryImpl.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/GestaltFactoryImpl.java
  2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/GestaltFactoryImpl.java
  2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,29 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal;
-
-import gestalt.shape.DrawableFactory;
-
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.presentation.processing.P5Renderer;
-
-public class GestaltFactoryImpl {
-       
-       private DrawableFactory dFactory;
-
-       
-       public GestaltFactoryImpl(DrawableFactory dFactory) {
-               this.dFactory = dFactory;
-       }
-       
-       public <T> P5Renderer<T> getPresentation(View<T> viewModel) {
-               
-               
-               
-               
-               return null;
-       }
-       
-       private void createCyNetworkView() {
-               
-       }
-
-}

Added: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5EdgeRenderer.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5EdgeRenderer.java
                              (rev 0)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5EdgeRenderer.java
      2009-07-24 23:55:43 UTC (rev 17568)
@@ -0,0 +1,74 @@
+package org.cytoscape.view.presentation.processing.internal;
+
+import static 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon.*;
+import static 
org.cytoscape.view.presentation.property.ThreeDVisualLexicon.NODE_Z_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_COLOR;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_X_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_Y_LOCATION;
+
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.VisualLexicon;
+import org.cytoscape.view.presentation.VisualItemRenderer;
+import org.cytoscape.view.presentation.processing.CyDrawable;
+import org.cytoscape.view.presentation.processing.internal.shape.Cube;
+import org.cytoscape.view.presentation.processing.internal.shape.Line;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+
+import processing.core.PApplet;
+
+public class P5EdgeRenderer implements VisualItemRenderer<View<CyEdge>>{
+       
+private PApplet p;
+       
+       private final VisualLexicon nodeLexicon;
+       
+       public P5EdgeRenderer(PApplet p) {
+               this.p = p;
+               nodeLexicon = buildLexicon();
+       }
+       
+       private VisualLexicon buildLexicon() {
+               final VisualLexicon sub = new BasicVisualLexicon();
+               System.out.println("%%%%%%%%%%%%% Building VP1");
+               sub.addVisualProperty(EDGE_COLOR);
+               
+               sub.addVisualProperty(NODE_X_LOCATION);
+               sub.addVisualProperty(NODE_Y_LOCATION);
+               sub.addVisualProperty(NODE_Z_LOCATION);
+               System.out.println("%%%%%%%%%%%%% Building VP2");
+               //sub.addVisualProperty(ProcessingVisualLexicon.NODE_STYLE);
+               
+//             sub.addVisualProperty(NODE_X_SIZE);
+//             sub.addVisualProperty(NODE_Y_SIZE);
+//             sub.addVisualProperty(NODE_Z_SIZE);
+               System.out.println("%%%%%%%%%%%%% Building VP3");
+               
+               return sub;
+       }
+
+       public VisualLexicon getVisualLexicon() {
+               return nodeLexicon;
+       }
+
+       public CyDrawable render(View<CyEdge> view) {
+               CyDrawable style = view.getVisualProperty(EDGE_STYLE);
+               
+               if(style == null) 
+                       style = new Line(p);
+               
+               view.getSource().getSource();
+               view.getSource().getTarget();
+               
+               
+               Cube cube = (Cube) style;
+               cube.x = view.getVisualProperty(NODE_X_LOCATION).floatValue();
+               cube.y = view.getVisualProperty(NODE_Y_LOCATION).floatValue();
+               cube.z = view.getVisualProperty(NODE_Z_LOCATION).floatValue();
+               
+               return cube;
+       }
+
+
+}

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5NodeRenderer.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5NodeRenderer.java
      2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/P5NodeRenderer.java
      2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,34 +1,70 @@
 package org.cytoscape.view.presentation.processing.internal;
 
-import gestalt.context.GLContext;
-import gestalt.extension.picking.Pickable;
+import static 
org.cytoscape.view.presentation.property.ThreeDVisualLexicon.NODE_Z_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_COLOR;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_X_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_Y_LOCATION;
+import static 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon.*;
 
+import org.cytoscape.view.presentation.processing.internal.shape.Cube;
+import 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon;
+
 import org.cytoscape.model.CyNode;
 import org.cytoscape.view.model.View;
 import org.cytoscape.view.model.VisualLexicon;
+import org.cytoscape.view.presentation.VisualItemRenderer;
 import org.cytoscape.view.presentation.processing.CyDrawable;
-import org.cytoscape.view.presentation.processing.P5Renderer;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
 
-public class P5NodeRenderer implements P5Renderer<CyNode> {
+import processing.core.PApplet;
 
-       private CyDrawable top;
+public class P5NodeRenderer implements VisualItemRenderer<View<CyNode>> {
 
-       public P5NodeRenderer(View<CyNode> nodeView, CyDrawable top) {
-
-               this.top = top;
+       private PApplet p;
+       
+       private final VisualLexicon nodeLexicon;
+       
+       public P5NodeRenderer(PApplet p) {
+               this.p = p;
+               nodeLexicon = buildLexicon();
        }
-
-       public CyDrawable getCyDrawable() {
-               // TODO Auto-generated method stub
-               return null;
+       
+       private VisualLexicon buildLexicon() {
+               final VisualLexicon sub = new BasicVisualLexicon();
+               System.out.println("%%%%%%%%%%%%% Building VP1");
+               sub.addVisualProperty(NODE_COLOR);
+               
+               sub.addVisualProperty(NODE_X_LOCATION);
+               sub.addVisualProperty(NODE_Y_LOCATION);
+               sub.addVisualProperty(NODE_Z_LOCATION);
+               System.out.println("%%%%%%%%%%%%% Building VP2");
+               //sub.addVisualProperty(ProcessingVisualLexicon.NODE_STYLE);
+               
+//             sub.addVisualProperty(NODE_X_SIZE);
+//             sub.addVisualProperty(NODE_Y_SIZE);
+//             sub.addVisualProperty(NODE_Z_SIZE);
+               System.out.println("%%%%%%%%%%%%% Building VP3");
+               
+               return sub;
        }
 
        public VisualLexicon getVisualLexicon() {
-               // TODO Auto-generated method stub
-               return null;
+               return nodeLexicon;
        }
 
+       public CyDrawable render(View<CyNode> view) {
+               CyDrawable style = view.getVisualProperty(NODE_STYLE);
+               
+               if(style == null) 
+                       style = new Cube(p);
+               
+               Cube cube = (Cube) style;
+               cube.x = view.getVisualProperty(NODE_X_LOCATION).floatValue();
+               cube.y = view.getVisualProperty(NODE_Y_LOCATION).floatValue();
+               cube.z = view.getVisualProperty(NODE_Z_LOCATION).floatValue();
+               
+               return cube;
+       }
 
 
-
 }

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingNetworkRenderer.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingNetworkRenderer.java
   2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingNetworkRenderer.java
   2009-07-24 23:55:43 UTC (rev 17568)
@@ -6,19 +6,23 @@
 import java.awt.Dimension;
 import java.awt.Image;
 import java.awt.print.Printable;
+import java.util.List;
 import java.util.Properties;
 
 import javax.media.opengl.GL;
 import javax.swing.Icon;
 
+import org.cytoscape.model.CyEdge;
 import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNode;
+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.RenderingEngine;
 import org.cytoscape.view.presentation.processing.CyDrawable;
-import org.cytoscape.view.presentation.processing.P5Renderer;
 import 
org.cytoscape.view.presentation.processing.internal.particle.ParticleManager;
-import org.cytoscape.view.presentation.processing.internal.shape.GCube;
+import org.cytoscape.view.presentation.processing.internal.shape.Cube;
 
 import processing.core.PApplet;
 import processing.opengl.PGraphicsOpenGL;
@@ -27,7 +31,7 @@
 import toxi.physics.VerletPhysics;
 
 public class ProcessingNetworkRenderer extends PApplet implements
-               P5Renderer<CyNetwork> {
+               RenderingEngine {
 
        /*
         * Basic Processing settings
@@ -37,22 +41,34 @@
        private static final int FRAME_RATE = 30;
 
        private Dimension windowSize;
-       private View<CyNetwork> view;
+       private CyNetworkView view;
 
        GraphRenderer renderer;
 
-       Drawable[] nodes;
+       private CyDrawable[] nodes;
+       private CyDrawable[] edges;
 
+       private P5NodeRenderer nodeRenderer;
+
        /**
         * Constructor. Create a PApplet component based on the size given as
         * parameter.
         * 
         * @param size
         */
-       public ProcessingNetworkRenderer(Dimension size, View<CyNetwork> view) {
-               this.windowSize = size;
-               this.view = view;
+       public ProcessingNetworkRenderer(Dimension size, CyNetworkView view) {
                System.out.println("%%%%%%%%%%%%% Constructor called for P5");
+               try {
+                       this.windowSize = size;
+                       System.out.println("%%%%%%%%%%%%% Constructor called 
for P5: 1");
+                       this.view = view;
+                       System.out.println("%%%%%%%%%%%%% Constructor called 
for P5: 2");
+                       this.nodeRenderer = new P5NodeRenderer(this);
+                       System.out.println("%%%%%%%%%%%%% Constructor called 
for P5: 3");
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+
                System.out.println("\n\n\n\n\n\n!!!!!!!!!! Calling constructor: 
");
        }
 
@@ -85,9 +101,7 @@
                // TODO Auto-generated method stub
                return null;
        }
-       
-       
-       
+
        PGraphicsOpenGL pgl;
        GL gl;
 
@@ -95,30 +109,35 @@
        VerletPhysics physics;
        float rotX, rotY, zoom = 200;
        AABB boundingBox;
-       
-       GCube cube;
-       
+
+
        public void setup() {
                System.out.println("%%%%%%%%%%%%% Setup called for P5");
                /* setup p5 */
                size(windowSize.width, windowSize.width, OPENGL);
+               hint(ENABLE_OPENGL_4X_SMOOTH);
+               hint(ENABLE_NATIVE_FONTS);
+               noStroke();
+               
                frameRate(30);
-               
-               physics = new VerletPhysics();
-               physics.friction = 1000;
-               AABB boundingBox = new AABB(new Vec3D(0, 0, 0), new Vec3D(width,
-                               height, height));
-               physics.worldBounds = boundingBox;
-               particleManager = new ParticleManager(200, this, physics);
-               
-               cube = new GCube(this);
+
+               // Convert views to drawable
+               final List<View<CyNode>> nodeViews = view.getNodeViews();
+               nodes = new CyDrawable[nodeViews.size()];
+               for (int i = 0; i < nodes.length; i++) {
+                       nodes[i] = nodeRenderer.render(nodeViews.get(i));
+               }
+
+               final List<View<CyEdge>> edgeViews = view.getEdgeViews();
+               edges = new CyDrawable[edgeViews.size()];
+
                System.out.println("%%%%%%%%%%%%% Setup DONE for P5");
        }
 
-
        public void draw() {
                background(0);
-               physics.update();
+               lights();
+               
                camera(width / 2.0f, height / 2.0f, (height / 2.0f)
                                / tan((float) (PI * 60.0 / 360.0)) + zoom, 
width / 2.0f,
                                height / 2.0f, 0, 0, 1, 0);
@@ -126,13 +145,17 @@
                rotateX(rotY);
                rotateY(rotX);
                translate(-width / 2, -height / 2, -height / 2);
-               beginGL();
-               particleManager.draw(gl);
+               beginGL();              
+               for (CyDrawable node : nodes)
+                       node.draw();
+
+               // for(CyDrawable edge: edges)
+               // edge.draw();
+               
                endGL();
-               // println(frameRate);
-               cube.draw();
                
                
+
        }
 
        public void beginGL() {
@@ -144,34 +167,23 @@
        public void endGL() {
                pgl.endGL();
        }
-       
+
        public void mouseDragged() {
                if (mouseButton == RIGHT) {
-                       zoom += (mouseY - pmouseY) * 1;
+                       zoom += (mouseY - pmouseY) * 2;
                } else if (mouseButton == LEFT) {
                        rotX += (mouseX - pmouseX) * 0.01;
                        rotY -= (mouseY - pmouseY) * 0.01;
                }
        }
-       
 
-
        public Icon getDefaultIcon(VisualProperty<?> vp) {
                // TODO Auto-generated method stub
                return null;
        }
 
-       public CyDrawable getCyDrawable() {
-               return null;
-       }
-
-       public Component getComponent() {
-               // TODO Auto-generated method stub
-               return this;
-       }
-
        public View<CyNetwork> getViewModel() {
-               return null;
+               return view;
        }
 
 }

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingPresentationFactory.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingPresentationFactory.java
       2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingPresentationFactory.java
       2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,27 +1,21 @@
 package org.cytoscape.view.presentation.processing.internal;
 
 import java.awt.BorderLayout;
-import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.EventQueue;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.swing.JFrame;
 
-import org.cytoscape.model.CyNetwork;
+import org.cytoscape.view.model.CyNetworkView;
 import org.cytoscape.view.model.View;
 import org.cytoscape.view.model.VisualProperty;
 import org.cytoscape.view.model.events.NetworkViewChangedEvent;
 import org.cytoscape.view.model.events.NetworkViewChangedListener;
 import org.cytoscape.view.presentation.NavigationPresentation;
 import org.cytoscape.view.presentation.PresentationFactory;
-import org.cytoscape.view.presentation.Renderer;
-import org.cytoscape.view.presentation.processing.P5Renderer;
+import org.cytoscape.view.presentation.RenderingEngine;
 
 public class ProcessingPresentationFactory implements PresentationFactory,
                NetworkViewChangedListener {
@@ -29,146 +23,91 @@
        private static final Dimension DEFAULT_WINDOW_SIZE = new Dimension(1200,
                        1000);
 
-       private final Map<Class<?>, Class<? extends P5Renderer<?>>> rendererMap;
+       // private final Map<Class<?>, Class<? extends P5Renderer<?>>> 
rendererMap;
 
-       public ProcessingPresentationFactory() {
-               rendererMap = new HashMap<Class<?>, Class<? extends 
P5Renderer<?>>>();
+       // public ProcessingPresentationFactory() {
+       // rendererMap = new HashMap<Class<?>, Class<? extends 
P5Renderer<?>>>();
+       //
+       // // This is the default renderer for network.
+       // rendererMap.put(CyNetwork.class, ProcessingNetworkRenderer.class);
+       // }
+       //
+       // public void registerPresentation(Class<?> targetDataType,
+       // Class<P5Renderer<?>> rendererClass) {
+       // rendererMap.put(targetDataType, rendererClass);
+       // }
 
-               // This is the default renderer for network.
-               rendererMap.put(CyNetwork.class, 
ProcessingNetworkRenderer.class);
-       }
-
-       public void registerPresentation(Class<?> targetDataType,
-                       Class<P5Renderer<?>> rendererClass) {
-               rendererMap.put(targetDataType, rendererClass);
-       }
-
        public NavigationPresentation addNavigationPresentation(
                        Object targetComponent, Object navBounds) {
                // TODO Auto-generated method stub
                return null;
        }
 
-       public <T extends View<?>> Renderer<T> addPresentation(
-                       final Container frame2, final T view) {
+       public RenderingEngine addPresentation(final Object target,
+                       final View<?> view) {
                // Check parameter
-//             if (view == null)
-//                     throw new IllegalArgumentException(
-//                                     "Cannot create presentation for null 
view model.");
+               if (view == null)
+                       throw new IllegalArgumentException(
+                                       "Cannot create presentation for null 
view model.");
 
-               // Class<? extends P5Renderer<?>> rendererClass = null;
-               //              
-               // for(Class<?> key :rendererMap.keySet()) {
-               // if(key.isAssignableFrom(view.getSource().getClass())) {
-               // rendererClass = rendererMap.get(key);
-               // }
-               // }
-               //              
-               // if (rendererClass == null)
-               // throw new IllegalArgumentException(
-               // "Cannot create presentation for "
-               // + view.getSource().getClass().toString() +
-               // ":  Could not find implementation.");
-               //
-               // System.out.println("====== Creating Processing Dialog 
=========");
-               //
-               //              
-               //
-               // P5Renderer<?> renderer = null;
-               // try {
-               // Constructor<? extends P5Renderer<?>> ct = rendererClass
-               // .getConstructor(Container.class, View.class);
-               //                      
-               //
-               // renderer = ct.newInstance(frame, view);
-               // } catch (IllegalArgumentException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // } catch (InstantiationException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // } catch (IllegalAccessException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // } catch (InvocationTargetException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // } catch (SecurityException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // } catch (NoSuchMethodException e) {
-               // // TODO Auto-generated catch block
-               // e.printStackTrace();
-               // }
-               //
-               //              
                System.out.println("\n\n\n\n\n!!!!!!!!!! Calling: ");
 
-               System.out.println("\n\n\n\n\n!!!!!!!!!! Done! ");
-               // window.setTitle(title);
-               
-//              JFrame f = (JFrame) frame;
-//              PAppletFrameListener listener = new PAppletFrameListener(rend);
-//              f.addWindowListener(listener);
+               final JFrame frame = (JFrame) target;
 
-               show((JFrame) frame2);
-
-
-               //              
-
-               return null;
-               //return (Renderer<T>) rend;
-       }
-       
-       private void show(final JFrame frame) {
                final ProcessingNetworkRenderer rend = new 
ProcessingNetworkRenderer(
-                               DEFAULT_WINDOW_SIZE, null);
+                               DEFAULT_WINDOW_SIZE, (CyNetworkView) view);
                rend.init();
-                EventQueue.invokeLater(new Runnable() {
-                   
+               System.out.println("\n\n\n\n\n!!!!!!!!!! Init Done! ");
+               
+               EventQueue.invokeLater(new Runnable() {
 
                        public void run() {
                                // TODO Auto-generated method stub
-                               
+                               System.out.println("\n\n\n\n\n!!!!!!!!!! 
Running new thread! ");
                                frame.setLayout(new BorderLayout());
                                frame.setSize(DEFAULT_WINDOW_SIZE);
                                frame.setPreferredSize(DEFAULT_WINDOW_SIZE);
-                               frame.add(rend.getComponent(), 
BorderLayout.CENTER);
-                               
+                               frame.add(rend, BorderLayout.CENTER);
+
                                frame.pack();
 
                                frame.setLocationByPlatform(true);
                                
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-                               
+
                                frame.addWindowListener(new WindowAdapter() {
 
-                           @Override
-                           public void windowClosing(WindowEvent e) {
-                               // Run this on another thread than the AWT 
event queue to
-                               // make sure the call to Animator.stop() 
completes before
-                               // exiting
-                               new Thread(new Runnable() {
+                                       @Override
+                                       public void windowClosing(WindowEvent 
e) {
+                                               // Run this on another thread 
than the AWT event queue
+                                               // to
+                                               // make sure the call to 
Animator.stop() completes
+                                               // before
+                                               // exiting
+                                               new Thread(new Runnable() {
 
-                                   public void run() {
-                                       System.out.println("========== P 
closed.");
-                                               rend.stop();
-                                               System.out.println("========== 
P Finished!==============");
-                                               //System.gc();
-                                   }
-                               }).start();
-                           }
-                       });
-                               
-                               
+                                                       public void run() {
+                                                               
System.out.println("========== P closed.");
+                                                               rend.stop();
+                                                               System.out
+                                                                               
.println("========== P Finished!==============");
+                                                               // System.gc();
+                                                       }
+                                               }).start();
+                                       }
+                               });
+
                                frame.setVisible(true);
-                               
-                               System.out.println(" ========= Processing 
Dialog Had been created.");
+
+                               System.out
+                                               .println(" ========= Processing 
Dialog Had been created.");
                        }
 
                });
-               
+
+               return rend;
+
        }
-       
+
        public void visualPropertySet(VisualProperty<?> vp, Object value) {
                // TODO Auto-generated method stub
 
@@ -179,9 +118,4 @@
 
        }
 
-       public <T extends View<?>> Renderer<T> createPresentation(T view) {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
 }

Copied: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Cube.java
 (from rev 17497, 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GCube.java)
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Cube.java
                          (rev 0)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Cube.java
  2009-07-24 23:55:43 UTC (rev 17568)
@@ -0,0 +1,115 @@
+package org.cytoscape.view.presentation.processing.internal.shape;
+
+import static 
org.cytoscape.view.presentation.property.ThreeDVisualLexicon.NODE_Z_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_COLOR;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_X_LOCATION;
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_Y_LOCATION;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.media.opengl.GL;
+import javax.swing.Icon;
+
+import org.cytoscape.model.CyNode;
+import org.cytoscape.view.model.VisualLexicon;
+import org.cytoscape.view.presentation.processing.CyDrawable;
+import 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+
+import processing.core.PApplet;
+import processing.opengl.PGraphicsOpenGL;
+import toxi.geom.Vec3D;
+
+/**
+ * Wrapper for JOGL-based Cube object.
+ * 
+ * @author kono
+ *
+ */
+public class Cube extends Vec3D implements CyDrawable {
+
+       private static final long serialVersionUID = -3971892445041605908L;
+       private static final String DISPLAY_NAME = "Cube";
+       
+       private ProcessingVisualLexicon lexicon;
+       
+       private Set<Class<?>> compatibleDataType;
+       
+       private static VisualLexicon sub;
+       
+       static {
+               sub = new BasicVisualLexicon();
+               sub.addVisualProperty(NODE_COLOR);
+               sub.addVisualProperty(NODE_X_LOCATION);
+               sub.addVisualProperty(NODE_Y_LOCATION);
+               sub.addVisualProperty(NODE_Z_LOCATION);
+       }
+       
+       
+       private PApplet p;
+       private GL gl;
+       private PGraphicsOpenGL pgl;
+       
+       
+       private float size;
+       private float r, g, b, alpha;
+        
+       
+       public Cube(PApplet parent) {
+               super();
+               this.p = parent;
+               size = 20;
+       }
+       
+       public Cube(ProcessingVisualLexicon lexicon) {
+               
+               this.lexicon = lexicon;
+               compatibleDataType = new HashSet<Class<?>>();
+               compatibleDataType.add(CyNode.class);
+               
+               this.lexicon.registerSubLexicon(this.getClass(), sub);
+               
+               r = 100;
+               g = 200;
+               b = 100;
+               alpha = 150;
+               
+               this.rotateX(p.random(p.PI));
+               this.rotateY(p.random(p.PI));
+               this.rotateZ(p.random(p.PI));
+       }
+
+
+
+       public Set<Class<?>> getCompatibleModels() {
+               return compatibleDataType;
+       }
+
+       public String getDisplayName() {
+               return DISPLAY_NAME;
+       }
+
+       public Icon getIcon(int width, int height) {
+               // TODO Implement icon renderer
+               return null;
+       }
+
+       public VisualLexicon getCompatibleVisualProperties() {
+               return lexicon.getSubLexicon(this.getClass());
+       }
+
+       public void draw() {
+               p.pushMatrix();
+               p.translate(x, y, z);
+               p.box(size);
+               p.popMatrix();
+       }
+
+       public List<CyDrawable> getChildren() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GCube.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GCube.java
 2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GCube.java
 2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,100 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal.shape;
-
-import static 
org.cytoscape.view.presentation.property.ThreeDVisualLexicon.NODE_Z_LOCATION;
-import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_COLOR;
-import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_X_LOCATION;
-import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_Y_LOCATION;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.media.opengl.GL;
-import javax.swing.Icon;
-
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.presentation.processing.CyDrawable;
-import 
org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon;
-import org.cytoscape.view.presentation.property.BasicVisualLexicon;
-
-import processing.core.PApplet;
-import processing.opengl.PGraphicsOpenGL;
-import toxi.geom.Rect;
-
-/**
- * Wrapper for JOGL-based Cube object.
- * 
- * @author kono
- *
- */
-public class GCube implements CyDrawable {
-
-       private static final long serialVersionUID = -3971892445041605908L;
-       private static final String DISPLAY_NAME = "Cube";
-       
-       private ProcessingVisualLexicon lexicon;
-       
-       private Set<Class<?>> compatibleDataType;
-       
-       private static VisualLexicon sub;
-       
-       static {
-               sub = new BasicVisualLexicon();
-               sub.addVisualProperty(NODE_COLOR);
-               sub.addVisualProperty(NODE_X_LOCATION);
-               sub.addVisualProperty(NODE_Y_LOCATION);
-               sub.addVisualProperty(NODE_Z_LOCATION);
-       }
-       
-       
-       private PApplet p;
-       private GL gl;
-       private PGraphicsOpenGL pgl;
-       
-       public GCube(PApplet parent, View<?> view) {
-               this.p = parent;
-               this.pgl = (PGraphicsOpenGL) p.g;
-               gl = pgl.gl;
-               
-       }
-       
-       public GCube(ProcessingVisualLexicon lexicon) {
-               
-               this.lexicon = lexicon;
-               compatibleDataType = new HashSet<Class<?>>();
-               compatibleDataType.add(CyNode.class);
-               
-               this.lexicon.registerSubLexicon(this.getClass(), sub);
-       }
-
-
-
-       public Set<Class<?>> getCompatibleModels() {
-               return compatibleDataType;
-       }
-
-       public String getDisplayName() {
-               return DISPLAY_NAME;
-       }
-
-       public Icon getIcon(int width, int height) {
-               // TODO Implement icon renderer
-               return null;
-       }
-
-       public VisualLexicon getCompatibleVisualProperties() {
-               return lexicon.getSubLexicon(this.getClass());
-       }
-
-       public void draw() {
-               p.box(20);
-       }
-
-       public List<CyDrawable> getChildren() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GLPoint.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GLPoint.java
       2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/GLPoint.java
       2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,49 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal.shape;
-
-import gestalt.context.GLContext;
-import gestalt.shape.AbstractShape;
-
-import java.util.Set;
-
-import javax.swing.Icon;
-
-import org.cytoscape.view.model.VisualLexicon;
-import org.cytoscape.view.presentation.processing.CyDrawable;
-
-public class GLPoint extends AbstractShape implements CyDrawable {
-
-       
-       private static final long serialVersionUID = -7966355417706954584L;
-
-       public Set<Class<?>> getCompatibleModels() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-       
-       public String getDisplayName() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public Icon getIcon(int width, int height) {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public void draw(GLContext arg0) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public VisualLexicon getCompatibleVisualProperties() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public void draw() {
-               // TODO Auto-generated method stub
-               
-       }
-
-
-}

Added: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Line.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Line.java
                          (rev 0)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Line.java
  2009-07-24 23:55:43 UTC (rev 17568)
@@ -0,0 +1,42 @@
+package org.cytoscape.view.presentation.processing.internal.shape;
+
+import java.awt.Color;
+import java.util.List;
+import java.util.Set;
+
+import org.cytoscape.view.presentation.processing.CyDrawable;
+
+import processing.core.PApplet;
+import toxi.geom.Vec3D;
+
+public class Line implements CyDrawable {
+       
+       private final PApplet p;
+       
+       private Vec3D source;
+       private Vec3D target;
+       
+       private Color color;
+       
+       public Line(PApplet p) {
+               this.p = p;
+               this.source = new Vec3D();
+               this.target = new Vec3D();
+       }
+
+       public void draw() {
+               p.stroke(color.getRed(), color.getGreen(), color.getBlue(), 
color.getAlpha());
+               p.line(source.x, source.y, source.z, target.x, target.y, 
target.z);             
+       }
+
+       public List<CyDrawable> getChildren() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       public Set<Class<?>> getCompatibleModels() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+}

Deleted: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/ShapeFactory.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/ShapeFactory.java
  2009-07-24 23:55:03 UTC (rev 17567)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/ShapeFactory.java
  2009-07-24 23:55:43 UTC (rev 17568)
@@ -1,28 +0,0 @@
-package org.cytoscape.view.presentation.processing.internal.shape;
-
-import gestalt.p5.GestaltPlugIn;
-import gestalt.shape.DrawableFactory;
-
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.presentation.processing.P5Renderer;
-
-public class ShapeFactory {
-
-       private final GestaltPlugIn p;
-
-       private final DrawableFactory factory;
-
-       public ShapeFactory(GestaltPlugIn p) {
-               this.p = p;
-               this.factory = p.drawablefactory();
-       }
-
-       public P5Renderer<CyNode> getNodeShape(View<CyNode> view) {
-
-       
-
-               return null;
-       }
-
-}


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to