Class BoundingXYVisitor
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
,PrimitiveVisitor
- Direct Known Subclasses:
ValidatorDialog.ValidatorBoundingXYVisitor
public class BoundingXYVisitor extends java.lang.Object implements OsmPrimitiveVisitor, PrimitiveVisitor
Calculates the total bounding rectangle of a series ofOsmPrimitive
objects, using the EastNorth values as reference.
-
-
Field Summary
Fields Modifier and Type Field Description private ProjectionBounds
bounds
private static double
ENLARGE_DEFAULT
default value for setting "edit.zoom-enlarge-bbox"
-
Constructor Summary
Constructors Constructor Description BoundingXYVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.0002 degrees or user value given in edit.zoom-enlarge-bbox.void
enlargeBoundingBox(double enlargeDegreeX, double enlargeDegreeY)
Enlarges the calculated bounding box by the specified number of degrees.void
enlargeBoundingBoxLogarithmically()
Enlarges the bounding box up to 0.0002 degrees, depending on its size and user settings in edit.zoom-enlarge-bbox.ProjectionBounds
getBounds()
Returns the bounding box.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(LatLon 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(Node n)
Visiting call for points.void
visit(Relation r)
Visiting call for relations.void
visit(Way w)
Visiting call for lines.void
visit(ProjectionBounds b)
Visiting call for projection bounds.
-
-
-
Field Detail
-
ENLARGE_DEFAULT
private static final double ENLARGE_DEFAULT
default value for setting "edit.zoom-enlarge-bbox"- See Also:
- Constant Field Values
-
bounds
private ProjectionBounds bounds
-
-
Constructor Detail
-
BoundingXYVisitor
public BoundingXYVisitor()
-
-
Method Detail
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for points.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
n
- The node to inspect.
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
w
- The way to inspect.
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Parameters:
r
- The relation to inspect.
-
visit
public void visit(INode n)
Description copied from interface:PrimitiveVisitor
Visiting call for nodes.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
n
- The node to inspect.
-
visit
public void visit(IWay<?> w)
Description copied from interface:PrimitiveVisitor
Visiting call for ways.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
w
- The way to inspect.
-
visit
public void visit(IRelation<?> r)
Description copied from interface:PrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
r
- The relation to inspect.
-
visit
public void visit(ProjectionBounds b)
Visiting call for projection bounds.- Parameters:
b
- projection bounds
-
visit
public void visit(ILatLon latlon)
Visiting call for lat/lon.- Parameters:
latlon
- lat/lon- Since:
- 12725 (public for ILatLon parameter)
-
visit
public void visit(EastNorth eastNorth)
Visiting call for east/north.- Parameters:
eastNorth
- east/north
-
hasExtend
public boolean hasExtend()
Determines if the visitor has a non null bounds area.- Returns:
true
if the visitor has a non null bounds area- See Also:
ProjectionBounds.hasExtend()
-
getBounds
public ProjectionBounds getBounds()
Returns the bounding box.- Returns:
- The bounding box or
null
if no coordinates have passed
-
enlargeBoundingBox
public void enlargeBoundingBox()
Enlarges the calculated bounding box by 0.0002 degrees or user value given in edit.zoom-enlarge-bbox. If the bounding box has not been set (min
ormax
equalnull
) this method does not do anything.
-
enlargeBoundingBox
public void enlargeBoundingBox(double enlargeDegreeX, double enlargeDegreeY)
Enlarges the calculated bounding box by the specified number of degrees. If the bounding box has not been set (min
ormax
equalnull
) this method does not do anything.- Parameters:
enlargeDegreeX
- number of degrees to enlarge on each side along XenlargeDegreeY
- number of degrees to enlarge on each side along Y
-
enlargeBoundingBoxLogarithmically
public void enlargeBoundingBoxLogarithmically()
Enlarges the bounding box up to 0.0002 degrees, depending on its size and user settings in edit.zoom-enlarge-bbox. 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 0.0 degrees. If the bounding box has not been set (min
ormax
equalnull
) this method does not do anything.- Since:
- 14628
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
computeBoundingBox
public void computeBoundingBox(java.util.Collection<? extends IPrimitive> primitives)
Compute the bounding box of a collection of primitives.- Parameters:
primitives
- the collection of primitives
-
-