private void PointMove(MapPointInfo mapPoint) { if (PointMove_Evnet != null) { PointMove_Evnet(mapPoint); } }
private void SelectedMapPoint(MapPointInfo SelectedMapPointValue) { if (SelectedMapPointEvent != null) { SelectedMapPointEvent(this, SelectedMapPointValue); } }
public void SelectedMapPoint(MapPointInfo MapPointInfo) { if (SelectedMapPointEvent != null) { SelectedMapPointEvent(this, MapPointInfo); } }
/// <summary> /// 显示地图_设置地图中心点 /// </summary> /// <param name="pointDisplayMapCenter"></param> public void DisplayMap_SetCenter(MapPointInfo point) { if (mapMain != null) { LegalLonAndLat(ref point.dblLon, ref point.dblLat); pointCurrentMapCenter = new PointD(point.dblLon, point.dblLat); DisplayMap(); } }
/// <summary> /// JS脚本调用用于显示标注的经纬度 160728 /// </summary> /// <param name="lng"></param> /// <param name="lat"></param> /// <param name="level"></param> public void Setlnglat(string lng, string lat, string level) { MapPointInfo mappointInfo = new MapPointInfo(); mappointInfo.dblLon = Convert.ToDouble(lng); mappointInfo.dblLat = Convert.ToDouble(lat); mappointInfo.intMapLevel = Convert.ToInt32(level); mappointInfo.cordinateSyatem = Enum_CordinateSystem.BD_09; SelectedMapPoint(mappointInfo); }
/// <summary> /// Html页面事件_显示标注点 /// </summary> /// <param name="point"></param> /// <param name="strIconFilePath"></param> private void ToHtml_DisplayMarker(MapPointInfo point, string strIconFilePath) { if (Maploaded) { while (!this.IsDisposed) { if (wbMain.ReadyState == WebBrowserReadyState.Complete) { BeginInvoke(new EventHandler(delegate { wbMain.Document.InvokeScript("DisplayMarker", new object[] { point.dblLon, point.dblLat, strIconFilePath }); })); break; } Delay(50); //系统延迟50毫秒 } } }
/// <summary> /// 设置标注点 /// </summary> public void DisplayMap_SetMarker(MapPointInfo point, string strImageFileName) { //设置图片位置,将状态置为显示 PointD pointDisplatPos = new PointD(point.dblLon, point.dblLat); PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 PictureBox pic = new PictureBox(); pic.Image = Image.FromFile(strMapIconPath + "\\" + strImageFileName); pic.Size = new Size(32, 32); pic.BackColor = Color.Transparent; pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - pic.Width / 2), Convert.ToInt32(picMap.Height / 2 + p.Y - pic.Height)); pic.Tag = point; if (dicPicValue.ContainsKey(intPicValueKey)) { dicPicValue[intPicValueKey].Dispose(); } dicPicValue[intPicValueKey] = pic; intPicValueKey++; picMap.Controls.Add(pic); }
public MapPointInfo ToBD_09() { MapPointInfo result = new MapPointInfo(); result.intMapLevel = intMapLevel; result.cordinateSyatem = Enum_CordinateSystem.BD_09; double Temp_dblLon = dblLon; double Temp_dblLat = dblLat; if (cordinateSyatem == Enum_CordinateSystem.WGS_84) { WGSToBD_encrypt(dblLon, dblLat, out Temp_dblLon, out Temp_dblLat); } else if (cordinateSyatem == Enum_CordinateSystem.GCJ_02) { GCJToBD_encrypt(dblLon, dblLat, out Temp_dblLon, out Temp_dblLat); } result.dblLon = Temp_dblLon; result.dblLat = Temp_dblLat; return(result); }
/// <summary> /// 显示地图 /// </summary> private void DisplayMap() { if (mapMain != null) { picMap.Image = mapMain.GetMapImage(pointCurrentMapCenter, picMap.Size, CurrentMapLevel); if (dicPicValue != null && dicPicValue.Count > 0) { foreach (PictureBox pic in dicPicValue.Values) { if (pic != null && pic.Visible == true && pic.Parent == picMap) { MapPointInfo point = (MapPointInfo)pic.Tag; PointD pointDisplatPos = new PointD(point.dblLon, point.dblLat); PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - pic.Width / 2), Convert.ToInt32(picMap.Height / 2 + p.Y - pic.Height)); } } } if (dicLabel != null && dicLabel.Count > 0) { foreach (Label pic in dicLabel.Values) { if (pic != null && pic.Visible == true && pic.Parent == picMap) { MapPointInfo point = (MapPointInfo)pic.Tag; PointD pointDisplatPos = new PointD(point.dblLon, point.dblLat); PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - pic.Width / 2), Convert.ToInt32(picMap.Height / 2 + p.Y - pic.Height) + 32); } } } if (picsDisplayPointList != null && picsDisplayPointList.Length > 0) { //存在显示点 foreach (PictureBox pic in picsDisplayPointList) { if (pic != null && pic.Visible == true && pic.Tag != null && pic.Parent == picMap) { PointD pointDisplatPos = (PointD)pic.Tag; PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - 8), Convert.ToInt32(picMap.Height / 2 + p.Y - 8)); } } } if (picsDisplayMulchList != null && picsDisplayMulchList.Length > 0) { //存在显示区域 foreach (PictureBox pic in picsDisplayMulchList) { if (pic != null && pic.Visible == true && pic.Tag != null && pic.Parent == picMap) { //PointD pointDisplatPos = (PointD)pic.Tag; //PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 //pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - 8), Convert.ToInt32(picMap.Height / 2 + p.Y - 8)); PointAndLevel pl = (PointAndLevel)pic.Tag; PointD pointDisplatPos = new PointD(pl.lon, pl.lat); PointD p = mapMain.WorldToImage(pointCurrentMapCenter, pointDisplatPos, CurrentMapLevel); //计算点在地图上的位置 pic.Location = new Point(Convert.ToInt32(picMap.Width / 2 + p.X - 8), Convert.ToInt32(picMap.Height / 2 + p.Y - 8)); //整体思路 //1.添加时设置显示等级,及默认大小 //2.在显示地图是判断当前等级及显示等级大小(比较) //3.根据比较结果放大或者缩小图片 int intDisplayMapLevel = pl.intMapLevel; //正数表示需要放大 0表示当前等级正常 负数表示需要缩小 以300px 为基准 Size sizeBasic = new Size(300, 300); int intDisparity = intCurrentMapLevel - intDisplayMapLevel; if (intDisparity > 0) { //放大 double Temp_dbl = Math.Pow(2, intDisparity); sizeBasic = new Size(Convert.ToInt32(300 * Temp_dbl), Convert.ToInt32(300 * Temp_dbl)); } else if (intDisparity < 0) { //缩小 intDisparity = Math.Abs(intDisparity); double Temp_dbl = Math.Pow(2, intDisparity); sizeBasic = new Size(Convert.ToInt32(300 / Temp_dbl), Convert.ToInt32(300 / Temp_dbl)); } else if (intDisparity == 0) { //默认值 pic.Size = sizeBasic; } pic.Size = sizeBasic; } } } Display(pointCurrentMapCenter.X, pointCurrentMapCenter.Y, intCurrentMapLevel, ""); } }
public void BaiduOnlineMap_SelectedMapPointEvent(object sender, MapPointInfo mappointInfo) { SelectedMapPoint(mappointInfo); }
/// <summary> /// 设置标注点 /// </summary> public void DisplayMap_SetMarker(MapPointInfo point, string strImageFileName) { ToHtml_DisplayMarker(point, strMapIconPath + "\\" + strImageFileName); }
/// 设置地图中心点 /// </summary> /// <param name="dblLon"></param> /// <param name="dblLat"></param> public void DisplayMap_SetCenter(MapPointInfo point) { ToHtml_SetCenter(point); }