本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}