Skip to content

Commit 6b4a548

Browse files
committed
Cover Pdf3DAnnotation with javadocs
DEVSIX-5333
1 parent 4bb78bd commit 6b4a548

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/annot/Pdf3DAnnotation.java

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,53 +50,139 @@ This file is part of the iText (R) project.
5050
import com.itextpdf.kernel.pdf.PdfName;
5151
import com.itextpdf.kernel.pdf.PdfObject;
5252

53-
53+
/**
54+
* This class represents 3D annotations by which 3D artwork shall be represented in a PDF document.
55+
* See also ISO-32000-2 13.6.2 "3D annotations".
56+
*/
5457
public class Pdf3DAnnotation extends PdfAnnotation {
5558

5659
private static final long serialVersionUID = 3823509772499230844L;
5760

61+
/**
62+
* Creates a {@link Pdf3DAnnotation} instance.
63+
*
64+
* @param rect the annotation rectangle, defining the location of the annotation on the page
65+
* in default user space units. See {@link PdfAnnotation#setRectangle(PdfArray)}.
66+
* @param artwork 3D artwork which is represented by the annotation
67+
*/
5868
public Pdf3DAnnotation(Rectangle rect, PdfObject artwork) {
5969
super(rect);
6070
put(PdfName._3DD, artwork);
6171
}
6272

73+
/**
74+
* Instantiates a new {@link Pdf3DAnnotation} instance based on {@link PdfDictionary}
75+
* instance, that represents existing annotation object in the document.
76+
*
77+
* @param pdfObject the {@link PdfDictionary} representing annotation object
78+
* @see PdfAnnotation#makeAnnotation(PdfObject)
79+
*/
6380
public Pdf3DAnnotation(PdfDictionary pdfObject) {
6481
super(pdfObject);
6582
}
6683

84+
/**
85+
* {@inheritDoc}
86+
*/
6787
@Override
6888
public PdfName getSubtype() {
6989
return PdfName._3D;
7090
}
7191

92+
/**
93+
* Sets the default initial view of the 3D artwork that shall be used when the annotation is activated.
94+
*
95+
* @param initialView the default initial view of the 3D artwork that shall be used
96+
* when the annotation is activated
97+
* @return this {@link Pdf3DAnnotation} instance
98+
*/
7299
public Pdf3DAnnotation setDefaultInitialView(PdfObject initialView) {
73100
return (Pdf3DAnnotation) put(PdfName._3DV, initialView);
74101
}
75102

103+
/**
104+
* Gets the default initial view of the 3D artwork that shall be used when the annotation is activated.
105+
*
106+
* @return the default initial view of the 3D artwork that shall be used when the annotation is activated
107+
*/
76108
public PdfObject getDefaultInitialView() {
77109
return getPdfObject().get(PdfName._3DV);
78110
}
79111

112+
/**
113+
* Sets the activation dictionary that defines the times at which the annotation shall be
114+
* activated and deactivated and the state of the 3D artwork instance at those times.
115+
*
116+
* @param activationDictionary dictionary that defines the times at which the annotation
117+
* shall be activated and deactivated and the state of the 3D artwork
118+
* instance at those times.
119+
* @return this {@link Pdf3DAnnotation} instance
120+
*/
80121
public Pdf3DAnnotation setActivationDictionary(PdfDictionary activationDictionary) {
81122
return (Pdf3DAnnotation) put(PdfName._3DA, activationDictionary);
82123
}
83124

125+
/**
126+
* Gets the activation dictionary that defines the times at which the annotation shall be
127+
* activated and deactivated and the state of the 3D artwork instance at those times.
128+
*
129+
* @return the activation dictionary that defines the times at which the annotation shall be
130+
* activated and deactivated and the state of the 3D artwork instance at those times.
131+
*/
84132
public PdfDictionary getActivationDictionary() {
85133
return getPdfObject().getAsDictionary(PdfName._3DA);
86134
}
87135

136+
/**
137+
* Sets the primary use of the 3D annotation.
138+
*
139+
* <p>
140+
* If true, it is intended to be interactive; if false, it is intended to be manipulated programmatically,
141+
* as with an ECMAScript animation. Interactive PDF processors may present different user interface controls
142+
* for interactive 3D annotations (for example, to rotate, pan, or zoom the artwork) than for those
143+
* managed by a script or other mechanism.
144+
*
145+
* <p>
146+
* Default value: true.
147+
*
148+
* @param interactive if true, it is intended to be interactive; if false, it is intended to be
149+
* manipulated programmatically
150+
* @return this {@link Pdf3DAnnotation} instance
151+
*/
88152
public Pdf3DAnnotation setInteractive(boolean interactive) {
89153
return (Pdf3DAnnotation) put(PdfName._3DI, PdfBoolean.valueOf(interactive));
90154
}
91155

156+
/**
157+
* Indicates whether the 3D annotation is intended to be interactive or not.
158+
*
159+
* @return whether the 3D annotation is intended to be interactive or not
160+
*/
92161
public PdfBoolean isInteractive() {
93162
return getPdfObject().getAsBoolean(PdfName._3DI);
94163
}
95164

165+
/**
166+
* Sets the 3D view box, which is the rectangular area in which the 3D artwork shall be drawn.
167+
* It shall be within the rectangle specified by the annotation’s Rect entry and shall be expressed
168+
* in the annotation’s target coordinate system.
169+
*
170+
* <p>
171+
* Default value: the annotation’s Rect entry, expressed in the target coordinate system.
172+
* This value is [-w/2 -h/2 w/2 h/2], where w and h are the width and height, respectively, of Rect.
173+
*
174+
* @param viewBox the rectangular area in which the 3D artwork shall be drawn
175+
* @return this {@link Pdf3DAnnotation} instance
176+
*/
96177
public Pdf3DAnnotation setViewBox(Rectangle viewBox) {
97178
return (Pdf3DAnnotation) put(PdfName._3DB, new PdfArray(viewBox));
98179
}
99180

181+
/**
182+
* Gets the 3D view box, which is the rectangular area in which the 3D artwork shall be drawn.
183+
*
184+
* @return the 3D view box, which is the rectangular area in which the 3D artwork shall be drawn.
185+
*/
100186
public Rectangle getViewBox() {
101187
return getPdfObject().getAsRectangle(PdfName._3DB);
102188
}

0 commit comments

Comments
 (0)