Example #1
0
        void RegeneratePolygon()
        {
            List <PointLatLng> polygonPoints = new List <PointLatLng>();

            foreach (GMapMarker m in objects.Markers)
            {
                if (m is GMapMarkerRect)
                {
                    m.Tag = polygonPoints.Count;
                    polygonPoints.Add(m.Position);
                }
            }

            if (polygon == null)
            {
                polygon = new GMapPolygon(polygonPoints, "polygon test");
                polygon.IsHitTestVisible = true;
                polygons.Polygons.Add(polygon);
            }
            else
            {
                polygon.Points.Clear();
                polygon.Points.AddRange(polygonPoints);

                if (polygons.Polygons.Count == 0)
                {
                    polygons.Polygons.Add(polygon);
                }
                else
                {
                    MainMap1.UpdatePolygonLocalPosition(polygon);
                }
            }
        }
Example #2
0
 // click on some marker  我现在不知道这些功能
 void MainMap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (item is GMapMarkerRect)
         {
             GeoCoderStatusCode status;
             var pos = GMapProviders.GoogleMap.GetPlacemark(item.Position, out status);
             if (status == GeoCoderStatusCode.G_GEO_SUCCESS && pos != null)
             {
                 GMapMarkerRect v = item as GMapMarkerRect;
                 {
                     v.ToolTipText = pos.Value.Address;
                 }
                 MainMap1.Invalidate(false);
             }
         }
         else
         {
             if (item.Tag != null)
             {
                 if (currentTransport != null)
                 {
                     currentTransport.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                     currentTransport             = null;
                 }
                 currentTransport             = item;
                 currentTransport.ToolTipMode = MarkerTooltipMode.Always;
             }
         }
     }
 }
Example #3
0
        // add demo circle
        void MainMap_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            /* var cc = new GMapMarkerCircle(MainMap1.FromLocalToLatLng(e.X, e.Y));
             * objects.Markers.Add(cc);*/

            // set current marker
            currentMarker = new GMarkerGoogle(MainMap1.FromLocalToLatLng(e.X, e.Y), GMarkerGoogleType.arrow);



            Lat_posion[numcount] = currentMarker.Position.Lat;  //向数组添加目标点
            Lng_posion[numcount] = currentMarker.Position.Lng;

            PointLatLng p      = new PointLatLng();
            PointLatLng p_last = new PointLatLng();

            if (numcount > 0)
            {
                p.Lat = Lat_posion[numcount];
                p.Lng = Lng_posion[numcount];

                p_last.Lat = Lat_posion[numcount - 1];
                p_last.Lng = Lng_posion[numcount - 1];

                DrawLineBetweenTwoPoint(p, p_last);
            }
            numcount++;

            //currentMarker.ToolTipText = numcount.ToString();
            //currentMarker.ToolTipMode = MarkerTooltipMode.Always;
            //top.Markers.Add(currentMarker);


            currentMarker = new GMarkerGoogle(p, GMarkerGoogleType.red_small);
            currentMarker.IsHitTestVisible = false;
            top.Markers.Add(currentMarker);


            XiangMuList.Items.Add("第" + numcount.ToString() + "目标点" + "   J:" + currentMarker.Position.Lat.ToString() + "   W:" + currentMarker.Position.Lng.ToString());
        }