Search in sources :

Example 1 with MarkerOptions

use of com.amap.api.maps2d.model.MarkerOptions in project summer-android by cn-cerc.

the class ClockInActivity method onLocationChanged.

@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (mListener != null && aMapLocation != null) {
        if (aMapLocation != null && aMapLocation.getErrorCode() == 0) {
            if (isFirstLoc) {
                CameraPosition LUJIAZUI = new CameraPosition.Builder().target(new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude())).zoom(17).bearing(0).tilt(45).build();
                aMap.animateCamera(CameraUpdateFactory.newCameraPosition(LUJIAZUI));
                isFirstLoc = false;
            }
            // 显示系统小蓝点
            mListener.onLocationChanged(aMapLocation);
            NowLocation = aMapLocation;
            myLaLn = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
            Log.i("Location", aMapLocation.getLatitude() + "::::" + aMapLocation.getLongitude());
            if (markerOption == null) {
                String address = NowLocation.getProvince() + NowLocation.getCity() + NowLocation.getDistrict() + NowLocation.getStreet() + NowLocation.getStreetNum() + NowLocation.getAoiName();
                text_address.setText(address);
                latLngSign = myLaLn;
                markerOption = new MarkerOptions().icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)).position(new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude())).draggable(true);
            }
        } else {
            String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
            Log.e("AmapErr", errText);
            ActivityCompat.requestPermissions(ClockInActivity.this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION }, 0x67);
        }
    }
}
Also used : CameraPosition(com.amap.api.maps2d.model.CameraPosition) MarkerOptions(com.amap.api.maps2d.model.MarkerOptions) LatLng(com.amap.api.maps2d.model.LatLng)

Example 2 with MarkerOptions

use of com.amap.api.maps2d.model.MarkerOptions in project KL2 by jweihao.

the class GaoDeActivity method refleshLocationMark.

/**
 * 刷新地图标志物gps定位位置
 *
 * @param latitude
 * @param longitude
 */
private void refleshLocationMark(double latitude, double longitude) {
    if (mLocationGpsMarker == null) {
        mLocationGpsMarker = mAMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.location_blue))).draggable(true));
    }
    mLocationGpsMarker.setPosition(new LatLng(latitude, longitude));
    mAMap.invalidate();
}
Also used : MarkerOptions(com.amap.api.maps2d.model.MarkerOptions) LatLng(com.amap.api.maps2d.model.LatLng)

Example 3 with MarkerOptions

use of com.amap.api.maps2d.model.MarkerOptions in project KL2 by jweihao.

the class GaoDeActivity method refleshSelectByListMark.

/**
 * 刷新地图标志物选中列表的位置
 *
 * @param latitude
 * @param longitude
 */
private void refleshSelectByListMark(double latitude, double longitude) {
    if (mSelectByListMarker == null) {
        mSelectByListMarker = mAMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.location_red))).draggable(true));
    }
    mSelectByListMarker.setPosition(new LatLng(latitude, longitude));
    if (!mSelectByListMarker.isVisible()) {
        mSelectByListMarker.setVisible(true);
    }
    mAMap.invalidate();
}
Also used : MarkerOptions(com.amap.api.maps2d.model.MarkerOptions) LatLng(com.amap.api.maps2d.model.LatLng)

Example 4 with MarkerOptions

use of com.amap.api.maps2d.model.MarkerOptions in project KL2 by jweihao.

the class GaoDeActivity method refleshMark.

/**
 * 刷新地图标志物位置
 *
 * @param latitude
 * @param longitude
 */
private void refleshMark(double latitude, double longitude) {
    if (mMarker == null) {
        mMarker = mAMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), android.R.color.transparent))).draggable(true));
    }
    mMarker.setPosition(new LatLng(latitude, longitude));
    mAMap.invalidate();
}
Also used : MarkerOptions(com.amap.api.maps2d.model.MarkerOptions) LatLng(com.amap.api.maps2d.model.LatLng)

Aggregations

LatLng (com.amap.api.maps2d.model.LatLng)4 MarkerOptions (com.amap.api.maps2d.model.MarkerOptions)4 CameraPosition (com.amap.api.maps2d.model.CameraPosition)1