當前位置: 首頁>>代碼示例>>Java>>正文


Java Parameters.setGpsAltitude方法代碼示例

本文整理匯總了Java中android.hardware.Camera.Parameters.setGpsAltitude方法的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.setGpsAltitude方法的具體用法?Java Parameters.setGpsAltitude怎麽用?Java Parameters.setGpsAltitude使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera.Parameters的用法示例。


在下文中一共展示了Parameters.setGpsAltitude方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setGpsParameters

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
public static void setGpsParameters(Parameters parameters, Location loc) {
	// Clear previous GPS location from the parameters.
	parameters.removeGpsData();

	// We always encode GpsTimeStamp
	parameters.setGpsTimestamp(System.currentTimeMillis() / 1000);

	// Set GPS location.
	if (loc != null) {
		double lat = loc.getLatitude();
		double lon = loc.getLongitude();
		boolean hasLatLon = (lat != 0.0d) || (lon != 0.0d);

		if (hasLatLon) {
			Log.d(TAG, "Set gps location");
			parameters.setGpsLatitude(lat);
			parameters.setGpsLongitude(lon);
			parameters.setGpsProcessingMethod(loc.getProvider()
					.toUpperCase());
			if (loc.hasAltitude()) {
				parameters.setGpsAltitude(loc.getAltitude());
			} else {
				// for NETWORK_PROVIDER location provider, we may have
				// no altitude information, but the driver needs it, so
				// we fake one.
				parameters.setGpsAltitude(0);
			}
			if (loc.getTime() != 0) {
				// Location.getTime() is UTC in milliseconds.
				// gps-timestamp is UTC in seconds.
				long utcTimeSeconds = loc.getTime() / 1000;
				parameters.setGpsTimestamp(utcTimeSeconds);
			}
		} else {
			loc = null;
		}
	}
}
 
開發者ID:hubert1002,項目名稱:WiCamera3D,代碼行數:39,代碼來源:Util.java

示例2: setGpsParameters

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
public static void setGpsParameters(Parameters parameters, Location loc) {
    // Clear previous GPS location from the parameters.
    parameters.removeGpsData();

    // We always encode GpsTimeStamp
    parameters.setGpsTimestamp(System.currentTimeMillis() / 1000);

    // Set GPS location.
    if (loc != null) {
        double lat = loc.getLatitude();
        double lon = loc.getLongitude();
        boolean hasLatLon = (lat != 0.0d) || (lon != 0.0d);

        if (hasLatLon) {
            Log.d(TAG, "Set gps location");
            parameters.setGpsLatitude(lat);
            parameters.setGpsLongitude(lon);
            parameters.setGpsProcessingMethod(loc.getProvider().toUpperCase());
            if (loc.hasAltitude()) {
                parameters.setGpsAltitude(loc.getAltitude());
            } else {
                // for NETWORK_PROVIDER location provider, we may have
                // no altitude information, but the driver needs it, so
                // we fake one.
                parameters.setGpsAltitude(0);
            }
            if (loc.getTime() != 0) {
                // Location.getTime() is UTC in milliseconds.
                // gps-timestamp is UTC in seconds.
                long utcTimeSeconds = loc.getTime() / 1000;
                parameters.setGpsTimestamp(utcTimeSeconds);
            }
        } else {
            loc = null;
        }
    }
}
 
開發者ID:asm-products,項目名稱:nexus-camera,代碼行數:38,代碼來源:CameraUtil.java


注:本文中的android.hardware.Camera.Parameters.setGpsAltitude方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。