求鬼吹灯之牧野诡事电视剧百度云的百度云资源

使用百度地图API实现驾车导航
进入应用后首先显示蓝色点为当前位置,可以输入目的地来形成导航线路(图1),也可以点选地图上任意点来形成导航线路(图2,3),选定点后,在地图上会标注红色定位点,点击开始导航按钮后便会形成最佳驾车线路。
接下来看看实现步骤:
首先是工程结构
其中libs下面是申请百度开发者后到地图API下下载的地图支持包并导入工程,这里不再细说。
然后是布局文件:
&?xml version=&1.0& encoding=&utf-8&?&&
&LinearLayout xmlns:android=&/apk/res/android&&
&&& android:layout_width=&fill_parent&&
&&& android:layout_height=&fill_parent&&
&&& android:orientation=&vertical& &&
&&& &LinearLayout&
&&&&&&& android:layout_width=&fill_parent&&
&&&&&&& android:layout_height=&wrap_content&&
&&&&&&& android:orientation=&horizontal& &&
&&&&&&& &TextView&
&&&&&&&&&&& android:layout_width=&wrap_content&&
&&&&&&&&&&& android:layout_height=&wrap_content&&
&&&&&&&&&&& android:text=&目的地:&&
&&&&&&&&&&& android:textSize=&17sp& /&&
&&&&&&& &EditText&
&&&&&&&&&&& android:id=&@+id/et_destination&&
&&&&&&&&&&& android:layout_width=&fill_parent&&
&&&&&&&&&&& android:hint=&输入目的地名称或在地图上点选&&
&&&&&&&&&&& android:textSize=&14sp&&
&&&&&&&&&&& android:layout_height=&wrap_content& /&&
&&& &/LinearLayout&&
&&& &LinearLayout&
&&&&&&& android:layout_width=&fill_parent&&
&&&&&&& android:layout_height=&wrap_content& &&
&&&&&&& &Button&
&&&&&&&&&&& android:id=&@+id/btn_navi&&
&&&&&&&&&&& android:layout_width=&fill_parent&&
&&&&&&&&&&& android:layout_height=&wrap_content&&
&&&&&&&&&&& android:layout_weight=&1&&
&&&&&&&&&&& android:text=&开始导航& /&&
&&&&&&& &Button&
&&&&&&&&&&& android:id=&@+id/btn_clear&&
&&&&&&&&&&& android:layout_width=&fill_parent&&
&&&&&&&&&&& android:layout_height=&wrap_content&&
&&&&&&&&&&& android:layout_weight=&1&&
&&&&&&&&&&& android:text=&清除路线& /&&
&&& &/LinearLayout&&
&&& &com.baidu.mapapi.MapView&
&&&&&&& android:id=&@+id/bmapsView&&
&&&&&&& android:layout_width=&fill_parent&&
&&&&&&& android:layout_height=&fill_parent&&
&&&&&&& android:clickable=&true& /&&
&/LinearLayout&&
然后是实现自定义的地图图层MyItemizedOverlay.java,这个类的作用是实现可点击地图图层的作用,点击地图后,便可以显示当前位置的经纬度,并可设置为目的地。
&* 自定义图层
&* @author Ryan
public class MyItemizedOverlay extends ItemizedOverlay&OverlayItem& {&
&&& private ArrayList&OverlayItem& mOverlays = new ArrayList&OverlayItem&();&&&&&
&&& private C&
&&& public MyItemizedOverlay(Context context,Drawable drawale) {&
&&&&&&& super(boundCenterBottom(drawale));&&&&&&&
&&&&&&& this.context=&
&&& @Override&
&&& protected OverlayItem createItem(int i) {&
&&&&&&& return mOverlays.get(i);&
&&& @Override&
&&& public int size() {&
&&&&&&& return mOverlays.size();&
&&& // 点击地图标注显示的内容&
&&& @Override&
&&& protected boolean onTap(int index) {&
&&&&&&& //这个方法的重写弹出信息等&
&&& @Override&
&&& public void draw(Canvas canvas, MapView mapView, boolean shadow) {&
&&&&&&& super.draw(canvas, mapView, shadow);&
&&& // Define a method in order to add new OverlayItems to our ArrayList&
&&& public void addOverlay(OverlayItem overlay) {&
&&&&&&& // add OverlayItems&
&&&&&&& mOverlays.add(overlay);&
&&&&&&& populate();&
&&& //该方法的重写可以相应点击图标的区域内还是外&
&&& @Override&
&&& public boolean onTap(GeoPoint p, MapView mapView) {&
&&&&&&& final SharedPreferences sharedPreferences = context.getSharedPreferences(&navigation_pre&, Context.MODE_WORLD_WRITEABLE);&
&&&&&&& //p获取的经纬度数据是整型变量,需要转换为float类型&
&&&&&&& final float lat=p.getLatitudeE6();&
&&&&&&& final float lon=p.getLongitudeE6();&
&&&&&&& final MapView map = mapV&
&&&&&&& float latitude = sharedPreferences.getFloat(&lat&, 0);&
&&&&&&& if (latitude == 0) {&
&&&&&&&&&&& AlertDialog.Builder builder = new AlertDialog.Builder(this.context);&
&&&&&&&&&&& builder.setTitle(&设置目的地&);&
&&&&&&&&&&& builder.setMessage(&设置选中的点为目的地吗?&);&
&&&&&&&&&&& builder.setPositiveButton(&确定&,new OnClickListener() {&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&& List&Overlay& overlays = map.getOverlays();&
&&&&&&&&&&&&&&&&&&& GeoPoint gpoint = new GeoPoint((int)lat,(int)lon);&
&&&&&&&&&&&&&&&&&&& OverlayItem overlayitem = new OverlayItem(gpoint, &title&, &content&);&
&&&&&&&&&&&&&&&&&&& Drawable drawale = context.getResources().getDrawable(R.drawable.current_mark);&
&&&&&&&&&&&&&&&&&&& MyItemizedOverlay iconOverlay = new MyItemizedOverlay(context,drawale);&
&&&&&&&&&&&&&&&&&&& // 添加图层&
&&&&&&&&&&&&&&&&&&& iconOverlay.addOverlay(overlayitem);&
&&&&&&&&&&&&&&&&&&& overlays.add(iconOverlay);&
&&&&&&&&&&&&&&&&&&& map.getController().animateTo(gpoint);&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& Editor editor = sharedPreferences.edit();&
&&&&&&&&&&&&&&&&&&& editor.putFloat(&lat&, lat);&
&&&&&&&&&&&&&&&&&&& editor.putFloat(&lon&, lon);&
&&&&&&&&&&&&&&&&&&& mit();&
&&&&&&&&&&&&&&&&&&& Toast.makeText(context, &纬度:&+lat / 1E6+&\n经度:&+lon / 1E6, Toast.LENGTH_SHORT).show();&&&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&& });&
&&&&&&&&&&& builder.setNegativeButton(&取消&, null);&
&&&&&&&&&&& builder.create().show();&
&&&&&&& }else {&
//&&&&&&&&& AlertDialog.Builder builder = new AlertDialog.Builder(this.context);&
//&&&&&&&&& builder.setTitle(&设置目的地&);&
//&&&&&&&&& builder.setMessage(&已经设置过线路,请先点击清除路线按钮清除当前路线&);&
//&&&&&&&&& builder.setNegativeButton(&确定&, null);&
//&&&&&&&&& builder.create().show();&
&&&&&&&&&&& Toast.makeText(context, &已经设置过线路,请先点击清除路线按钮清除当前路线&,Toast.LENGTH_SHORT).show();&&&
&&&&&&&&&&&&&
&&&&&&& }&
&&&&&&& return super.onTap(p, mapView);&
最后是主Activity实现类,注释中有详细说明:
public class NavigationDemoActivity extends MapActivity {&
&&& //Map key&
&&& private String mMapKey = &你的MapKey,到百度开发者官网申请&;&
&&& private EditText destinationEditText =&
&&& private Button startNaviButton =&
&&& private Button clearButton =&
&&& private MapView mapView =&
&&& private BMapManager mMapManager =&
&&& private MyLocationOverlay myLocationOverlay =&
&&& //onResume时注册此listener,onPause时需要Remove,注意此listener不是Android自带的,是百度API中的&
&&& private LocationListener locationListener =&
&&& //搜索模块&
&&& private MKSearch searchModel =&
&&& private GeoPoint pt =&
&&& private SharedPreferences sharedP&
&&& @Override&
&&& public void onCreate(Bundle savedInstanceState) {&
&&&&&&& super.onCreate(savedInstanceState);&
&&&&&&& requestWindowFeature(Window.FEATURE_NO_TITLE);&
&&&&&&& setContentView(R.layout.main);&
&&&&&&& //弹出使用说明对话框&
&&&&&&& showIntroduceDialog();&
&&&&&&& sharedPreferences = this.getSharedPreferences(&navigation_pre&, Context.MODE_WORLD_WRITEABLE);&
&&&&&&& destinationEditText = (EditText) this.findViewById(R.id.et_destination);&
&&&&&&& startNaviButton = (Button) this.findViewById(R.id.btn_navi);&
&&&&&&& clearButton = (Button) this.findViewById(R.id.btn_clear);&
&&&&&&& //初始化地图管理器&
&&&&&&& mMapManager = new BMapManager(getApplication());&
&&&&&&& mMapManager.init(mMapKey, new MyGeneralListener());&
&&&&&&& super.initMapActivity(mMapManager);&
&&&&&&& mapView = (MapView) this.findViewById(R.id.bmapsView);&
&&&&&&& //设置启用内置的缩放控件&
&&&&&&& mapView.setBuiltInZoomControls(true);&&&
&&&&&&& //设置在缩放动画过程中也显示overlay,默认为不绘制&
//&&&&&&& mapView.setDrawOverlayWhenZooming(true);&
&&&&&&& //设置初始化地图的缩放级别&
&&&&&&& mapView.getController().setZoom(16);&
&&&&&&& mapView.setClickable(true);&
&&&&&&& //获取当前位置层&
&&&&&&& myLocationOverlay = new MyLocationOverlay(this, mapView);&
&&&&&&& //将当前位置的层添加到地图底层中&
&&&&&&& mapView.getOverlays().add(myLocationOverlay);&
&&&&&&& //添加可点选地图获取目的地的层&
&&&&&&& addTapOverLay();&
&&&&&&& //注册定位事件&
&&&&&&& locationListener = new LocationListener(){&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onLocationChanged(Location location) {&
&&&&&&&&&&&&&&& if (location != null){&
&&&&&&&&&&&&&&&&&&& //生成GEO类型坐标并在地图上定位到该坐标标示的地点&
&&&&&&&&&&&&&&&&&&&& pt = new GeoPoint((int)(location.getLatitude() * 1e6),&
&&&&&&&&&&&&&&&&&&&&&&&&&&& (int)(location.getLongitude() * 1e6));&
&&&&&&&&&&&&&&&&&&&& mapView.getController().animateTo(pt);&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&& }&
&&&&&&& };&
&&&&&&& //初始化搜索模块&
&&&&&&& searchModel = new MKSearch();&
&&&&&&& //设置路线策略为最短距离&
&&&&&&& searchModel.setDrivingPolicy(MKSearch.ECAR_DIS_FIRST);&
&&&&&&& searchModel.init(mMapManager, new MKSearchListener() {&
&&&&&&&&&&& //获取驾车路线回调方法&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetDrivingRouteResult(MKDrivingRouteResult res, int error) {&
&&&&&&&&&&&&&&& // 错误号可参考MKEvent中的定义&
&&&&&&&&&&&&&&& if (error != 0 || res == null) {&
&&&&&&&&&&&&&&&&&&& Toast.makeText(NavigationDemoActivity.this, &抱歉,未找到结果&, Toast.LENGTH_SHORT).show();&
&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& RouteOverlay routeOverlay = new RouteOverlay(NavigationDemoActivity.this, mapView);&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& // 此处仅展示一个方案作为示例&
&&&&&&&&&&&&&&& MKRoute route = res.getPlan(0).getRoute(0);&
&&&&&&&&&&&&&&& int distanceM = route.getDistance();&
&&&&&&&&&&&&&&& String distanceKm = String.valueOf(distanceM / 1000) +&.&+String.valueOf(distanceM % 1000);&
&&&&&&&&&&&&&&& System.out.println(&距离:&+distanceKm+&公里---节点数量:&+route.getNumSteps());&
&&&&&&&&&&&&&&& for (int i = 0; i & route.getNumSteps(); i++) {&
&&&&&&&&&&&&&&&&&&& MKStep step = route.getStep(i);&
&&&&&&&&&&&&&&&&&&& System.out.println(&节点信息:&+step.getContent());&
&&&&&&&&&&&&&&&&&&& System.out.println(&经度:&+step.getPoint().getLongitudeE6() / 1E6 +& 纬度:&+step.getPoint().getLatitudeE6() / 1E6);&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& routeOverlay.setData(route);&
&&&&&&&&&&&&&&& mapView.getOverlays().clear();&
&&&&&&&&&&&&&&& mapView.getOverlays().add(routeOverlay);&
&&&&&&&&&&&&&&& mapView.invalidate();&
&&&&&&&&&&&&&&& mapView.getController().animateTo(res.getStart().pt);&
&&&&&&&&&&& }&
&&&&&&&&&&&&&
&&&&&&&&&&& //以下两种方式和上面的驾车方案实现方法一样&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetWalkingRouteResult(MKWalkingRouteResult res, int error) {&
&&&&&&&&&&&&&&& //获取步行路线&
&&&&&&&&&&& }&
&&&&&&&&&&&&&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetTransitRouteResult(MKTransitRouteResult arg0, int arg1) {&
&&&&&&&&&&&&&&& //获取公交线路&
&&&&&&&&&&& }&
&&&&&&&&&&&&&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetBusDetailResult(MKBusLineResult arg0, int arg1) {&
&&&&&&&&&&& }&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetAddrResult(MKAddrInfo arg0, int arg1) {&
&&&&&&&&&&& }&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetSuggestionResult(MKSuggestionResult arg0, int arg1) {&
&&&&&&&&&&& }&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetPoiResult(MKPoiResult arg0, int arg1, int arg2) {&
&&&&&&&&&&& }&
&&&&&&& });&
&&&&&&& startNaviButton.setOnClickListener(new OnClickListener() {&
&&&&&&&&&&&&&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onClick(View v) {&
&&&&&&&&&&&&&&& String destination = destinationEditText.getText().toString();&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& //设置起始地(当前位置)&
&&&&&&&&&&&&&&& MKPlanNode startNode = new MKPlanNode();&
&&&&&&&&&&&&&&& startNode.pt =&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& //设置目的地&
&&&&&&&&&&&&&&& MKPlanNode endNode = new MKPlanNode();&&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& float lat = sharedPreferences.getFloat(&lat&, 0);&
&&&&&&&&&&&&&&& float lon = sharedPreferences.getFloat(&lon&, 0);&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& if (lat != 0 && lon != 0) {&
&&&&&&&&&&&&&&&&&&& endNode.pt = new GeoPoint((int)lat,(int)lon);&
&&&&&&&&&&&&&&& }else if (!destination.equals(&&)) {&
&&&&&&&&&&&&&&&&&&& endNode.name =&
&&&&&&&&&&&&&&& }else {&
&&&&&&&&&&&&&&&&&&& Toast.makeText(NavigationDemoActivity.this, &请输入或点选目的地&,Toast.LENGTH_SHORT).show();&
&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& //展开搜索的城市&
&&&&&&&&&&&&&&& String city = getResources().getString(R.string.beijing);&
&&&&&&&&&&&&&&& searchModel.drivingSearch(city, startNode, city, endNode);&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& //步行路线&
//&&&&&&&&&&&&& searchModel.walkingSearch(city, startNode, city, endNode);&
&&&&&&&&&&&&&&& //公交路线&
//&&&&&&&&&&&&& searchModel.transitSearch(city, startNode, endNode);&
&&&&&&&&&&& }&
&&&&&&& });&
&&&&&&& //清除路线按钮事件&
&&&&&&& clearButton.setOnClickListener(new OnClickListener() {&
&&&&&&&&&&&&&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onClick(View v) {&
&&&&&&&&&&&&&&& List&Overlay& overlays = mapView.getOverlays();&
&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& if (sharedPreferences.getFloat(&lon&, 0) != 0) {&
&&&&&&&&&&&&&&&&&&& //移除顶层的路线图层&
&&&&&&&&&&&&&&&&&&& overlays.remove(overlays.size() - 1);&
&&&&&&&&&&&&&&&&&&& //添加用户当前位置图层&
&&&&&&&&&&&&&&&&&&& overlays.add(myLocationOverlay);&
&&&&&&&&&&&&&&&&&&& //地图更新定位到当前位置&
&&&&&&&&&&&&&&&&&&& mapView.getController().animateTo(pt);&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& //清除存储的经纬度信息&
&&&&&&&&&&&&&&&&&&& Editor editor = sharedPreferences.edit();&
&&&&&&&&&&&&&&&&&&& editor.clear();&
&&&&&&&&&&&&&&&&&&& mit();&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& //添加可点选图层&
&&&&&&&&&&&&&&&&&&& addTapOverLay();&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& }else if (!destinationEditText.getText().toString().equals(&&)) {&
&&&&&&&&&&&&&&&&&&& overlays.remove(overlays.size() - 1);&
&&&&&&&&&&&&&&&&&&& overlays.add(myLocationOverlay);&
&&&&&&&&&&&&&&&&&&& mapView.getController().animateTo(pt);&
&&&&&&&&&&&&&&&&&&& addTapOverLay();&
&&&&&&&&&&&&&&& }else {&
&&&&&&&&&&&&&&&&&&& Toast.makeText(NavigationDemoActivity.this, &没有设置路线&, Toast.LENGTH_SHORT).show();&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&& }&
&&&&&&& });&
&&& public void showIntroduceDialog(){&
&&&&&&& AlertDialog.Builder builder = new AlertDialog.Builder(this);&
&&&&&&& builder.setTitle(&使用说明&);&
&&&&&&& StringBuilder sb = new StringBuilder();&
&&&&&&& sb.append(&1.地图中蓝色点为当前位置;\n\n&);&
&&&&&&& sb.append(&2.双指捏合或点击缩放按钮可以缩放地图;\n\n&);&
&&&&&&& sb.append(&3.在输入框中输入目的地或在地图上点选目的地;\n\n&);&
&&&&&&& sb.append(&4.选取目的地后点击按钮开始导航;\n\n&);&
&&&&&&& sb.append(&5.点击清除按钮取消本次导航路线;&);&
&&&&&&& builder.setMessage(sb.toString());&
&&&&&&& builder.setNegativeButton(&确定&, null);&
&&&&&&& builder.create().show();&
&&& public void addTapOverLay(){&
&&&&&&& //以一副透明图片标示可点选图层,这里在地图上不显示出来,只提供可点选目的地功能&
&&&&&&& GeoPoint gpoint = new GeoPoint((int) (39.914714 * 1E6), (int) (116.404269 * 1E6));&
&&&&&&& OverlayItem overlayitem = new OverlayItem(gpoint, &title&, &content&);&
&&&&&&& Drawable drawale = getResources().getDrawable(R.drawable.current);&
&&&&&&& MyItemizedOverlay iconOverlay = new MyItemizedOverlay(NavigationDemoActivity.this,drawale);&
&&&&&&& // 添加图层&
&&&&&&& iconOverlay.addOverlay(overlayitem);&
&&&&&&& mapView.getOverlays().add(iconOverlay);&
&&& @Override&
&&& protected void onResume() {&
&&&&&&& mMapManager.getLocationManager().requestLocationUpdates(locationListener);&
&&&&&&& myLocationOverlay.enableMyLocation();&
&&&&&&& myLocationOverlay.enableCompass(); // 打开指南针&
&&&&&&& mMapManager.start();&
&&&&&&& super.onResume();&
&&& @Override&
&&& protected void onPause() {&
&&&&&&& mMapManager.getLocationManager().removeUpdates(locationListener);&
&&&&&&& myLocationOverlay.disableMyLocation();//显示当前位置&
&&&&&&& myLocationOverlay.disableCompass(); // 关闭指南针&
&&&&&&& mMapManager.stop();&
&&&&&&& super.onPause();&
&&& @Override&
&&& protected boolean isRouteDisplayed() {&
&&&&&&& // TODO Auto-generated method stub&
&&& //按物理返回键退出应用时清空存储的经纬度信息&
&&& @Override&
&&& public boolean dispatchKeyEvent(KeyEvent event) {&
&&&&&&& if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {&
&&&&&&&&&&& Editor editor = sharedPreferences.edit();&
&&&&&&&&&&& editor.clear();&
&&&&&&&&&&& mit();&
&&&&&&& }&
&&&&&&& return super.dispatchKeyEvent(event);&
&&& // 常用事件监听,用来处理通常的网络错误,授权验证错误等&
&&& class MyGeneralListener implements MKGeneralListener {&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetNetworkState(int iError) {&
&&&&&&&&&&&&&&& Log.d(&MyGeneralListener&, &onGetNetworkState error is &+ iError);&
&&&&&&&&&&&&&&& Toast.makeText(NavigationDemoActivity.this, &您的网络出错啦!&,&
&&&&&&&&&&&&&&&&&&&&&&& Toast.LENGTH_LONG).show();&
&&&&&&&&&&& }&
&&&&&&&&&&& @Override&
&&&&&&&&&&& public void onGetPermissionState(int iError) {&
&&&&&&&&&&&&&&& Log.d(&MyGeneralListener&, &onGetPermissionState error is &+ iError);&
&&&&&&&&&&&&&&& if (iError ==& MKEvent.ERROR_PERMISSION_DENIED) {&
&&&&&&&&&&&&&&&&&&& // 授权Key错误:&
&&&&&&&&&&&&&&&&&&& Toast.makeText(NavigationDemoActivity.this,&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& &请在BMapApiDemoApp.java文件输入正确的授权Key!&,&
&&&&&&&&&&&&&&&&&&&&&&&&&&& Toast.LENGTH_LONG).show();&
&&&&&&&&&&&&&&& }&
&&&&&&&&&&& }&
&&&&&&& }&
最后是配置文件:
&?xml version=&1.0& encoding=&utf-8&?&&
&manifest xmlns:android=&&&
&&& package=&com.ericssonlabs&&
&&& android:versionCode=&1&&
&&& android:versionName=&1.0& &&
&&& &uses-sdk android:minSdkVersion=&8& /&&
&&& &uses-permission android:name=&android.permission.ACCESS_NETWORK_STATE&&&/uses-permission&&
&&& &uses-permission android:name=&android.permission.ACCESS_FINE_LOCATION&&&/uses-permission&&
&&& &uses-permission android:name=&android.permission.INTERNET&&&/uses-permission&&
&&& &uses-permission android:name=&android.permission.WRITE_EXTERNAL_STORAGE&&&/uses-permission&&
&&& &uses-permission android:name=&android.permission.ACCESS_WIFI_STATE&&&/uses-permission&&&&
&&& &uses-permission android:name=&android.permission.CHANGE_WIFI_STATE&&&/uses-permission&&&
&&& &uses-permission android:name=&android.permission.READ_PHONE_STATE&&&/uses-permission&&
&&& &supports-screens android:largeScreens=&true&&
&&&&&&& android:normalScreens=&true& android:smallScreens=&true&&
&&&&&&& android:resizeable=&true& android:anyDensity=&true&/&&
&&& &uses-sdk android:minSdkVersion=&3&&&/uses-sdk&&
&&& &application&
&&&&&&& android:icon=&@drawable/ic_launcher&&
&&&&&&& android:label=&@string/app_name& &&
&&&&&&& &activity&
&&&&&&&&&&& android:name=&.NavigationDemoActivity&&
&&&&&&&&&&& android:label=&@string/app_name& &&
&&&&&&&&&&& &intent-filter&&
&&&&&&&&&&&&&&& &action android:name=&android.intent.action.MAIN& /&&
&&&&&&&&&&&&&&& &category android:name=&android.intent.category.LAUNCHER& /&&
&&&&&&&&&&& &/intent-filter&&
&&&&&&& &/activity&&
&&& &/application&&
&/manifest&&
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
爱自由,反独裁,反专制,倡导言论自由.新闻自由.拒绝洗脑.独立思想者,坚信思想是个好东西,它会要了独裁的命...........
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
var map = new BMap.Map("allmap");//去除路网&&map.setMapStyle({
& styleJson:[
& & & & & & & & & &"featureType": "poi",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "road",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "background",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "administrative",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &}
});html代码如下:&!DOCTYPE html&&html&&head& &meta http-equiv="Content-Type" content="text/ charset=utf-8" /& &meta name="viewport" content="initial-scale=1.0, user-scalable=no" /& &style type="text/css"&
body, html,#allmap {width: 100%;height: 100%;overflow:margin:0;font-family:"微软雅黑";} &/style& &script type="text/javascript" src="http://api./api?v=2.0&ak=您的密钥"&&/script& &title&添加行政区划&/title&&/head&&body& &div id="allmap"&&/div&&/body&&/html&&script type="text/javascript"& // 百度地图API功能 var map = new BMap.Map("allmap");&&&map.setMapStyle({
& styleJson:[
& & & & & & & & & &"featureType": "poi",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "road",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "background",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff"
& & & & & & & & & &}
& & & & &},
& & & & &{
& & & & & & & & & &"featureType": "administrative",
& & & & & & & & & &"elementType": "all",
& & & & & & & & & &"stylers": {
& & & & & & & & & & & & & & &"color": "#ffffff",
& & & & & & & & & & & & & & &"visibility": "off"
& & & & & & & & & &}
& & & & &}
&& map.centerAndZoom(new BMap.Point(116..914850), 5); map.enableScrollWheelZoom(); function getBoundary(){ & & &&
var bdary = new BMap.Boundary();
bdary.get("重庆", function(rs){ & & & //获取行政区域
map.clearOverlays(); & & & &//清除地图覆盖物 & & &&
var count = rs.boundaries. //行政区域的点有多少个
for(var i = 0; i & i++){
var ply = new BMap.Polygon(rs.boundaries[i], {strokeWeight: 2, strokeColor: "#ff0000"}); //建立多边形覆盖物
map.addOverlay(ply); &//添加覆盖物
map.setViewport(ply.getPath()); & &//调整视野 & & & &&
} & & & & & & & &
}); && } setTimeout(function(){
getBoundary(); }, 0);&/script&效果图:&&怎么样,看起来干净多了吧&&
阅读(13336)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'百度地图API去除路网显示行政区域划分',
blogAbstract:'用百度地图做行政区域划分时,路网、行政标注太多使页面显的很杂乱,那么有没有什么办法可以去除它们呢?答案是肯定的:var map = new BMap.Map(\"allmap\");//去除路网&&map.setMapStyle({\t\t & &\t & styleJson:[\t\t & &\t & & & & {\t\t & & & & & & & & & &\"featureType\": \"poi\",\t\t & & & & & & & & & &\"elementType\": \"all\",',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:8,
publishTime:8,
permalink:'blog/static/',
commentCount:6,
mainCommentCount:5,
recommendCount:2,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'爱自由,反独裁,反专制,倡导言论自由.新闻自由.拒绝洗脑.独立思想者,坚信思想是个好东西,它会要了独裁的命...........',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 牧野诡事 txt 云盘 的文章

 

随机推荐