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


Java AMapUtils类代码示例

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


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

示例1: accept

import com.amap.api.maps.AMapUtils; //导入依赖的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: equals

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    BuildingPoint that = (BuildingPoint) o;
    if( AMapUtils.calculateLineDistance(latLng,that.latLng) < RMConfiguration.MAX_DISTANCE){
        return true;
    }
    if(StringUtils.isEmpty(buildName) && StringUtils.isEmpty(that.buildName)){
        return false;
    }
    return buildName != null ? buildName.equals(that.buildName) : that.buildName == null;

}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:20,代码来源:BuildingPoint.java

示例3: isWithinGroup

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 计算点是否在一组定位的范围内
 * */
public int isWithinGroup(LatLng a , List<LatLng> list , float distance){

    if(a == null || list == null || list.size() == 0 || distance <= 0){

        return Const.BAD_REQUEST;
    }

    for (LatLng latLng : list){

        float d = AMapUtils.calculateLineDistance(a, latLng);
        if(distance - d > 0){
            LogUtil.getIns(TAG).i(latLng.toString());
            return Const.WITHIN_AREA;
        }
    }

    return Const.WITHOUT_AREA;
}
 
开发者ID:larrySmile02,项目名称:MultipleViewMap,代码行数:22,代码来源:LocateLogic.java

示例4: startAMapNavi

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 调起高德地图导航功能,如果没安装高德地图,会进入异常,可以在异常中处理,调起高德地图app的下载页面
 */
public void startAMapNavi(Marker marker) {
	//构造导航参数
	NaviPara naviPara=new NaviPara();
	//设置终点位置
	naviPara.setTargetPoint(marker.getPosition());
	//设置导航策略,这里是避免拥堵
	naviPara.setNaviStyle(NaviPara.DRIVING_AVOID_CONGESTION);
	try {
		//调起高德地图导航
		AMapUtils.openAMapNavi(naviPara, getApplicationContext());
	} catch (com.amap.api.maps.AMapException e) {
		  //如果没安装会进入异常,调起下载页面
		 AMapUtils.getLatestAMapApp(getApplicationContext());
	}
	
	


}
 
开发者ID:Tsroad,项目名称:Road,代码行数:23,代码来源:PoiKeywordSearchActivity.java

示例5: getDistance

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
private float getDistance(List<AMapLocation> list) {
	float distance = 0;
	if (list == null || list.size() == 0) {
		return distance;
	}
	for (int i = 0; i < list.size() - 1; i++) {
		AMapLocation firstpoint = list.get(i);
		AMapLocation secondpoint = list.get(i + 1);
		LatLng firstLatLng = new LatLng(firstpoint.getLatitude(),
				firstpoint.getLongitude());
		LatLng secondLatLng = new LatLng(secondpoint.getLatitude(),
				secondpoint.getLongitude());
		double betweenDis = AMapUtils.calculateLineDistance(firstLatLng,
				secondLatLng);
		distance = (float) (distance + betweenDis);
	}
	return distance;
}
 
开发者ID:amapapi,项目名称:RecordPath3D,代码行数:19,代码来源:MainActivity.java

示例6: getCluster

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 根据一个点获取是否可以依附的聚合点,没有则返回null
 *
 * @param latLng
 * @return
 */
