當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。