• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LatLngBounds类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawFence

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:19,代码来源:GeoFence_District_Activity.java


示例2: drawFence

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));

	removeMarkers();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:21,代码来源:GeoFence_Nearby_Activity.java


示例3: drawFence

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void drawFence(GeoFence fence) {
	switch (fence.getType()) {
		case GeoFence.TYPE_ROUND :
		case GeoFence.TYPE_AMAPPOI :
			drawCircle(fence);
			break;
		case GeoFence.TYPE_POLYGON :
		case GeoFence.TYPE_DISTRICT :
			drawPolygon(fence);
			break;
		default :
			break;
	}

	// 设置所有maker显示在当前可视区域地图中
	LatLngBounds bounds = boundsBuilder.build();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
	polygonPoints.clear();
	removeMarkers();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:21,代码来源:GeoFence_Polygon_Activity.java


示例4: setRegion

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
    if (region == null) return;
    AMap map = mapView.getMap();
    Double lat = region.getDouble("latitude");
    Double lng = region.getDouble("longitude");
    Double lngDelta = region.getDouble("longitudeDelta");
    Double latDelta = region.getDouble("latitudeDelta");
    LatLngBounds bounds = new LatLngBounds(
        new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
        new LatLng(lat + latDelta / 2, lng + lngDelta / 2)  // northeast
    );
    if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
        boundsToMove = bounds;
    } else {
        map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:20,代码来源:AMapViewManager.java


示例5: getExpandedBounds

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private LatLngBounds getExpandedBounds(LatLngBounds bounds) {
	if (bounds != null && options != null) {
		double expandBoundsFactor = options.getExpandBoundsFactor();

		boolean spans180Meridian = bounds.northeast.longitude < bounds.southwest.longitude;

		double distanceFromNorthToSouth = bounds.northeast.latitude - bounds.southwest.latitude;
		double distanceFromEastToWest;
		if (spans180Meridian == false) {
			distanceFromEastToWest = bounds.northeast.longitude - bounds.southwest.longitude;
		} else {
			distanceFromEastToWest = (180 + bounds.northeast.longitude) + (180 - bounds.southwest.longitude);
		}

		double expandLatitude = distanceFromNorthToSouth * expandBoundsFactor;
		double expandLongitude = distanceFromEastToWest * expandBoundsFactor;

		LatLng newNortheast = new LatLng(bounds.northeast.latitude + expandLatitude, bounds.northeast.longitude + expandLongitude);
		LatLng newSouthwest = new LatLng(bounds.southwest.latitude - expandLatitude, bounds.southwest.longitude - expandLongitude);

		return new LatLngBounds(newSouthwest, newNortheast);
	}
	return null;
}
 
开发者ID:mikezit,项目名称:cluster-amap,代码行数:25,代码来源:ClustersBuilder.java


示例6: calculateClusters

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void calculateClusters() {
    mIsCanceled = false;
    mClusters.clear();
    LatLngBounds visibleBounds = mAMap.getProjection().getVisibleRegion().latLngBounds;
    for (ClusterItem clusterItem : mClusterItems) {
        if (mIsCanceled) {
            return;
        }
        LatLng latlng = clusterItem.getPosition();
        if (visibleBounds.contains(latlng)) {
            Cluster cluster = getCluster(latlng,mClusters);
            if (cluster != null) {
                cluster.addClusterItem(clusterItem);
            } else {
                cluster = new Cluster(latlng);
                mClusters.add(cluster);
                cluster.addClusterItem(clusterItem);
            }

        }
    }

    //复制一份数据,规避同步
    List<Cluster> clusters = new ArrayList<Cluster>();
    clusters.addAll(mClusters);
    Message message = Message.obtain();
    message.what = MarkerHandler.ADD_CLUSTER_LIST;
    message.obj = clusters;
    if (mIsCanceled) {
        return;
    }
    mMarkerhandler.sendMessage(message);
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:34,代码来源:ClusterOverlay.java


示例7: zoomToSpan

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
public void zoomToSpan(){
    if (mRankEntities != null && mRankEntities.size() > 0) {
        if (mAMap == null)
            return;
        LatLngBounds bounds = getLatLngBounds(mRankEntities);
        mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
    }
}
 
开发者ID:amap-demo,项目名称:android-collision-marker,代码行数:9,代码来源:RankerOverlay.java


示例8: getLatLngBounds

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
/**
 * 根据自定义内容获取缩放bounds
 */
private LatLngBounds getLatLngBounds( List<RankEntity> RankEntitiesList) {
    LatLngBounds.Builder b = LatLngBounds.builder();
    for (int i = 0; i < RankEntitiesList.size(); i++) {
        LatLng p = RankEntitiesList.get(i).getPosition();
        b.include(p);
    }
    return b.build();
}
 
开发者ID:amap-demo,项目名称:android-collision-marker,代码行数:12,代码来源:RankerOverlay.java


示例9: scaleCurrentCamera

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
@Override
public void scaleCurrentCamera() {
    CameraPosition position = mapObject.getController().getCameraPosition();
    List<TrackPoint> trackPoints = mMoveModel.getHistoryCoordiates();
    LatLng start = new LatLng(trackPoints.get(0).getLatitude(), trackPoints.get(0).getLongitude());
    LatLng end = new LatLng(trackPoints.get(trackPoints.size() - 1).getLatitude(), trackPoints.get(trackPoints.size() - 1).getLongitude());
    CameraUpdate update = CameraUpdateFactory.newLatLngBounds(new LatLngBounds(start, end), (int) (position.zoom - 6));
    mapObject.moveToSpecficCamera(update);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:10,代码来源:TrackPresenterImpl.java


示例10: onClick

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
@Override
public void onClick(Marker marker, List<ClusterItem> clusterItems) {
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (ClusterItem clusterItem : clusterItems) {
        builder.include(clusterItem.getPosition());
    }
    LatLngBounds latLngBounds = builder.build();
    mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 0));
}
 
开发者ID:xiaogu-space,项目名称:android-cluster-marker-master,代码行数:10,代码来源:MainActivity.java


示例11: calculateClusters

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void calculateClusters() {
    mIsCanceled = false;
    mClusters.clear();
    LatLngBounds visibleBounds = mAMap.getProjection().getVisibleRegion().latLngBounds;
    for (ClusterItem clusterItem : mClusterItems) {
        if (mIsCanceled) {
            return;
        }
        LatLng latlng = clusterItem.getPosition();
        if (visibleBounds.contains(latlng)) {
            Cluster cluster = getCluster(latlng, mClusters);
            if (cluster != null) {
                cluster.addClusterItem(clusterItem);
            } else {
                cluster = new Cluster(latlng);
                mClusters.add(cluster);
                cluster.addClusterItem(clusterItem);
            }

        }
    }
    //复制一份数据,规避同步
    List<Cluster> clusters = new ArrayList<Cluster>();
    clusters.addAll(mClusters);
    Message message = Message.obtain();
    message.what = MarkerHandler.ADD_CLUSTER_LIST;
    message.obj = clusters;
    if (mIsCanceled) {
        return;
    }
    mMarkerhandler.sendMessage(message);
}
 
开发者ID:xiaogu-space,项目名称:android-cluster-marker-master,代码行数:33,代码来源:ClusterOverlay.java


示例12: zoomToSpan

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
/**
 * 移动镜头到当前的视角。
 * @since V2.1.0
 */
public void zoomToSpan(){
    if (startPoint != null){
        if (mAMap == null){
            return;
        }
        try{
            LatLngBounds bounds = getLatLngBounds();
            mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds,50));
        }catch (Throwable e){
            e.printStackTrace();
        }
    }
}
 
开发者ID:yimiaoxiehou,项目名称:ZhuHaiBusApplication,代码行数:18,代码来源:RouteOverlay.java


示例13: onClick

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
@Override
public void onClick(Marker marker, List<ClusterItem> clusterItems) {

    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (ClusterItem clusterItem : clusterItems) {
        builder.include(clusterItem.getPosition());
    }
    LatLngBounds latLngBounds = builder.build();
    mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 0)
    );
}
 
开发者ID:amap-demo,项目名称:android-cluster-marker,代码行数:12,代码来源:MainActivity.java


示例14: getBounds

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private LatLngBounds getBounds() {
	LatLngBounds.Builder b = LatLngBounds.builder();
	if (mOriginLatLngList == null) {
		return b.build();
	}
	for (int i = 0; i < mOriginLatLngList.size(); i++) {
		b.include(mOriginLatLngList.get(i));
	}
	return b.build();

}
 
开发者ID:amapapi,项目名称:RecordPath3D,代码行数:12,代码来源:RecordShowActivity.java


示例15: centerPoints

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
public static void centerPoints(AMap map, List<LatLng> points){
	if(points == null || points.size() < 2){
		return;
	}
	
	LatLng first = points.get(0);
	double minLat = first.latitude;
	double maxLat = first.latitude;
	double minLon = first.longitude;
	double maxLon = first.longitude;
	for(int i = 1, num = points.size() ; i < num ; i++){
		LatLng t = points.get(i);
		if(t.latitude > maxLat){
			maxLat = t.latitude;
		}
		if(t.latitude < minLat){
			minLat = t.latitude;
		}
		if(t.longitude > maxLon){
			maxLon = t.longitude;
		}
		if(t.longitude < minLon){
			minLon = t.longitude;
		}
	}
			
	LatLngBounds bounds = new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon));
	map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5));
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:30,代码来源:MapUtil.java


