Exemplo n.º 1
0
        private void circleButton_Click(object sender, EventArgs e)
        {
            Int16       r = Convert.ToInt16(this.radiusTextBox.Text);
            UInt16      n = Convert.ToUInt16(this.numTextBox.Text);
            int         id;
            PointLatLng pos;

            if (mapOverlayMarker.Markers.Count > 0)
            {
                pos = MyMap.gcj_To_Gps84(mapOverlayMarker.Markers[0].Position);
                id  = IbusMessageClass.Send_tastitem_circle(0, 0, pos.Lat, pos.Lng, IbusMessageClass.Get_position_alt(), r, n);
            }
            else
            {
                id = IbusMessageClass.Send_tastitem_circle(0, 0, 0, 0, 0, r, n);
            }


            int ret = 0;

            if (id < 0)
            {
                MessageBox.Show("绕圈失败");
            }

            do
            {
                ret = IbusMessageClass.Get_ibus_ret(id);
                Thread.Sleep(5);
            } while (ret > 0);
            if (ret < 0)
            {
                MessageBox.Show("自动起飞失败:" + ret.ToString());
            }
            else if (ret == 0)
            {
                MessageBox.Show("自动起飞成功:" + ret.ToString());
            }
        }
Exemplo n.º 2
0
        private void setWayPointButton_Click(object sender, EventArgs e)
        {
            int id, ret;
            int wpCount = mapOverlayMarker.Markers.Count;

            if (wpCount == 0)
            {
                return;
            }

            for (int i = 0; i < wpCount; i++)
            {
                PointLatLng pos = MyMap.gcj_To_Gps84(mapOverlayMarker.Markers[i].Position);
                id = IbusMessageClass.Send_tastitem_waypoint((ushort)wpCount, (ushort)(i + 1), pos.Lat, pos.Lng, 10, 0);

                if (id < 0)
                {
                    MessageBox.Show("设置航点点错误");
                }

                do
                {
                    ret = IbusMessageClass.Get_ibus_ret(id);
                    Thread.Sleep(5);
                } while (ret > 0);

                if (ret < 0)
                {
                    MessageBox.Show("设置航点错误:" + ret.ToString());
                }
                else if (ret == 0)
                {
                    //  MessageBox.Show("设置航点成功:" + ret.ToString());
                }
            }
        }
Exemplo n.º 3
0
        private void myMap_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                PointLatLng mouseLatLng = myMap.FromLocalToLatLng(e.X, e.Y);
                GMapMarker  mapMarker   = new GMarkerGoogle(mouseLatLng, GMarkerGoogleType.green);
                mapMarker.ToolTipText = (mapOverlayMarker.Markers.Count + 1).ToString();
                mapOverlayMarker.Markers.Add(mapMarker);
                if (mapOverlayMarker.Markers.Count >= 2)
                {
                    List <PointLatLng> listPoint = new List <PointLatLng>();
                    listPoint.Add(mapOverlayMarker.Markers[mapOverlayMarker.Markers.Count - 2].Position);
                    listPoint.Add(mouseLatLng);
                    GMapRoute gMapRoute = new GMapRoute(listPoint, "");
                    gMapRoute.Stroke.Color = Color.Yellow;
                    gMapRoute.Stroke.Width = 2;

                    mapOverlayMarker.Routes.Add(gMapRoute);
                }
                mouseLatLng = MyMap.gcj_To_Gps84(mouseLatLng);
                this.showMapLatLable.Text = mouseLatLng.Lat.ToString();
                this.showMapLonLabel.Text = mouseLatLng.Lng.ToString();
            }
        }