Package mil.nga.mgrs.features
Class Line
- java.lang.Object
-
- mil.nga.mgrs.features.Line
-
public class Line extends Object
Line between two points in meters- Author:
- wnewman, osbornb
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GridTypegetGridType()Get the line grid typePointgetPoint1()Get the first pointPointgetPoint2()Get the second pointUnitgetUnit()Get the unitbooleanhasGridType()Check if the line has a grid typebooleanisDegrees()Is this line in degreesbooleanisMeters()Is this line in metersbooleanisUnit(Unit unit)Is in the provided unit typestatic Lineline(Point point1, Point point2)Create a linestatic Lineline(Point point1, Point point2, GridType gridType)Create a linevoidsetGridType(GridType gridType)Set the line grid typevoidsetPoint1(Point point1)Set the first pointvoidsetPoint2(Point point2)Set the second pointvoidsetPoints(Point point1, Point point2)Set the pointsLinetoDegrees()Convert to degreesLinetoMeters()Convert to metersLinetoUnit(Unit unit)Convert to the unit
-
-
-
Method Detail
-
line
public static Line line(Point point1, Point point2)
Create a line- Parameters:
point1- first pointpoint2- second point- Returns:
- line
-
line
public static Line line(Point point1, Point point2, GridType gridType)
Create a line- Parameters:
point1- first pointpoint2- second pointgridType- line grid type- Returns:
- line
-
getPoint1
public Point getPoint1()
Get the first point- Returns:
- first point
-
setPoint1
public void setPoint1(Point point1)
Set the first point- Parameters:
point1- first point
-
getPoint2
public Point getPoint2()
Get the second point- Returns:
- second point
-
setPoint2
public void setPoint2(Point point2)
Set the second point- Parameters:
point2- second point
-
setPoints
public void setPoints(Point point1, Point point2)
Set the points- Parameters:
point1- first pointpoint2- second point
-
getUnit
public Unit getUnit()
Get the unit- Returns:
- unit
-
isUnit
public boolean isUnit(Unit unit)
Is in the provided unit type- Parameters:
unit- unit- Returns:
- true if in the unit
-
isDegrees
public boolean isDegrees()
Is this line in degrees- Returns:
- true if degrees
-
isMeters
public boolean isMeters()
Is this line in meters- Returns:
- true if meters
-
toUnit
public Line toUnit(Unit unit)
Convert to the unit- Parameters:
unit- unit- Returns:
- point in units, same point if equal units
-
toDegrees
public Line toDegrees()
Convert to degrees- Returns:
- line in degrees, same line if already in degrees
-
toMeters
public Line toMeters()
Convert to meters- Returns:
- line in meters, same line if already in meters
-
getGridType
public GridType getGridType()
Get the line grid type- Returns:
- grid type
-
hasGridType
public boolean hasGridType()
Check if the line has a grid type- Returns:
- true if has grid type
-
setGridType
public void setGridType(GridType gridType)
Set the line grid type- Parameters:
gridType- grid type
-
-