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


Java LatLngBounds类代码示例

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


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


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