@@ -50,53 +50,139 @@ This file is part of the iText (R) project.
50
50
import com .itextpdf .kernel .pdf .PdfName ;
51
51
import com .itextpdf .kernel .pdf .PdfObject ;
52
52
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
+ */
54
57
public class Pdf3DAnnotation extends PdfAnnotation {
55
58
56
59
private static final long serialVersionUID = 3823509772499230844L ;
57
60
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
+ */
58
68
public Pdf3DAnnotation (Rectangle rect , PdfObject artwork ) {
59
69
super (rect );
60
70
put (PdfName ._3DD , artwork );
61
71
}
62
72
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
+ */
63
80
public Pdf3DAnnotation (PdfDictionary pdfObject ) {
64
81
super (pdfObject );
65
82
}
66
83
84
+ /**
85
+ * {@inheritDoc}
86
+ */
67
87
@ Override
68
88
public PdfName getSubtype () {
69
89
return PdfName ._3D ;
70
90
}
71
91
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
+ */
72
99
public Pdf3DAnnotation setDefaultInitialView (PdfObject initialView ) {
73
100
return (Pdf3DAnnotation ) put (PdfName ._3DV , initialView );
74
101
}
75
102
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
+ */
76
108
public PdfObject getDefaultInitialView () {
77
109
return getPdfObject ().get (PdfName ._3DV );
78
110
}
79
111
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
+ */
80
121
public Pdf3DAnnotation setActivationDictionary (PdfDictionary activationDictionary ) {
81
122
return (Pdf3DAnnotation ) put (PdfName ._3DA , activationDictionary );
82
123
}
83
124
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
+ */
84
132
public PdfDictionary getActivationDictionary () {
85
133
return getPdfObject ().getAsDictionary (PdfName ._3DA );
86
134
}
87
135
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
+ */
88
152
public Pdf3DAnnotation setInteractive (boolean interactive ) {
89
153
return (Pdf3DAnnotation ) put (PdfName ._3DI , PdfBoolean .valueOf (interactive ));
90
154
}
91
155
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
+ */
92
161
public PdfBoolean isInteractive () {
93
162
return getPdfObject ().getAsBoolean (PdfName ._3DI );
94
163
}
95
164
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
+ */
96
177
public Pdf3DAnnotation setViewBox (Rectangle viewBox ) {
97
178
return (Pdf3DAnnotation ) put (PdfName ._3DB , new PdfArray (viewBox ));
98
179
}
99
180
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
+ */
100
186
public Rectangle getViewBox () {
101
187
return getPdfObject ().getAsRectangle (PdfName ._3DB );
102
188
}
0 commit comments