示例16: centerTrackPoints

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
public static void centerTrackPoints(AMap map, List<TrackPoint> points){
	if(points == null || points.size() < 2){
		return;
	}
	
	TrackPoint first = points.get(0);
	double minLat = first.getLatitude();
	double maxLat = first.getLatitude();
	double minLon = first.getLongitude();
	double maxLon = first.getLongitude();
	for(int i = 1, num = points.size() ; i < num ; i++){
		TrackPoint t = points.get(i);
		if(t.getPointStatus() == TrackPointStatus.normal.getValue()){
			if(t.getLatitude() > maxLat){
				maxLat = t.getLatitude();
			}
			if(t.getLatitude() < minLat){
				minLat = t.getLatitude();
			}
			if(t.getLongitude() > maxLon){
				maxLon = t.getLongitude();
			}
			if(t.getLongitude() < minLon){
				minLon = t.getLongitude();
			}
		}
	}
			
	LatLngBounds bounds = new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon));
	map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5));
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:32,代码来源:MapUtil.java


示例17: zoomMarker

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
private void zoomMarker() {
    JUtils.Log("zoomMarker"+mMyLocation.getPosition().toString()+":"+mPlaceLocation.getPosition().toString());
    mMapView.postDelayed(() -> {
        LatLngBounds.Builder boundsBuild = new LatLngBounds.Builder();
        boundsBuild.include(mMyLocation.getPosition());
        boundsBuild.include(mPlaceLocation.getPosition());
        mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(boundsBuild.build(), 10));
        mAMap.moveCamera(CameraUpdateFactory.zoomOut());
    },100);
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:11,代码来源:PlaceMapPathActivity.java


示例18: zoomMarker

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
/**
 *  不用post会报“the map must have a size”错误,why
 *
 * @param place
 */
private void zoomMarker(ArrayList<PlaceBrief> place) {
    mMapView.post(() -> {
        LatLngBounds.Builder boundsBuild = new LatLngBounds.Builder();
        boundsBuild.include(mMyLocation.getPosition());
        for (PlaceBrief placeBrief : place) {
            boundsBuild.include(new LatLng(placeBrief.getLat(), placeBrief.getLng()));
        }
        aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(boundsBuild.build(), 10));
    });
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:16,代码来源:PlaceMapFragment.java


示例19: getBoundsOfInputPoints

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
LatLngBounds getBoundsOfInputPoints() {
	if (boundsOfInputPoints == null) {
		LatLngBounds.Builder builder = LatLngBounds.builder();
		for (InputPoint inputPoint : pointsInClusterList) {
			builder.include(inputPoint.getMapPosition());
		}
		boundsOfInputPoints = builder.build();
	}
	return boundsOfInputPoints;
}
 
开发者ID:mikezit,项目名称:cluster-amap,代码行数:11,代码来源:ClusterPoint.java


示例20: addAll

import com.amap.api.maps.model.LatLngBounds; //导入依赖的package包/类
void addAll(ArrayList<InputPoint> points) {
	if (points != null) {
		Projection projection = getProjection();
		VisibleRegion visibleRegion = getVisibleRegion();
		if (projection != null && visibleRegion != null) {
			LatLngBounds bounds = getExpandedBounds(visibleRegion.latLngBounds);
			for (InputPoint point : points) {
				addIfNecessary(point, projection, bounds);
			}
		}
	}
}
 
开发者ID:mikezit,项目名称:cluster-amap,代码行数:13,代码来源:ClustersBuilder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BoundKind类代码示例发布时间:2022-05-21
下一篇:
Java Settings类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap