public class BoundingXYVisitor extends AbstractVisitor
OsmPrimitive
objects, using the
EastNorth values as reference.Modifier and Type | Field and Description |
---|---|
private ProjectionBounds |
bounds |
Constructor and Description |
---|
BoundingXYVisitor() |
Modifier and Type | Method and Description |
---|---|
void |
computeBoundingBox(Collection<? extends OsmPrimitive> primitives) |
void |
enlargeBoundingBox()
Enlarges the calculated bounding box by 0.002 degrees.
|
void |
enlargeBoundingBox(double enlargeDegree)
Enlarges the calculated bounding box by the specified number of degrees.
|
void |
enlargeBoundingBoxLogarithmically(double maxEnlargePercent)
Enlarges the bounding box up to
maxEnlargePercent , depending on
its size. |
void |
enlargeToMinSize(double size)
Specify a degree larger than 0 in order to make the bounding box at least
the specified size in width and height.
|
ProjectionBounds |
getBounds() |
boolean |
hasExtend() |
String |
toString() |
void |
visit(Bounds b) |
void |
visit(EastNorth eastNorth) |
void |
visit(LatLon latlon) |
void |
visit(Node n)
Visiting call for points.
|
void |
visit(ProjectionBounds b) |
void |
visit(Relation e)
Visiting call for relations.
|
void |
visit(Way w)
Visiting call for lines.
|
visit
private ProjectionBounds bounds
public BoundingXYVisitor()
public void visit(Node n)
Visitor
n
- The node to inspect.public void visit(Way w)
Visitor
w
- The way to inspect.public void visit(Relation e)
Visitor
e
- The relation to inspect.public void visit(ProjectionBounds b)
public boolean hasExtend()
public ProjectionBounds getBounds()
null
if no coordinates have passedpublic void enlargeBoundingBox()
min
or max
equal null
) this method does not do anything.public void enlargeBoundingBox(double enlargeDegree)
min
or max
equal null
) this method does not do anything.enlargeDegree
- public void enlargeBoundingBoxLogarithmically(double maxEnlargePercent)
maxEnlargePercent
, depending on
its size. If the bounding box is small, it will be enlarged more in relation
to its beginning size. The larger the bounding box, the smaller the change,
down to the minimum of 1% enlargement.
Warning: if the bounding box only contains a single node, no expansion takes
place because a node has no width/height. Use enlargeToMinDegrees
instead.
Example: You specify enlargement to be up to 100%.
Bounding box is a small house: enlargement will be 95–100%, i.e.
making enough space so that the house fits twice on the screen in
each direction.
Bounding box is a large landuse, like a forest: Enlargement will
be 1–10%, i.e. just add a little border around the landuse.
If the bounding box has not been set (min
or max
equal null
) this method does not do anything.maxEnlargePercent
- public void enlargeToMinSize(double size)
min
or max
equal null
) this method does not do anything.
If the bounding box contains objects and is to be enlarged, the objects
will be centered within the new bounding box.size
- minimum width and height in meterpublic void computeBoundingBox(Collection<? extends OsmPrimitive> primitives)