Author: mes
Date: 2012-03-08 14:08:19 -0800 (Thu, 08 Mar 2012)
New Revision: 28455

Added:
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/pom.xml
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/
   csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/
   
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/
   
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/
   
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/CyActivator.java
   
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTask.java
   
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTaskFactory.java
Log:
initial checkin

Added: csplugins/trunk/ucsd/mes/edge_bundling_gdeb/pom.xml
===================================================================
--- csplugins/trunk/ucsd/mes/edge_bundling_gdeb/pom.xml                         
(rev 0)
+++ csplugins/trunk/ucsd/mes/edge_bundling_gdeb/pom.xml 2012-03-08 22:08:19 UTC 
(rev 28455)
@@ -0,0 +1,94 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+       <properties>
+               <bundle.symbolicName>edge-bundler</bundle.symbolicName>
+               
<bundle.namespace>org.cytoscape.edge.bundler.internal</bundle.namespace>
+               
<cytoscape.api.version>3.0.0-alpha8-SNAPSHOT</cytoscape.api.version>
+               
+               <maven-bundle-plugin.version>2.3.4</maven-bundle-plugin.version>
+               <osgi.api.version>4.2.0</osgi.api.version>
+       </properties>
+
+       <groupId>org.cytoscape</groupId>
+       <artifactId>edge-bundler</artifactId>
+       <packaging>bundle</packaging>
+       <name>${bundle.symbolicName}</name>
+
+       <version>1.0.0-SNAPSHOT</version>
+  
+       <repositories>
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
+               </repository>
+       </repositories>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               
<version>${maven-bundle-plugin.version}</version>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+                                               
<Bundle-Version>${project.version}</Bundle-Version>
+                                               
<Export-Package>!${bundle.namespace}.*</Export-Package>
+                                               
<Private-Package>${bundle.namespace}.*</Private-Package>
+                                               
<Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+  
+       <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>application-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>work-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>core-task-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>service-api</artifactId>
+                       <version>${cytoscape.api.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>${osgi.api.version}</version>
+               </dependency>
+               
+    </dependencies>
+  
+</project>

Added: 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/CyActivator.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/CyActivator.java
                              (rev 0)
+++ 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/CyActivator.java
      2012-03-08 22:08:19 UTC (rev 28455)
@@ -0,0 +1,25 @@
+package org.cytoscape.edge.bundler.internal;
+
+import org.cytoscape.task.NetworkViewTaskFactory;
+import org.cytoscape.service.util.AbstractCyActivator;
+import java.util.Properties;
+import org.osgi.framework.BundleContext;
+
+
+public class CyActivator extends AbstractCyActivator {
+       public CyActivator() {
+               super();
+       }
+
+       public void start(BundleContext bc) {
+
+               EdgeBundlerTaskFactory edgeBundlerTaskFactory = new 
EdgeBundlerTaskFactory();
+               
+               Properties edgeBundlerTaskFactoryProps = new Properties();
+               
edgeBundlerTaskFactoryProps.setProperty("preferredMenu","Layout");
+               edgeBundlerTaskFactoryProps.setProperty("menuGravity","11.0");
+               edgeBundlerTaskFactoryProps.setProperty("title","Bundle Edges");
+               
registerService(bc,edgeBundlerTaskFactory,NetworkViewTaskFactory.class, 
edgeBundlerTaskFactoryProps);
+       }
+}
+

Added: 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTask.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTask.java
                          (rev 0)
+++ 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTask.java
  2012-03-08 22:08:19 UTC (rev 28455)
@@ -0,0 +1,88 @@
+package org.cytoscape.edge.bundler.internal;
+
+import org.cytoscape.task.AbstractNetworkViewTask;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.work.TaskMonitor;
+
+
+public class EdgeBundlerTask extends AbstractNetworkViewTask {
+
+       @Tunable(description="value of K")
+       public double K;
+
+       EdgeBundlerTask(CyNetworkView v) {
+               super(v);
+       }
+
+       public void run(TaskMonitor tm) {
+                       
+       }
+
+       private double force(CyEdge p, List<CyEdge> allEdges) {
+       }
+
+       private double compatibility(View<CyEdge> p, View<CyEdge> q) {
+               return (angleCompat(p,q) * scaleCompat(p,q) * 
positionCompat(p,q) * visibilityCompat(p,q));
+       }
+
+       private double angleCompat(View<CyEdge> p, View<CyEdge> q) {
+               View<CyNode> pSource = view.getNodeView(p.getSource());
+               View<CyNode> pTarget = view.getNodeView(p.getSource());
+
+               View<CyNode> qSource = view.getNodeView(q.getSource());
+               View<CyNode> qTarget = view.getNodeView(q.getSource());
+
+               double psx = pSource.getVisualProperty(NODE_X_LOCATION);
+               double psy = pSource.getVisualProperty(NODE_Y_LOCATION);
+               double ptx = pTarget.getVisualProperty(NODE_X_LOCATION);
+               double pty = pTarget.getVisualProperty(NODE_Y_LOCATION);
+               double a = ptx - psx;
+               double b = pty - psy;
+
+               double qsx = qSource.getVisualProperty(NODE_X_LOCATION);
+               double qsy = qSource.getVisualProperty(NODE_Y_LOCATION);
+               double qtx = qTarget.getVisualProperty(NODE_X_LOCATION);
+               double qty = qTarget.getVisualProperty(NODE_Y_LOCATION);
+               double c = qtx - qsx;
+               double d = qty - qsy;
+
+               double cosAlpha = ((a*c) + (b*d))/(Math.sqrt(a*a + 
b*b)*Math.sqrt(c*c + d*d));
+
+               return Math.round(cosAlpha);
+       }
+
+       private double scaleCompat(View<CyEdge> p, View<CyEdge> q) {
+               double lavg = (len(p) + len(q))/2.0;
+               return 2.0/((lavg*Math.min(len(p),len(q))) + 
(Math.max(len(p),len(q))/lavg));
+       }
+
+       private double positionCompat(View<CyEdge> p, View<CyEdge> q) {
+               double lavg = (len(p) + len(q))/2.0;
+
+               return lavg / (lavg + normMinus( mid(p),mid(q) )); 
+       }
+
+       private Point2D.Double mid(View<CyEdge> p) {
+               View<CyNode> pSource = view.getNodeView(p.getSource());
+               View<CyNode> pTarget = view.getNodeView(p.getSource());
+               double psx = pSource.getVisualProperty(NODE_X_LOCATION);
+               double psy = pSource.getVisualProperty(NODE_Y_LOCATION);
+               double ptx = pTarget.getVisualProperty(NODE_X_LOCATION);
+               double pty = pTarget.getVisualProperty(NODE_Y_LOCATION);
+               return new Point2D.Double((psx-ptx)/2.0,(psy-pty)/2.0);
+       }
+
+       private double normMinus(Point2D.Double p, Point2D.Double q) {
+               double x = p.getX() - q.getX()
+               double y = p.getY() - q.getY()
+               return Math.sqrt(x*x + y*y);
+       }
+
+       private double visibilityCompat(View<CyEdge> p, View<CyEdge> q) {
+               return Math.min(vis(p,q), vis(q,p));
+       }
+
+       private double vis(View<CyEdge> p, View<CyEdge> q) {
+               return Math.max(1.0 - 
+       }
+}

Added: 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTaskFactory.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTaskFactory.java
                           (rev 0)
+++ 
csplugins/trunk/ucsd/mes/edge_bundling_gdeb/src/main/java/org/cytoscape/edge/bundler/internal/EdgeBundlerTaskFactory.java
   2012-03-08 22:08:19 UTC (rev 28455)
@@ -0,0 +1,16 @@
+package org.cytoscape.edge.bundler.internal;
+
+import org.cytoscape.task.AbstractNetworkViewTaskFactory;
+import org.cytoscape.work.TaskIterator;
+
+
+public class EdgeBundlerTaskFactory extends AbstractNetworkViewTaskFactory {
+
+       public EdgeBundlerTaskFactory() {
+               super();
+       }
+       
+       public TaskIterator createTaskIterator() {
+               return new TaskIterator(new EdgeBundlerTask(view));
+       }
+}

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