本文整理汇总了Java中gov.nasa.worldwind.geom.coords.MGRSCoord.fromString方法的典型用法代码示例。如果您正苦于以下问题:Java MGRSCoord.fromString方法的具体用法?Java MGRSCoord.fromString怎么用?Java MGRSCoord.fromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.geom.coords.MGRSCoord
的用法示例。
在下文中一共展示了MGRSCoord.fromString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkFilename
import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入方法依赖的package包/类
boolean checkFilename (String filename, boolean verbose)
{
try
{
String mgrs = getMGRSFromName(filename);
if (mgrs==null) new NullPointerException("MGRS string not extracted.");
MGRSCoord.fromString(mgrs);
}
catch (Exception e)
{
if (verbose)
{
logger.error("Wrong input image file (" + e.getMessage() + ").");
}
return false;
}
return true;
}
示例2: latLonFromMgrs
import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入方法依赖的package包/类
public static double[] latLonFromMgrs(String mgrs)
{
MGRSCoord coord = MGRSCoord.fromString(mgrs);
return new double[]
{
coord.getLatitude().degrees,
coord.getLongitude().degrees
};
}
示例3: utmFromMgrs
import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入方法依赖的package包/类
public static UTMCoord utmFromMgrs(String mgrs)
{
MGRSCoord coord = MGRSCoord.fromString(mgrs);
UTMCoord utm = UTMCoord.fromLatLon(coord.getLatitude(),
coord.getLongitude());
return utm;
}
示例4: tmFromMgrs
import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入方法依赖的package包/类
public static TMCoord tmFromMgrs(String mgrs, double central_meridan)
{
MGRSCoord coord = MGRSCoord.fromString(mgrs);
TMCoord tm = TMCoord.fromLatLon(coord.getLatitude(),
coord.getLongitude(), WGS84_A, WGS84_F,
Angle.fromRadians(ORIGIN_LATITUDE),
Angle.fromRadians(central_meridan),
FALSE_EASTING, FALSE_NORTHING, SCALE);
return tm;
}
示例5: parseWithResult
import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入方法依赖的package包/类
@NonNull
public static Result parseWithResult(@NonNull String input) throws IllegalArgumentException {
Result result = new Result();
result.tokens = lex(input);
if (result.tokens.size() == 0)
throw new IllegalArgumentException("Wrong coordinates format");
switch (result.tokens.get(0).t) {
case MGRS: {
MGRSCoord coord = MGRSCoord.fromString(result.tokens.get(0).c);
result.coordinates = new GeoPoint(coord.getLatitude().degrees, coord.getLongitude().degrees);
return result;
}
case UTM_ZONE: {
result.coordinates = parseUtmTokens(result.tokens);
return result;
}
}
double lat = Double.NaN, lon = Double.NaN, latSign = 1, lonSign = 1;
for (Token token : result.tokens) {
if (token.t == Type.H_PREFIX) {
if (Double.isNaN(lat))
latSign = ("-".equals(token.c) || "S".equals(token.c) || "W".equals(token.c)) ? -1 : 1;
else if (Double.isNaN(lon))
lonSign = ("-".equals(token.c) || "S".equals(token.c) || "W".equals(token.c)) ? -1 : 1;
else
throw new IllegalArgumentException("Wrong coordinates format");
}
if (token.t == Type.H_SUFFIX) {
if (!Double.isNaN(lon))
lonSign = ("-".equals(token.c) || "S".equals(token.c) || "W".equals(token.c)) ? -1 : 1;
else if (!Double.isNaN(lat))
latSign = ("-".equals(token.c) || "S".equals(token.c) || "W".equals(token.c)) ? -1 : 1;
else
throw new IllegalArgumentException("Wrong coordinates format");
}
if (token.t == Type.DEG) {
if (Double.isNaN(lat))
lat = Double.valueOf(token.c);
else
lon = Double.valueOf(token.c);
}
if (token.t == Type.MIN) {
if (!Double.isNaN(lon))
lon += Math.signum(lon) * Double.valueOf(token.c) / 60;
else if (!Double.isNaN(lat))
lat += Math.signum(lat) * Double.valueOf(token.c) / 60;
else
throw new IllegalArgumentException("Wrong coordinates format");
}
if (token.t == Type.SEC) {
if (!Double.isNaN(lon))
lon += Math.signum(lon) * Double.valueOf(token.c) / 3600;
else if (!Double.isNaN(lat))
lat += Math.signum(lat) * Double.valueOf(token.c) / 3600;
else
throw new IllegalArgumentException("Wrong coordinates format");
}
}
if (Double.isNaN(lat) || Double.isNaN(lon))
throw new IllegalArgumentException("Wrong coordinates format");
result.coordinates = new GeoPoint(lat * latSign, lon * lonSign);
return result;
}