Java Code Examples for com.amap.api.maps2d.model.MarkerOptions#icon()

The following examples show how to use com.amap.api.maps2d.model.MarkerOptions#icon() . 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: FindMapAroundAty.java    From myapplication with Apache License 2.0 6 votes vote down vote up
private MarkerOptions getMarkerOptions(AMapLocation amapLocation) {
        //设置图钉选项
        MarkerOptions options = new MarkerOptions();
        //图标
        options.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_location_on_black_48dp));
        //位置
        options.position(new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude()));
        StringBuffer buffer = new StringBuffer();
        buffer.append(amapLocation.getCountry() + "" + amapLocation.getProvince() + "" +
                amapLocation.getCity() + "" + amapLocation.getDistrict() + "" +
                amapLocation.getStreet() + "" + amapLocation.getStreetNum());
        //标题
        options.title(buffer.toString());
        //子标题
//        options.snippet("I'am Here!");
        //设置多少帧刷新一次图片资源
        options.period(60);

        return options;

    }
 
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: Waypoint1Activity.java    From Android-GSDemo-Gaode-Map with MIT License 6 votes vote down vote up
private void updateDroneLocation(){

        LatLng pos = new LatLng(droneLocationLat, droneLocationLng);
        //Create MarkerOptions object
        final MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(pos);
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.aircraft));

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (droneMarker != null) {
                    droneMarker.remove();
                }

                if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
                    droneMarker = aMap.addMarker(markerOptions);
                }
            }
        });
    }
 
Example 4
Source File: Waypoint2Activity.java    From Android-GSDemo-Gaode-Map with MIT License 6 votes vote down vote up
private void updateDroneLocation() {

        LatLng pos = new LatLng(mAircraftLat, mAircraftLng);
        //Create MarkerOptions object
        final MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(pos);
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.aircraft));

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (droneMarker != null) {
                    droneMarker.remove();
                }

                if (checkGpsCoordination(mAircraftLat, mAircraftLng)) {
                    droneMarker = aMap.addMarker(markerOptions);
                    droneMarker.setRotateAngle(droneHeading * -1.0f);
                }
            }
        });
    }
 
Example 5
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 6
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 7
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);
}