本文整理匯總了Java中com.baidu.mapapi.map.MapStatusUpdateFactory.newLatLng方法的典型用法代碼示例。如果您正苦於以下問題:Java MapStatusUpdateFactory.newLatLng方法的具體用法?Java MapStatusUpdateFactory.newLatLng怎麽用?Java MapStatusUpdateFactory.newLatLng使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baidu.mapapi.map.MapStatusUpdateFactory
的用法示例。
在下文中一共展示了MapStatusUpdateFactory.newLatLng方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: moveToMe
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
private void moveToMe(BDLocation location)
{
MapStatusUpdate mapUpdate=MapStatusUpdateFactory.zoomTo(18);
baiduMap.setMapStatus(mapUpdate);
//開始移動
MapStatusUpdate mapLatlng=MapStatusUpdateFactory.newLatLng(new LatLng(location.getLatitude(),location.getLongitude()));
baiduMap.setMapStatus(mapLatlng);
//顯示我的位置
MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
locationBuilder.latitude(location.getLatitude());
locationBuilder.longitude(location.getLongitude());
MyLocationData locationData=locationBuilder.build();
baiduMap.setMyLocationData(locationData);
//顯示用戶所在地附近
Toast.makeText(this,"您當前在"+location.getAddrStr()+"附近",Toast.LENGTH_SHORT).show();
}
示例2: navigateTo
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
public void navigateTo(BDLocation location){
if(isFirstLocate){
LatLng latLng=new LatLng(location.getLatitude(),location.getLongitude());
showToast("定位到當前位置已執行");
MapStatusUpdate update=MapStatusUpdateFactory.zoomTo(8f);
baiduMap.animateMapStatus(update);
update= MapStatusUpdateFactory.newLatLng(latLng);
baiduMap.animateMapStatus(update);
isFirstLocate=false;
}
MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
locationBuilder.latitude(location.getLatitude());
locationBuilder.longitude(location.getLongitude());
baiduMap.setMyLocationData(locationBuilder.build());
}
示例3: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation bdLocation) {
mLastLocationData=bdLocation;
MyLocationData myLocationData=new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude())
.build();
mBaiduMap.setMyLocationData(myLocationData);
MapStatusUpdate msu1 = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu1);
if(isFirstIn){
LatLng ll=new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude());
MapStatusUpdate msu=MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.setMapStatus(msu);
isFirstIn=false;
}
}
示例4: onMapStatusChangeFinish
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
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);
}
}
}
示例5: navigateTo
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
/**
* des:地圖跳到指定位置
*
* @param location
*/
private void navigateTo(BDLocation location) {
if (isFirstLocation) {
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll);
baiduMap.animateMapStatus(update);
update = MapStatusUpdateFactory.zoomTo(18f);
baiduMap.animateMapStatus(update);
isFirstLocation = false;
}
MyLocationData.Builder builder = new MyLocationData.Builder();
builder.latitude(location.getLatitude());
builder.longitude(location.getLongitude());
MyLocationData data = builder.build();
baiduMap.setMyLocationData(data);
}
示例6: onMarkerClick
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public boolean onMarkerClick(Marker marker) {
Log.d("lml", "MapFragment:覆蓋物被點擊");
baiduMap.hideInfoWindow();
if (marker != null) {
latLngshow = marker.getPosition();
reverseGeoCodeOption.location(latLngshow);
geoCoder.reverseGeoCode(reverseGeoCodeOption);
tvAddOverlayGeoCoder.setText("正在獲取詳細位置");
bundle = marker.getExtraInfo();
generalIsMale = bundle.getString("general").equals("m");
layoutAddOverlayRadarNearbyItem.setBackgroundColor(getResources().getColor(generalIsMale ? R.color.blue : R.color.pink));
imageViewAddOverlayItem.setImageResource(generalIsMale ? R.mipmap.map_portrait_man : R.mipmap.map_portrait_woman);
tvAddOverlayItemUserID.setText(bundle.getString("userID"));
tvAddOverlayItemDistance.setText("距離" + bundle.getInt("distance") + "米 ");
tvAddOverlayItemLatlng.setText("坐標: " + latLngshow.latitude + " , " + latLngshow.longitude + " ");
Log.d("lml", "MapFragment顯示的信息:" + bundle.getString("userID"));
Log.d("lml", bundle.getString("general") + ";" + generalIsMale);
baiduMap.showInfoWindow(new InfoWindow(viewOverlayItem, marker.getPosition(), -70));
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(marker.getPosition());
baiduMap.animateMapStatus(update);
return true;
} else
return false;
}
示例7: updateBDMapStatus
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
private void updateBDMapStatus(BDLocation location) {
final BaiduMap map = getBaiduMap();
final BaiduMapPrefFragment provider = (BaiduMapPrefFragment)(getProvider().getMapProviderPreferences());
final Context context = getActivity().getApplicationContext();
int mapType = provider.getMapType(context);
map.setMapType(mapType);
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
.latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
map.setMyLocationData(locData);
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
map.animateMapStatus(u);
}
示例8: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
// map view 銷毀後不在處理新接收的位置
if (location == null || mMapView == null)
return;
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此處設置開發者獲取到的方向信息,順時針0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.animateMapStatus(u);
}
}
示例9: onClick
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
// TODO 自動生成的方法存根
switch (v.getId()) {
case R.id.map_imageView_mylocaiton:
LatLng ll = new LatLng(mCurrentLantitude, mCurrentLongitude);
// float zoom = mBaiduMap.getMapStatus().zoom;
// // showCurrtenStroeOnMap(ll, zoom);
System.out.println("點擊定位:" + ll);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.animateMapStatus(u);
Utity.showToast(getApplicationContext(), "正在定位中...");
break;
case R.id.map_layout_store:
Bundle pBundle = new Bundle();
pBundle.putString("fromFlag", "map");
pBundle.putSerializable("list", (Serializable) list);
openActivity(ShopListActivity.class, pBundle);
break;
}
}
示例10: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
// map view 銷毀後不在處理新接收的位置
if (location == null || mMapView == null)
return;
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此處設置開發者獲取到的方向信息,順時針0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.animateMapStatus(u);
// StringBuffer U = new StringBuffer(256);
// U.append(location.getLatitude());
// U.append(location.getLongitude());
}
}
示例11: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
MyLocationData data2 = new MyLocationData.Builder()
.accuracy(location.getRadius())//精度
.latitude(location.getLatitude())//緯度
.longitude(location.getLongitude()).build();//經度
mBaidumap.setMyLocationData(data2);
//第三個參數設置自定義圖標
MyLocationConfiguration config =
new MyLocationConfiguration(null, true, null);
mBaidumap.setMyLocationConfigeration(config);
//更新經緯度
mLatitude = location.getLatitude();
mLongtitude = location.getLongitude();
if (isFirstIn) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
mBaidumap.animateMapStatus(msu);
isFirstIn = false;
}
}
示例12: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
MyLocationData data = new MyLocationData.Builder()
.direction(100)//方向
.accuracy(location.getRadius())//精度
.latitude(location.getLatitude())//緯度
.longitude(location.getLongitude()).build();//經度
mBaiduMap.setMyLocationData(data);
MyLocationConfiguration config =
new MyLocationConfiguration(null, true, null);
mBaiduMap.setMyLocationConfigeration(config);
//更新經緯度
mLatitude = location.getLatitude();
mLongtitude = location.getLongitude();
if (isFirstIn) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.animateMapStatus(msu);
isFirstIn = false;
}
}
示例13: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
MyLocationData data = new MyLocationData.Builder()
.direction(mCurrentX)//更新當前方向
.accuracy(400.0f)//精度
.latitude(location.getLatitude())//緯度
.longitude(location.getLongitude()).build();//經度
mBaiduMap.setMyLocationData(data);
//可在第三個參數設置自定義圖標
MyLocationConfiguration config =
new MyLocationConfiguration(mLocationMode, true, null);
mBaiduMap.setMyLocationConfigeration(config);
//更新經緯度
mLatitude = location.getLatitude();
mLongtitude = location.getLongitude();
mCity = location.getCity();
if (isFirstIn) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.animateMapStatus(msu);
isFirstIn = false;
Toast.makeText(context, location.getAddrStr(), Toast.LENGTH_SHORT).show();
}
}
示例14: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
// map view 銷毀後不在處理新接收的位置
if (location == null || mMapView == null)
return;
curMapCenterLatLng = mBaiduMap.getMapStatus().target;
mCurrentLantitude = location.getLatitude();
mCurrentLongitude = location.getLongitude();
curCity = location.getCity();
textView_curCity.setText(curCity);
MyLocationData locData = new MyLocationData.Builder().accuracy(location.getRadius())
// 此處設置開發者獲取到的方向信息,順時針0-360
.direction(100).latitude(mCurrentLantitude).longitude(mCurrentLongitude).build();
// 設置定位數據
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(mCurrentLantitude, mCurrentLongitude);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.animateMapStatus(u);
getData();
}
}
示例15: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
MyLocationData data = new MyLocationData.Builder()
.accuracy(location.getRadius())//精度
.latitude(location.getLatitude())//緯度
.longitude(location.getLongitude()).build();//經度
mBaiduMap.setMyLocationData(data);
//可在第三個參數設置自定義圖標
MyLocationConfiguration config =
new MyLocationConfiguration(null, true, null);
mBaiduMap.setMyLocationConfigeration(config);
//更新經緯度
mLatitude = location.getLatitude();
mLongtitude = location.getLongitude();
if (isFirstIn) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.animateMapStatus(msu);
isFirstIn = false;
}
}