From: Charles Ofoegbu Date: Mon, 17 Nov 2014 10:01:53 +0000 (+0000) Subject: comand line support for svg generation X-Git-Tag: Jalview_2_9~151 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=36c3d72e0344f1aaa2137dca8eba829e7395f05a;p=jalview.git comand line support for svg generation --- diff --git a/.classpath b/.classpath index 801980d..26cfdb0 100644 --- a/.classpath +++ b/.classpath @@ -55,5 +55,6 @@ + diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 046d132..184c267 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,8 +20,11 @@ */ package jalview.bin; -import java.awt.FlowLayout; -import java.awt.Frame; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.util.MessageManager; +import jalview.util.Platform; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; @@ -39,13 +42,11 @@ import java.security.CodeSource; import java.security.PermissionCollection; import java.security.Permissions; import java.security.Policy; -import java.util.*; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; -import javax.swing.*; - -import jalview.gui.*; -import jalview.util.MessageManager; -import jalview.util.Platform; +import javax.swing.UIManager; /** * Main class for Jalview Application
@@ -451,6 +452,7 @@ public class Jalview { FeatureFetcher ff = startFeatureFetching(getFeatures); if (ff != null) + { while (!ff.allFinished() || af.operationInProgress()) { // wait around until fetching is finished. @@ -462,6 +464,7 @@ public class Jalview } } + } getFeatures = null; // have retrieved features - forget them now. } if (groovyscript != null) @@ -495,6 +498,14 @@ public class Jalview System.out.println("Creating PNG image: " + file); continue; } + else if (format.equalsIgnoreCase("svg")) + { + File imageFile = new java.io.File(file); + imageName = imageFile.getName(); + af.createSVG(imageFile); + System.out.println("Creating SVG image: " + file); + continue; + } else if (format.equalsIgnoreCase("imgMap")) { af.createImageMap(new java.io.File(file), imageName); diff --git a/src/jalview/io/HtmlFile.java b/src/jalview/io/HtmlFile.java index 77da038..3cb7c3f 100644 --- a/src/jalview/io/HtmlFile.java +++ b/src/jalview/io/HtmlFile.java @@ -70,10 +70,13 @@ public class HtmlFile extends AlignFile JSONObject sequence = sequenceIter.next(); String sequcenceString = sequence.get("seq").toString(); Sequence seq = new Sequence(sequence.get("name").toString(), - sequcenceString, 0, sequcenceString.length()); + sequcenceString, Integer.valueOf(sequence.get("start") + .toString()), Integer.valueOf(sequence.get("end") + .toString())); JSONArray jsonSeqArray = (JSONArray) sequence.get("features"); - SequenceFeature[] retrievedSeqFeatures = getJalviewSequenceFeatures(jsonSeqArray); + SequenceFeature[] retrievedSeqFeatures = getJalviewSequenceFeatures( + jsonSeqArray, seq); if (retrievedSeqFeatures != null) { seq.setSequenceFeatures(retrievedSeqFeatures); @@ -88,7 +91,7 @@ public class HtmlFile extends AlignFile } public SequenceFeature[] getJalviewSequenceFeatures( - JSONArray jsonSeqFeatures) + JSONArray jsonSeqFeatures, Sequence seq) { SequenceFeature[] seqFeatures = null; int count = 0; @@ -105,11 +108,10 @@ public class HtmlFile extends AlignFile Long begin = (Long) jsonFeature.get("xStart"); Long end = (Long) jsonFeature.get("xEnd"); String type = (String) jsonFeature.get("text"); - // String color = (String) jsonFeature.get("fillColor"); - sequenceFeature.setBegin(begin.intValue()); - sequenceFeature.setEnd(end.intValue()); + sequenceFeature.setBegin(seq.findPosition(begin.intValue())); + sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1); sequenceFeature.setType(type); seqFeatures[count++] = sequenceFeature; }