Class Shape
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.Shape
-
public class Shape extends java.lang.Object
Data class to store the outline for background imagery coverage. Configuration data for imagery to describe the coverage area (ImageryInfo.ImageryBounds
).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Shape.CoordinateList
A list ofCoordinate
s that attempts to be very efficient in terms of CPU time and memory allocations.
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Polygon
coords
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPoint(java.lang.String sLat, java.lang.String sLon)
boolean
contains(LatLon latlon)
Check if the coordinates are inside this shape.java.lang.String
encodeAsString(java.lang.String separator)
Encodes this as a string so that it may be parsed usingShape(String, String)
static java.lang.String
encodeAsString(java.util.List<Shape> shapes)
Encodes the shapes as a string using,
and;
as separatorsboolean
equals(java.lang.Object obj)
private static boolean
equalsPolygon(java.awt.Polygon first, java.awt.Polygon second)
Check that twoPolygon
s are equaljava.util.List<org.openstreetmap.gui.jmapviewer.Coordinate>
getPoints()
int
hashCode()
private static int
hashPolygon(java.awt.Polygon coords)
Hash a polygonjava.lang.String
toString()
-
-
-
Field Detail
-
coords
private final java.awt.Polygon coords
-
-
Method Detail
-
encodeAsString
public java.lang.String encodeAsString(java.lang.String separator)
Encodes this as a string so that it may be parsed usingShape(String, String)
- Parameters:
separator
- The separator- Returns:
- The string encoded shape
-
encodeAsString
public static java.lang.String encodeAsString(java.util.List<Shape> shapes)
Encodes the shapes as a string using,
and;
as separators- Parameters:
shapes
- The shapes to encode- Returns:
- The string encoded shapes
-
getPoints
public java.util.List<org.openstreetmap.gui.jmapviewer.Coordinate> getPoints()
-
contains
public boolean contains(LatLon latlon)
Check if the coordinates are inside this shape.- Parameters:
latlon
- The latlon to look for- Returns:
true
if the LatLon is inside the shape.- See Also:
Polygon.contains(int, int)
-
addPoint
public void addPoint(java.lang.String sLat, java.lang.String sLon)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashPolygon
private static int hashPolygon(java.awt.Polygon coords)
Hash a polygon- Parameters:
coords
- The polygon to hash- Returns:
- The hashcode to use; equivalent to
Object.hashCode()
, but zero allocations.
-
equalsPolygon
private static boolean equalsPolygon(java.awt.Polygon first, java.awt.Polygon second)
Check that twoPolygon
s are equal- Parameters:
first
- The first polygon to checksecond
- The second polygon to check- Returns:
true
if the polygons are equal
-
-