2 * Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 * contributor license agreements. See the NOTICE file distributed with
\r
4 * this work for additional information regarding copyright ownership.
\r
5 * The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 * (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 package org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination;
\r
19 import org.apache.pdfbox.cos.COSArray;
\r
20 import org.apache.pdfbox.cos.COSBase;
\r
23 * This represents a destination to a page at an x,y coordinate with a zoom setting.
\r
24 * The default x,y,z will be whatever is the current value in the viewer application and
\r
27 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
\r
28 * @version $Revision: 1.2 $
\r
30 public class PDPageXYZDestination extends PDPageDestination
\r
33 * The type of this destination.
\r
35 protected static final String TYPE = "XYZ";
\r
38 * Default constructor.
\r
41 public PDPageXYZDestination()
\r
44 array.growToSize(5);
\r
45 array.setName( 1, TYPE );
\r
50 * Constructor from an existing destination array.
\r
52 * @param arr The destination array.
\r
54 public PDPageXYZDestination( COSArray arr )
\r
60 * Get the left x coordinate. A return value of -1 implies that the current x-coordinate
\r
63 * @return The left x coordinate.
\r
65 public int getLeft()
\r
67 return array.getInt( 2 );
\r
71 * Set the left x-coordinate, a value of -1 implies that the current x-coordinate
\r
73 * @param x The left x coordinate.
\r
75 public void setLeft( int x )
\r
77 array.growToSize( 3 );
\r
80 array.set( 2, (COSBase)null );
\r
84 array.setInt( 2, x );
\r
89 * Get the top y coordinate. A return value of -1 implies that the current y-coordinate
\r
92 * @return The top y coordinate.
\r
96 return array.getInt( 3 );
\r
100 * Set the top y-coordinate, a value of -1 implies that the current y-coordinate
\r
102 * @param y The top ycoordinate.
\r
104 public void setTop( int y )
\r
106 array.growToSize( 4 );
\r
109 array.set( 3, (COSBase)null );
\r
113 array.setInt( 3, y );
\r
118 * Get the zoom value. A return value of -1 implies that the current zoom
\r
121 * @return The zoom value for the page.
\r
123 public int getZoom()
\r
125 return array.getInt( 4 );
\r
129 * Set the zoom value for the page, a value of -1 implies that the current zoom
\r
131 * @param zoom The zoom value.
\r
133 public void setZoom( int zoom )
\r
135 array.growToSize( 5 );
\r
138 array.set( 4, (COSBase)null );
\r
142 array.setInt( 4, zoom );
\r