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


Java MarkerOptions.icon方法代码示例

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


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

示例1: fromMarkerInfo

import com.baidu.mapapi.map.MarkerOptions; //导入方法依赖的package包/类
private MarkerOptions fromMarkerInfo(MarkerInfo markerInfo, boolean isDraggable) {
    final LatLong coord = markerInfo.getPosition();
    if (coord == null) {
        return null;
    }

    final MarkerOptions markerOptions = new MarkerOptions()
        .position(MapUtils.coordToBaiduLatLng(coord))
        .draggable(isDraggable)
        .alpha(markerInfo.getAlpha())
        .anchor(markerInfo.getAnchorU(), markerInfo.getAnchorV())
        .rotate(markerInfo.getRotation())
        .title(markerInfo.getTitle())
        .flat(markerInfo.isFlat())
        .visible(markerInfo.isVisible());

    final Bitmap markerIcon = markerInfo.getIcon(getResources());
    if (markerIcon != null) {
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(markerIcon));
    }

    return markerOptions;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:24,代码来源:BaiduMapFragment.java

示例2: generateMarker

import com.baidu.mapapi.map.MarkerOptions; //导入方法依赖的package包/类
private void generateMarker(MarkerInfo markerInfo, LatLng position, boolean isDraggable) {

        Log.v("123","SSSSSSSSSSSSSSSSSSSSSSSSSSSSS");
        final MarkerOptions markerOptions = new MarkerOptions()
                .position(position)
                .draggable(isDraggable)
                .anchor(markerInfo.getAnchorU(), markerInfo.getAnchorV())
                .title(markerInfo.getSnippet()).title(markerInfo.getTitle());

        final Bitmap markerIcon = markerInfo.getIcon(getResources());
        if (markerIcon != null) {
            markerOptions.icon(BitmapDescriptorFactory.fromBitmap(markerIcon));
        }
        else
        {
            markerOptions.icon(BitmapDescriptorFactory
                    .fromResource(R.drawable.ic_marker_white));
        }

        Marker marker = (Marker)getBaiduMap().addOverlay(markerOptions);
        mBiMarkersMap.put(markerInfo, marker);
    }
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:23,代码来源:BaiduMapFragment.java

示例3: onBeforeClusterRendered

import com.baidu.mapapi.map.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());
        Bitmap bitmap = mIconGenerator.makeIcon(getClusterText());
        descriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
        mIcons.put(bucket, descriptor);
    }
    // TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
    markerOptions.icon(descriptor);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:19,代码来源:DefaultClusterRenderer.java

示例4: onBeforeClusterRendered

import com.baidu.mapapi.map.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:modricwang,项目名称:FindYou,代码行数:16,代码来源:DefaultClusterRenderer.java

示例5: drawHistoryTrack

import com.baidu.mapapi.map.MarkerOptions; //导入方法依赖的package包/类
/** 绘制历史轨迹
   * 
   * @param points
   */
private void drawHistoryTrack(final List<LatLng> points,final double distance) {
	// 绘制新覆盖物前,清空之前的覆盖物
	
	mBaiduMap.clear();
	
	if(points.size() == 1){
		points.add(points.get(0));
	}
	
	if(points == null || points.size() == 0){
		TrackApplication.showMessage("当前查询无轨迹点");
		resetMarker();
	}else if (points.size() > 1) {
		
		LatLng llc = points.get(0);
		LatLng llD = points.get(points.size() - 1);
		LatLngBounds bounds = new LatLngBounds.Builder()
				.include(llc).include(llD).build();
		
		mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(bounds);
		 
		//起点图标
		bmStart = BitmapDescriptorFactory.fromResource(R.drawable.icon_start);
		bmEnd = BitmapDescriptorFactory.fromResource(R.drawable.icon_end);
		
		//添加起点图标
		startMarker = new MarkerOptions()
				.position(points.get(points.size() - 1)).icon(bmStart)
				.zIndex(9).draggable(true);
		
		//添加终点图标
		endMarker = new MarkerOptions().position(points.get(0))
				.icon(bmEnd).zIndex(9).draggable(true);
		
		//添加路线
		polylineOptions = new PolylineOptions().width(10)
				.color(Color.RED).points(points);
		
		markerOptions = new MarkerOptions();
		markerOptions.flat(true);
		markerOptions.anchor(0.5f, 0.5f);
		markerOptions.icon(BitmapDescriptorFactory
				.fromResource(R.drawable.icon_gcoding));
		markerOptions.position(points.get(points.size() - 1));
		
		addMarker();
		
	}
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:54,代码来源:RunQueryHistoryActivity.java


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