本文整理汇总了Java中com.baidu.mapapi.search.route.RoutePlanSearch.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java RoutePlanSearch.newInstance方法的具体用法?Java RoutePlanSearch.newInstance怎么用?Java RoutePlanSearch.newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.mapapi.search.route.RoutePlanSearch
的用法示例。
在下文中一共展示了RoutePlanSearch.newInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
CharSequence titleLable = "路线规划功能";
setTitle(titleLable);
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
// 地图点击事件处理
mBaidumap.setOnMapClickListener(this);
// 初始化搜索模块,注册事件监听
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
}
示例2: initView
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
private void initView() {
iv_back = (ImageView) findViewById(R.id.iv_back);
iv_back.setVisibility(View.VISIBLE);
iv_back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
});
mMapView = (MapView) findViewById(R.id.bmapView);
mMapView.showScaleControl(false);
mMapView.showZoomControls(false);
mBaiduMap = mMapView.getMap();
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
Intent intent = getIntent();
LatLng locLatLng = new LatLng(intent.getDoubleExtra("locLat", 0), intent.getDoubleExtra("locLon", 0));
LatLng desLatLng = new LatLng(intent.getDoubleExtra("lat", 0), intent.getDoubleExtra("lon", 0));
PlanNode st = PlanNode.withLocation(locLatLng);
PlanNode en = PlanNode.withLocation(desLatLng);
mSearch.drivingSearch(new DrivingRoutePlanOption().from(st).to(en));
}
示例3: initMap
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
private void initMap() {
// 地图初始化
mMapView = (MapView) findViewById(R.id.id_bmapView);
mBaiduMap = mMapView.getMap();
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
// 定位初始化
mlocationClient = new LocationClient(this);
mlocationClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(5000);//设置onReceiveLocation()获取位置的频率
option.setIsNeedAddress(true);//如想获得具体位置就需要设置为true
mlocationClient.setLocOption(option);
mlocationClient.start();
mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, null));
myOrientationListener = new MyOrientationListener(this);
//通过接口回调来实现实时方向的改变
myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
@Override
public void onOrientationChanged(float x) {
mCurrentX = x;
}
});
myOrientationListener.start();
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
initMarkerClickEvent();
}
示例4: initMap
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
private void initMap() {
baiduMap = mBaiduMap.getMap();
baiduMap.setMyLocationEnabled(true);
mlocationClient = new LocationClient(getApplicationContext());
mlocationClient.registerLocationListener(new MylocationListener());
// mBaiduMap.showScaleControl(false);// 隐藏比例尺控件
mBaiduMap.showZoomControls(false);//隐藏缩放按钮
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(5000);//设置onReceiveLocation()获取位置的频率
option.setIsNeedAddress(true);//如想获得具体位置就需要设置为true
mlocationClient.setLocOption(option);
mlocationClient.start();
mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, null));
myOrientationListener = new MyOrientationListener(this);
//通过接口回调来实现实时方向的改变
myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
@Override
public void onOrientationChanged(float x) {
mCurrentX = x;
}
});
myOrientationListener.start();
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
initMarkerClickEvent();
}
示例5: initRoutePlan
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
private void initRoutePlan() {
flag = 1;
CharSequence title = "推荐路线";
setTitle(title);
mBaiduMap = mMapView.getMap();
mBaiduMap.setOnMapClickListener(this);
mRouteSearch = RoutePlanSearch.newInstance();
mRouteSearch.setOnGetRoutePlanResultListener(this);
}
示例6: initViews
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
private void initViews() {
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
etStart = (EditText) findViewById(R.id.et_online_transstart);
etEnd = (EditText) findViewById(R.id.et_online_transend);
// ��ʼ����ͼ
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
// �趨��ͼ��ʼ���ĵ����꣨�����ʵ��ѧ����У����
LatLng xayd = new LatLng(34.162719, 108.907775);
// �趨��ͼ״̬���趨��ʼ���ĵ�����ż�����
MapStatus mMapStatus = new MapStatus.Builder().target(xayd).zoom(12)
.build();
// ����MapStatusUpdate�����Ա�������ͼ״̬��Ҫ�����ı仯
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory
.newMapStatus(mMapStatus);
// ���õ�ͼ״̬
mBaidumap.setMapStatus(mMapStatusUpdate);
// ��ʼ������ģ�飬ע���¼�����
mSearch = RoutePlanSearch.newInstance();
}
示例7: onCreate
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
CharSequence titleLable = "路线规划功能";
setTitle(titleLable);
intent=getIntent();
city=intent.getStringExtra("city");
//初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
//地图点击事件处理
mBaidumap.setOnMapClickListener(this);
// 初始化搜索模块,注册事件监听
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
back= (ImageView) findViewById(R.id.iv_back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
示例8: onCreate
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
initMapView();
initLocation();
setOnClickListener();
// 初始化搜索模块,注册事件监听
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
showDialog(mMapView);
}
示例9: onCreate
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
Log.e("sid",netWork.session_id);
//netWork.fun(7.0,1.3);
CharSequence titleLable = "FindYou";
setTitle(titleLable);
mWalk=(Button)findViewById(R.id.walk);
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
editSt = (EditText) findViewById(R.id.start);
editEn = (EditText) findViewById(R.id.end);
editSt.setFocusable(false);
editEn.setFocusable(false);
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
//mBtnPre.setVisibility(View.INVISIBLE);
//mBtnNext.setVisibility(View.INVISIBLE);
// 地图点击事件处理
mBaidumap.setOnMapClickListener(this);
// 初始化搜索模块,注册事件监听
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
mCurrentMarker = BitmapDescriptorFactory
.fromResource(R.drawable.icon_geo);
mBaidumap
.setMyLocationConfigeration(new MyLocationConfiguration(
mCurrentMode, true, null));
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(3000);
mLocClient.setLocOption(option);
mLocClient.start();
}
示例10: initMapView
import com.baidu.mapapi.search.route.RoutePlanSearch; //导入方法依赖的package包/类
/**
* 初始化地图控件
*/
public void initMapView() {
mMapLayout = (RelativeLayout)findViewById(R.id.routePlan_mapLayout);
mMapLayout.setVisibility(View.GONE);
mMapFragment = ((MapFragment) (getSupportFragmentManager()
.findFragmentById(R.id.routePlan_mapview)));
mMapView = mMapFragment.getMapView();
mBaiduMap = mMapFragment.getBaiduMap();
//DeoSearch
mGeoSearch = GeoCoder.newInstance();
mGeoSearch.setOnGetGeoCodeResultListener(this);
//Map click handler
mBaiduMap.setOnMapClickListener(this);
//RoutePlanSearch
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
//location
mBaiduMap.setMyLocationEnabled(true);
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setIsNeedAddress(true);
option.setOpenGps(true);
option.setCoorType("bd09ll");
option.setScanSpan(1000);
option.setAddrType("all");
mLocClient.setLocOption(option);
mLocClient.start();
//SuggestSearch
mSuggestionSearch = SuggestionSearch.newInstance();
OnGetSuggestionResultListener listener = new OnGetSuggestionResultListener() {
public void onGetSuggestionResult(SuggestionResult res) {
if (res == null || res.getAllSuggestions() == null) {
return;
}
suggestPosAdapter.clear();
for (SuggestionResult.SuggestionInfo info : res.getAllSuggestions()) {
if (info.key != null)
suggestPosAdapter.add(info.district+info.key);
}
suggestPosAdapter.notifyDataSetChanged();
}
};
mSuggestionSearch.setOnGetSuggestionResultListener(listener);
}