private Cluster getCluster(LatLng latLng,List<Cluster>clusters) {
    for (Cluster cluster : clusters) {
        LatLng clusterCenterPoint = cluster.getCenterLatLng();
        double distance = AMapUtils.calculateLineDistance(latLng, clusterCenterPoint);
        if (distance < mClusterDistance && mAMap.getCameraPosition().zoom < 19) {
            return cluster;
        }
    }

    return null;
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:18,代码来源:ClusterOverlay.java

示例7: onNewLocation

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
@Override
public long onNewLocation(TrackPoint trackPoint) {
    LatLng cur = new LatLng(trackPoint.getLatitude(), trackPoint.getLongitude());
    if(mCoordinateLists.isEmpty()){
        mCoordinateLists.add(trackPoint);
        return 0;
    }
    LatLng pre = mCoordinateLists.get(mCoordinateLists.size() - 1).getLocation();
    mCoordinateLists.add(trackPoint);
    mDurationDistance += AMapUtils.calculateLineDistance(pre, cur);
    return mDurationDistance;
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:13,代码来源:MoveTrackModel.java

示例8: isClosed

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
private boolean isClosed(TrackPoint cur,TrackPoint cmp){
    float distance = AMapUtils.calculateLineDistance(cur.getLocation(),cmp.getLocation());
    if(distance < RMConfiguration.MAX_DISTANCE){
        CFLog.e("Build","closed = "+distance);
        return true;
    }
    return false;
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:9,代码来源:BuildPresenterImpl.java

示例9: isWithin

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 计算两点间距离,返回是否在范围内
 * */
public boolean isWithin(LatLng a, LatLng b, float distance){

    if(a == null || b == null){
        return false;
    }
    float d = AMapUtils.calculateLineDistance(a, b);
    if(distance - d > 0){
        return true;
    }

    return false;
}
 
开发者ID:larrySmile02,项目名称:MultipleViewMap,代码行数:16,代码来源:LocateLogic.java

示例10: getCluster

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 根据一个点获取是否可以依附的聚合点,没有则返回null
 *
 * @param latLng
 * @return
 */
private Cluster getCluster(LatLng latLng, List<Cluster> clusters) {
    for (Cluster cluster : clusters) {
        LatLng clusterCenterPoint = cluster.getCenterLatLng();
        double distance = AMapUtils.calculateLineDistance(latLng, clusterCenterPoint);
        if (distance < mClusterDistance) {
            return cluster;
        }
    }
    return null;
}
 
开发者ID:xiaogu-space,项目名称:android-cluster-marker-master,代码行数:17,代码来源:ClusterOverlay.java

示例11: CaluteDistance

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
private void CaluteDistance() {
    //定位到当前位置并且获取相应经纬度
    mLocationClient = new AMapLocationClient(getActivity());
    mLocationOption = new AMapLocationClientOption();
    mLocationOption.setOnceLocation(true);
    mLocationClient.setLocationOption(mLocationOption);
    mLocationClient.startLocation();
    mLocationClient.setLocationListener(new AMapLocationListener() {

        @SuppressWarnings("static-access")
        @Override
        public void onLocationChanged(AMapLocation amapLocation) {
            if (amapLocation != null) {
                if (amapLocation.getErrorCode() == 0) {
                    latidue = amapLocation.getLatitude();//获取当前位置的纬度
                    longitude = amapLocation.getLongitude();//获取当前位置的经度
                    LatLng startLatlng = new LatLng(latidue, longitude);
                    Log.e("nihao",latidue+".........");
                    LatLng endLatlng = new LatLng(Float.valueOf(getArguments().getString("latidue").toString()), Float.valueOf(getArguments().getString("longitude").toString()));
                    Float distance = AMapUtils.calculateLineDistance(startLatlng, endLatlng);
                    //设置当前店铺大概离你多少距离
                    tv_distance.setText("约" + Math.round(distance) + "米");


                }
            }
        }
    });
}
 
开发者ID:CKTim,项目名称:MyApplication,代码行数:30,代码来源:Shopdetail_fragment.java

示例12: setPoints

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
/**
 * 设置平滑移动的经纬度数组
 *
 * @param points
 */
public void setPoints(List<LatLng> points) {
    this.points.clear();
    for (LatLng latLng : points) {
        this.points.add(latLng);
    }

    if (points.size() > 1) {
        endPoint = points.get(points.size() - 1);
        lastEndPoint = points.get(points.size() - 2);
    }

    eachDistance.clear();
    totalDistance = 0;

    //计算比例
    for (int i = 0; i < points.size() - 1; i++) {
        double distance = AMapUtils.calculateLineDistance(points.get(i), points.get(i + 1));
        eachDistance.add(distance);
        totalDistance += distance;
    }

    remainDistance = totalDistance;

    LatLng markerPoint = this.points.removeFirst();

    if (marker != null) {
        marker.setPosition(markerPoint);
        //判断是否使用正确的图标
        checkMarkerIcon();
    } else {
        if (descriptor == null) {
            useDefaultDescriptor = true;
        }
        marker = mAMap.addMarker(new MarkerOptions().belowMaskLayer(true).position
                (markerPoint).icon(descriptor).title("").anchor(0.5f, 0.5f));
    }

}
 
开发者ID:facexxyz,项目名称:SmoothMove,代码行数:44,代码来源:SmoothMarker.java

示例13: onCreate

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.set_trace);
    context = this;
    init();
    float f = 0;
    for (int i = 0; i < latlngList.size() - 1; i++) {
        f += AMapUtils.calculateLineDistance(latlngList.get(i),
                latlngList.get(i + 1));
    }
    Log.i("float", String.valueOf(f / 1000));
}
 
开发者ID:Tsroad,项目名称:Road,代码行数:14,代码来源:SetTraceActivity.java

示例14: getView

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    ViewHolder holder = null;
    if (view == null) {
        holder = new ViewHolder();
        view = getLayoutInflater().inflate(R.layout.item_device, null);
        holder.image = (ImageView) view.findViewById(R.id.image);
        holder.name = (TextView) view.findViewById(R.id.name);
        holder.state = (TextView) view.findViewById(R.id.state);
        holder.price = (TextView) view.findViewById(R.id.price);
        holder.address = (TextView) view.findViewById(R.id.address);
        holder.deviceState = (TextView) view.findViewById(R.id.device_state);
        holder.nearBy = (TextView) view.findViewById(R.id.nearby);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    MediaDevice mediaDevice = list.get(i);

    holder.name.setText(mediaDevice.getName());
    holder.state.setText(mediaDevice.parseBidState());
    holder.price.setText(String.valueOf(mediaDevice.getBasePrice()));
    holder.address.setText(mediaDevice.getAddress());
    holder.deviceState.setText(mediaDevice.parseDeviceState());
    if(mediaDevice.getDevicePictureUrls()!=null && !mediaDevice.getDevicePictureUrls().isEmpty()){
        Glide.with(context)
                .load(mediaDevice.getDevicePictureUrls().get(0))
                .into(holder.image);
    }else{
        Glide.with(context)
                .load("")
                .into(holder.image);
    }
    holder.nearBy.setVisibility(View.VISIBLE);
    LatLng latLng1 = new LatLng(
            new BigDecimal(Float.toString(mediaDevice.getLat())).doubleValue(),
            new BigDecimal(Float.toString(mediaDevice.getLng())).doubleValue());
    float distance = AMapUtils.calculateLineDistance(latLng,latLng1);
    if(distance < 1000){
        holder.nearBy.setText((int)distance+"m");
    }else{
        holder.nearBy.setText((int)(distance/1000)+"km");
    }
    return view;
}
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:47,代码来源:DeviceNearListActivity.java

示例15: getDistance

import com.amap.api.maps.AMapUtils; //导入依赖的package包/类
public static String getDistance(double longitude, double latitude) {
        double localLongitude = UserManager.getInstance().getCurrentUser().getLocation().getLongitude();
        double localLatitude = UserManager.getInstance().getCurrentUser().getLocation().getLatitude();
        int distance = (int) AMapUtils.calculateLineDistance(new LatLng(localLatitude, localLongitude), new LatLng(latitude, longitude));
        return distance + "";
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:7,代码来源:CommonUtils.java


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