Interface PositionForAreaStrategy
-
- All Known Implementing Classes:
CompletelyInsideAreaStrategy,OnLineStrategy,PartiallyInsideAreaStrategy
public interface PositionForAreaStrategy
This strategy defines how to place a label or icon inside the area.- Since:
- 11722, 11748 moved to own file
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MapViewPositionAndRotationfindLabelPlacement(MapViewPath path, java.awt.geom.Rectangle2D nb)Finds the correct position of a label / icon inside the area.static PositionForAreaStrategyforKeyword(Keyword keyword)Gets a strategy for the given keyword.static PositionForAreaStrategyforKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy)Gets a strategy for the given keyword.default java.util.List<java.awt.font.GlyphVector>generateGlyphVectors(MapViewPath path, java.awt.geom.Rectangle2D nb, java.util.List<java.awt.font.GlyphVector> gvs, boolean isDoubleTranslationBug)Generates the transformed glyph vectors for the given text.booleansupportsGlyphVector()Checks whether this placement strategy supports more detailed (rotation / ...) placement using a glyph vector.PositionForAreaStrategywithAddedOffset(java.awt.geom.Point2D addToOffset)Create a new instance of the same strategy adding a offset
-
-
-
Method Detail
-
findLabelPlacement
MapViewPositionAndRotation findLabelPlacement(MapViewPath path, java.awt.geom.Rectangle2D nb)
Finds the correct position of a label / icon inside the area.- Parameters:
path- The area to search innb- The bounding box of the thing we are searching a place for.- Returns:
- The position as rectangle with the same dimension as nb.
nullif none was found.
-
supportsGlyphVector
boolean supportsGlyphVector()
Checks whether this placement strategy supports more detailed (rotation / ...) placement using a glyph vector.- Returns:
trueif it is supported.
-
generateGlyphVectors
default java.util.List<java.awt.font.GlyphVector> generateGlyphVectors(MapViewPath path, java.awt.geom.Rectangle2D nb, java.util.List<java.awt.font.GlyphVector> gvs, boolean isDoubleTranslationBug)
Generates the transformed glyph vectors for the given text.- Parameters:
path- The path to place the text alongnb- The bounds of the textgvs- The glyph vectors for the text. May be modifiedisDoubleTranslationBug-trueto fix a glyph placement bug.- Returns:
- The glyph vectors.
- Throws:
java.lang.UnsupportedOperationException- ifsupportsGlyphVector()returns false
-
forKeyword
static PositionForAreaStrategy forKeyword(Keyword keyword)
Gets a strategy for the given keyword.- Parameters:
keyword- The text position keyword.- Returns:
- The strategy or line if none was specified.
- Since:
- 11722
-
forKeyword
static PositionForAreaStrategy forKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy)
Gets a strategy for the given keyword.- Parameters:
keyword- The text position keyword.defaultStrategy- The default if no strategy was recognized.- Returns:
- The strategy or line if none was specified.
- Since:
- 11722
-
withAddedOffset
PositionForAreaStrategy withAddedOffset(java.awt.geom.Point2D addToOffset)
Create a new instance of the same strategy adding a offset- Parameters:
addToOffset- The offset to add- Returns:
- The new strategy
- Since:
- 12476
-
-