百度地图javascript api怎么实现自定义标记然后将多个标记点连线起来

JavaScript017

百度地图javascript api怎么实现自定义标记然后将多个标记点连线起来,第1张

百度地图javascript api怎么实现自定义标记然后将多个标记点连线起来

官方文件有明确的示例。

你需要用到:maker,polygon

百度地图里的标记点能改颜色么 怎么改

开启百度地图,点选地图右上角的标记,在地图弹出标记工具;

点选标记地点工具选中,在地图任意位置点选即可标记;

点选新增的标记,在开启的编辑框,点选右侧的更换图示,即可选择喜欢的颜色。

如何将多个视讯连线起来

你所说的将多个视讯连线起来是怎样的连线呢? 1、如果多个摄像头的画面需要在一个电脑上显示,是通过在电脑上安装视讯采集卡(分多少路),然后电脑上会显示多个摄像头画面;或者单独买硬碟录影机(方法很多) 2、如果将一个摄像头的画面要在多个监视器上显示,要增加视讯分配器,可以将一路视讯输入变成多路视讯输出。

android开发百度地图怎么实现自定义弹出视窗

基本原理就是用ItemizedOverlay来新增附加物,在OnTap方法中向MapView上新增一个自定义的View(如果已存在就直接设为可见),下面具体来介绍我的实现方法:

一、自定义覆盖物类:MyPopupOverlay,这个类是最关键的一个类ItemizedOverlay,用于设定Marker,并定义Marker的点选事件,弹出视窗,至于弹出视窗的内容,则通过定义Listener,放到Activity中去构造。如果没有特殊需求,这个类不需要做什么改动。程式码如下,popupLinear这个物件,就是加到地图上的自定义View:

public class MyPopupOverlay extends ItemizedOverlay<OverlayItem>{

private Context context = null

这是弹出视窗, 包括内容部分还有下面那个小三角

private LinearLayout popupLinear = null

这是弹出视窗的内容部分

private View popupView = null

private MapView mapView = null

private Projection projection = null

这是弹出视窗内容部分使用的layoutId,在Activity中设定

private int layoutId = 0

是否使用百度带有A-J字样的Marker

private boolean useDefaultMarker = false

private int[] defaultMarkerIds = { R.drawable.icon_marka,

R.drawable.icon_markb, R.drawable.icon_markc,

R.drawable.icon_markd, R.drawable.icon_marke,

R.drawable.icon_markf, R.drawable.icon_markg,

R.drawable.icon_markh, R.drawable.icon_marki,

R.drawable.icon_markj, }

这个Listener用于在Marker被点选时让Activity填充PopupView的内容

private OnTapListener onTapListener = null

public MyPopupOverlay(Context context, Drawable marker, MapView mMapView) {

super(marker, mMapView)

this.context = context

this.popupLinear = new LinearLayout(context)

this.mapView = mMapView

popupLinear.setOrientation(LinearLayout.VERTICAL)

popupLinear.setVisibility(View.GONE)

projection = mapView.getProjection()

}

@Override

public boolean onTap(GeoPoint pt, MapView mMapView) {

点选视窗以外的区域时,当前视窗关闭

if (popupLinear != null &&popupLinear.getVisibility() == View.VISIBLE) {

LayoutParams lp = (LayoutParams) popupLinear.getLayoutParams()

Point tapP = new Point()

projection.toPixels(pt, tapP)

Point popP = new Point()

projection.toPixels(lp.point, popP)

int xMin = popP.x - lp.width / 2 + lp.x

int yMin = popP.y - lp.height + lp.y

int xMax = popP.x + lp.width / 2 + lp.x

int yMax = popP.y + lp.y

if (tapP.x <xMin || tapP.y <yMin || tapP.x >xMax

|| tapP.y >yMax)

popupLinear.setVisibility(View.GONE)

}

return false

}

@Override

protected boolean onTap(int i) {

点选Marker时,该Marker滑动到地图中央偏下的位置,并显示Popup视窗

OverlayItem item = getItem(i)

if (popupView == null) {

如果popupView还没有建立,则构造popupLinear

if (!createPopupView()){

return true

}

}

if (onTapListener == null)

return true

popupLinear.setVisibility(View.VISIBLE)

onTapListener.onTap(i, popupView)

popupLinear.measure(0, 0)

int viewWidth = popupLinear.getMeasuredWidth()

int viewHeight = popupLinear.getMeasuredHeight()

LayoutParams layoutParams = new LayoutParams(viewWidth, viewHeight,

item.getPoint(), 0, -60, LayoutParams.BOTTOM_CENTER)

layoutParams.mode = LayoutParams.MODE_MAP

popupLinear.setLayoutParams(layoutParams)

Point p = new Point()

projection.toPixels(item.getPoint(), p)

p.y = p.y - viewHeight / 2

GeoPoint point = projection.fromPixels(p.x, p.y)

mapView.getController().animateTo(point)

return true

}

private boolean createPopupView() {

TODO Auto-generated method stub

if (layoutId == 0)

return false

popupView = LayoutInflater.from(context).inflate(layoutId, null)

popupView.setBackgroundResource(R.drawable.popupborder)

ImageView dialogStyle = new ImageView(context)

dialogStyle.setImageDrawable(context.getResources().getDrawable(

R.drawable.iw_tail))

popupLinear.addView(popupView)

android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams(

LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)

lp.Margin = -2

lp.leftMargin = 60

popupLinear.addView(dialogStyle, lp)

mapView.addView(popupLinear)

return true

}

@Override

public void addItem(List<OverlayItem>items) {

TODO Auto-generated method stub

int startIndex = getAllItem().size()

for (OverlayItem item : items){

if (startIndex >= defaultMarkerIds.length)

startIndex = defaultMarkerIds.length - 1

if (useDefaultMarker &&item.getMarker() == null){

item.setMarker(context.getResources().getDrawable(

defaultMarkerIds[startIndex++]))

}

}

super.addItem(items)

}

@Override

public void addItem(OverlayItem item) {

TODO Auto-generated method stub

过载这两个addItem方法,主要用于设定自己预设的Marker

int index = getAllItem().size()

if (index >= defaultMarkerIds.length)

index = defaultMarkerIds.length - 1

if (useDefaultMarker &&item.getMarker() == null){

item.setMarker(context.getResources().getDrawable(

defaultMarkerIds[getAllItem().size()]))

}

super.addItem(item)

}

public void setLayoutId(int layoutId) {

this.layoutId = layoutId

}

public void setUseDefaultMarker(boolean useDefaultMarker) {

this.useDefaultMarker = useDefaultMarker

}

public void setOnTapListener(OnTapListener onTapListener) {

this.onTapListener = onTapListener

}

public interface OnTapListener {

public void onTap(int index, View popupView)

}

}

百度地图怎么自定义弹出泡泡

地图是需要用来搜寻的,一般不会出现泡泡的,只有搜寻到你的地图才会出现

弹出泡泡

只有在搜寻地图的你的地图并且点选地图之后才能展现出来

您可以使用自定义类来显示气泡,然后在自定义类中的onTap(int index)中设定一个一个弹出视窗来解决这个问题!

@Override

public boolean onTap(int index) {

在此处理item点选事件

LayoutInflater inflater = LayoutInflater.from(mapView.getContext())

View view = inflater.inflate(R.layout.reserve_warning_pop, null)

TextView tv_reservewarning_pop_parkinglotname = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotname)

TextView tv_reservewarning_pop_parkinglotaddress = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotaddress)

TextView tv_reservewarning_pop_parkinglotcurrentstall = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotcurrentstall)

TextView tv_reservewarning_pop_parkinglotprice = (TextView) view.findViewById(R.id.tv_reservewarning_pop_parkinglotprice)

if (parkingLot != null) {

停车场名

停车场地址

停车场可预订车位

停车场收费型别

}

预定按钮

Button bt_reservewarning_pop_reserve = (Button) view.findViewById(R.id.bt_reservewarning_pop_reserve)

bt_reservewarning_pop_reserve.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

业务处理 }

}

}

})

弹出自定义介面

popupOverlay = new PopupOverlay(mapView, null)

OverlayItem overlayItem = getItem(index)

mapView.getController().setCenter(overlayItem.getPoint())

popupOverlay.showPopup(view, overlayItem.getPoint(), 5)

mapView.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

隐藏弹出视窗

popupOverlay.hidePop()

}

})

return super.onTap(index)

}

请问现在百度地图可以标记多少个点

标注的点说给你是有关系的,

如果是企业的话,你可以做公司名的标注,或者是标注关键词

这个要看有你需要多少了

标注的越多,效果越好,搜寻量就越大

希望可以帮助你,记得采纳我啊

百度地图标注点选后弹出的气泡注释检视怎么自定义

商户中心标注只能搜寻用红色气泡显示在地图上,并不能直接显示出地图名称,百度地图底图文字为系统收录抓取形成,并不是人工手动标注。

})

我们在map对象上添加了一个click事件的监听函数,当点击地图上某个位置时,监听函数通过控制台把当前点击的位置输出出来(注意需要有控制台的支持,比如firebug,如果没有控制台则可使用alert把point的lng和lat属性输出出来)。此外,你也可以使用API提供的坐标拾取工具来完成(http://dev.baidu.com/wiki/static/map/API/tool/getPoint/),它支持检索并且点击地图上任意位置时会出现该位置的坐标。

标注元素组成

从DOM元素构成角度看,一个完整的标注是由以下几个部分组成的:

标注点击区域

标注图标

标注阴影

下面是示意图: