加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
MapLabels2.java 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
蔡奇刚 提交于 2020-05-11 15:28 . add MapLabels2.java.
/**
A map label has a place name, longitude and latitude
*/
public class MapLabels
{
private String placeName;
private double latitude;
private double longitude;
/**
Constructs a map label with place name, logitude and latitude given in decimal degrees
*/
public MapLabels (String name, double aLat, double aLong)
{
placeName = name;
latitude = aLat;
longitude = aLong;
}
/**
Constructs a map label with place name, logitude and latitude given in degrees, minutes, seconds
*/
public MapLabels (String name, int degLat, int minLat, double secLat, int degLong, int minLong, double secLong)
{
placeName = name;
// decimalDegress = Math.signum(degrees) * (Math.abs(degrees) + minutes/60. + seconds/3600.);
latitude = Math.signum(degLat) * (Math.abs(degLat) + minLat/60. + secLat/3600.);
longitude = Math.signum(degLong) * (Math.abs(degLong) + minLong/60. + secLong/3600.);
}
/**
Gets the string in XML form
@return the string
*/
public String toString()
{
String label = "<label name=\"" + placeName + "\" latitude=\""+ latitude +"\" longitude=\"" + longitude +"\"/>";
return label;
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化