public class BoundingXYVisitor extends java.lang.Object implements OsmPrimitiveVisitor, PrimitiveVisitor
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(java.util.Collection<? extends IPrimitive> primitives)
Compute the bounding box of a collection of 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()
Determines if the visitor has a non null bounds area.
|
java.lang.String |
toString() |
void |
visit(Bounds b)
Visiting call for bounds.
|
void |
visit(EastNorth eastNorth)
Visiting call for east/north.
|
void |
visit(ILatLon latlon)
Visiting call for lat/lon.
|
void |
visit(INode n)
Visiting call for nodes.
|
void |
visit(IRelation<?> r)
Visiting call for relations.
|
void |
visit(IWay<?> w)
Visiting call for ways.
|
void |
visit(LatLon latlon)
Visiting call for lat/lon.
|
void |
visit(Node n)
Visiting call for points.
|
void |
visit(ProjectionBounds b)
Visiting call for projection bounds.
|
void |
visit(Relation r)
Visiting call for relations.
|
void |
visit(Way w)
Visiting call for lines.
|
private ProjectionBounds bounds
public BoundingXYVisitor()
public void visit(Node n)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
n
- The node to inspect.public void visit(Way w)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
w
- The way to inspect.public void visit(Relation r)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
r
- The relation to inspect.public void visit(INode n)
PrimitiveVisitor
visit
in interface PrimitiveVisitor
n
- The node to inspect.public void visit(IWay<?> w)
PrimitiveVisitor
visit
in interface PrimitiveVisitor
w
- The way to inspect.public void visit(IRelation<?> r)
PrimitiveVisitor
visit
in interface PrimitiveVisitor
r
- The relation to inspect.public void visit(ProjectionBounds b)
b
- projection boundspublic void visit(ILatLon latlon)
latlon
- lat/lonpublic void visit(EastNorth eastNorth)
eastNorth
- east/northpublic boolean hasExtend()
true
if the visitor has a non null bounds areaProjectionBounds.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
- number of degrees to enlarge on each sidepublic 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
- maximum enlargement in percentage (100.0 for 100%)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 java.lang.String toString()
toString
in class java.lang.Object
public void computeBoundingBox(java.util.Collection<? extends IPrimitive> primitives)
primitives
- the collection of primitives