in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / AptxUtil.java
index 9a87721..5d8c854 100644 (file)
@@ -122,15 +122,26 @@ public final class AptxUtil {
         return false;
     }
 
-    public static void writePhylogenyToGraphicsFileNonInteractive( final File intree,
-                                                                   final File outfile,
-                                                                   final int width,
-                                                                   final int height,
-                                                                   final GraphicsExportType type,
-                                                                   final Configuration config ) throws IOException {
+    public static void writePhylogenyToGraphicsFile( final File intree,
+                                                     final File outfile,
+                                                     final int width,
+                                                     final int height,
+                                                     final GraphicsExportType type,
+                                                     final Configuration config ) throws IOException {
         final PhylogenyParser parser = ParserUtils.createParserDependingOnFileType( intree, true );
         Phylogeny[] phys = null;
         phys = PhylogenyMethods.readPhylogenies( parser, intree );
+        writePhylogenyToGraphicsFile( phys[ 0 ], outfile, width, height, type, config );
+    }
+
+    public static void writePhylogenyToGraphicsFile( final Phylogeny phy,
+                                                     final File outfile,
+                                                     final int width,
+                                                     final int height,
+                                                     final GraphicsExportType type,
+                                                     final Configuration config ) throws IOException {
+        final Phylogeny[] phys = new Phylogeny[ 1 ];
+        phys[ 0 ] = phy;
         final MainFrameApplication mf = MainFrameApplication.createInstance( phys, config );
         AptxUtil.writePhylogenyToGraphicsFileNonInteractive( outfile, width, height, mf.getMainPanel()
                 .getCurrentTreePanel(), mf.getMainPanel().getControlPanel(), type, mf.getOptions() );
@@ -958,19 +969,10 @@ public final class AptxUtil {
         if ( outfile.isDirectory() ) {
             throw new IOException( "\"" + outfile + "\" is a directory" );
         }
-        //Rectangle visible = null;
         final BufferedImage buffered_img = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB );
         final Graphics2D g2d = buffered_img.createGraphics();
         g2d.setRenderingHints( rendering_hints );
-        final int x = 0;
-        final int y = 0;
-        //if ( options.isGraphicsExportVisibleOnly() ) {
-        //    g2d = ( Graphics2D ) g2d.create( -visible.x, -visible.y, visible.width, visible.height );
-        //    g2d.setClip( null );
-        //    x = visible.x;
-        //    y = visible.y;
-        //}
-        tree_panel.paintPhylogeny( g2d, false, true, width, height, x, y );
+        tree_panel.paintPhylogeny( g2d, false, true, width, height, 0, 0 );
         if ( type == GraphicsExportType.TIFF ) {
             writeToTiff( outfile, buffered_img );
         }