当前位置: 首页>>代码示例>>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;未经允许,请勿转载。