当前位置: 首页>>代码示例>>Java>>正文


Java MarkerOptions.icon方法代码示例

本文整理汇总了Java中com.amap.api.maps.model.MarkerOptions.icon方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.icon方法的具体用法?Java MarkerOptions.icon怎么用?Java MarkerOptions.icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amap.api.maps.model.MarkerOptions的用法示例。


在下文中一共展示了MarkerOptions.icon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBeforeClusterRendered

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(Cluster<SceneryCluster> cluster,
		MarkerOptions markerOptions) {
	List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
       int width = mDimension;
       int height = mDimension;

       for (SceneryCluster p : cluster.getItems()) {
           // Draw 4 at most.
           if (profilePhotos.size() == 4) break;
           Drawable drawable = BitmapUtil.toDrawable(App.app, p.getPicture());
           drawable.setBounds(0, 0, width, height);
           profilePhotos.add(drawable);
       }
       MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
       multiDrawable.setBounds(0, 0, width, height);

       mClusterImageView.setImageDrawable(multiDrawable);
       Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
       markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:22,代码来源:SceneryRenderer.java

示例2: onMapLoaded

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapLoaded() {

	MarkerOptions markerOptions = new MarkerOptions();
	markerOptions.setFlat(true);
	markerOptions.anchor(0.5f, 0.5f);
	markerOptions.position(new LatLng(0, 0));
	markerOptions
			.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
					.decodeResource(getResources(),
							R.drawable.icon_loaction_start)));
	mPositionMark = mAmap.addMarker(markerOptions);

	mPositionMark.setPositionByPixels(mMapView.getWidth() / 2,
			mMapView.getHeight() / 2);
	mLocationTask.startSingleLocate();
}
 
开发者ID:amapapi,项目名称:Android_UsingCar_Example,代码行数:18,代码来源:MainActivity.java

示例3: addMarkerOnMap

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void addMarkerOnMap(String message) {
        if (mMarker == null) {
                LogUtil.e("这里设置图标选项");
                mOptions = new MarkerOptions();
                mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
                mOptions.snippet(message);
                mOptions.position(new LatLng(latitude, longitude));
                mMarker = mMap.addMarker(mOptions);
        }
        mMap.reloadMap();
        startMarkerAnimation();
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:13,代码来源:MapActivity.java

示例4: drawSingleMaker

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void drawSingleMaker(LatLng latLng, String title, int iconId) {
    if (iconId != -1) {
        MarkerOptions options = new MarkerOptions().position(latLng).title(title);
        options.icon(BitmapDescriptorFactory.fromResource(iconId));
        mAmap.addMarker(options);
    } else {
        mAmap.addMarker(new MarkerOptions().position(latLng).title(title).snippet("DefaultMarker"));
    }
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:10,代码来源:MapDrawer.java

示例5: createMarkerOptions

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private MarkerOptions createMarkerOptions() {
    MarkerOptions options = new MarkerOptions();
    if (anchorIsSet) options.anchor(anchorX, anchorY);
    //if (calloutAnchorIsSet) options.infoWindowAnchor(calloutAnchorX, calloutAnchorY);
    options.position(position);
    options.title(title);
    options.snippet(snippet);
    options.rotateAngle(rotation);
    options.setFlat(flat);
    options.draggable(draggable);
    options.zIndex(zIndex);
    options.alpha(opacity);
    options.icon(getIcon());
    return options;
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:16,代码来源:AMapMarker.java

示例6: onBeforeClusterItemRendered

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterItemRendered(SceneryCluster item,
		MarkerOptions markerOptions) {
	mImageView.setImageBitmap(item.getPicture());
       Bitmap icon = mIconGenerator.makeIcon();
       markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:8,代码来源:SceneryRenderer.java

示例7: onBeforeClusterRendered

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Called before the marker for a Cluster is added to the map.
 * The default implementation draws a circle with a rough count of the number of items.
 */
protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions) {
    int bucket = getBucket(cluster);
    BitmapDescriptor descriptor = mIcons.get(bucket);
    if (descriptor == null) {
        mColoredCircleBackground.getPaint().setColor(getColor(bucket));
        descriptor = BitmapDescriptorFactory.fromBitmap(mIconGenerator.makeIcon(getClusterText(bucket)));
        mIcons.put(bucket, descriptor);
    }
    // TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
    markerOptions.icon(descriptor);
}
 
开发者ID:jp1017,项目名称:TheSceneryAlong,代码行数:16,代码来源:DefaultClusterRenderer.java

示例8: initMyPoint

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void initMyPoint() {
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_marker));
    markerOption.title("我的位置")
    ;
    mMyLocation = mAMap.addMarker(markerOption);
    LocationModel.getInstance().registerLocationChange(location -> {
        mMyLocation.setPosition(new LatLng(location.latitude,location.longitude));
        mMyLocation.setSnippet(location.getAddress());
    });
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:13,代码来源:PlaceMapPathActivity.java

示例9: initPlacePoint

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void initPlacePoint() {
    MarkerOptions markerOption = new MarkerOptions();
    JUtils.Log("Place" + mPlaceDetail.getLat() + ":" + mPlaceDetail.getLng());
    markerOption.position(new LatLng(mPlaceDetail.getLat(), mPlaceDetail.getLng()));
    markerOption.title(mPlaceDetail.getName()).snippet(mPlaceDetail.getAddressBrief());
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(mPlaceDetail.getCostType() == 0 ? R.drawable.location_point_green : R.drawable.location_point_red));
    mPlaceLocation = mAMap.addMarker(markerOption);
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:10,代码来源:PlaceMapPathActivity.java

示例10: initMyPoint

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void initMyPoint() {
    Location location = LocationModel.getInstance().getCurLocation();
    moveTo(location.getLatitude(), location.getLongitude(), 13);
    mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP));

    MarkerOptions markerOption = new MarkerOptions();
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_marker));
    mMyLocation = aMap.addMarker(markerOption);
    mPoint = new LatLng(location.getLatitude(),location.getLongitude());
    LocationModel.getInstance().registerLocationChange(newLocation -> mMyLocation.setPosition(new LatLng(location.latitude,location.longitude)));
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:13,代码来源:PlaceLocationSelectActivity.java

