pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1671193 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
Date Fri, 03 Apr 2015 22:38:40 GMT
Author: tilman
Date: Fri Apr  3 22:38:40 2015
New Revision: 1671193

URL: http://svn.apache.org/r1671193
Log:
PDFBOX-2745: zoom value is a float; fix javadoc (-1 and 0 mean the same)

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java?rev=1671193&r1=1671192&r2=1671193&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
Fri Apr  3 22:38:40 2015
@@ -18,6 +18,8 @@ package org.apache.pdfbox.pdmodel.intera
 
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSFloat;
+import org.apache.pdfbox.cos.COSNumber;
 
 /**
  * This represents a destination to a page at an x,y coordinate with a zoom setting.
@@ -43,7 +45,6 @@ public class PDPageXYZDestination extend
         super();
         array.growToSize(5);
         array.setName( 1, TYPE );
-
     }
 
     /**
@@ -57,7 +58,7 @@ public class PDPageXYZDestination extend
     }
 
     /**
-     * Get the left x coordinate.  A return value of -1 implies that the current x-coordinate
+     * Get the left x coordinate.  Return values of 0 or -1 imply that the current x-coordinate
      * will be used.
      *
      * @return The left x coordinate.
@@ -68,7 +69,7 @@ public class PDPageXYZDestination extend
     }
 
     /**
-     * Set the left x-coordinate, a value of -1 implies that the current x-coordinate
+     * Set the left x-coordinate, values 0 or -1 imply that the current x-coordinate
      * will be used.
      * @param x The left x coordinate.
      */
@@ -86,7 +87,7 @@ public class PDPageXYZDestination extend
     }
 
     /**
-     * Get the top y coordinate.  A return value of -1 implies that the current y-coordinate
+     * Get the top y coordinate.  Return values of 0 or -1 imply that the current y-coordinate
      * will be used.
      *
      * @return The top y coordinate.
@@ -97,7 +98,7 @@ public class PDPageXYZDestination extend
     }
 
     /**
-     * Set the top y-coordinate, a value of -1 implies that the current y-coordinate
+     * Set the top y-coordinate, values 0 or -1 imply that the current y-coordinate
      * will be used.
      * @param y The top ycoordinate.
      */
@@ -115,22 +116,27 @@ public class PDPageXYZDestination extend
     }
 
     /**
-     * Get the zoom value.  A return value of -1 implies that the current zoom
+     * Get the zoom value.  Return values of 0 or -1 imply that the current zoom
      * will be used.
      *
      * @return The zoom value for the page.
      */
-    public int getZoom()
+    public float getZoom()
     {
-        return array.getInt( 4 );
+        COSBase obj = array.getObject(4);
+        if (obj instanceof COSNumber)
+        {
+            return ((COSNumber) obj).floatValue();
+        }
+        return -1;
     }
 
     /**
-     * Set the zoom value for the page, a value of -1 implies that the current zoom
+     * Set the zoom value for the page, values 0 or -1 imply that the current zoom
      * will be used.
      * @param zoom The zoom value.
      */
-    public void setZoom( int zoom )
+    public void setZoom( float zoom )
     {
         array.growToSize( 5 );
         if( zoom == -1 )
@@ -139,7 +145,7 @@ public class PDPageXYZDestination extend
         }
         else
         {
-            array.setInt( 4, zoom );
+            array.set( 4, new COSFloat(zoom) );
         }
     }
 }



Mime
View raw message