Package org.hortonmachine.gears.utils
Class RegionMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Double>
-
- org.hortonmachine.gears.utils.RegionMap
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Double>
public class RegionMap extends HashMap<String,Double>
Map containing a region definition, having utility methods to get the values.- Since:
- 0.7.2
- Author:
- Andrea Antonello (www.hydrologis.com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description RegionMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCols()Getter for the region cols.doublegetEast()Getter for the region's east bound.doublegetHeight()Getter for the region height.doublegetNorth()Getter for the region's north bound.intgetRows()Getter for the region rows.doublegetSouth()Getter for the region's south bound.doublegetWest()Getter for the region's west bound.doublegetWidth()Getter for the region width.doublegetXres()Getter for the region's X resolution.doublegetYres()Getter for the region's Y resolution.org.locationtech.jts.geom.CoordinatesnapToNextHigherInRegionResolution(double x, double y)Snaps a geographic point to be on the region grid.org.locationtech.jts.geom.EnvelopetoEnvelope()Create the envelope of the region borders.StringtoStringJGT()RegionMaptoSubRegion(double n, double s, double w, double e)Creates a newRegionMapcropped on the new bounds and snapped on the original grid.RegionMaptoSubRegion(org.locationtech.jts.geom.Envelope envelope)Creates a newRegionMapcropped on the new bounds and snapped on the original grid.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Method Detail
-
getCols
public int getCols()
Getter for the region cols.- Returns:
- the region cols or -1.
-
getRows
public int getRows()
Getter for the region rows.- Returns:
- the region rows or -1.
-
getNorth
public double getNorth()
Getter for the region's north bound.- Returns:
- the region north bound or
HMConstants.doubleNovalue
-
getSouth
public double getSouth()
Getter for the region's south bound.- Returns:
- the region south bound or
HMConstants.doubleNovalue
-
getEast
public double getEast()
Getter for the region's east bound.- Returns:
- the region east bound or
HMConstants.doubleNovalue
-
getWest
public double getWest()
Getter for the region's west bound.- Returns:
- the region west bound or
HMConstants.doubleNovalue
-
getXres
public double getXres()
Getter for the region's X resolution.- Returns:
- the region's X resolution or
HMConstants.doubleNovalue
-
getYres
public double getYres()
Getter for the region's Y resolution.- Returns:
- the region's Y resolution or
HMConstants.doubleNovalue
-
getWidth
public double getWidth()
Getter for the region width.- Returns:
- the region's width or
HMConstants.doubleNovalue
-
getHeight
public double getHeight()
Getter for the region height.- Returns:
- the region's height or
HMConstants.doubleNovalue
-
snapToNextHigherInRegionResolution
public org.locationtech.jts.geom.Coordinate snapToNextHigherInRegionResolution(double x, double y)Snaps a geographic point to be on the region grid.Moves the point given by X and Y to be on the grid of the supplied region.
- Parameters:
x- the easting of the arbitrary point.y- the northing of the arbitrary point.- Returns:
- the snapped coordinate.
-
toEnvelope
public org.locationtech.jts.geom.Envelope toEnvelope()
Create the envelope of the region borders.- Returns:
- the envelope of the region borders.
-
toSubRegion
public RegionMap toSubRegion(double n, double s, double w, double e)
Creates a newRegionMapcropped on the new bounds and snapped on the original grid.The supplied bounds are contained in the resulting region.
- Parameters:
n- the new north.s- the new south.w- the new west.e- the new east.- Returns:
- the new
RegionMap.
-
toSubRegion
public RegionMap toSubRegion(org.locationtech.jts.geom.Envelope envelope)
Creates a newRegionMapcropped on the new bounds and snapped on the original grid.The supplied bounds are contained in the resulting region.
- Parameters:
envelope- the envelope to snap.- Returns:
- the new
RegionMap.
-
toStringJGT
public String toStringJGT()
-
-