com.amap.api.maps2d.model.Marker Java Examples

The following examples show how to use com.amap.api.maps2d.model.Marker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 6 votes vote down vote up
/**
 * 删除地图上的标记
 * @param markerControl 传递消息的对象
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void deleteMarker(MarkerControl markerControl) {
    LogUtil.d(TAG, "code = " + markerControl.getControl());
    int code = markerControl.getControl();
    if (code == -100) {
        for (int i = 0; i <= mMarkerList.size() - 1; i++) {
            mMarkerList.get(i).destroy();
        }
        mMarkerList.clear();
    } else {
        Marker marker = mMarkerList.get(code);
        mMarkerList.remove(code);
        marker.destroy();
    }
}
 
Example #2
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
private void addMarker(LatLng latLng, String url) {
        AsyncImageView imageView = (AsyncImageView) LayoutInflater.from(this).inflate(R.layout.map_marker_view, null);
//        AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.icon);
        imageView.setResource(url,0);

//        aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
//                .position(new LatLng(30.679879, 104.064855)).title("成都市")
//                .snippet("成都市:30.679879, 104.064855").draggable(true));

        MarkerOptions markerOption = new MarkerOptions();
        markerOption.position(new LatLng(34.341568, 108.940174));
//        markerOption.title("西安市").snippet("西安市:34.341568, 108.940174");
//        markerOption.draggable(true);
//        markerOption.icon(BitmapDescriptorFactory.fromResource(R.drawable.rc_default_portrait));
        markerOption.icon(BitmapDescriptorFactory.fromView(imageView));
//        markerOption.icon(BitmapDescriptorFactory
//                .defaultMarker(BitmapDescriptorFactory.HUE_RED));


        Marker marker2 = aMap.addMarker(markerOption);
        // marker旋转90度
//        marker2.setRotateAngle(90);
    }
 
Example #3
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
/**
 * 记录获得点的坐标
 * @param mapMarker 记录的信号
 */
@Subscribe(threadMode = ThreadMode.MAIN)
public void onIntEvent(MapMarker mapMarker) {
    LogUtil.e(TAG, "addToMap()");
    if (mapMarker == MapMarker.ADD) {
        Marker marker = aMap.addMarker(new MarkerOptions());
        marker.setPosition(mLatLng);
        mMarkerList.add(marker);
        LogUtil.d(TAG, "ListLeng =" + mMarkerList.size());
    }
}
 
Example #4
Source File: Waypoint2Activity.java    From Android-GSDemo-Gaode-Map with MIT License 5 votes vote down vote up
private void markWaypoint(LatLng point) {
    //Create MarkerOptions object
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(point);
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    Marker marker = aMap.addMarker(markerOptions);
    mMarkers.put(mMarkers.size(), marker);
}
 
Example #5
Source File: Waypoint1Activity.java    From Android-GSDemo-Gaode-Map with MIT License 5 votes vote down vote up
private void markWaypoint(LatLng point){
    //Create MarkerOptions object
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(point);
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    Marker marker = aMap.addMarker(markerOptions);
    mMarkers.put(mMarkers.size(), marker);
}
 
Example #6
Source File: LocationMapActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
public void removeMarker(String userId) {

        List<Marker> markers = getaMap().getMapScreenMarkers();

        for (Marker marker : markers) {
            if (marker.getObject() != null && userId.equals(marker.getObject())) {
                marker.remove();
                break;
            }
        }
    }
 
Example #7
Source File: FindMapAroundAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
/**
 * 从marker中得到poi在list的位置。
 *
 * @param marker 一个标记的对象。
 * @return 返回该marker对应的poi在list的位置。
 * @since V2.1.0
 */
public int getPoiIndex(Marker marker) {
    for (int i = 0; i < mPoiMarks.size(); i++) {
        if (mPoiMarks.get(i).equals(marker)) {
            return i;
        }
    }
    return -1;
}
 
