use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.
the class BusRouteOverlay method addTaxiMarkers.
private void addTaxiMarkers(TaxiItem taxiItem) {
LatLng position = AMapUtil.convertToLatLng(taxiItem.getOrigin());
String title = taxiItem.getmSname() + "打车";
String snippet = "到终点";
addStationMarker(new MarkerOptions().position(position).title(title).snippet(snippet).anchor(0.5f, 0.5f).visible(nodeIconVisible).icon(getDriveBitmapDescriptor()));
}
use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.
the class RouteOverlay method getLatLngBounds.
protected LatLngBounds getLatLngBounds() {
LatLngBounds.Builder b = LatLngBounds.builder();
b.include(new LatLng(startPoint.latitude, startPoint.longitude));
b.include(new LatLng(endPoint.latitude, endPoint.longitude));
return b.build();
}
use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.
the class PoiAroundSearchActivity method onPoiSearched.
@Override
public void onPoiSearched(PoiResult result, int rcode) {
/**
* 点击隐藏软键盘
*/
InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
mInputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
if (rcode == 1000) {
if (result != null && result.getQuery() != null) {
// 搜索poi的结果
if (result.getQuery().equals(query)) {
// 是否是同一条
poiResult = result;
// 取得第一页的poiitem数据,页数从数字0开始
poiItems = poiResult.getPois();
List<SuggestionCity> suggestionCities = poiResult.getSearchSuggestionCitys();
if (poiItems != null && poiItems.size() > 0) {
// 清除POI信息显示
whetherToShowDetailInfo(false);
// 并还原点击marker样式
if (mLastMarker != null) {
resetLastMarker();
}
// 清理之前搜索结果的marker
if (poiOverlay != null) {
poiOverlay.removeFromMap();
}
mAMap.clear();
poiOverlay = new myPoiOverlay(mAMap, poiItems);
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
mAMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.point4))).position(new LatLng(lp.getLatitude(), lp.getLongitude())));
mAMap.addCircle(new CircleOptions().center(new LatLng(lp.getLatitude(), lp.getLongitude())).radius(10000).strokeColor(Color.BLUE).fillColor(Color.argb(50, 1, 1, 1)).strokeWidth(2));
} else if (suggestionCities != null && suggestionCities.size() > 0) {
showSuggestCity(suggestionCities);
} else {
Utils.toast(PoiAroundSearchActivity.this, R.string.no_result);
}
}
} else {
Utils.toast(PoiAroundSearchActivity.this, R.string.no_result);
}
}
}
use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.
the class PoiAroundSearchActivity method init.
/**
* 初始化AMap对象
*/
private void init() {
if (mAMap == null) {
mAMap = mapview.getMap();
mUiSettings = mAMap.getUiSettings();
mUiSettings.setScaleControlsEnabled(true);
mAMap.setOnMapClickListener(this);
mAMap.setOnMarkerClickListener(this);
mAMap.setOnInfoWindowClickListener(this);
mAMap.setInfoWindowAdapter(this);
TextView searchButton = (TextView) findViewById(R.id.btn_search);
searchButton.setOnClickListener(this);
locationMarker = mAMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.point4))).position(new LatLng(lp.getLatitude(), lp.getLongitude())));
locationMarker.showInfoWindow();
}
setup();
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lp.getLatitude(), lp.getLongitude()), 13));
}
use of com.amap.api.maps.model.LatLng in project LivingInCampus by DulCoder.
the class AMapUtil method convertArrList.
/**
* 把集合体的LatLonPoint转化为集合体的LatLng
*/
public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) {
ArrayList<LatLng> lineShapes = new ArrayList<LatLng>();
for (LatLonPoint point : shapes) {
LatLng latLngTemp = AMapUtil.convertToLatLng(point);
lineShapes.add(latLngTemp);
}
return lineShapes;
}
Aggregations