示例11: onMapClick

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapClick(LatLng latLng) {
    if (mLastMarker != null) mLastMarker.destroy();
    mPoint = latLng;
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.position(latLng);
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_point_bigger_red));
    mLastMarker = aMap.addMarker(markerOption);
    mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP));
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:12,代码来源:PlaceLocationSelectActivity.java

示例12: initMyPoint

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void initMyPoint() {
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_marker));
    mMyLocation = aMap.addMarker(markerOption);
    LocationModel.getInstance().registerLocationChange(location -> {
        JUtils.Log("latitude"+location.latitude+"  longitude"+location.longitude);
        mMyLocation.setPosition(new LatLng(location.latitude, location.longitude));
    });
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:11,代码来源:PlaceMapFragment.java

示例13: addMarker

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addMarker(PlaceBrief place) {
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.position(new LatLng(place.getLat(), place.getLng()));
    markerOption.title(place.getName()).snippet(place.getAddressBrief());
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(place.getCostType() == 0 ? R.drawable.location_point_green : R.drawable.location_point_red));
    Marker marker = aMap.addMarker(markerOption);
    marker.setToTop();
    mMarkerMap.put(marker, place);
    if (mMarkerMap.size() < MIN_ZOOM_MARKER_COUNT+1) zoomMarkerList.add(place);
    if (mMarkerMap.size()== MIN_ZOOM_MARKER_COUNT+1) moveToAdjustPlace(zoomMarkerList);
}
 
开发者ID:Jude95,项目名称:Fishing,代码行数:13,代码来源:PlaceMapFragment.java

示例14: choose

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void choose(MarkerOptions markerOptions, ClusterPoint clusterPoint) {
	Context context = contextRef.get();
	if (context != null) {
		Resources res = context.getResources();
		boolean isCluster = clusterPoint.size() > 1;
		boolean hasTwoToasters = clusterPoint.containsInputPoint(twoToasters);
		BitmapDescriptor icon;
		String title;
		if (isCluster) {
			title = res.getQuantityString(R.plurals.count_points, clusterPoint.size(), clusterPoint.size());
			int clusterSize = clusterPoint.size();
			if (hasTwoToasters) {
				icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster_toaster, clusterSize));
				title = res.getString(R.string.including_two_toasters, title);
			} else {
				icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster, clusterSize));
				title = res.getQuantityString(R.plurals.count_points, clusterSize, clusterSize);
			}
		} else {
			MarkerData data = (MarkerData)clusterPoint.getPointAtOffset(0).getTag();
			if (hasTwoToasters) {
				icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin_toaster);
				title = data.getLabel();
			} else {
				icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin);
				title = res.getString(R.string.point_number_x, data.getLabel());
			}
		}
		markerOptions.icon(icon);
		markerOptions.title(title);
		markerOptions.anchor(0.5f, 1.0f);
	}
}
 
开发者ID:mikezit,项目名称:cluster-amap,代码行数:35,代码来源:ToastedMarkerOptionsChooser.java

示例15: choose

import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void choose(MarkerOptions markerOptions, ClusterPoint clusterPoint) {
	Host host = hostRef.get();
	if (host != null) {
		Bitmap bitmap = host.getIconBitmap(clusterPoint);
		markerOptions.icon(BitmapDescriptorFactory.fromBitmap(bitmap));
	}
}
 
开发者ID:mikezit,项目名称:cluster-amap,代码行数:9,代码来源:MarkerOptionsChooser.java


注:本文中的com.amap.api.maps.model.MarkerOptions.icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。