Example #8
Source File: FindMapAroundAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
/**
 * 添加Marker到地图中。
 *
 * @since V2.1.0
 */
public void addToMap() {
    for (int i = 0; i < mPois.size(); i++) {
        Marker marker = mamap.addMarker(getMarkerOptions(i));
        PoiItem item = mPois.get(i);
        marker.setObject(item);
        mPoiMarks.add(marker);
    }
}
 
Example #9
Source File: ScheduleMapFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化坐标
 */
private void initLatLng() {
    for (int i = 0; i < mLatLngList.size(); i++) {
        Marker marker = mAMap.addMarker(new MarkerOptions());
        marker.setPosition(mLatLngList.get(i));
        marker.setTitle(String.valueOf(i + 1));
        mAMap.moveCamera(CameraUpdateFactory.changeLatLng(mLatLngList.get(0)));
        mAMap.moveCamera(CameraUpdateFactory.zoomTo(13));
    }
}
 
Example #10
Source File: AMapLiteActivity.java    From XposedRimetHelper with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 添加标记 并移除旧的
 *
 * @param latLng
 * @return
 */
private void addMarker(LatLng latLng, String name) {
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_current_location));
    markerOptions.position(latLng);
    markerOptions.snippet(latLng.latitude + "," + latLng.longitude);
    markerOptions.title(TextUtils.isEmpty(name) ? "未知" : name);
    Marker marker = mAMap.addMarker(markerOptions);

    if (mChooseMarker != null) {
        mChooseMarker.remove();
    }
    mChooseMarker = marker;
}
 
Example #11
Source File: FindMapAroundAty.java    From myapplication with Apache License 2.0 4 votes vote down vote up
/**
 * 去掉PoiOverlay上所有的Marker。
 *
 * @since V2.1.0
 */
public void removeFromMap() {
    for (Marker mark : mPoiMarks) {
        mark.remove();
    }
}
 
Example #12
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public View getInfoWindow(Marker marker) {
    return null;
}
 
Example #13
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public View getInfoContents(Marker marker) {
    return null;
}
 
Example #14
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    return false;
}
 
Example #15
Source File: LocationMapActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
public void addMarker(LatLng latLng, final UserInfo userInfo) {

        final String url = userInfo.getPortraitUri().toString();

        final MarkerOptions markerOption = new MarkerOptions();

        markerOption.position(latLng);

        View view = LayoutInflater.from(this).inflate(R.layout.rc_icon_rt_location_marker, null);
        AsyncImageView imageView = (AsyncImageView) view.findViewById(android.R.id.icon);
        ImageView locImageView = (ImageView) view.findViewById(android.R.id.icon1);

        if (userInfo.getUserId().equals(RongIMClient.getInstance().getCurrentUserId())) {
            locImageView.setImageResource(R.drawable.rc_rt_loc_myself);
        } else {
            locImageView.setImageResource(R.drawable.rc_rt_loc_other);
        }

        imageView.setResource(url, 0);

        markerOption.anchor(0.5f, 0.5f).icon(BitmapDescriptorFactory.fromView(view));

        Marker marker = getaMap().addMarker(markerOption);
        marker.setObject(userInfo.getUserId());

    }
 
Example #16
Source File: FindMapAroundAty.java    From myapplication with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    marker = mMarker;
    return false;
}
 
Example #17
Source File: LocationMapActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
/**
 * 对marker标注点点击响应事件
 */
@Override
public boolean onMarkerClick(final Marker marker) {
    return true;
}
 
Example #18
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 2 votes vote down vote up
@Override
public void onInfoWindowClick(Marker marker) {

}
 
Example #19
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 2 votes vote down vote up
@Override
public void onMarkerDragStart(Marker marker) {

}
 
Example #20
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 2 votes vote down vote up
@Override
public void onMarkerDrag(Marker marker) {

}
 
Example #21
Source File: ShareLocationActivity.java    From sealtalk-android with MIT License 2 votes vote down vote up
@Override
public void onMarkerDragEnd(Marker marker) {

}