public class OnLineStrategy extends java.lang.Object implements PositionForAreaStrategy
Modifier and Type | Class and Description |
---|---|
private class |
OnLineStrategy.GlyphRotatingVisitor
Rotate the glyphs along a path.
|
private static class |
OnLineStrategy.HalfSegment
A half segment that can be used to place text on it.
|
private static class |
OnLineStrategy.OffsetGlyph |
private static class |
OnLineStrategy.UpsideComputingVisitor
A visitor that computes the side of the way that is the upper one for each segment and computes the dominant upper side of the way.
|
Modifier and Type | Field and Description |
---|---|
static OnLineStrategy |
INSTANCE
An instance of this class.
|
private double |
yOffset |
Constructor and Description |
---|
OnLineStrategy(double yOffset)
Create a new strategy that places the text on the line.
|
Modifier and Type | Method and Description |
---|---|
private static java.util.List<OnLineStrategy.OffsetGlyph> |
computeOffsetGlyphs(java.util.List<java.awt.font.GlyphVector> gvs,
double startOffset,
boolean rotateText)
Create a list of glyphs with an offset along the way
|
private static double |
computeQuality(MapViewState.MapViewPoint p1,
MapViewState.MapViewPoint p2) |
boolean |
equals(java.lang.Object obj) |
MapViewPositionAndRotation |
findLabelPlacement(MapViewPath path,
java.awt.geom.Rectangle2D nb)
Finds the correct position of a label / icon inside the area.
|
private static java.util.Optional<OnLineStrategy.HalfSegment> |
findOptimalWayPosition(java.awt.geom.Rectangle2D rect,
MapViewPath path) |
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.
|
int |
hashCode() |
boolean |
supportsGlyphVector()
Checks whether this placement strategy supports more detailed (rotation / ...) placement using a glyph vector.
|
private static double |
theta(MapViewState.MapViewPoint start,
MapViewState.MapViewPoint end) |
java.lang.String |
toString() |
private static double |
upsideTheta(OnLineStrategy.HalfSegment best) |
PositionForAreaStrategy |
withAddedOffset(java.awt.geom.Point2D addToOffset)
Create a new instance of the same strategy adding a offset
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forKeyword, forKeyword
public static final OnLineStrategy INSTANCE
private final double yOffset
public OnLineStrategy(double yOffset)
yOffset
- The offset sidewards to the line.public MapViewPositionAndRotation findLabelPlacement(MapViewPath path, java.awt.geom.Rectangle2D nb)
PositionForAreaStrategy
findLabelPlacement
in interface PositionForAreaStrategy
path
- The area to search innb
- The bounding box of the thing we are searching a place for.null
if none was found.private static double upsideTheta(OnLineStrategy.HalfSegment best)
public boolean supportsGlyphVector()
PositionForAreaStrategy
supportsGlyphVector
in interface PositionForAreaStrategy
true
if it is supported.public 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)
PositionForAreaStrategy
generateGlyphVectors
in interface PositionForAreaStrategy
path
- The path to place the text alongnb
- The bounds of the textgvs
- The glyph vectors for the text. May be modifiedisDoubleTranslationBug
- true
to fix a glyph placement bug.private static java.util.List<OnLineStrategy.OffsetGlyph> computeOffsetGlyphs(java.util.List<java.awt.font.GlyphVector> gvs, double startOffset, boolean rotateText)
gvs
- The list of glyphsstartOffset
- The offset in the linerotateText
- Rotate the text by 180°private static java.util.Optional<OnLineStrategy.HalfSegment> findOptimalWayPosition(java.awt.geom.Rectangle2D rect, MapViewPath path)
private static double computeQuality(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2)
private static double theta(MapViewState.MapViewPoint start, MapViewState.MapViewPoint end)
public PositionForAreaStrategy withAddedOffset(java.awt.geom.Point2D addToOffset)
PositionForAreaStrategy
withAddedOffset
in interface PositionForAreaStrategy
addToOffset
- The offset to addpublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object