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

Java OverlayItem类代码示例

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

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



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

示例1: showMap

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
private void showMap(double latitude, double longtitude, String address) {
	sendButton.setVisibility(View.GONE);

	GeoPoint point1 = new GeoPoint((int) (latitude * 1e6), (int) (longtitude * 1e6));
	point1 = CoordinateConvert.fromGcjToBaidu(point1);
	mMapController.setCenter(point1);
	Drawable marker = this.getResources().getDrawable(R.drawable.icon_marka);
	// 为maker定义位置和边界
	marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
	mAddrOverlay = new ItemizedOverlay<OverlayItem>(marker, mMapView);
	GeoPoint point = new GeoPoint((int) (latitude * 1e6), (int) (longtitude * 1e6));
	point = CoordinateConvert.fromGcjToBaidu(point);
	OverlayItem addrItem = new OverlayItem(point, "", address);
	mAddrOverlay.addItem(addrItem);
	mMapView.getOverlays().add(mAddrOverlay);
	mMapView.refresh();
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:18,代码来源:BaiduMapActivity.java


示例2: animateTo

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
public void animateTo(GeoPoint geoPoint, Drawable drawable) {
	// LogUtil.systemOut(geoPoint);
	if (geoPoint == null || drawable == null) {
		return;
	}
	// System.out.println("x:" + geoPoint.getLatitudeE6() + "y:"
	// + geoPoint.getLongitudeE6());
	this.myOverlay.removeAll();
	if (this.isUsePopup) {
		this.popupOverlay.hidePop();
	}
	OverlayItem overlayItem = new OverlayItem(geoPoint, null, null);
	overlayItem.setMarker(drawable != null ? drawable
			: this.defaultDrawable);
	this.myOverlay.addItem(overlayItem);
	// this.geoPoints.add(geoPoint);
	this.mapController.setZoom(100);
	this.animateTo(geoPoint);
	// LogUtil.systemOut("++++++--------");
	this.mMapView.refresh();
}
 
开发者ID:AfirSraftGarrier,项目名称:ACCAndroid,代码行数:22,代码来源:BaiduMapManager.java


示例3: handleMessage

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    switch(msg.what) {
        case MSG_OPEN_POP_WINDOW: {
            if(msg.obj instanceof OverlayItem) {
                OverlayItem item = (OverlayItem)msg.obj;
                mPopContent.setText(item.getTitle());
                mPopWindow.showPopup(mPopContent, item.getPoint(), POP_OFFSET_PX);
            }
            break;
        }
        
        default:
            super.handleMessage(msg);
            break;
    }
}
 
开发者ID:alexcaisenchuan,项目名称:FunWeibo,代码行数:18,代码来源:BaiduMapActivity.java


示例4: addMarker

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
/**
 * 把一个标注点添加到地图上
 */
private void addMarker(double lat, double lon, String title, String address) {
    //标记点图像
    Drawable mark = getResources().getDrawable(R.drawable.icon_gcoding);
    //创建Overlay
    MyOverlay overlay = new MyOverlay(mark, mMapView);
    
    //将Overlay添加到地图上
    mMapView.getOverlays().clear();
    mMapView.getOverlays().add(overlay);
     
    //添加标注点
    GeoPoint p = CoordinateConvert.fromGcjToBaidu(new GeoPos(lat, lon));
    OverlayItem item = new OverlayItem(p, title, address);
    overlay.addItem(item);
    sendMessage(MSG_OPEN_POP_WINDOW, 0, 0, item);
    
    //刷新地图
    mMapView.refresh();
}
 
开发者ID:alexcaisenchuan,项目名称:FunWeibo,代码行数:23,代码来源:BaiduMapActivity.java


