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.documentinterchange.taggedpdf;
\r
19 import org.apache.pdfbox.cos.COSArray;
\r
20 import org.apache.pdfbox.cos.COSDictionary;
\r
21 import org.apache.pdfbox.cos.COSName;
\r
22 import org.apache.pdfbox.pdmodel.common.PDRectangle;
\r
23 import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent;
\r
26 * An artifact marked content.
\r
28 * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
\r
29 * @version $Revision: $
\r
32 public class PDArtifactMarkedContent extends PDMarkedContent
\r
35 public PDArtifactMarkedContent(COSDictionary properties)
\r
37 super(COSName.ARTIFACT, properties);
\r
42 * Gets the type (Type).
\r
46 public String getType()
\r
48 return this.getProperties().getNameAsString(COSName.TYPE);
\r
52 * Gets the artifact's bounding box (BBox).
\r
54 * @return the artifact's bounding box
\r
56 public PDRectangle getBBox()
\r
58 PDRectangle retval = null;
\r
59 COSArray a = (COSArray) this.getProperties().getDictionaryObject(
\r
63 retval = new PDRectangle(a);
\r
69 * Is the artifact attached to the top edge?
\r
71 * @return <code>true</code> if the artifact is attached to the top edge,
\r
72 * <code>false</code> otherwise
\r
74 public boolean isTopAttached()
\r
76 return this.isAttached("Top");
\r
80 * Is the artifact attached to the bottom edge?
\r
82 * @return <code>true</code> if the artifact is attached to the bottom edge,
\r
83 * <code>false</code> otherwise
\r
85 public boolean isBottomAttached()
\r
87 return this.isAttached("Bottom");
\r
91 * Is the artifact attached to the left edge?
\r
93 * @return <code>true</code> if the artifact is attached to the left edge,
\r
94 * <code>false</code> otherwise
\r
96 public boolean isLeftAttached()
\r
98 return this.isAttached("Left");
\r
102 * Is the artifact attached to the right edge?
\r
104 * @return <code>true</code> if the artifact is attached to the right edge,
\r
105 * <code>false</code> otherwise
\r
107 public boolean isRightAttached()
\r
109 return this.isAttached("Right");
\r
113 * Gets the subtype (Subtype).
\r
115 * @return the subtype
\r
117 public String getSubtype()
\r
119 return this.getProperties().getNameAsString(COSName.SUBTYPE);
\r
124 * Is the artifact attached to the given edge?
\r
126 * @param edge the edge
\r
127 * @return <code>true</code> if the artifact is attached to the given edge,
\r
128 * <code>false</code> otherwise
\r
130 private boolean isAttached(String edge)
\r
132 COSArray a = (COSArray) this.getProperties().getDictionaryObject(
\r
136 for (int i = 0; i < a.size(); i++)
\r
138 if (edge.equals(a.getName(i)))
\r