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 ofOsmPrimitiveobjects, using the EastNorth values as reference.
-
-
Field Summary
Fields Modifier and Type Field Description private ProjectionBoundsboundsprivate static doubleENLARGE_DEFAULTdefault 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 voidcomputeBoundingBox(java.util.Collection<? extends IPrimitive> primitives)Compute the bounding box of a collection of primitives.voidenlargeBoundingBox()Enlarges the calculated bounding box by 0.0002 degrees or user value given in edit.zoom-enlarge-bbox.voidenlargeBoundingBox(double enlargeDegreeX, double enlargeDegreeY)Enlarges the calculated bounding box by the specified number of degrees.voidenlargeBoundingBoxLogarithmically()Enlarges the bounding box up to 0.0002 degrees, depending on its size and user settings in edit.zoom-enlarge-bbox.ProjectionBoundsgetBounds()Returns the bounding box.booleanhasExtend()Determines if the visitor has a non null bounds area.java.lang.StringtoString()voidvisit(Bounds b)Visiting call for bounds.voidvisit(EastNorth eastNorth)Visiting call for east/north.voidvisit(ILatLon latlon)Visiting call for lat/lon.voidvisit(LatLon latlon)Visiting call for lat/lon.voidvisit(INode n)Visiting call for nodes.voidvisit(IRelation<?> r)Visiting call for relations.voidvisit(IWay<?> w)Visiting call for ways.voidvisit(Node n)Visiting call for points.voidvisit(Relation r)Visiting call for relations.voidvisit(Way w)Visiting call for lines.voidvisit(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:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
n- The node to inspect.
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
w- The way to inspect.
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
r- The relation to inspect.
-
visit
public void visit(INode n)
Description copied from interface:PrimitiveVisitorVisiting call for nodes.- Specified by:
visitin interfacePrimitiveVisitor- Parameters:
n- The node to inspect.
-
visit
public void visit(IWay<?> w)
Description copied from interface:PrimitiveVisitorVisiting call for ways.- Specified by:
visitin interfacePrimitiveVisitor- Parameters:
w- The way to inspect.
-
visit
public void visit(IRelation<?> r)
Description copied from interface:PrimitiveVisitorVisiting call for relations.- Specified by:
visitin 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:
trueif 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
nullif 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 (minormaxequalnull) 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 (minormaxequalnull) 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 (minormaxequalnull) this method does not do anything.- Since:
- 14628
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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
-
-