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


Java CompassPoint类代码示例

本文整理汇总了Java中net.sf.marineapi.nmea.util.CompassPoint的典型用法代码示例。如果您正苦于以下问题:Java CompassPoint类的具体用法?Java CompassPoint怎么用?Java CompassPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompassPoint类属于net.sf.marineapi.nmea.util包,在下文中一共展示了CompassPoint类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGPSPosition

import net.sf.marineapi.nmea.util.CompassPoint; //导入依赖的package包/类
public GPSLocation getGPSPosition(String gps) {
	try {
		if ((gps == null || EXTERNAL.equals(gps)) && hasValidGGAMessage()) {
			GGASentence ggaSentence = (GGASentence) SentenceFactory.getInstance().createParser(this.GGAMessage);
			double latitude = ggaSentence.getPosition().getLatitude();
			double longitude = ggaSentence.getPosition().getLongitude();
			latitude = CompassPoint.NORTH.equals(ggaSentence.getPosition().getLatHemisphere()) ? latitude : -latitude;
			longitude = CompassPoint.EAST.equals(ggaSentence.getPosition().getLonHemisphere()) ? longitude : -longitude;
			return new GPSLocation(longitude, latitude, this.externalGPSTimestamp);
		} else if ((gps == null || INTERNAL.equals(gps)) && isUsingInternalGPS()) {
			return new GPSLocation(this.location.getLongitude(), this.location.getLatitude(), this.internalGPSTimestamp);
		}
	}catch(Exception e){
		FLog.e("error when getting gps position for " + gps, e);
	}
	return null;
}
 
开发者ID:FAIMS,项目名称:faims-android,代码行数:18,代码来源:GPSDataManager.java

示例2: createRMC

import net.sf.marineapi.nmea.util.CompassPoint; //导入依赖的package包/类
public String createRMC(SignalKModel model) {
    if (model.get(vessels_dot_self_dot + nav_position_latitude) != null && model.get(vessels_dot_self_dot + nav_position_longitude) != null) {
        RMCSentence sen = (RMCSentence) sf.createParser(TalkerId.GP, SentenceId.RMC);
        sen.setDate(new Date());
        sen.setStatus(DataStatus.ACTIVE);
        sen.setMode(FaaMode.AUTOMATIC);
        sen.setPosition(new Position((double) model.get(vessels_dot_self_dot + nav_position_latitude), (double) model.get(vessels_dot_self_dot
            + nav_position_longitude)));
        if (model.getValue(vessels_dot_self_dot + nav_speedOverGround) != null) {
            sen.setSpeed((double) model.getValue(vessels_dot_self_dot + nav_speedOverGround) * MS_TO_KNOTS);
        }
        if (model.get(vessels_dot_self_dot + nav_courseOverGroundTrue) != null) {
            sen.setCourse(Math.toDegrees((double) model.getValue(vessels_dot_self_dot + nav_courseOverGroundTrue)));
        }
        if (model.get(vessels_dot_self_dot + nav_magneticVariation) != null) {
            Double variation = (Double) model.getValue(vessels_dot_self_dot + nav_magneticVariation);
            if (variation != null) {
                sen.setVariation(Math.toDegrees(Math.abs(variation)));
                sen.setDirectionOfVariation((variation < 0) ? CompassPoint.WEST : CompassPoint.EAST);
            }
        }
        return sen.toSentence();
    }
    return null;
}
 
开发者ID:SignalK,项目名称:signalk-core-java,代码行数:26,代码来源:NMEA0183Producer.java

示例3: insertGGA

import net.sf.marineapi.nmea.util.CompassPoint; //导入依赖的package包/类
/**
 * Process a GGA sentence.
 *
 * @param s sentence
 */
public void insertGGA(GGASentence s) {
    Reporting.report("GPS Reader", 4, "GGA sentence presented for processing");
    Reporting.report("GPS Reader", 6, "%s", s);
    if (s.getFixQuality() == GpsFixQuality.INVALID) {
        Reporting.report("GPS Reader", 5, "GGA fix quality INVALID");
        return;
    }
    Time t = s.getTime();
    GPSTime time = new GPSTime(t.getHour(), t.getMinutes(), (int) t.getSeconds());
    if (time.prior(oldtime)) {
        Reporting.report("GPS Reader", 5, "Ignoring historical GGA sentence at %s (previous time %s)\n%s",
                time.toString(), oldtime.toString(), s);
        return; // skip over GGA sentances which are historical
    }
    if (gpsdata == null) {
        gpsdata = new ConsolidatedGPSData();
    }
    gpsdata.time = time;
    oldtime = time;
    net.sf.marineapi.nmea.util.Position p = s.getPosition();
    gpsdata.altitude = new Altitude(p.getAltitude());
    gpsdata.position = new Position(
            new Latitude(p.getLatitude(), p.getLatitudeHemisphere() == CompassPoint.SOUTH ? 'S' : 'N'),
            new Longitude(p.getLongitude(), p.getLongitudeHemisphere() == CompassPoint.WEST ? 'W' : 'E')
    );
    gpsdata.satelliteCount = s.getSatelliteCount();
    gpsdata.setup |= ConsolidatedGPSData.GGASETUP;
}
 
开发者ID:The-Retired-Programmer,项目名称:gpssurvey,代码行数:34,代码来源:GPSMessageConsolidator.java


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