Package mil.nga.grid
Class GridUtils
- java.lang.Object
- 
- mil.nga.grid.GridUtils
 
- 
 public class GridUtils extends Object Grid utilities- Author:
- osbornb
 
- 
- 
Constructor SummaryConstructors Constructor Description GridUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static BoundsgetBounds(int x, int y, int zoom)Get the tile bounds from the XYZ tile coordinates and zoom levelstatic PixelgetPixel(int width, int height, Bounds bounds, Point point)Get the pixel where the point fits into the boundsstatic floatgetXPixel(int width, Bounds bounds, double longitude)Get the X pixel for where the longitude in meters fits into the boundsstatic floatgetYPixel(int height, Bounds bounds, double latitude)Get the Y pixel for where the latitude in meters fits into the boundsstatic doublegetZoomLevel(Bounds bounds)Get the zoom level of the bounds using the shortest bounds side lengthstatic Pointintersection(Line line1, Line line2)Get the point intersection between two linesstatic Pointintersection(Point line1Point1, Point line1Point2, Point line2Point1, Point line2Point2)Get the point intersection between end points of two linesstatic booleanisOmittedBandLetter(char letter)Is the band letter an omitted letterGridConstants.BAND_LETTER_OMIT_IorGridConstants.BAND_LETTER_OMIT_Ostatic doubleprecisionAfter(double value, double precision)Get the precision value after the valuestatic doubleprecisionBefore(double value, double precision)Get the precision value before the valuestatic doubletileSize(int tilesPerSide)Get the tile size in metersstatic inttilesPerSide(int zoom)Get the tiles per side, width and height, at the zoom levelstatic PointtoUnit(double longitude, double latitude, Unit unit)Convert a coordinate to the unit, assumes the coordinate is in the opposite unitstatic PointtoUnit(Unit fromUnit, double longitude, double latitude, Unit toUnit)Convert a coordinate from a unit to another unit
 
- 
- 
- 
Method Detail- 
getPixelpublic static Pixel getPixel(int width, int height, Bounds bounds, Point point) Get the pixel where the point fits into the bounds- Parameters:
- width- width
- height- height
- bounds- bounds
- point- point
- Returns:
- pixel
 
 - 
getXPixelpublic static float getXPixel(int width, Bounds bounds, double longitude)Get the X pixel for where the longitude in meters fits into the bounds- Parameters:
- width- width
- bounds- bounds
- longitude- longitude in meters
- Returns:
- x pixel
 
 - 
getYPixelpublic static float getYPixel(int height, Bounds bounds, double latitude)Get the Y pixel for where the latitude in meters fits into the bounds- Parameters:
- height- height
- bounds- bounds
- latitude- latitude
- Returns:
- y pixel
 
 - 
getBoundspublic static Bounds getBounds(int x, int y, int zoom) Get the tile bounds from the XYZ tile coordinates and zoom level- Parameters:
- x- x coordinate
- y- y coordinate
- zoom- zoom level
- Returns:
- bounds
 
 - 
tilesPerSidepublic static int tilesPerSide(int zoom) Get the tiles per side, width and height, at the zoom level- Parameters:
- zoom- zoom level
- Returns:
- tiles per side
 
 - 
tileSizepublic static double tileSize(int tilesPerSide) Get the tile size in meters- Parameters:
- tilesPerSide- tiles per side
- Returns:
- tile size
 
 - 
getZoomLevelpublic static double getZoomLevel(Bounds bounds) Get the zoom level of the bounds using the shortest bounds side length- Parameters:
- bounds- bounds
- Returns:
- zoom level
 
 - 
toUnitpublic static Point toUnit(Unit fromUnit, double longitude, double latitude, Unit toUnit) Convert a coordinate from a unit to another unit- Parameters:
- fromUnit- unit of provided coordinate
- longitude- longitude
- latitude- latitude
- toUnit- desired unit
- Returns:
- point in unit
 
 - 
toUnitpublic static Point toUnit(double longitude, double latitude, Unit unit) Convert a coordinate to the unit, assumes the coordinate is in the opposite unit- Parameters:
- longitude- longitude
- latitude- latitude
- unit- desired unit
- Returns:
- point in unit
 
 - 
isOmittedBandLetterpublic static boolean isOmittedBandLetter(char letter) Is the band letter an omitted letterGridConstants.BAND_LETTER_OMIT_IorGridConstants.BAND_LETTER_OMIT_O- Parameters:
- letter- band letter
- Returns:
- true if omitted
 
 - 
precisionBeforepublic static double precisionBefore(double value, double precision)Get the precision value before the value- Parameters:
- value- value
- precision- precision
- Returns:
- precision value
 
 - 
precisionAfterpublic static double precisionAfter(double value, double precision)Get the precision value after the value- Parameters:
- value- value
- precision- precision
- Returns:
- precision value
 
 - 
intersectionpublic static Point intersection(Line line1, Line line2) Get the point intersection between two lines- Parameters:
- line1- first line
- line2- second line
- Returns:
- intersection point or null if no intersection
 
 - 
intersectionpublic static Point intersection(Point line1Point1, Point line1Point2, Point line2Point1, Point line2Point2) Get the point intersection between end points of two lines- Parameters:
- line1Point1- first point of the first line
- line1Point2- second point of the first line
- line2Point1- first point of the second line
- line2Point2- second point of the second line
- Returns:
- intersection point or null if no intersection
 
 
- 
 
-