com.baidu.mapapi.map.MapStatus Java Examples

The following examples show how to use com.baidu.mapapi.map.MapStatus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From BaiDuMapSelectDemo with Apache License 2.0 6 votes vote down vote up
/**
 * 根据获取到的位置在地图上移动“我”的位置
 *
 * @param location
 */
private void navigateTo(BDLocation location) {
    double longitude = location.getLongitude();
    double latitude = location.getLatitude();
    String address = location.getAddrStr();
    if (isFirstLocation) {
        currentLatLng = new LatLng(latitude, longitude);
        MapStatus.Builder builder = new MapStatus.Builder();
        MapStatus mapStatus = builder.target(currentLatLng).zoom(17.0f).build();
        mBaiduMap.animateMapStatus(MapStatusUpdateFactory
                .newMapStatus(mapStatus));
        isFirstLocation = false;

        //反向地理解析(含有poi列表)
        mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption()
                .location(currentLatLng));
    }
    MyLocationData.Builder locationBuilder = new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    MyLocationData locationData = locationBuilder.build();
    mBaiduMap.setMyLocationData(locationData);
}
 
Example #2
Source File: TrafficShowPresenter.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomToSpan() {
    if (mapView != null) {
        try {
            mapView.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmCustomPoiOverlay.super.zoomToSpan();
                    if (mTrafficShowView.getPoiListBox().getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #3
Source File: BaiduMapRouteFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {

    if (mBaiduMap.getMaxZoomLevel() <= mapStatus.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mBaiduMap.getMinZoomLevel() >= mapStatus.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #4
Source File: TrafficShowPresenter.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomToSpan() {
    if (mapView != null) {
        try {
            mapView.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmPoiOverlay.super.zoomToSpan();
                    if (mTrafficShowView.getPoiListBox().getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #5
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {

    if (mBaiduMap.getMaxZoomLevel() <= mapStatus.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mBaiduMap.getMinZoomLevel() >= mapStatus.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }

    mSearchInteracter.searchLatLng(mapStatus.target.latitude, mapStatus.target.longitude, 2, this);

}
 
Example #6
Source File: MainActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
public void onMapStatusChangeFinish(MapStatus mapStatus) {
    String _str = mapStatus.toString();
    String _regex = "target lat: (.*)\ntarget lng";
    String _regex2 = "target lng: (.*)\ntarget screen x";
    changeLatitude = Double.parseDouble(latlng(_regex, _str));
    changeLongitude = Double.parseDouble(latlng(_regex2, _str));
    LatLng changeLL = new LatLng(changeLatitude, changeLongitude);
    startNodeStr = PlanNode.withLocation(changeLL);
    Log.d(TAG, "changeLatitude-----change--------" + changeLatitude);
    Log.d(TAG, "changeLongitude-----change--------" + changeLongitude);
    if (!isNeedCurrentlocation) {
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(changeLL);
        baiduMap.setMapStatus(u);
        if (Math.hypot((changeLatitude - currentLatitude),
                (changeLongitude - currentLongitude)) > 0.00001) {
            Logger.d(Math.hypot((changeLatitude - currentLatitude),
                    (changeLongitude - currentLongitude)));
            if (routeOverlay != null)
                routeOverlay.removeFromMap();
            addOverLayout(changeLatitude, changeLongitude);
        }

    }
}
 
Example #7
Source File: MainActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void cancelBook() {
    if (isNeedLogin) {
        mLogin.setVisibility(View.VISIBLE);
    } else {
        mLogin.setVisibility(View.GONE);
    }
    mBikeInfoBoard.setVisibility(View.GONE);
    countDownTimer.cancel();
    mBikeOrderBoard.setVisibility(View.GONE);
    //        confirm_cancel_layout.setVisibility(View.GONE);
    //        prompt.setVisibility(View.GONE);
    //        bike_distance_layout.setVisibility(View.VISIBLE);
    //        bike_distance_layout.setVisibility(View.VISIBLE);
    mBtLoginOrorder.setVisibility(View.VISIBLE);
    if (routeOverlay != null)
        routeOverlay.removeFromMap();
    MapStatus.Builder builder = new MapStatus.Builder();
    //地图缩放比设置为18
    builder.target(currentLL).zoom(18.0f);
    baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #8
Source File: NaviConfirmPointActivity.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 **/
@Override
public void zoomToSpan() {
    if (mAncpMap != null) {
        try {
            mAncpMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmPoiOverlay.super.zoomToSpan();
                    if (mAncpPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        /* 设置地图操作中心点在屏幕中的坐标 */
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        /* 以动画的方式更新地图状态,耗时300ms */
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 500);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #9
Source File: BaiduMapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
public void setModeEDog(boolean isChecked) {

        if (isChecked) {

            if (null != mBaiduMap.getLocationConfiguration() && mBaiduMap.getLocationConfiguration().locationMode != MyLocationConfiguration.LocationMode.COMPASS) {
                mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.COMPASS, true, null));
                btnLocation.setImageResource(R.drawable.ic_explore_24dp);
            }
            mIsModeEDog = true;
        } else {
            if (null != mBaiduMap.getLocationConfiguration() && mBaiduMap.getLocationConfiguration().locationMode == MyLocationConfiguration.LocationMode.COMPASS) {
                mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null));
                btnLocation.setImageResource(R.drawable.ic_my_location_24dp);
                MapStatus.Builder builder = new MapStatus.Builder().rotate(0).overlook(90);
                mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
            }
            mIsModeEDog = false;

        }
    }
 
Example #10
Source File: NaviConfirmPointActivity.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomToSpan() {
    if (mAncpMap != null) {
        try {
            mAncpMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmCustomPoiOverlay.super.zoomToSpan();
                    if (mAncpPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 500);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #11
Source File: AddressEditDelegate.java    From FastWaiMai with MIT License 6 votes vote down vote up
/**
 * 根据收货地址的位置在地图上移动"我"的位置
 */
private void navigateTo(double longitude, double latitude) {
	if (isFirstLocation) {
		currentLatLng = new LatLng(latitude, longitude);
		MapStatus.Builder builder = new MapStatus.Builder();
		MapStatus mapStatus = builder.target(currentLatLng).zoom(17.0f).build();
		mBaiduMap.animateMapStatus(MapStatusUpdateFactory
				.newMapStatus(mapStatus));
		isFirstLocation = false;

		//反向地理解析(含有poi列表)
		mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption()
				.location(currentLatLng));
	}
	MyLocationData.Builder locationBuilder = new MyLocationData.Builder();
	locationBuilder.latitude(latitude);
	locationBuilder.longitude(longitude);
	MyLocationData locationData = locationBuilder.build();
	mBaiduMap.setMyLocationData(locationData);
}
 
Example #12
Source File: AddressEditDelegate.java    From FastWaiMai with MIT License 6 votes vote down vote up
/**
 * 根据获取到的位置在地图上移动"我"的位置
 *
 * @param location
 */
private void navigateTo(BDLocation location) {
	double longitude = location.getLongitude();
	double latitude = location.getLatitude();
	String address = location.getAddrStr();
	if (isFirstLocation) {
		currentLatLng = new LatLng(latitude, longitude);
		MapStatus.Builder builder = new MapStatus.Builder();
		MapStatus mapStatus = builder.target(currentLatLng).zoom(17.0f).build();
		mBaiduMap.animateMapStatus(MapStatusUpdateFactory
				.newMapStatus(mapStatus));
		isFirstLocation = false;

		//反向地理解析(含有poi列表)
		mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption()
				.location(currentLatLng)
				.radius(radius));
	}
	MyLocationData.Builder locationBuilder = new MyLocationData.Builder();
	locationBuilder.latitude(location.getLatitude());
	locationBuilder.longitude(location.getLongitude());
	MyLocationData locationData = locationBuilder.build();
	mBaiduMap.setMyLocationData(locationData);
}
 
Example #13
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation bdLocation) {
    //查看定位结果
    Log.d("Tag", "定位返回----" + bdLocation.getAddrStr());

    //定位成功后,把定位的点,设置地图的中心点
    //包装经纬,从定位信息中,获取经纬度
    LatLng currentLatLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());

    //构建地图状态
    MapStatus status = new MapStatus.Builder()
            //包装经纬度
            .target(currentLatLng)
            //缩放等级
            .zoom(15)
            //构建
            .build();
    //通过地图工厂设置地图状态
    MapStatusUpdate update = MapStatusUpdateFactory.newMapStatus(status);
    //更新地图界面
    mBaiduMap.setMapStatus(update);

}
 
Example #14
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
public void setModeEDog(boolean isChecked) {

        if (isChecked) {

            if (null != mBaiduMap.getLocationConfiguration() && mBaiduMap.getLocationConfiguration().locationMode != MyLocationConfiguration.LocationMode.COMPASS) {
                mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.COMPASS, true, null));
                btnLocation.setImageResource(R.drawable.ic_explore_24dp);
            }
            mIsModeEDog = true;
        } else {
            if (null != mBaiduMap.getLocationConfiguration() && mBaiduMap.getLocationConfiguration().locationMode == MyLocationConfiguration.LocationMode.COMPASS) {
                mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null));
                btnLocation.setImageResource(R.drawable.ic_my_location_24dp);
                MapStatus.Builder builder = new MapStatus.Builder().rotate(0).overlook(90);
                mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
            }
            mIsModeEDog = false;

        }
    }
 
Example #15
Source File: SetFavoriteMapActivity.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomToSpan() {
    if (mAmosfMap != null) {
        try {
            mAmosfMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmPoiOverlay.super.zoomToSpan();
                    if (mAmosfPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #16
Source File: SetFavoriteMapActivity.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomToSpan() {
    if (mAmosfMap != null) {
        try {
            mAmosfMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmCustomPoiOverlay.super.zoomToSpan();
                    if (mAmosfPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #17
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {

    if (mBaiduMap.getMaxZoomLevel() <= mapStatus.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mBaiduMap.getMinZoomLevel() >= mapStatus.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }

    mSearchInteracter.searchLatLng(mapStatus.target.latitude, mapStatus.target.longitude, 2, this);

}
 
Example #18
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #19
Source File: MapActivity.java    From foodie-app with Apache License 2.0 5 votes vote down vote up
private void startLocationOverlap() {
    //开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    //构造定位数据
    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(mLocation.getRadius())
            // 此处设置开发者获取到的方向信息,顺时针0-360
            .direction(100).latitude(mLocation.getLatitude())
            .longitude(mLocation.getLongitude()).build();
    // 设置定位数据
    mBaiduMap.setMyLocationData(locData);
    // 设置定位图层的配置(定位模式,是否允许方向信息,用户自定义定位图标)
    //构建Marker图标
    BitmapDescriptor bitmap = BitmapDescriptorFactory
            .fromResource(R.drawable.my_location);
    //bitmap.
    MyLocationConfiguration config = new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, bitmap);
    mBaiduMap.setMyLocationConfigeration(config);
    //中心点为我的位置
    LatLng cenpt = new LatLng(locData.latitude, locData.longitude);
    //定义地图状态
    MapStatus mMapStatus = new MapStatus.Builder()
            .target(cenpt)
            .zoom(mCurrentLevel)
            .build();
    //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
    MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
    //改变地图状态
    mBaiduMap.setMapStatus(mMapStatusUpdate);
    // 当不需要定位图层时关闭定位图层
    //mBaiduMap.setMyLocationEnabled(false);
}
 
Example #20
Source File: BaiduMapRouteFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #21
Source File: BaiduMapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #22
Source File: RouteBaiduBusActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {
    if (mBaiduMap.getMaxZoomLevel() <= mapStatus.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mBaiduMap.getMinZoomLevel() >= mapStatus.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #23
Source File: TrafficShowPresenter.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
private void setPoiPosition() {
    if (aList.size() == 0 || poiOverlay == null)
        return;
    if (aList.size() == 1) {
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
                .targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
                .zoom(17F);
        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
    } else
        poiOverlay.zoomToSpan();
}
 
Example #24
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #25
Source File: BaiduMapRouteFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #26
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapStatusChangeFinish(MapStatus mapStatus) {
    if (mBaiduMap.getMaxZoomLevel() <= mapStatus.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mBaiduMap.getMinZoomLevel() >= mapStatus.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #27
Source File: NaviConfirmPointActivity.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 设置检索结果显示索引(若有多个结果则地图缩放到保证所有结果可见)
 **/
private void setPoiPosition() {
    if (aList.size() == 0 || poiOverlay == null)
        return;
    if (aList.size() == 1) {
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
                .targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
                .zoom(17F);
        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
    } else
        poiOverlay.zoomToSpan();
}
 
Example #28
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(getActivity());

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
Example #29
Source File: ClusterManager.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
@Override
public void onMapStatusChange(MapStatus mapStatus) {
    if (mRenderer instanceof BaiduMap.OnMapStatusChangeListener) {
        ((BaiduMap.OnMapStatusChangeListener) mRenderer).onMapStatusChange(mapStatus);
    }

    // Don't re-compute clusters if the map has just been panned/tilted/rotated.
    MapStatus position = mMap.getMapStatus();
    if (mPreviousCameraPosition != null && mPreviousCameraPosition.zoom == position.zoom) {
        return;
    }
    mPreviousCameraPosition = mMap.getMapStatus();

    cluster();
}
 
Example #30
Source File: RouteBaiduBusActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void setCacheMapStatus() {
    CacheInteracter cacheInteracter = new CacheInteracter(this);

    LatLng latLng = new LatLng(cacheInteracter.getLatitude(), cacheInteracter.getLongitude());
    MapStatus.Builder builder = new MapStatus.Builder();
    builder.target(latLng).zoom(14.5f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}