Class CompletelyInsideAreaStrategy
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.styleelement.placement.CompletelyInsideAreaStrategy
-
- All Implemented Interfaces:
PositionForAreaStrategy
- Direct Known Subclasses:
PartiallyInsideAreaStrategy
public class CompletelyInsideAreaStrategy extends java.lang.Object implements PositionForAreaStrategy
Places the label / icon so that it is completely inside the area.- Since:
- 11722, 11748 moved to own file
-
-
Field Summary
Fields Modifier and Type Field Description static CompletelyInsideAreaStrategy
INSTANCE
An instance of this class.protected double
offsetX
protected double
offsetY
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompletelyInsideAreaStrategy(double offsetX, double offsetY)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MapViewPositionAndRotation
centerOf(MapViewState mapViewState, java.awt.Rectangle centeredNBounds)
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.int
hashCode()
boolean
supportsGlyphVector()
Checks whether this placement strategy supports more detailed (rotation / ...) placement using a glyph vector.java.lang.String
toString()
PositionForAreaStrategy
withAddedOffset(java.awt.geom.Point2D addToOffset)
Create a new instance of the same strategy adding a offset-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.mappaint.styleelement.placement.PositionForAreaStrategy
generateGlyphVectors
-
-
-
-
Field Detail
-
INSTANCE
public static final CompletelyInsideAreaStrategy INSTANCE
An instance of this class.
-
offsetX
protected final double offsetX
-
offsetY
protected final double offsetY
-
-
Constructor Detail
-
CompletelyInsideAreaStrategy
protected CompletelyInsideAreaStrategy(double offsetX, double offsetY)
-
-
Method Detail
-
findLabelPlacement
public MapViewPositionAndRotation findLabelPlacement(MapViewPath path, java.awt.geom.Rectangle2D nb)
Description copied from interface:PositionForAreaStrategy
Finds the correct position of a label / icon inside the area.- Specified by:
findLabelPlacement
in interfacePositionForAreaStrategy
- 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.
null
if none was found.
-
centerOf
private MapViewPositionAndRotation centerOf(MapViewState mapViewState, java.awt.Rectangle centeredNBounds)
-
supportsGlyphVector
public boolean supportsGlyphVector()
Description copied from interface:PositionForAreaStrategy
Checks whether this placement strategy supports more detailed (rotation / ...) placement using a glyph vector.- Specified by:
supportsGlyphVector
in interfacePositionForAreaStrategy
- Returns:
true
if it is supported.
-
withAddedOffset
public PositionForAreaStrategy withAddedOffset(java.awt.geom.Point2D addToOffset)
Description copied from interface:PositionForAreaStrategy
Create a new instance of the same strategy adding a offset- Specified by:
withAddedOffset
in interfacePositionForAreaStrategy
- Parameters:
addToOffset
- The offset to add- Returns:
- The new strategy
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-