Author: kono
Date: 2009-08-12 21:10:16 -0700 (Wed, 12 Aug 2009)
New Revision: 17803

Added:
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ui/RoundRectWindow.java
Modified:
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/DefaultVisualStyleBuilder.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/shape/Cube.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Text.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/visualproperty/ProcessingVisualLexicon.java
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Z-Layer bug fixed.

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/DefaultVisualStyleBuilder.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/DefaultVisualStyleBuilder.java
   2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/DefaultVisualStyleBuilder.java
   2009-08-13 04:10:16 UTC (rev 17803)
@@ -1,5 +1,6 @@
 package org.cytoscape.view.presentation.processing.internal;
 
+import static 
org.cytoscape.view.presentation.property.ThreeDVisualLexicon.NODE_Z_LOCATION;
 import static org.cytoscape.view.presentation.property.TwoDVisualLexicon.*;
 import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_LABEL;
 import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NODE_OPACITY;
@@ -8,6 +9,7 @@
 
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.mappings.DiscreteMapping;
 import org.cytoscape.view.vizmap.mappings.PassthroughMapping;
 
 /**
@@ -29,7 +31,7 @@
        private static final Color DEF_EDGE_COLOR = new Color(0, 30, 250);
        private static final double DEF_EDGE_OPACITY = 150d;
 
-       private static final Color DEF_BACKGROUND_COLOR = new Color(255, 255, 
255);
+       private static final Color DEF_BACKGROUND_COLOR = new Color(200, 200, 
200);
 
        private VisualStyle style;
 
@@ -45,13 +47,22 @@
 
                final PassthroughMapping<String, String> labelMapping = new 
PassthroughMapping<String, String>(
                                NAME, String.class, NODE_LABEL);
+               
+               final DiscreteMapping<String, Double> randSize = new 
DiscreteMapping<String, Double>(
+                               NAME, String.class, NODE_X_SIZE);
+               
+               final DiscreteMapping<String, Double> location = new 
DiscreteMapping<String, Double>(
+                               NAME, String.class, NODE_Z_LOCATION);
+               
+               randSize.putMapValue("YMR043W", 100d);
+               location.putMapValue("YMR043W", 500d);
 
-               final PassthroughMapping<String, String> edgeLabelMapping = new 
PassthroughMapping<String, String>(
-                               NAME, String.class, EDGE_LABEL);
 
                style.addVisualMappingFunction(labelMapping);
-               style.addVisualMappingFunction(edgeLabelMapping);
-
+               style.addVisualMappingFunction(randSize);
+               style.addVisualMappingFunction(location);
+               
+               
                style.setDefaultValue(NODE_COLOR, DEF_NODE_COLOR);
                style.setDefaultValue(NODE_OPACITY, DEF_NODE_OPACITY);
 

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-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ProcessingNetworkRenderer.java
   2009-08-13 04:10:16 UTC (rev 17803)
@@ -1,9 +1,10 @@
 package org.cytoscape.view.presentation.processing.internal;
 
+import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NETWORK_BACKGROUND_COLOR;
+
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Image;
-import java.awt.Paint;
 import java.awt.event.MouseWheelEvent;
 import java.awt.event.MouseWheelListener;
 import java.awt.print.Printable;
@@ -11,9 +12,6 @@
 import java.util.Properties;
 
 import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCanvas;
-import javax.media.opengl.GLEventListener;
 import javax.swing.Icon;
 
 import org.cytoscape.model.CyEdge;
@@ -25,7 +23,6 @@
 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.Pickable;
 import 
org.cytoscape.view.presentation.processing.internal.particle.ParticleManager;
 import org.cytoscape.view.presentation.processing.internal.ui.Overlay;
 
@@ -34,14 +31,9 @@
 import processing.opengl.PGraphicsOpenGL;
 import toxi.geom.AABB;
 import toxi.geom.Vec3D;
-import toxi.physics.VerletParticle;
 import toxi.physics.VerletPhysics;
 
-import com.sun.opengl.util.FPSAnimator;
 
-import static 
org.cytoscape.view.presentation.property.TwoDVisualLexicon.NETWORK_BACKGROUND_COLOR;
-
-
 public class ProcessingNetworkRenderer extends PApplet implements
                RenderingEngine {
 
@@ -63,8 +55,6 @@
        private final P5NodeRenderer nodeRenderer;
        private final P5EdgeRenderer edgeRenderer;
 
-       private GLCanvas canvas;
-
        private Overlay overlay;
        
        private final PFont DEF_FONT = createFont("SansSerif", 20);
@@ -76,6 +66,7 @@
        
        // Control
        private boolean isOverlay = false;
+       private boolean freeze = false;
        
        // Network Visuals
        private Color bgColor;
@@ -99,6 +90,8 @@
                this.addMouseWheelListener(new MouseWheelListener() {
 
                        public void mouseWheelMoved(MouseWheelEvent e) {
+                               if(freeze) return;
+                               
                                zoom += e.getWheelRotation() * 100;
 
                        }
@@ -142,36 +135,12 @@
 
        
 
-       class GLRenderer implements GLEventListener {
-               GL gl;
-
-               public void init(GLAutoDrawable drawable) {
-                       this.gl = drawable.getGL();
-                       gl.glClearColor(1, 0, 0, 0);
-                       canvas.setLocation(100, 80);
-               }
-
-               public void display(GLAutoDrawable drawable) {
-                       gl.glClear(GL.GL_COLOR_BUFFER_BIT | 
GL.GL_DEPTH_BUFFER_BIT);
-                       gl.glColor3f(1, 1, 1);
-                       gl.glRectf(-0.8f, 0.8f, frameCount % 100 / 100f - 0.8f, 
0.7f);
-               }
-
-               public void reshape(GLAutoDrawable drawable, int x, int y, int 
width,
-                               int height) {
-               }
-
-               public void displayChanged(GLAutoDrawable drawable,
-                               boolean modeChanged, boolean deviceChanged) {
-               }
-       }
-
        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);
+               hint(ENABLE_OPENGL_4X_SMOOTH);
+               hint(ENABLE_NATIVE_FONTS);
                noStroke();
                frameRate(FRAME_RATE);
 
@@ -201,6 +170,7 @@
                overlay = new Overlay(this, 
view.getSource().attrs().get("name", String.class));
                
                System.out.println("%%%%%%%%%%%%% Setup DONE for P5");
+               
        }
 
        private void renderNetworkVisualProperties() {
@@ -214,18 +184,14 @@
 
        public void draw() {
                background(bgColor.getRed(), bgColor.getGreen(), 
bgColor.getGreen());
-               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);
-
+               
                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);
-
-               translate(width / 2, height / 2, height / 2);
+               
+//             translate(width / 2, height / 2, height / 2);
                rotateX(rotY);
                rotateY(rotX);
                translate(-width / 2 + translateX, -height / 2 + translateY,
@@ -240,6 +206,8 @@
 
                // particleManager.draw(gl);
 
+               
+               
                camera();
                beginGL();
                gl.glClear(javax.media.opengl.GL.GL_DEPTH_BUFFER_BIT);
@@ -264,6 +232,8 @@
        float translateY = 0;
 
        public void mouseDragged() {
+               if(freeze) return;
+               
                if (mouseButton == RIGHT) {
                        rotX += (mouseX - pmouseX) * 0.01;
                        rotY -= (mouseY - pmouseY) * 0.01;
@@ -290,6 +260,17 @@
          // if the key is between 'A'(65) and 'z'(122)
          if( key == 'o')
                  isOverlay = !isOverlay;
+         else if( key == 'f') {
+                 // freeze
+                 freeze = !freeze;
+                 if(freeze) {
+                         fill(100, 100, 100, 100);
+                         rect(0, 0, width, height);
+                         noLoop();
+                 } else
+                         loop();
+                 
+         }
            
        }
 

Modified: 
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/Cube.java
  2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Cube.java
  2009-08-13 04:10:16 UTC (rev 17803)
@@ -109,6 +109,8 @@
                this.y = 
viewModel.getVisualProperty(NODE_Y_LOCATION).floatValue();             
                this.z = 
viewModel.getVisualProperty(NODE_Z_LOCATION).floatValue();
                
+               System.out.println("Z location = " + this.z);
+               
                this.size = 
viewModel.getVisualProperty(NODE_X_SIZE).floatValue();
                if(size <= 0)
                        size = DEF_SIZE;

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Text.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Text.java
  2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/shape/Text.java
  2009-08-13 04:10:16 UTC (rev 17803)
@@ -25,43 +25,43 @@
 
 import processing.core.PApplet;
 import processing.core.PFont;
+import processing.core.PGraphics;
+import processing.core.PGraphics3D;
+import processing.core.PMatrix3D;
+import processing.opengl.PGraphicsOpenGL;
 import toxi.geom.Vec3D;
 
 public class Text extends Vec3D implements CyDrawable, Pickable {
 
-       
        private static final int DEF_SIZE = 20;
-       
+
        private static final int OFFSET = 10;
 
-       
        private boolean picked;
        private Set<Class<?>> compatibleDataType;
-       
+
        private final VisualLexicon lexicon;
-       
+
        private PApplet p;
-       
+
        private float size;
        private int r, g, b, alpha;
        private String text;
-       
+
        private float offsetX = 30;
        private float offsetY = 0;
        private float offsetZ = 0;
-       
+
        private PFont font;
-       
-       
+
        private Map<VisualProperty<?>, Object> fieldMap;
-       
+
        public Text(PApplet parent, VisualLexicon lexicon) {
                super();
                this.p = parent;
                this.lexicon = lexicon;
                this.picked = false;
-               
-               
+
                compatibleDataType = new HashSet<Class<?>>();
                compatibleDataType.add(CyNode.class);
                compatibleDataType.add(CyEdge.class);
@@ -71,16 +71,28 @@
                return compatibleDataType;
        }
 
-
        public Icon getIcon(int width, int height) {
                // TODO Implement icon renderer
                return null;
        }
 
        public void draw() {
-               
+
+//             PGraphicsOpenGL graphics = (PGraphicsOpenGL) p.g;
+//             PMatrix3D m_inv = graphics.camera;
+//
+//             p.pushMatrix();
+//             p.applyMatrix(
+//                             1, 0, 0, m_inv.m03, 
+//                             0, 1, 0, m_inv.m13, 
+//                             0, 0, 1, m_inv.m23, 
+//                             m_inv.m30, m_inv.m31, m_inv.m32, m_inv.m33);
+//
+
                p.fill(r, g, b, alpha);
-               p.text(text, x, y, z);
+               p.text(text, x,y, z);
+
+//             p.popMatrix();
        }
 
        public List<CyDrawable> getChildren() {
@@ -89,32 +101,37 @@
        }
 
        public void setContext(View<?> viewModel) {
-               
+
                this.text = viewModel.getVisualProperty(NODE_LABEL);
-               
+
                System.out.println("********************** Node Text = " + 
text);
-               
-               this.x = 
viewModel.getVisualProperty(NODE_X_LOCATION).floatValue() + offsetX;
-               this.y = 
viewModel.getVisualProperty(NODE_Y_LOCATION).floatValue() + offsetY;
-               this.z = 
viewModel.getVisualProperty(NODE_Z_LOCATION).floatValue() + offsetZ;
-               
+
+               this.x = 
viewModel.getVisualProperty(NODE_X_LOCATION).floatValue()
+                               + offsetX;
+               this.y = 
viewModel.getVisualProperty(NODE_Y_LOCATION).floatValue()
+                               + offsetY;
+               this.z = 
viewModel.getVisualProperty(NODE_Z_LOCATION).floatValue()
+                               + offsetZ;
+
+
                Paint color = viewModel.getVisualProperty(NODE_LABEL_COLOR);
-               if(color instanceof Color) {
-                       this.r = ((Color)color).getRed();
-                       this.g = ((Color)color).getGreen();
-                       this.b = ((Color)color).getBlue();
-                       //this.alpha = opacity.intValue();              
+               if (color instanceof Color) {
+                       this.r = ((Color) color).getRed();
+                       this.g = ((Color) color).getGreen();
+                       this.b = ((Color) color).getBlue();
+                       // this.alpha = opacity.intValue();
                        this.alpha = 100;
-               }       
+               }
        }
-       
+
        public void setContext(View<?> viewModel, VisualProperty<?> vp) {
                // If the VP is not in the context, ignore
-               if(lexicon.getAllVisualProperties().contains(vp) == false) 
return;
-               
+               if (lexicon.getAllVisualProperties().contains(vp) == false)
+                       return;
+
                // Extract value for the visual property
                Object value = viewModel.getVisualProperty(vp);
-               
+
        }
 
        public boolean isPicked() {
@@ -122,27 +139,26 @@
        }
 
        public void pick(float cx, float cy) {
-               
-               final float distance = PApplet.dist(cx, cy, p.screenX(this.x, 
this.y, this.z), p.screenY(x, y, z));
+
+               final float distance = PApplet.dist(cx, cy, p.screenX(this.x, 
this.y,
+                               this.z), p.screenY(x, y, z));
                System.out.println("Distance = " + distance);
-               if(distance < 200){
+               if (distance < 200) {
                        picked = true;
                        System.out.println("PICKED!!");
                        this.r = 0;
                        g = 250;
                        b = 0;
                        alpha = 255;
-                       System.out.println("Color of PICKED node" + g); 
+                       System.out.println("Color of PICKED node" + g);
                } else
                        picked = false;
-               
+
        }
 
        public void addChild(CyDrawable child) {
                // TODO Auto-generated method stub
-               
+
        }
 
-       
-
 }

Added: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ui/RoundRectWindow.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ui/RoundRectWindow.java
                          (rev 0)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/internal/ui/RoundRectWindow.java
  2009-08-13 04:10:16 UTC (rev 17803)
@@ -0,0 +1,6 @@
+package org.cytoscape.view.presentation.processing.internal.ui;
+
+public class RoundRectWindow {
+       
+
+}

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/visualproperty/ProcessingVisualLexicon.java
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/visualproperty/ProcessingVisualLexicon.java
       2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/java/org/cytoscape/view/presentation/processing/visualproperty/ProcessingVisualLexicon.java
       2009-08-13 04:10:16 UTC (rev 17803)
@@ -10,6 +10,7 @@
 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.internal.shape.Cube;
 import org.cytoscape.view.presentation.property.StringVisualProperty;
 import org.cytoscape.view.presentation.property.ThreeDVisualLexicon;
 
@@ -17,6 +18,8 @@
 
        private final Map<Class<? extends CyDrawable>, VisualLexicon> 
lexiconMap;
        
+       private static final Cube cube = new Cube(null, null);
+       
        public static final VisualProperty<? extends CyDrawable> NODE_STYLE = 
new CyDrawableVisualProperty(
                        NODE, null, "NODE_STYLE", "Node Style");
        public static final VisualProperty<? extends CyDrawable> EDGE_STYLE = 
new CyDrawableVisualProperty(
@@ -30,6 +33,7 @@
                super();
                this.visualPropertySet.add(NODE_STYLE);
                this.visualPropertySet.add(EDGE_STYLE);
+               this.visualPropertySet.add(NETWORK_BACKGROUND_IMAGE);
                
                lexiconMap = new HashMap<Class<? extends CyDrawable>, 
VisualLexicon>();
        }

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context-osgi.xml
 2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context-osgi.xml
 2009-08-13 04:10:16 UTC (rev 17803)
@@ -34,6 +34,12 @@
                        <entry key="id" value="processing" />
                </osgi:service-properties>
        </osgi:service>
+       
+       
+       <!-- Export this Lexicon -->
+       <osgi:service id="pVisualLexiconService" ref="pVisualLexicon"
+               interface="org.cytoscape.view.model.VisualLexicon">
+       </osgi:service>
 
 
 </beans>

Modified: 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context.xml
      2009-08-13 03:48:10 UTC (rev 17802)
+++ 
csplugins/trunk/soc/kozo/processing-renderer/processing-rendering-engine/src/main/resources/META-INF/spring/bundle-context.xml
      2009-08-13 04:10:16 UTC (rev 17803)
@@ -21,6 +21,8 @@
 
        <context:annotation-config />
 
+       <bean id="pVisualLexicon" 
class="org.cytoscape.view.presentation.processing.visualproperty.ProcessingVisualLexicon"
 />
+
        <bean id="createPresentationTaskFactory"
                
class="org.cytoscape.view.presentation.processing.internal.CreatePresentationTaskFactory">
                <constructor-arg ref="cyNetworkManagerServiceRef" />
@@ -30,7 +32,7 @@
        <bean id="processingPresentationFactory"
                
class="org.cytoscape.view.presentation.processing.internal.ProcessingPresentationFactory">
        </bean>
-       
+
        <bean id="visualStyleBuilder"
                
class="org.cytoscape.view.presentation.processing.internal.DefaultVisualStyleBuilder">
                <constructor-arg ref="visualMappingManagerServiceRef" />


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