Author: paperwing
Date: 2012-03-20 09:00:50 -0700 (Tue, 20 Mar 2012)
New Revision: 28593

Added:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/CameraCytoscapeDataSubprocessor.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithm.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java
Modified:
   csplugins/trunk/toronto/yuedong/paperwing-impl/pom.xml
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/LightingCytoscapeDataSubprocessor.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
Log:
Updated drawing algorithm for cubic node shapes, added first draft of spherical 
layout algorithm implementing the AbstractLayoutAlgorithm interface

Modified: csplugins/trunk/toronto/yuedong/paperwing-impl/pom.xml
===================================================================
--- csplugins/trunk/toronto/yuedong/paperwing-impl/pom.xml      2012-03-20 
14:09:25 UTC (rev 28592)
+++ csplugins/trunk/toronto/yuedong/paperwing-impl/pom.xml      2012-03-20 
16:00:50 UTC (rev 28593)
@@ -57,6 +57,11 @@
                        <version>${cytoscape.version}</version>
                </dependency>
                
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>layout-api</artifactId>
+                </dependency>
+               
                <!-- Dependencies used for context menus -->
                <dependency>
                        <groupId>org.cytoscape</groupId>

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
      2012-03-20 14:09:25 UTC (rev 28592)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/CyActivator.java
      2012-03-20 16:00:50 UTC (rev 28593)
@@ -3,12 +3,14 @@
 import java.util.Properties;
 
 import org.cytoscape.paperwing.internal.cytoscape.view.WindNetworkViewFactory;
+import org.cytoscape.paperwing.internal.layouts.SphericalLayoutAlgorithm;
 import org.cytoscape.paperwing.internal.task.TaskFactoryListener;
 import org.cytoscape.service.util.AbstractCyActivator;
 import org.cytoscape.service.util.CyServiceRegistrar;
 import org.cytoscape.task.EdgeViewTaskFactory;
 import org.cytoscape.task.NetworkViewTaskFactory;
 import org.cytoscape.task.NodeViewTaskFactory;
+import org.cytoscape.view.layout.CyLayoutAlgorithm;
 import org.cytoscape.view.model.CyNetworkViewFactory;
 import org.cytoscape.view.model.CyNetworkViewManager;
 import org.cytoscape.view.model.VisualLexicon;
@@ -19,6 +21,7 @@
 import org.cytoscape.work.TaskManager;
 import org.cytoscape.work.swing.DialogTaskManager;
 import org.cytoscape.work.swing.SubmenuTaskManager;
+import org.cytoscape.work.undo.UndoSupport;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -97,6 +100,15 @@
                                windBirdsEyeRenderingEngineFactoryProps);
 
                
+               UndoSupport undoSupportServiceRef = getService(bc, 
UndoSupport.class);
                
+               SphericalLayoutAlgorithm sphericalLayoutAlgorithm = new 
SphericalLayoutAlgorithm(undoSupportServiceRef);
+               Properties sphericalLayoutAlgorithmProps = new Properties();
+               
sphericalLayoutAlgorithmProps.setProperty("preferredMenu","Layout.3D Layouts");
+               
sphericalLayoutAlgorithmProps.setProperty("preferredTaskManager","menu");
+               
sphericalLayoutAlgorithmProps.setProperty("title",sphericalLayoutAlgorithm.toString());
+               sphericalLayoutAlgorithmProps.setProperty("menuGravity","10.2");
+               
+               registerService(bc,sphericalLayoutAlgorithm, 
CyLayoutAlgorithm.class, sphericalLayoutAlgorithmProps);
        }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
        2012-03-20 14:09:25 UTC (rev 28592)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
        2012-03-20 16:00:50 UTC (rev 28593)
@@ -85,13 +85,13 @@
        // =======================
        
        public static final VisualProperty<Double> LIGHT_X_LOCATION = new 
DoubleVisualProperty(
-                       1.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_X_LOCATION", "Light 
X Location", CyNetwork.class);
+                       200.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_X_LOCATION", 
"Light X Location", CyNetwork.class);
        
        public static final VisualProperty<Double> LIGHT_Y_LOCATION = new 
