當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。