public class

PolygonAnnotation

extends BaseLineAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.ShapeAnnotation
       ↳ com.pspdfkit.annotations.BaseLineAnnotation
         ↳ com.pspdfkit.annotations.PolygonAnnotation

Class Overview

Represents a closed polygon on a page.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
PolygonAnnotation(int pageIndex, List<PointF> points)
Creates a new polygon annotation.
PolygonAnnotation(int pageIndex, List<PointF> points, Scale scale, FloatPrecision precision)
Creates a measurement rectangular area annotation.
Public Methods
BorderStyle getBorderStyle()
Returns the current border style on the annotation or NONE if none is set.
List<PointF> getPoints()
Returns polygon points in PDF coordinates.
AnnotationType getType()
Gets the annotation type of the annotation.
void setBorderStyle(BorderStyle borderStyle)
Sets a border style for current annotation.
void setPoints(List<PointF> points)
Sets polygon points in PDF coordinates.
Protected Methods
Pair<LineEndTypeLineEndType> getLineEnds()
Returns current line ending styles for this line.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.BaseLineAnnotation
From class com.pspdfkit.annotations.ShapeAnnotation
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Constructors

public PolygonAnnotation (int pageIndex, List<PointF> points)

Creates a new polygon annotation.

Parameters
pageIndex Page to which this annotation will be attached to.
points List of points in polygon annotation.

public PolygonAnnotation (int pageIndex, List<PointF> points, Scale scale, FloatPrecision precision)

Creates a measurement rectangular area annotation. Will throw an exception if Measurement Tools are not licensed.

Parameters
pageIndex Page to which this annotation will be attached to.
points List of points in polygon annotation.
scale Measurement Scale for the annotation.
precision Measurement FloatPrecision for the annotation.

Public Methods

public BorderStyle getBorderStyle ()

Returns the current border style on the annotation or NONE if none is set.

Returns
  • Border style or NONE if none is set.

public List<PointF> getPoints ()

Returns polygon points in PDF coordinates.

Returns
  • List of polygon points. If for any reason valid coordinates aren't set, returns (0, 0) points.

public AnnotationType getType ()

Gets the annotation type of the annotation.

Returns
  • The type of the annotation. Makes down casting easier.

public void setBorderStyle (BorderStyle borderStyle)

Sets a border style for current annotation. It should be accompanied with setBorderColor(int) call to set the border color as well.

Parameters
borderStyle BorderStyle to be set. NONE to clear it.

public void setPoints (List<PointF> points)

Sets polygon points in PDF coordinates.

Parameters
points List of points in polygon annotation.

Protected Methods

protected Pair<LineEndTypeLineEndType> getLineEnds ()

Returns current line ending styles for this line.

Returns
  • Pair of start and end line ending styles. If they're not set, returns NONE.