/// <summary>
        /// チェックポイント削除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            if (null != EditCheckPoint)
            {
                CheckPoints.Remove(EditCheckPoint);
                EditCheckPoint = null;
                listbox_CheckPoint.SelectedIndex = -1;

                UpdateCheckPointList();
            }
        }
        /// <summary>
        /// チェックポイントをリストに追加
        /// </summary>
        /// <param name="newCP"></param>
        private void AddCheckPoint(CheckPointData newCP)
        {
            EditListIndex = listbox_CheckPoint.SelectedIndex;

            if (EditListIndex == -1)
            {
                // 新規追加(末尾)
                CheckPoints.Add(newCP);
            }
            else
            {
                // 挿入
                CheckPoints.Insert(EditListIndex, newCP);
            }

            string listItm = newCP.wdPosX.ToString() + "," + newCP.wdPosY.ToString();
            listbox_CheckPoint.Items.Add(listItm);
        }
Esempio n. 3
0
        /// <summary>
        /// バイナリデータ ロード
        /// </summary>
        /// <param name="strm"></param>
        private void Read(BinaryReader strm)
        {
            strm.ReadInt32();   // FileVersion
            strm.ReadInt32();   // セクション数

            LRF_LogFileName = strm.ReadString();

            // マップレイヤー セクション
            {
                int numLayer = strm.ReadInt32();

                WaitProressBar.Value = 0;
                WaitProressBar.Maximum = numLayer;
                WaitProressBar.Step = 1;

                MapLyaer = new List<LayerData>();
                for (int i = 0; i < numLayer; i++)
                {
                    LayerData layer = new LayerData();
                    layer.Read(strm);

                    layer.MakeMapBmp(LRF_Range, LRF_ScaleOfPixel, LRF_PixelSize, colLayerPixel, colLayerBase);
                    MapLyaer.Add(layer);

                    WaitProressBar.PerformStep();
                }
            }

            // チェックポイント セクション
            {
                int numCp = strm.ReadInt32();

                CheckPoints = new List<CheckPointData>();
                for (int i = 0; i < numCp; i++)
                {
                    CheckPointData cp = new CheckPointData();
                    cp.Read(strm);
                }
                UpdateCheckPointList();
            }

            WaitProressBar.Value = 0;
        }
 /// <summary>
 /// リスト選択解除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_DisSelect_Click(object sender, EventArgs e)
 {
     // 選択解除
     EditCheckPoint = null;
     listbox_CheckPoint.SelectedIndex = -1;
 }
        // チェックポイント マウス操作 ===============================================================================================================
        /// <summary>
        /// MouseButton Down
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pb_CPMap_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                if (rbtn_AddPoint.Checked)
                {
                    // チェックポイント新規 追加
                    CheckPointData newCP = new CheckPointData(e.X - ViewTransX, e.Y - ViewTransY);
                    AddCheckPoint(newCP);
                }
                else if (rbtn_Edit.Checked)
                {
                    // オブジェクト移動
                    wldMoveFlg = true;
                }
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                // View移動
                viewMoveFlg = true;
            }

            // 移動前の座標を記憶
            msX = e.X;
            msY = e.Y;

            if (null != EditCheckPoint)
            {
                stX = (int)EditCheckPoint.wdPosX;
                stY = (int)EditCheckPoint.wdPosY;
                //stAng = EditLayer.GetLocalAng();
            }

            if (viewMoveFlg)
            {
                stX = (int)ViewTransX;
                stY = (int)ViewTransY;
                stAng = ViewScale;
            }
        }
        /// <summary>
        /// リスト選択
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listbox_CheckPoint_SelectedIndexChanged(object sender, EventArgs e)
        {
            EditListIndex = listbox_CheckPoint.SelectedIndex;

            if (EditListIndex >= 0 && CheckPoints.Count > 0)
            {
                EditCheckPoint = CheckPoints[EditListIndex];
                //rbtn_AddPoint.Checked = false;
                //rbtn_Edit.Checked = true;
            }
            else
            {
                EditCheckPoint = null;
            }
        }
        /// <summary>
        /// チェックポイント マーカ表示
        /// </summary>
        /// <param name="g"></param>
        /// <param name="cp"></param>
        /// <param name="pastCp"></param>
        private void DrawCheckPoint(Graphics g, CheckPointData cp, CheckPointData pastCp, bool bSelected)
        {
            int nonScl = (int)(10.0 / ViewScale);
            int nonSclHf = nonScl / 2;
            int nonScl3Q = nonSclHf * 3 / 4;

            if (nonSclHf <= 0) nonSclHf = 1;
            if (nonScl3Q <= 0) nonScl3Q = 1;

            g.ResetTransform();
            // View
            g.ScaleTransform(ViewScale, ViewScale, MatrixOrder.Append);
            g.TranslateTransform(ViewTransX, ViewTransY, MatrixOrder.Append);

            // チェックポイント間のライン
            if (null != pastCp)
            {
                g.DrawLine(Pens.Blue,
                           (float)pastCp.wdPosX, (float)pastCp.wdPosY,
                           (float)cp.wdPosX, (float)cp.wdPosY);
            }

            // WorldPos
            g.TranslateTransform((float)cp.wdPosX, (float)cp.wdPosY, MatrixOrder.Prepend);

            // 菱型
            /*
            Point[] ps = {
                 new Point( 0, -nonScl3Q),
                 new Point(nonScl3Q, 0),
                 new Point(0, nonScl3Q),
                 new Point(-nonScl3Q, 0)
             };
            g.FillPolygon(Brushes.Yellow, ps);
            */
            Pen dPen = Pens.Cyan;
            if (bSelected) dPen = Pens.Yellow;

            g.DrawEllipse(dPen, -nonSclHf, -nonSclHf, nonScl, nonScl);
        }