public class

PolylineAnnotation

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

Class Overview

Represents a polyline on the page. Polyline is similar to PolygonAnnotation but is not closed and supports LineEndTypes.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
PolylineAnnotation(int pageIndex, List<PointF> points)
Creates a new polyline annotation.
PolylineAnnotation(int pageIndex, List<PointF> points, Scale scale, FloatPrecision precision)
Creates a measurement perimeter annotation.
Public Methods
Pair<LineEndTypeLineEndType> getLineEnds()
Returns current line ending styles for this polyline.
List<PointF> getPoints()
Returns polyline points in PDF coordinates.
AnnotationType getType()
Gets the annotation type of the annotation.
void setLineEnds(LineEndType lineEnd1, LineEndType lineEnd2)
Sets line ending style for this polyline.
void setPoints(List<PointF> points)
Sets polyline points in PDF coordinates.
[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 PolylineAnnotation (int pageIndex, List<PointF> points)

Creates a new polyline annotation.

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

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

Creates a measurement perimeter 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 polyline annotation.
scale Measurement Scale for the annotation.
precision Measurement FloatPrecision for the annotation.

Public Methods

public Pair<LineEndTypeLineEndType> getLineEnds ()

Returns current line ending styles for this polyline.

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

public List<PointF> getPoints ()

Returns polyline points in PDF coordinates.

Returns
  • List of polyline 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 setLineEnds (LineEndType lineEnd1, LineEndType lineEnd2)

Sets line ending style for this polyline.

Parameters
lineEnd1 LineEndType for start of this polyline.
lineEnd2 LineEndType for end of this polyline.

public void setPoints (List<PointF> points)

Sets polyline points in PDF coordinates.

Parameters
points List of points in polyline annotation.