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


Java AMapLocation.getSpeed方法代码示例

本文整理汇总了Java中com.amap.api.location.AMapLocation.getSpeed方法的典型用法代码示例。如果您正苦于以下问题:Java AMapLocation.getSpeed方法的具体用法?Java AMapLocation.getSpeed怎么用?Java AMapLocation.getSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amap.api.location.AMapLocation的用法示例。


在下文中一共展示了AMapLocation.getSpeed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: accept

import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public boolean accept(AMapLocation previous, AMapLocation current) {
    if(previous == null){
        return true;
    }
    LatLng pre = new LatLng(previous.getLatitude(), previous.getLongitude());
    LatLng cur = new LatLng(current.getLatitude(), current.getLongitude());
    float distance = AMapUtils.calculateLineDistance(pre, cur);
    if(distance < RMConfiguration.DRAW_DISTANCE){
        return false;
    }
    float speed = current.getSpeed();
    double interval = (SystemClock.elapsedRealtime() - mPreviousUpdateTime)/1000.0;
    float v = (float) (distance/interval);
    if(v > RMConfiguration.MAX_SPEED || v > speed * 1.5){
        return false;
    }
    mPreviousUpdateTime = SystemClock.elapsedRealtime();
    return true;
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:21,代码来源:SpeedAndDistanceFilter.java

示例2: onLocationChanged

import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public void onLocationChanged(AMapLocation amapLocation) {
    if (amapLocation != null && amapLocation.getErrorCode() == 0) {
        Double latitude = amapLocation.getLatitude();
        Double longitude = amapLocation.getLongitude();
        boolean hasAccuracy = amapLocation.hasAccuracy();
        float accuracy = amapLocation.getAccuracy();
        String address = amapLocation.getAddress();
        String province = amapLocation.getProvince();
        String road = amapLocation.getRoad();
        float speed = amapLocation.getSpeed();
        float bearing = amapLocation.getBearing();
        int satellites = amapLocation.getExtras().getInt("satellites", 0);
        long time = amapLocation.getTime();

        JSONObject jo = new JSONObject();
        try {
            jo.put("latitude", latitude);
            jo.put("longitude", longitude);
            jo.put("hasAccuracy", hasAccuracy);
            jo.put("accuracy", accuracy);
            jo.put("address", address);
            jo.put("province", province);
            jo.put("road", road);
            jo.put("speed", speed);
            jo.put("bearing", bearing);
            jo.put("satellites", satellites);
            jo.put("time", time);

        } catch (JSONException e) {
            jo = null;
            e.printStackTrace();
        }
        callbackContext.success(jo);
    } else {
        callbackContext.error(amapLocation.getErrorInfo());
    }
}
 
开发者ID:starwander,项目名称:cordova-plugin-amap-navi,代码行数:39,代码来源:AMapLoc.java

示例3: getLocationDelay

import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
private int getLocationDelay(AMapLocation location){
    int interval;
    if(location.getProvider().equals("lbs"))
        interval = MAX_LOCATION_DELAY;
    else{
        float speed = location.getSpeed();
        interval = (int) (MAX_LOCATION_DELAY - speed * (MAX_LOCATION_DELAY - MIN_LOCATION_DELAY) / 10);
        if(interval < MIN_LOCATION_DELAY)
            interval = MIN_LOCATION_DELAY;
    }
    return interval;
}
 
开发者ID:gghyoo,项目名称:CarPathRecorder,代码行数:13,代码来源:LocationService.java

示例4: onLocationChanged

import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aLocation) {
	if (mListener != null && aLocation != null
			&& aLocation.getAMapException().getErrorCode() == 0) {
		latitude = aLocation.getLatitude();
		longitude = aLocation.getLongitude();
		if (aLocation.getProvider().equals("gps")) {
			speed = aLocation.getSpeed();
			provider = "gps";
		} else if (aLocation.getProvider().equals("lbs")) {
			provider = "lbs";
		}
		mListener.onLocationChanged(aLocation);
	}
}
 
开发者ID:jp1017,项目名称:SmallDogAssistant,代码行数:16,代码来源:LocationService.java


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