DoubleVisualProperty(
-                       1.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_Y_LOCATION", "Light 
Y Location", CyNetwork.class);
+                       0.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_Y_LOCATION", "Light 
Y Location", CyNetwork.class);
        
        public static final VisualProperty<Double> LIGHT_Z_LOCATION = new 
DoubleVisualProperty(
-                       2.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_Z_LOCATION", "Light 
Z Location", CyNetwork.class);
+                       400.0, ARBITRARY_DOUBLE_RANGE, "LIGHT_Z_LOCATION", 
"Light Z Location", CyNetwork.class);
        
        public static final VisualProperty<Boolean> LIGHT_ENABLED = new 
BooleanVisualProperty(
                        true, "LIGHT_ENABLED", "Light Enabled", 
CyNetwork.class);

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/CameraCytoscapeDataSubprocessor.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/CameraCytoscapeDataSubprocessor.java
                             (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/CameraCytoscapeDataSubprocessor.java
     2012-03-20 16:00:50 UTC (rev 28593)
@@ -0,0 +1,15 @@
+package org.cytoscape.paperwing.internal.cytoscape.processing;
+
+import org.cytoscape.paperwing.internal.data.GraphicsData;
+
+public class CameraCytoscapeDataSubprocessor implements
+               CytoscapeDataSubprocessor {
+
+       @Override
+       public void processCytoscapeData(GraphicsData graphicsData) {
+               // TODO Auto-generated method stub
+
+       }
+
+       
+}


Property changes on: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/CameraCytoscapeDataSubprocessor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/LightingCytoscapeDataSubprocessor.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/LightingCytoscapeDataSubprocessor.java
   2012-03-20 14:09:25 UTC (rev 28592)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/processing/LightingCytoscapeDataSubprocessor.java
   2012-03-20 16:00:50 UTC (rev 28593)
@@ -56,9 +56,9 @@
                                (float) specularAlpha);
                
                // Transfer position properties
-               
light.setPosition(networkView.getVisualProperty(WindVisualLexicon.LIGHT_X_LOCATION).floatValue(),
 
-                               
networkView.getVisualProperty(WindVisualLexicon.LIGHT_Y_LOCATION).floatValue(), 
-                               
networkView.getVisualProperty(WindVisualLexicon.LIGHT_Z_LOCATION).floatValue(), 
+               
light.setPosition(networkView.getVisualProperty(WindVisualLexicon.LIGHT_X_LOCATION).floatValue()
 / graphicsData.getDistanceScale(),
+                               
networkView.getVisualProperty(WindVisualLexicon.LIGHT_Y_LOCATION).floatValue() 
/ graphicsData.getDistanceScale(), 
+                               
networkView.getVisualProperty(WindVisualLexicon.LIGHT_Z_LOCATION).floatValue() 
/ graphicsData.getDistanceScale(), 
                                1.0f);
                
                // Transfer remaining properties

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithm.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithm.java
                         (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithm.java
 2012-03-20 16:00:50 UTC (rev 28593)
@@ -0,0 +1,21 @@
+package org.cytoscape.paperwing.internal.layouts;
+
+import org.cytoscape.view.layout.AbstractLayoutAlgorithm;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.undo.UndoSupport;
+
+public class SphericalLayoutAlgorithm extends AbstractLayoutAlgorithm {
+
+       public SphericalLayoutAlgorithm(UndoSupport undo) {
+               
+               super(undo, "spherical", "Spherical Layout", false);
+       }
+       
+       @Override
+       public TaskIterator createTaskIterator() {
+               return new TaskIterator(
+                               new SphericalLayoutAlgorithmTask(
+                                               networkView, getName(), 
selectedOnly, staticNodes));
+       }
+       
+}


Property changes on: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithm.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java
                             (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java
     2012-03-20 16:00:50 UTC (rev 28593)
@@ -0,0 +1,49 @@
+package org.cytoscape.paperwing.internal.layouts;
+
+import java.util.Set;
+
+import org.cytoscape.model.CyNode;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.presentation.property.BasicVisualLexicon;
+import org.cytoscape.work.TaskMonitor;
+
+public class SphericalLayoutAlgorithmTask extends AbstractBasicLayoutTask {
+
+       public SphericalLayoutAlgorithmTask(CyNetworkView networkView, String 
name,
+                       boolean selectedOnly, Set<View<CyNode>> staticNodes) {
+               super(networkView, name, selectedOnly, staticNodes);
+       }
+
+       @Override
+       protected void doLayout(TaskMonitor taskMonitor) {
+
+               taskMonitor.setProgress(0.2);
+               
+               int nodeCount = networkView.getNodeViews().size();
+               int current = 0;
+               
+               double sphereRadius = 500 + Math.sqrt(nodeCount);
+               double x, y, z;
+               
+               for (View<CyNode> nodeView : networkView.getNodeViews()) {
+                       x = Math.cos((double) current / nodeCount * Math.PI * 
2);
+                       y = Math.sin((double) current / nodeCount * Math.PI * 
2);
+                       z = -Math.sin((double) current / nodeCount * Math.PI * 
2);
+                       
+                       x *= sphereRadius;
+                       y *= sphereRadius;
+                       z *= sphereRadius;
+                       
+                       
nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
+                       
nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);
+                       
nodeView.setVisualProperty(BasicVisualLexicon.NODE_Z_LOCATION, z);      
+                       
+                       current++;
+               }
+               
+               taskMonitor.setProgress(0.8);
+       }
+
+}


Property changes on: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
     2012-03-20 14:09:25 UTC (rev 28592)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
     2012-03-20 16:00:50 UTC (rev 28593)
@@ -18,6 +18,7 @@
        public static enum ShapeType {
                SHAPE_SPHERE,
                SHAPE_CUBE, 
+               SHAPE_CUBE_SLICED_CORNERS,
                SHAPE_TETRAHEDRON,
                SHAPE_CONE,
                SHAPE_CYLINDER,
@@ -33,6 +34,7 @@
        public void initialize(GL2 gl) {
                initializeSphere(gl);
                initializeCube(gl);
+               initializeCubeSlicedCorners(gl);
                initializeTetrahedron(gl);
        }
        
@@ -58,12 +60,40 @@
        private void initializeCube(GL2 gl) {
                int shapeListIndex = gl.glGenLists(1);
 
+               GLU glu = GLU.createGLU(gl);
+               
+               GLUquadric quadric = glu.gluNewQuadric();
+               glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
+               glu.gluQuadricNormals(quadric, GLU.GLU_SMOOTH);
+               
                float halfLength = (float) (1.0 / Math.sqrt(2) / 2);
                
                gl.glNewList(shapeListIndex, GL2.GL_COMPILE);
                // gl.glBegin(GL2.GL_TRIANGLE_STRIP);
                
                gl.glPushMatrix();
+               //gl.glScalef(halfLength, halfLength, halfLength);
+               gl.glTranslatef(0.0f, 0.0f, -0.5f);
+               
+               glu.gluCylinder(quadric, 1.0, 1.0, 1.0, 4, 1);
+               
+               gl.glPopMatrix();
+               
+               gl.glEndList();
+               
+               shapeLists.put(ShapeType.SHAPE_CUBE, shapeListIndex);
+       }
+       
+       // Cube inscribed in a radius 0.5 sphere
+       private void initializeCubeSlicedCorners(GL2 gl) {
+               int shapeListIndex = gl.glGenLists(1);
+
+               float halfLength = (float) (1.0 / Math.sqrt(2) / 2);
+               
+               gl.glNewList(shapeListIndex, GL2.GL_COMPILE);
+               // gl.glBegin(GL2.GL_TRIANGLE_STRIP);
+               
+               gl.glPushMatrix();
                gl.glScalef(halfLength, halfLength, halfLength);
                
                gl.glBegin(GL2.GL_QUADS);

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