PointFCollection Class
A collection of points that specify vertices of a polygon or polyline annotation.
Declaration
public class PointFCollection extends TrackedObjectCollection<PointF>
Remarks
Call the PathAnnotation.getVertices() method to access vertices of a PolygonAnnotation or PolylineAnnotation.
The collection implements the java.util.List interface and does not accept null items. If you add or insert a null item or replace an item with null, the API throws an ArgumentNullException. If you pass an index outside the collection bounds, the API throws an ArgumentOutOfRangeException.
Refer to the following help topic for additional information: Drawing Annotations.
Example: Add a Polygon Annotation and Modify Vertices
The following code snippet adds a polygon annotation to a page and adds a vertex to the polygon:
import java.io.*;
import java.nio.file.*;
import java.util.List;
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;
public class Main {
public static void main(String[] args) throws Exception {
try (PdfDocument document = new PdfDocument()) {
Page page = document.getPages().add(595, 842);
PolygonAnnotation polygon = new PolygonAnnotation(List.of(
new PointF(100, 600), new PointF(250, 700), new PointF(400, 600)));
polygon.setColor(PdfColor.getRed());
polygon.getVertices().add(new PointF(250, 500));
page.getAnnotations().add(polygon);
Files.createDirectories(Path.of("output"));
try (OutputStream stream = Files.newOutputStream(Path.of("output", "Document.pdf"))) {
document.save(stream);
}
}
}
}
Inherited Members
Inheritance
Constructors
PointFCollection() Constructor
Initializes a new instance of the PointFCollection class.
Declaration
public PointFCollection()
PointFCollection(Iterable<PointF> points) Constructor
Initializes a new instance of the PointFCollection class with the specified points.
Declaration
public PointFCollection(Iterable<PointF> points)
Parameters
| Name | Type | Description |
|---|---|---|
| points | java.lang.Iterable<com.devexpress.system.drawing.PointF> | Points to add to the collection. |
Exceptions
| Type | Description |
|---|---|
| ArgumentNullException | Thrown if the |
Methods
getSource() Method
Returns the internal collection that stores collection items.
Declaration
public PointFCollection getSource()
Returns
| Type | Description |
|---|---|
| com.devexpress.docs.pdf.internal.PointFCollection | The internal collection. |
Remarks
The getSource() method supports the internal infrastructure of the PDF Document API. Do not call the getSource() method in your code.
objectClone() Method
Returns a copy of the collection.
Declaration
public PointFCollection objectClone()
Returns
| Type | Description |
|---|---|
PointFCollection |
A new collection that contains the same points. |