Package mil.nga.mgrs.grid
Class Grid
- java.lang.Object
-
- mil.nga.mgrs.grid.Grid
-
- All Implemented Interfaces:
Comparable<Grid>
public class Grid extends Object implements Comparable<Grid>
Grid- Author:
- wnewman, osbornb
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_WIDTHDefault line width
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Grid other)booleanequals(Object obj)ColorgetColor()Get the grid line colorColorgetColor(GridType gridType)Get the grid type precision line colordoublegetLabelBuffer()Get the label grid zone edge bufferLabelergetLabeler()Get the grid labelerList<Label>getLabels(int zoom, Bounds tileBounds, GridZone zone)Get the labels for the zoom, tile bounds, and zoneList<Label>getLabels(MGRSTile tile, GridZone zone)Get the labels for the tile and zoneList<Line>getLines(int zoom, Bounds tileBounds, GridZone zone)Get the lines for the zoom, tile bounds, and zoneList<Line>getLines(Bounds tileBounds, GridZone zone)Get the lines for the tile bounds and zoneList<Line>getLines(MGRSTile tile, GridZone zone)Get the lines for the tile and zoneIntegergetLinesMaxZoom()Get the maximum zoom level for drawing grid linesintgetLinesMinZoom()Get the minimum zoom level for drawing grid linesIntegergetMaxZoom()Get the maximum zoom levelintgetMinZoom()Get the minimum zoom levelintgetPrecision()Get the precision in metersintgetPrecisionCompare()Get the precision in metersGridStylegetStyle()Get the grid line styleGridStylegetStyle(GridType gridType)Get the grid type precision line style for the grid typeGridTypegetType()Get the grid typedoublegetWidth()Get the grid line widthdoublegetWidth(GridType gridType)Get the grid type precision line widthinthashCode()booleanhasLabeler()Has a grid labelerbooleanhasLinesMaxZoom()Has a maximum zoom level override for drawing grid linesbooleanhasLinesMinZoom()Has a minimum zoom level override for drawing grid linesbooleanhasMaxZoom()Has a maximum zoom levelbooleanisEnabled()Is the grid enabledbooleanisLinesWithin(int zoom)Is the zoom level within the grid lines zoom rangebooleanisType(GridType type)Is the provided grid typebooleanisWithin(int zoom)Is the zoom level within the grid zoom rangevoidsetColor(Color color)Set the grid line colorvoidsetColor(GridType gridType, Color color)Set the grid type precision line colorprotected voidsetEnabled(boolean enabled)Set the enabled flagprotected voidsetLabeler(Labeler labeler)Set the grid labelervoidsetLinesMaxZoom(Integer linesMaxZoom)Set the maximum level override for drawing grid linesvoidsetLinesMinZoom(Integer linesMinZoom)Set the minimum level override for drawing grid linesprotected voidsetMaxZoom(Integer maxZoom)Set the maximum zoom levelprotected voidsetMinZoom(int minZoom)Set the minimum zoom levelvoidsetStyle(GridStyle style)Set the grid line stylevoidsetStyle(GridType gridType, GridStyle style)Set the grid type precision line stylevoidsetWidth(double width)Set the grid line widthvoidsetWidth(GridType gridType, double width)Set the grid type precision line width
-
-
-
Constructor Detail
-
Grid
protected Grid(GridType type)
Constructor- Parameters:
type- grid type
-
-
Method Detail
-
getType
public GridType getType()
Get the grid type- Returns:
- grid type
-
isType
public boolean isType(GridType type)
Is the provided grid type- Parameters:
type- grid type- Returns:
- true if the type
-
getPrecision
public int getPrecision()
Get the precision in meters- Returns:
- precision meters
-
isEnabled
public boolean isEnabled()
Is the grid enabled- Returns:
- enabled flag
-
setEnabled
protected void setEnabled(boolean enabled)
Set the enabled flag- Parameters:
enabled- enabled flag
-
getMinZoom
public int getMinZoom()
Get the minimum zoom level- Returns:
- minimum zoom level
-
setMinZoom
protected void setMinZoom(int minZoom)
Set the minimum zoom level- Parameters:
minZoom- minimum zoom level
-
getMaxZoom
public Integer getMaxZoom()
Get the maximum zoom level- Returns:
- maximum zoom level
-
hasMaxZoom
public boolean hasMaxZoom()
Has a maximum zoom level- Returns:
- true if has a maximum, false if unbounded
-
setMaxZoom
protected void setMaxZoom(Integer maxZoom)
Set the maximum zoom level- Parameters:
maxZoom- maximum zoom level
-
isWithin
public boolean isWithin(int zoom)
Is the zoom level within the grid zoom range- Parameters:
zoom- zoom level- Returns:
- true if within range
-
getLinesMinZoom
public int getLinesMinZoom()
Get the minimum zoom level for drawing grid lines- Returns:
- minimum zoom level
-
hasLinesMinZoom
public boolean hasLinesMinZoom()
Has a minimum zoom level override for drawing grid lines- Returns:
- true if has a minimum, false if not overridden
-
setLinesMinZoom
public void setLinesMinZoom(Integer linesMinZoom)
Set the minimum level override for drawing grid lines- Parameters:
linesMinZoom- minimum zoom level or null to remove
-
getLinesMaxZoom
public Integer getLinesMaxZoom()
Get the maximum zoom level for drawing grid lines- Returns:
- maximum zoom level
-
hasLinesMaxZoom
public boolean hasLinesMaxZoom()
Has a maximum zoom level override for drawing grid lines- Returns:
- true if has a maximum, false if not overridden
-
setLinesMaxZoom
public void setLinesMaxZoom(Integer linesMaxZoom)
Set the maximum level override for drawing grid lines- Parameters:
linesMaxZoom- maximum zoom level or null to remove
-
isLinesWithin
public boolean isLinesWithin(int zoom)
Is the zoom level within the grid lines zoom range- Parameters:
zoom- zoom level- Returns:
- true if within range
-
getStyle
public GridStyle getStyle()
Get the grid line style- Returns:
- grid line style
-
setStyle
public void setStyle(GridStyle style)
Set the grid line style- Parameters:
style- grid line style
-
getColor
public Color getColor()
Get the grid line color- Returns:
- grid line color
-
setColor
public void setColor(Color color)
Set the grid line color- Parameters:
color- grid line color
-
getWidth
public double getWidth()
Get the grid line width- Returns:
- grid line width
-
setWidth
public void setWidth(double width)
Set the grid line width- Parameters:
width- grid line width
-
getStyle
public GridStyle getStyle(GridType gridType)
Get the grid type precision line style for the grid type- Parameters:
gridType- grid type- Returns:
- grid type line style
-
setStyle
public void setStyle(GridType gridType, GridStyle style)
Set the grid type precision line style- Parameters:
gridType- grid typestyle- grid line style
-
getColor
public Color getColor(GridType gridType)
Get the grid type precision line color- Parameters:
gridType- grid type- Returns:
- grid type line color
-
setColor
public void setColor(GridType gridType, Color color)
Set the grid type precision line color- Parameters:
gridType- grid typecolor- grid line color
-
getWidth
public double getWidth(GridType gridType)
Get the grid type precision line width- Parameters:
gridType- grid type- Returns:
- grid type line width
-
setWidth
public void setWidth(GridType gridType, double width)
Set the grid type precision line width- Parameters:
gridType- grid typewidth- grid line width
-
getLabeler
public Labeler getLabeler()
Get the grid labeler- Returns:
- grid labeler
-
hasLabeler
public boolean hasLabeler()
Has a grid labeler- Returns:
- true if has a grid labeler
-
setLabeler
protected void setLabeler(Labeler labeler)
Set the grid labeler- Parameters:
labeler- grid labeler
-
getLines
public List<Line> getLines(MGRSTile tile, GridZone zone)
Get the lines for the tile and zone- Parameters:
tile- tilezone- grid zone- Returns:
- lines
-
getLines
public List<Line> getLines(int zoom, Bounds tileBounds, GridZone zone)
Get the lines for the zoom, tile bounds, and zone- Parameters:
zoom- zoom leveltileBounds- tile boundszone- grid zone- Returns:
- lines
-
getLines
public List<Line> getLines(Bounds tileBounds, GridZone zone)
Get the lines for the tile bounds and zone- Parameters:
tileBounds- tile boundszone- grid zone- Returns:
- lines
-
getLabels
public List<Label> getLabels(MGRSTile tile, GridZone zone)
Get the labels for the tile and zone- Parameters:
tile- tilezone- grid zone- Returns:
- labels
-
getLabels
public List<Label> getLabels(int zoom, Bounds tileBounds, GridZone zone)
Get the labels for the zoom, tile bounds, and zone- Parameters:
zoom- zoom leveltileBounds- tile boundszone- grid zone- Returns:
- labels
-
getLabelBuffer
public double getLabelBuffer()
Get the label grid zone edge buffer- Returns:
- label buffer (greater than or equal to 0.0 and less than 0.5)
-
compareTo
public int compareTo(Grid other)
- Specified by:
compareToin interfaceComparable<Grid>
-
getPrecisionCompare
public int getPrecisionCompare()
Get the precision in meters- Returns:
- precision meters
-
-