js代码: function hailiangdian()
{
if(map.getZoom()<12){
map.removeOverlay();
var points = []; // 添加海量点数据
var total_num =window.external.getRowsNumber();
for (var i = 0; i <= 2 * total_num - 1; i++) {
//points.push(new BMap.Point(data.data[i][0], data.data[i][1]));
points.push(window.external.Getpoints(i));
}
var options = {
size: BMAP_POINT_SIZE_TINY,
shape: BMAP_POINT_SHAPE_CIRCLE,
color: '#53FF53'
}
var pointCollection = new BMap.PointCollection(points, options); // 初始化PointCollection
pointCollection.addEventListener('click', function (e) {
alert(map.getZoom()); // 监听点击事件
});
map.addOverlay(pointCollection); // 添加Overlay
}
else
{
map.removeOverlay();
var points = []; // 添加海量点数据
var total_num =window.external.getRowsNumber();
for (var i = 0; i <= 2 * total_num - 1; i++) {
//points.push(new BMap.Point(data.data[i][0], data.data[i][1]));
points.push(window.external.Getpoints(i));
}
var options = {
size: BMAP_POINT_SIZE_SMALL,
shape: BMAP_POINT_SHAPE_STAR,
color: '#00bb00'
}
var pointCollection = new BMap.PointCollection(points, options); // 初始化PointCollection
pointCollection.addEventListener('click', function (e) {
alert(map.getZoom()); // 监听点击事件
});
map.addOverlay(pointCollection); // 添加Overlay
}
}
}
c# 代码
#region 画点
int Rows_Num = 0;
double[] Pointarry;
public void loadshipjw()
{
//OleDbDataReader DR = DBfunction.getread(limit_sql);
Rows_Num = 0;
ArrayList a = new ArrayList();
string str = "";
str = string.Format("SELECT [UserID],[MessageID] ,[RepeatIndicator],[Navigationstatus],[Rateofturn],[SOG] ,[Positionaccuracy],[Longitude],[Latitude],[COG] ,[Trueheading],[RegionalApplication] ,[Spare],[RAIMFlag] ,[Communicationstate],[ReceiveTime],[UpdateCount],[FromDevice] ,[UpdateTime] FROM [dbo].[tbBoatLocation]");
DataSet ds = DataBase.Query(str);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
double lng =Convert.ToDouble( ds.Tables[0].Rows[i][7])/600000;
double lat = Convert.ToDouble(ds.Tables[0].Rows[i][8]) / 600000;
a.Add(lng.ToString());//经度
a.Add(lat.ToString());//纬度
Rows_Num++;
}
Pointarry = new double[2 * Rows_Num];
for (int i = 0; i <= 2 * Rows_Num-1 ; i++)
{
Pointarry[i] = Convert.ToDouble(a[i]);
}
webBrowser1.Document.InvokeScript("hailiangdian");
}
public int getRowsNumber()
{
return Rows_Num;
}
public double Getpoints(int index)
{
return Pointarry[index];
}
private void timer3_Tick(object sender, EventArgs e)
{
loadshipjw();
}
结果就是不显示,请那位大神给看看