# Interface IProjectionPosition

public interface IProjectionPosition
An `IProjectionPosition` is a position that is associated with a `ProjectionAnnotation` and that is able to compute its collapsed regions. That is, if a `Position` implements this interface, `ProjectionViewer` will delegate to the `computeProjectionRegions` method when determining the document regions that should be collapsed for a certain `ProjectionAnnotation`.

Since:
  3.1

## Method Summary

Modifier and Type
Method
Description
`int`
`computeCaptionOffset(IDocument document)`
Returns the offset of the caption (the anchor region) of this projection position.
`IRegion[]`
`computeProjectionRegions(IDocument document)`
Returns an array of regions that should be collapsed when the annotation belonging to this position is collapsed.

## Method Details

### computeProjectionRegions

IRegion[] computeProjectionRegions(IDocument document) throws BadLocationException
Returns an array of regions that should be collapsed when the annotation belonging to this position is collapsed. May return null instead of an empty array.

Parameters:
  `document` - the document that this position is attached to
Returns:
  the foldable regions for this position
Throws:
  `BadLocationException` - if accessing the document fails

### computeCaptionOffset

int computeCaptionOffset(IDocument document) throws BadLocationException
Returns the offset of the caption (the anchor region) of this projection position. The returned offset is relative to the receivers offset into the document.

Parameters:
  `document` - the document that this position is attached to
Returns:
  the caption offset relative to the position's offset
Throws:
  `BadLocationException` - if accessing the document fails