本文整理汇总了Java中com.baidu.mapapi.map.MarkerOptions类的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions类的具体用法?Java MarkerOptions怎么用?Java MarkerOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MarkerOptions类属于com.baidu.mapapi.map包,在下文中一共展示了MarkerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: locationReceiveAddress
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
/**
* 定位接收到的地址
**/
private void locationReceiveAddress() {
if (receiveAddress == null) {
return;
}
LatLng p = new LatLng(receiveAddress.getLatitude(), receiveAddress.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
/* 设置覆盖物图标 */
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_openmap_focuse_mark))
.position(p)
.visible(true);
baiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
setSinglePoiDetail();
return true;
}
});
if (NetUtil.getInstance(SetFavoriteMapActivity.this).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) {
// Snackbar.make(mAmosfPoiList,mAppConfig.getResources().getString(R.string.no_network), Snackbar.LENGTH_SHORT).show();
return;
}
/* 添加覆盖图层 */
baiduMap.addOverlay(markerOptions);
baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(p, 17F));
}
示例2: getOverlayOptions
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
@Override
public final List<OverlayOptions> getOverlayOptions() {
if (mIndoorPoiResult == null || mIndoorPoiResult.getmArrayPoiInfo() == null) {
return null;
}
List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
int markerSize = 0;
for (int i = 0; i < mIndoorPoiResult.getmArrayPoiInfo().size()
&& markerSize < MAX_POI_SIZE; i++) {
if (mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng == null) {
continue;
}
markerSize++;
Bundle bundle = new Bundle();
bundle.putInt("index", i);
markerList.add(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
+ markerSize + ".png")).extraInfo(bundle)
.position(mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng));
}
return markerList;
}
示例3: getOverlayOptions
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
@Override
public final List<OverlayOptions> getOverlayOptions() {
if (mPoiResult == null || mPoiResult.getAllPoi() == null) {
return null;
}
List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
int markerSize = 0;
for (int i = 0; i < mPoiResult.getAllPoi().size()
&& markerSize < MAX_POI_SIZE; i++) {
if (mPoiResult.getAllPoi().get(i).location == null) {
continue;
}
markerSize++;
Bundle bundle = new Bundle();
bundle.putInt("index", i);
markerList.add(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
+ markerSize + ".png")).extraInfo(bundle)
.position(mPoiResult.getAllPoi().get(i).location));
}
return markerList;
}
示例4: addOverLayout
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
private void addOverLayout(double _latitude, double _longitude) {
//先清除图层
mBaiduMap.clear();
mlocationClient.requestLocation();
// 定义Maker坐标点
LatLng point = new LatLng(_latitude, _longitude);
// 构建MarkerOption,用于在地图上添加Marker
MarkerOptions options = new MarkerOptions().position(point)
.icon(dragLocationIcon);
// 在地图上添加Marker,并显示
mBaiduMap.addOverlay(options);
infos.clear();
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_mobai, "001",
"100米", "1分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_youbai, "002",
"200米", "2分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_ofo, "003",
"300米", "3分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_xiaolan, "004",
"400米", "4分钟"));
BikeInfo bikeInfo = new BikeInfo(_latitude - 0.0005, _longitude - 0.0005, R.mipmap.bike_xiaolan, "005",
"50米", "0.5分钟");
infos.add(bikeInfo);
addInfosOverlay(infos);
initNearestBike(bikeInfo, new LatLng(_latitude - 0.0005, _longitude - 0.0005));
}
示例5: handleMessage
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
final SeeLocationActivity activity = activityWeakReference.get();
switch (msg.what) {
case 0:
final String response = (String) msg.obj;
Scanner scanner = new Scanner(response);
double latitude = Double.parseDouble(scanner.next());
double longitude = Double.parseDouble(scanner.next());
LatLng point = new LatLng(latitude, longitude);
if (activity.centP == null) {
activity.centP = point;
activity.baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(activity.centP));
}
activity.initHeadBitmap();
OverlayOptions options = new MarkerOptions().position(point).icon(activity.bitmapDescriptor);
activity.baiduMap.clear();
activity.baiduMap.addOverlay(options);
break;
}
}
示例6: initBaiduMap
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
/**
* 初始化百度地图
*/
private void initBaiduMap() {
// 设置是否显示缩放控件
mMapView.showZoomControls(false);
mBaiduMap = mMapView.getMap();
// 设定地图中心点坐标:宁波天翔货柜有限公司(云台山路)
LatLng point = new LatLng(29.882673, 121.894326);
// 以动画方式更新地图状态,动画耗时默认 300 ms ,地图支持的最大最小级别分别为[3-21]
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLngZoom(point, 18));
// 定义Maker坐标点:宁波天翔货柜有限公司(云台山路)
ArrayList<BitmapDescriptor> giflist = new ArrayList<>();
giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker));
giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker_light));
// 通过marker的icons设置一组图片,再通过period设置多少帧刷新一次图片资源
MarkerOptions mo = new MarkerOptions().position(point).icons(giflist).zIndex(0).period(20);
// 设置生长动画/掉下动画
// mo.animateType(MarkerOptions.MarkerAnimateType.drop);
// 在地图上添加Marker,并显示
mBaiduMap.addOverlay(mo);
}
示例7: onCreate
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
mTvtitle.setText("财神谷地址");
ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
img.setImageResource(R.mipmap.icon_back);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
RoutePlanDemo.this.finish();
}
});
// mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
MapStatus.Builder builder = new MapStatus.Builder();
builder.zoom(18.0f);
builder.target(new LatLng(29.184662, 121.305024));
mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
mBaidumap.setMapStatus(mMapStatusUpdate);
MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
.zIndex(9).draggable(true);
mBaidumap.addOverlay(ooA);
mBaidumap.setTrafficEnabled(true);
findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
go2ThirdMap();
}
});
}
示例8: addOverLayout
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
private void addOverLayout(double _latitude, double _longitude) {
//先清除图层
baiduMap.clear();
mlocationClient.requestLocation();
// 定义Maker坐标点
LatLng point = new LatLng(_latitude, _longitude);
// 构建MarkerOption,用于在地图上添加Marker
MarkerOptions options = new MarkerOptions().position(point)
.icon(dragLocationIcon);
// 在地图上添加Marker,并显示
baiduMap.addOverlay(options);
infos.clear();
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_mobai, "001",
"100米", "1分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_youbai, "002",
"200米", "2分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_ofo, "003",
"300米", "3分钟"));
infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_xiaolan, "004",
"400米", "4分钟"));
BikeInfo bikeInfo = new BikeInfo(_latitude - 0.0005, _longitude - 0.0005, R.mipmap.bike_xiaolan, "005",
"50米", "0.5分钟");
infos.add(bikeInfo);
addInfosOverlay(infos);
initNearestBike(bikeInfo, new LatLng(_latitude - 0.0005, _longitude - 0.0005));
}
示例9: drawRealtimePoint
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
/**
* 画出实时线路点
*
* @param point
*/
private void drawRealtimePoint(LatLng point) {
Log.i("TGA", "绘制成功");
mBaiduMap.clear();
MapStatus mapStatus = new MapStatus.Builder().target(point).zoom(18).build();
msUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus);
realtimeBitmap = BitmapDescriptorFactory.fromResource(R.drawable.ct_map_location);
overlay = new MarkerOptions().position(point)
.icon(realtimeBitmap).zIndex(9).draggable(true);
if (pointList.size() >= 2 && pointList.size() <= 6000) {
polyline = new PolylineOptions().width(10).color(Color.GREEN).points(pointList);
}
addMarker();
}
示例10: addMarker
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
private void addMarker() {
if (stLatLng != null) {
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ct_map_location_32);
OverlayOptions option = new MarkerOptions().position(stLatLng).icon(bitmap);
mBaiduMap.addOverlay(option);
}
if (msUpdate != null) {
mBaiduMap.setMapStatus(msUpdate);
}
if (polyline != null) {
mBaiduMap.addOverlay(polyline);
}
if (overlay != null) {
mBaiduMap.addOverlay(overlay);
}
}
示例11: 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;
}
示例12: initMapView
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
/**
* 初始化地图
*/
private void initMapView() {
//设定中心点坐标
myLatLng = new LatLng(Const.LATITUDE_OF_MY_LOCATION,Const.LONGITUDE_OF_MY_LOCATION);
//定义地图状态
MapStatus mMapStatus = new MapStatus.Builder()
.target(myLatLng)
.zoom(18)
.build();
//定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
bd = BitmapDescriptorFactory
.fromResource(R.drawable.icon_gcoding);
MarkerOptions markerOptions = new MarkerOptions().position(myLatLng).icon(bd);
mBaiduMap.addOverlay(markerOptions);
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
//改变地图状态
mBaiduMap.setMapStatus(mMapStatusUpdate);
}
示例13: 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);
}
示例14: initMaker
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
private void initMaker() {
for (FootInfo info : mFootList) {
if (info.geo != null) {
Double lat = Double.valueOf(info.geo.latitude);
Double lon = Double.valueOf(info.geo.longitude);
// 定义Maker坐标点
LatLng point = new LatLng(lat,lon);
// 构建Marker图标
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(R.drawable.icon_gcoding);
// 构建MarkerOption,用于在地图上添加Marker
OverlayOptions option = new MarkerOptions().position(point)
.icon(bitmap).zIndex(19);
marker = (Marker)baiduMap.addOverlay(option);
}
}
mMapView.invalidate();
}
示例15: setMarker
import com.baidu.mapapi.map.MarkerOptions; //导入依赖的package包/类
/**
* 显示地理标记
*
* @param mapView
* @param array
*/
@ReactProp(name="marker")
public void setMarker(MapView mapView, ReadableArray array) {
Log.d(TAG, "marker:" + array);
if (array != null) {
for (int i = 0; i < array.size(); i++) {
ReadableArray sub = array.getArray(i);
//定义Maker坐标点
LatLng point = new LatLng(sub.getDouble(0), sub.getDouble(1));
//构建Marker图标
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding);
//构建MarkerOption,用于在地图上添加Marker
OverlayOptions option = new MarkerOptions()
.position(point)
.icon(bitmap)
.draggable(true);
//在地图上添加Marker,并显示
mapView.getMap().addOverlay(option);
}
}
}