示例5: setData

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
public void setData(List<CloudPoiInfo> lbsPoints) {
	if (lbsPoints != null) {
		mLbsPoints = lbsPoints;
	}
	for (CloudPoiInfo rec : mLbsPoints) {
		GeoPoint pt = new GeoPoint((int) (rec.latitude * 1e6),
				(int) (rec.longitude * 1e6));
		OverlayItem item = new OverlayItem(pt, rec.title, rec.address);
		Drawable marker1 = this.mContext.getResources().getDrawable(
				R.drawable.icon_school);
		item.setMarker(marker1);
		addItem(item);
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:15,代码来源:CloudOverlay.java


示例6: run

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
@Override
public void run() {
	Looper.prepare();
	while(true) {
		try {
			Thread.sleep(2000);
			itemOverlay.removeAll();
			
			String url = prefix + "getDriver.php";
			String ret = new HttpFunc().execute(url);
			JSONArray json = new JSONArray(ret);

			double last = 0; 
			for(int i = 0 ;i < json.length(); i++) { 
				double value = json.getDouble(i);
				if(0 == i % 2)
					last = value;
				else {
					GeoPoint p1 = new GeoPoint((int) (last * 1E6), (int) (value * 1E6));  
					OverlayItem item = new OverlayItem(p1,"","");  
					itemOverlay.addItem(item);
				}
			}
               mMapView.refresh();  
		} 
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:townboy,项目名称:calltaxi,代码行数:31,代码来源:MapActivity.java


示例7: run

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
@Override
public void run() {
	Looper.prepare();
	while(true) {
		try {
			Thread.sleep(2000);
			itemOverlay.removeAll();
			
			String url = prefix + "getUser.php";
			String ret = new HttpFunc().execute(url);
			JSONArray json = new JSONArray(ret);

			double last = 0, value; 
			for(int i = 0 ;i < json.length(); i++) { 
				if(2 == i % 3) {
					log_id[i/3] = json.getInt(i);
					continue;
				}
				value = json.getDouble(i);
				if(0 == i % 3)
					lati[i/3] = value;
				else if(1 == i % 3) {
					Long[i/3] = value;
					GeoPoint p1 = new GeoPoint((int) (lati[i/3] * 1E6), (int) (Long[i/3] * 1E6));  
					OverlayItem item = new OverlayItem(p1,"","");  
					itemOverlay.addItem(item);
				}
			}
               mMapView.refresh();  
		} 
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:townboy,项目名称:calltaxi,代码行数:36,代码来源:MapActivity.java


示例8: addVenueLocations

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
public void addVenueLocations(List<BDLocation> locationList) {
    ItemizedOverlay<OverlayItem> locationOverlay = new ItemizedOverlay<OverlayItem>(
            getResources().getDrawable(R.drawable.ic_checkbox_selected),
            mMapView);
    mMapView.getOverlays().add(locationOverlay);
    GeoPoint geoPoint = null;
    for (BDLocation location : locationList) {
        geoPoint = Utils.BDToGeoPoint(location);
        locationOverlay.addItem(new OverlayItem(geoPoint, "A", "A"));
    }

}
 
开发者ID:cuipengpeng,项目名称:p1-android,代码行数:13,代码来源:VenueActivity.java


示例9: onTap

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
protected boolean onTap(int index) {
    //在此处理item点击事件
    OverlayItem item = getItem(index);      //获取对应的OverlayItem
    if(item != null) {
        Message msg = mHandler.obtainMessage(MSG_OPEN_POP_WINDOW, item);
        mMapView.getController().animateTo(item.getPoint(), msg);
    }
    return true;
}
 
开发者ID:alexcaisenchuan,项目名称:FunWeibo,代码行数:10,代码来源:BaiduMapActivity.java


示例10: showMapWithLocationClient

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
private void showMapWithLocationClient() {
	progressDialog = new ProgressDialog(this);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	progressDialog.setMessage("正在确定你的位置...");

	progressDialog.setOnCancelListener(new OnCancelListener() {

		public void onCancel(DialogInterface arg0) {
			if (progressDialog.isShowing()) {
				progressDialog.dismiss();
			}
			Log.d("map cancel retrieve location");
			finish();
		}
	});

	progressDialog.show();

	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);

	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// 打开gps
	// option.setCoorType("bd09ll"); //设置坐标类型
	// Johnson change to use gcj02 coordination. chinese national standard
	// so need to conver to bd09 everytime when draw on baidu map
	option.setCoorType("gcj02");
	option.setScanSpan(30000);
	option.setAddrType("all");
	mLocClient.setLocOption(option);

	Drawable marker = this.getResources().getDrawable(R.drawable.icon_marka);
	// 为maker定义位置和边界
	marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
	mAddrOverlay = new ItemizedOverlay<OverlayItem>(marker, mMapView);
	mMapView.getOverlays().add(mAddrOverlay);

	mMapListener = new MKMapViewListener() {

		@Override
		public void onMapMoveFinish() {
			// TODO Auto-generated method stub
		}

		@Override
		public void onClickMapPoi(MapPoi mapPoiInfo) {
			// TODO Auto-generated method stub
			String title = "";
			if (mapPoiInfo != null) {
				title = mapPoiInfo.strText;
				Toast.makeText(BaiduMapActivity.this, title, Toast.LENGTH_SHORT).show();
			}
		}

		@Override
		public void onGetCurrentMap(Bitmap b) {
			// TODO Auto-generated method stub

		}

		@Override
		public void onMapAnimationFinish() {
		}
	};
	mMapView.regMapViewListener(mBMapManager, mMapListener);

	if (lastLocation != null) {
		GeoPoint point1 = new GeoPoint((int) (lastLocation.getLatitude() * 1e6), (int) (lastLocation.getLongitude() * 1e6));
		point1 = CoordinateConvert.fromGcjToBaidu(point1);
		mMapController.setCenter(point1);
	}
	mMapView.refresh();
	mMapView.invalidate();
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:76,代码来源:BaiduMapActivity.java


示例11: onReceiveLocation

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map On location change received:" + location);
	Log.d("map addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}

	lastLocation = location;

	GeoPoint gcj02Point = new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6));
	EMLog.d(TAG, "GCJ-02 loc:" + gcj02Point);
	GeoPoint point = CoordinateConvert.fromGcjToBaidu(gcj02Point);
	EMLog.d(TAG, "converted BD-09 loc:" + point);

	// GeoPoint p1 = gcjToBaidu(location.getLatitude(),
	// location.getLongitude());
	// System.err.println("johnson change to baidu:" + p1);
	// GeoPoint p2 = baiduToGcj(location.getLatitude(),
	// location.getLongitude());
	// System.err.println("johnson change to gcj:" + p2);

	OverlayItem addrItem = new OverlayItem(point, "title", location.getAddrStr());
	mAddrOverlay.removeAll();
	mAddrOverlay.addItem(addrItem);
	mMapView.getController().setZoom(17);
	mMapView.refresh();
	mMapController.animateTo(point);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:42,代码来源:BaiduMapActivity.java


示例12: updateMapView

import com.baidu.mapapi.map.OverlayItem; //导入依赖的package包/类
public void updateMapView(List<BaiduMapData> baiduMapDatas) {
	this.myOverlay.removeAll();
	if (this.isUsePopup) {
		this.popupOverlay.hidePop();
	}
	if (!ListUtil.isEmpty(baiduMapDatas)) {
		// this.tasks = new ArrayList<Task>();
		this.geoPoints = new ArrayList<GeoPoint>();
		for (BaiduMapData baiduMapData : baiduMapDatas) {
			MGeoPoint mGeoPoint = baiduMapData.getmGeoPoint();
			if (baiduMapData.getmGeoPoint() != null) {
				GeoPoint geoPoint = new GeoPoint(
						(int) (mGeoPoint.getLatitude() * 1E6),
						(int) (mGeoPoint.getLongitude() * 1E6));
				// LogUtil.systemOut(geoPoint);
				OverlayItem overlayItem = new OverlayItem(geoPoint, null,
						null);
				overlayItem
						.setMarker(baiduMapData.getDrawable() != null ? baiduMapData
								.getDrawable() : this.defaultDrawable);
				myOverlay.addItem(overlayItem);
				// this.tasks.add(task);
				this.geoPoints.add(geoPoint);
			}
		}
		// /**
		// * 鍑嗗overlay 鏁版嵁
		// */
		// GeoPoint p1 = new GeoPoint((int) (mLat1 * 1E6), (int) (mLon1 *
		// 1E6));
		// OverlayItem item1 = new OverlayItem(p1, "瑕嗙洊鐗�1", "");
		// /**
		// * 璁剧疆overlay鍥炬爣锛屽涓嶈缃紝鍒欎娇鐢ㄥ垱寤篒temizedOverlay鏃剁殑榛樿鍥炬爣.
		// */
		// item1.setMarker(getResources().getDrawable(R.drawable.icon_marka));
		//
		// GeoPoint p2 = new GeoPoint((int) (mLat2 * 1E6), (int) (mLon2 *
		// 1E6));
		// OverlayItem item2 = new OverlayItem(p2, "瑕嗙洊鐗�2", "");
		// item2.setMarker(getResources().getDrawable(R.drawable.icon_marka));
		//
		// GeoPoint p3 = new GeoPoint((int) (mLat3 * 1E6), (int) (mLon3 *
		// 1E6));
		// OverlayItem item3 = new OverlayItem(p3, "瑕嗙洊鐗�3", "");
		// item3.setMarker(getResources().getDrawable(R.drawable.icon_marka));
		//
		// GeoPoint p4 = new GeoPoint((int) (mLat4 * 1E6), (int) (mLon4 *
		// 1E6));
		// OverlayItem item4 = new OverlayItem(p4, "瑕嗙洊鐗�4", "");
		// item4.setMarker(getResources().getDrawable(R.drawable.icon_gcoding));
		// /**
		// * 灏唅tem 娣诲姞鍒皁verlay涓� 娉ㄦ剰锛� 鍚屼竴涓猧tme鍙兘add涓�娆�
		// */
		// myOverlay.addItem(item1);
		// myOverlay.addItem(item2);
		// myOverlay.addItem(item3);
		// myOverlay.addItem(item4);
		this.animateToBestZoomAndCenter();
	}

	this.mMapView.refresh();
	// this.mapController.animateTo(this.geoPoints.get(0));
}
 
开发者ID:AfirSraftGarrier,项目名称:ACCAndroid,代码行数:64,代码来源:BaiduMapManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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