Search in sources :

Example 16 with LatLng

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()));
}
Also used : MarkerOptions(com.amap.api.maps.model.MarkerOptions) LatLng(com.amap.api.maps.model.LatLng)

Example 17 with LatLng

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();
}
Also used : LatLngBounds(com.amap.api.maps.model.LatLngBounds) LatLng(com.amap.api.maps.model.LatLng)

Example 18 with LatLng

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);
        }
    }
}
Also used : SuggestionCity(com.amap.api.services.core.SuggestionCity) MarkerOptions(com.amap.api.maps.model.MarkerOptions) CircleOptions(com.amap.api.maps.model.CircleOptions) InputMethodManager(android.view.inputmethod.InputMethodManager) LatLng(com.amap.api.maps.model.LatLng)

Example 19 with LatLng

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));
}
Also used : MarkerOptions(com.amap.api.maps.model.MarkerOptions) TextView(android.widget.TextView) LatLng(com.amap.api.maps.model.LatLng)

Example 20 with LatLng

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;
}
Also used : ArrayList(java.util.ArrayList) LatLng(com.amap.api.maps.model.LatLng) LatLonPoint(com.amap.api.services.core.LatLonPoint)

Aggregations

LatLng (com.amap.api.maps.model.LatLng)50 LatLonPoint (com.amap.api.services.core.LatLonPoint)16 MarkerOptions (com.amap.api.maps.model.MarkerOptions)9 ArrayList (java.util.ArrayList)7 LatLngBounds (com.amap.api.maps.model.LatLngBounds)6 Marker (com.amap.api.maps.model.Marker)6 CameraUpdate (com.amap.api.maps.CameraUpdate)5 Bitmap (android.graphics.Bitmap)4 Point (android.graphics.Point)4 CameraPosition (com.amap.api.maps.model.CameraPosition)4 PolylineOptions (com.amap.api.maps.model.PolylineOptions)4 SuppressLint (android.annotation.SuppressLint)3 TextView (android.widget.TextView)3 Polyline (com.amap.api.maps.model.Polyline)3 Location (android.location.Location)2 View (android.view.View)2 BounceInterpolator (android.view.animation.BounceInterpolator)2 Interpolator (android.view.animation.Interpolator)2 ImageView (android.widget.ImageView)2 BindView (butterknife.BindView)2