本文整理汇总了Java中com.baidu.platform.comapi.basestruct.GeoPoint类的典型用法代码示例。如果您正苦于以下问题:Java GeoPoint类的具体用法?Java GeoPoint怎么用?Java GeoPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoPoint类属于com.baidu.platform.comapi.basestruct包,在下文中一共展示了GeoPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMap
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的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();
}
示例2: animateTo
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的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();
}
示例3: handleMessage
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public void handleMessage(Message msg)
{
if (null == mBMapManager)
{
return;
}
new CardToastUtils(LocationActivity.this).setMessageTextColor(Color.RED).showAndAutoDismiss("定位成功 " + msg.obj);
mStartGeoPoint = new GeoPoint((int) (mLocationData.latitude * 1E6), (int) (mLocationData.longitude * 1E6));
// 用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6)
mMapController.setCenter(mStartGeoPoint);// 设置地图中心点
mMapController.animateTo(mStartGeoPoint);
mMapController.setZoom(19);
mLocationOverlay.setData(mLocationData);// 设置我的位置信息
// 更新图层数据执行刷新后生效
mMapView.refresh();
mLocationClient.stop();
}
示例4: dummyData
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public GeoPoint[][] dummyData()
{
int count = 6;
int startLa = mStartGeoPoint.getLatitudeE6();
int startLo = mStartGeoPoint.getLongitudeE6();
int endLa = mEndGeoPoint.getLatitudeE6();
int endLo = mEndGeoPoint.getLongitudeE6();
int perDifferLa = (endLa - startLa) / count;
int perDifferLo = (endLo - startLo) / count;
GeoPoint[] step = new GeoPoint[count + 2];
Random random = new Random();
step[0] = mStartGeoPoint;
for (int i = 0; i < count; i++)
{
int dummyNextInt = random.nextInt(count);
System.out.println("dummyNextInt = " + dummyNextInt);
GeoPoint point = new GeoPoint(startLa + perDifferLa * dummyNextInt, startLo + perDifferLo * dummyNextInt);
step[i + 1] = point;
}
step[count + 1] = mEndGeoPoint;
// 站点数据保存在一个二维数据中
GeoPoint[][] routeData = new GeoPoint[1][];
routeData[0] = step;
return routeData;
}
示例5: onClickMapPoi
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public void onClickMapPoi(MapPoi poi)
{
if (null != poi)
{
mEndGeoPoint = new GeoPoint(poi.geoPt.getLatitudeE6(), poi.geoPt.getLongitudeE6());
LocationData clickLocationData = new LocationData();
clickLocationData.latitude = poi.geoPt.getLatitudeE6() / 1000000.0;
clickLocationData.longitude = poi.geoPt.getLongitudeE6() / 1000000.0;
mClickLocationOverlay.setData(clickLocationData);
mClickLocationOverlay.setMarker(getResources().getDrawable(R.drawable.ic_nav_turn_start_s));
mMapView.getOverlays().remove(mClickLocationOverlay);
// mMapView.getOverlays().add(mClickLocationOverlay);
MKPoiInfo info = new MKPoiInfo();
info.pt = poi.geoPt;
info.address = poi.strText;
routeDrive(info, true);
mMapView.refresh();
Toast.makeText(LocationActivity.this, poi.strText, Toast.LENGTH_SHORT).show();
}
}
示例6: showPopu
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public void showPopu(int index) {
final CloudPoiInfo info = mLbsPoints.get(index);
GeoPoint point = new GeoPoint((int) (info.latitude * 1e6),
(int) (info.longitude * 1e6));
((TextView) view.findViewById(R.id.popup_title)).setText(info.title);
((ImageView) view.findViewById(R.id.popup_msg))
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
intent.setClass(mContext, BbsActivity.class);
intent.putExtra("Name", info.title);
mContext.startActivity(intent);
}
});
int height = this.getItem(index).getMarker().getMinimumHeight();
mMapView.getController().animateTo(point);
popup.showPopup(view, point, height);// ��ʾ����
}
示例7: onOptionsItemSelected
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId())// �õ��������item��itemId
{
case R.id.menu_begin:
pdialog = LoadingDialog.createLoadingDialog(LjghTab.this,
"���ڹ滮·��...");
pdialog.show();
mLocClient.stop();
mMKSearch = new MKSearch();
mMKSearch.init(mBMapMan, new MapSearchListener());
MKPlanNode start = new MKPlanNode();
start.pt = new GeoPoint((int) (mywd * 1E6), (int) (myjd * 1E6));
MKPlanNode end = new MKPlanNode();
end.pt = new GeoPoint((int) (wd * 1E6), (int) (jd * 1E6));
mMKSearch.setDrivingPolicy(MKSearch.ECAR_TIME_FIRST);
mMKSearch.drivingSearch(null, start, null, end);
break;
}
return super.onOptionsItemSelected(item);
}
示例8: onGetDrivingRouteResult
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
@Override
public void onGetDrivingRouteResult(MKDrivingRouteResult result,
int arg1) {
// TODO Auto-generated method stub
if (result == null) {
return;
}
RouteOverlay routeOverlay = new RouteOverlay(LjghTab.this, mMapView); // �˴���չʾһ��������Ϊʾ��
routeOverlay.setData(result.getPlan(0).getRoute(0));
mMapView.getOverlays().add(routeOverlay);
GeoPoint point = new GeoPoint((int) (mywd * 1e6),
(int) (myjd * 1e6));
mMapController.setCenter(point);
mMapView.refresh();
pdialog.dismiss();
}
示例9: onReceiveLocation
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null)
return ;
Intent intent = new Intent();
intent.setAction("com.hit.changyou");
intent.putExtra("city",location.getCity() );
BaiduMapActivity.this.sendBroadcast(intent);
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
locData.accuracy = location.getRadius();
locData.direction = location.getDerect();
myLocationOverlay.setData(locData);
mMapView.refresh();
Log.i("yxy", locData.latitude+";"+locData.longitude);
//定位预留
if (app.cityString.equals("")) {
mMapController.animateTo(new GeoPoint((int)(locData.latitude* 1e6), (int)(locData.longitude * 1e6)));
}
}
示例10: addMarker
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的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();
}
示例11: setMyLocation
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
/**
* 设置用户当前位置
* @param p 要设置的位置,gcj坐标系
*/
private void setMyLocation(Position p) {
if(p != null && p.isValid()) {
//坐标转换
GeoPoint gp = CoordinateConvert.fromGcjToBaidu(new GeoPos(p.getLat(), p.getLon()));
//创建位置
LocationData locData = new LocationData();
locData.latitude = gp.getLatitudeE6() * 1.0 / 1E6;
locData.longitude = gp.getLongitudeE6() * 1.0 / 1E6;
locData.direction = p.getDirection();
locData.accuracy = p.getRadius();
locData.speed = p.getSpeed();
//设置位置
myLocationOverlay.setData(locData);
if(!mMapView.getOverlays().contains(myLocationOverlay)) {
mMapView.getOverlays().add(myLocationOverlay);
} else {
//KLog.d(TAG, "overlay added al-ready!");
}
mMapView.refresh();
}
}
示例12: gcjToBaidu
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public static GeoPoint gcjToBaidu(double lat, double lng) {
double x = lng, y = lat;
double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
double bdLng = z * Math.cos(theta) + 0.0065;
double bdLat = z * Math.sin(theta) + 0.006;
return new GeoPoint((int) (bdLat * 1e6), (int) (bdLng * 1e6));
}
示例13: baiduToGcj
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
public static GeoPoint baiduToGcj(double lat, double lng) {
double x = lng - 0.0065, y = lat - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
double gcjLng = z * Math.cos(theta);
double gcjLat = z * Math.sin(theta);
return new GeoPoint((int) (gcjLat * 1e6), (int) (gcjLng * 1e6));
}
示例14: onReceiveLocation
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的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());
Log.d("map streed:" + location.getStreet());
//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");
stopLocate();
// mMapView.refresh(); //need this refresh?
return;
}
}
lastLocation = location;
GeoPoint gcj02Point = new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6));
EMLog.d("loc", "GCJ-02 loc:" + gcj02Point);
//GeoPoint point = CoordinateConvert.fromGcjToBaidu(gcj02Point);
//EMLog.d("loc", "converted BD-09 loc:" + gcj02Point);
stopLocate();
}
示例15: onTap
import com.baidu.platform.comapi.basestruct.GeoPoint; //导入依赖的package包/类
@Override
public boolean onTap(GeoPoint pt, MapView mMapView) {
if (!BaiduMapManager.this.isUsePopup) {
return true;
}
if (popupOverlay != null) {
popupOverlay.hidePop();
mMapView.removeView(BaiduMapManager.this.popupView);
}
return false;
}