public final class ConvertTools
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createGMLObjectDebug(java.util.Collection<? extends GMLObject> objects)
Create ShapeInfo objects for a set of GMLObjects.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createGMLObjectDebug(GMLObject... objects)
Create ShapeInfo objects for a set of GMLObjects.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createGMLShapeDebug(java.util.Collection<? extends GMLShape> objects)
Create ShapeInfo objects for a set of GMLShapes.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createGMLShapeDebug(GMLShape... objects)
Create ShapeInfo objects for a set of GMLShapes.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createTemporaryObjectDebug(java.util.Collection<? extends TemporaryObject> objects)
Create ShapeInfo objects for a set of TemporaryObjects.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
createTemporaryObjectDebug(TemporaryObject... objects)
Create ShapeInfo objects for a set of TemporaryObjects.
|
static Edge |
findBestTurn(DirectedEdge from,
java.util.Set<? extends Edge> candidates,
boolean preferLeft)
Find the "best" turn in a particular direction.
|
static Edge |
findLeftTurn(DirectedEdge from,
java.util.Set<? extends Edge> candidates)
Find the "leftmost" turn in a particular direction, i.e.
|
static Edge |
findRightTurn(DirectedEdge from,
java.util.Set<? extends Edge> candidates)
Find the "rightmost" turn in a particular direction, i.e.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
getAllDebugShapes(GMLMap map)
Create ShapeInfo objects for all GMLShapes in a map.
|
static java.util.List<ShapeDebugFrame.ShapeInfo> |
getAllDebugShapes(TemporaryMap map)
Create ShapeInfo objects for all TemporaryObjects in a map.
|
static double |
getAnglesSum(OSMBuilding building,
OSMMap map)
Sum the angles of all turns in an OSMBuilding.
|
static Line2D |
gmlDirectedEdgeToLine(GMLDirectedEdge edge)
Convert a GMLDirectedEdge to a Line2D.
|
static Line2D |
gmlEdgeToLine(GMLEdge edge)
Convert a GMLEdge to a Line2D.
|
static Line2D |
gmlEdgeToLine(GMLEdge edge,
GMLNode start)
Convert a GMLEdge to a Line2D.
|
static boolean |
isClockwise(OSMBuilding building,
OSMMap map)
Find out if an OSMBuilding is defined clockwise or not.
|
static boolean |
isConvex(java.util.List<DirectedEdge> edges)
Find out if a set of GMLDirectedEdges is convex.
|
static double |
nearbyThreshold(OSMMap map,
double thresholdM)
Compute the nearby-node threshold for an OSMMap in degrees.
|
static boolean |
nearlyEqual(double n,
double expected,
double threshold)
Is a number approximately equal to another number?
|
static double |
sizeOf1Metre(OSMMap map)
Compute the size of one metre in latitude/longitude for an OSMMap.
|
public static double sizeOf1Metre(OSMMap map)
map
- The map to look up.public static double nearbyThreshold(OSMMap map, double thresholdM)
map
- The map to look up.thresholdM
- The desired threshold in meters.public static Line2D gmlEdgeToLine(GMLEdge edge)
edge
- The edge to convert.public static Line2D gmlEdgeToLine(GMLEdge edge, GMLNode start)
edge
- The edge to convert.start
- The node to start from. This must be one of the endpoints of the edge.public static Line2D gmlDirectedEdgeToLine(GMLDirectedEdge edge)
edge
- The edge to convert.public static Edge findLeftTurn(DirectedEdge from, java.util.Set<? extends Edge> candidates)
from
- The edge we're turning from.candidates
- The set of edges we could turn into.public static Edge findRightTurn(DirectedEdge from, java.util.Set<? extends Edge> candidates)
from
- The edge we're turning from.candidates
- The set of edges we could turn into.public static Edge findBestTurn(DirectedEdge from, java.util.Set<? extends Edge> candidates, boolean preferLeft)
from
- The edge we're turning from.candidates
- The set of edges we could turn into.preferLeft
- Whether to prefer left turns or not.public static java.util.List<ShapeDebugFrame.ShapeInfo> getAllDebugShapes(GMLMap map)
map
- The map to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> getAllDebugShapes(TemporaryMap map)
map
- The map to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createGMLShapeDebug(GMLShape... objects)
objects
- The objects to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createGMLShapeDebug(java.util.Collection<? extends GMLShape> objects)
objects
- The objects to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createGMLObjectDebug(GMLObject... objects)
objects
- The objects to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createGMLObjectDebug(java.util.Collection<? extends GMLObject> objects)
objects
- The objects to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createTemporaryObjectDebug(TemporaryObject... objects)
objects
- The objects to debug.public static java.util.List<ShapeDebugFrame.ShapeInfo> createTemporaryObjectDebug(java.util.Collection<? extends TemporaryObject> objects)
objects
- The objects to debug.public static boolean nearlyEqual(double n, double expected, double threshold)
n
- The number to test.expected
- The expected value.threshold
- The threshold.public static boolean isConvex(java.util.List<DirectedEdge> edges)
edges
- The set of edges to test.public static double getAnglesSum(OSMBuilding building, OSMMap map)
building
- The building to check.map
- The OSMMap the building is part of.public static boolean isClockwise(OSMBuilding building, OSMMap map)
building
- The OSMBuilding to check.map
- The OSM map.