当前位置: 首页>>代码示例>>Java>>正文


Java MGRSCoord类代码示例

本文整理汇总了Java中gov.nasa.worldwind.geom.coords.MGRSCoord的典型用法代码示例。如果您正苦于以下问题:Java MGRSCoord类的具体用法?Java MGRSCoord怎么用?Java MGRSCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MGRSCoord类属于gov.nasa.worldwind.geom.coords包,在下文中一共展示了MGRSCoord类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:19,代码来源:DrbImageManager.java

示例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 
      };
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:10,代码来源:Coordinates.java

示例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;
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:8,代码来源:Coordinates.java

示例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;
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:11,代码来源:Coordinates.java

示例5: handleCursorPositionChange

import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入依赖的package包/类
private void handleCursorPositionChange(final PositionEvent event) {
	final Position newPos = event.getPosition();
	if (newPos != null) {
		//merge lat & lon into one field to display MGRS in lon field
		final String las = makeAngleDescription("Lat", newPos.getLatitude(), coordDecimalPlaces)
				+ " "
				+ makeAngleDescription("Lon", newPos.getLongitude(), coordDecimalPlaces);
		final String els = makeCursorElevationDescription(getEventSource()
				.getModel()
				.getGlobe()
				.getElevation(newPos.getLatitude(), newPos.getLongitude()));
		String los;
		try {
			final MGRSCoord MGRS = MGRSCoord.fromLatLon(
					newPos.getLatitude(),
					newPos.getLongitude(),
					getEventSource().getModel().getGlobe());
			los = MGRS.toString();
		} catch (final Exception e) {
			los = "";
		}
		latDisplay = las;
		lonDisplay = los;
		elevDisplay = els;

		if ((previousPos != null)
				&& (previousPos.getLatitude().compareTo(newPos.getLatitude()) != 0)
				&& (previousPos.getLongitude().compareTo(newPos.getLongitude()) != 0)) {
			this._ww.redraw();
		}
	} else {
		latDisplay = "";
		lonDisplay = Logging.getMessage("term.OffGlobe");
		elevDisplay = "";
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:37,代码来源:StatusLayer.java

示例6: mgrsFromLatLon

import gov.nasa.worldwind.geom.coords.MGRSCoord; //导入依赖的package包/类
public static String mgrsFromLatLon(double lat, double lon)
{
   Angle latitude = Angle.fromDegrees(lat);
   Angle longitude = Angle.fromDegrees(lon);
   return MGRSCoord.fromLatLon(latitude, longitude).toString();
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:7,代码来源:Coordinates.java

示例7: 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;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:64,代码来源:CoordinatesParser.java


注:本文中的gov.nasa.worldwind.geom.coords.MGRSCoord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。