none
請問PaPaGo! SDK 如何使用繪圖元件 RRS feed

  • 問題

  • 我從版主的範例程式中  加上papagosdk的繪圖元件(標上紅色表示)

    希望在輸入經緯度  找到相對應的地圖時  同時在地圖中心  用繪圖元件在地圖中心

    標示上矩形的點  但是點沒標出來  請問是哪裡出問題

     

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using CEPPGSDK50Lib;
    using CEBMPSDKLib;
    using OpenNETCF.Drawing.Imaging;
    using System.IO.Ports;
    using GPS;

    namespace PpgDemo
    {
        public partial class frmMain : Form
        {
            MapObjectClass mapObj = null;
            DrawObjectClass drawObj = null;

            public frmMain()
            {
                InitializeComponent();
            }

            private void frmMain_Load(object sender, EventArgs e)
            {
                mapObj = new MapObjectClass();
                drawObj = new DrawObjectClass();

               
                int result = 0;

                // 選定風格檔
                //openFileDialog1.Filter = "Profile|*.mpb";
                //openFileDialog1.ShowDialog();
                //mapObj.LoadProfile(openFileDialog1.FileName, out result);
                mapObj.LoadProfile(@"\儲存卡\Program Files\STANDARDV5.mpb", out result);
                if (result == 0)
                {
                    MessageBox.Show("載入風格檔失敗");
                    return;
                }

                // 選定地圖檔
                openFileDialog1.Filter = "Map File|*.nv5";
                openFileDialog1.ShowDialog();
                mapObj.OpenMap(openFileDialog1.FileName, out result);
                //mapObj.LoadProfile(@"\儲存卡\Program Files\Taiwan_UYS.nv5", out result);
                if (result == 0)
                {
                    MessageBox.Show("載入地圖檔失敗");
                    return;
                }

                // 設定圖片大小
                mapObj.SetImageSize(picMap.Width, picMap.Height);
                // 設定圖片標題
                mapObj.SetMapBanner("MSDN Seminar Demo");
                // 更新地圖
                updateMap();
            }

            private void updateMap()
            {
                Bitmap bmp = null;
                int pValue = 0;
                mapObj.GetMapBitmap(out pValue);

                bmp = BitmapBuffer.FromHbitmap((IntPtr)pValue);
                picMap.Image = bmp;
            }

            private void frmMain_Closing(object sender, CancelEventArgs e)
            {
                mapObj.CloseMap();
            }

            private void mnuitmInput_Click(object sender, EventArgs e)
            {
                pnlInput.Visible = !pnlInput.Visible;
            }

            private void btnSet_Click(object sender, EventArgs e)
            {
                double wgsX = 0;
                double wgsY = 0;
                try
                {
                    wgsX = double.Parse(txtX.Text);
                    wgsY = double.Parse(txtY.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                // 設定 X / Y 座標
                int x = 0;
                int y = 0;
                TransformXY(wgsX, wgsY, out x, out y);

                // 設定地圖中心點座標
                mapObj.SetMapCenterXY(x, y);
                int bResult = 0;

              //先產生要update的bmp
                mapObj.OutputMapImage(@"\儲存卡\Program Files\ppgMap.bmp", out bResult);

              //開啟要繪圖的BMP檔、PNG檔或JPG檔
                drawObj.OpenImage(@"\儲存卡\Program Files\ppgMap.bmp", out bResult);

              畫一藍色長度40的正方形
                drawObj.DrawRect(x, y, 20, 20, 255, 255);

              //將結果輸出成一張影像檔 
                drawObj.OutputImageFile(@"\儲存卡\Program Files\ppgMap.bmp", out bResult);

               

                // 更新地圖
                updateMap();
               
               
               
               
                pnlInput.Visible = false;
              
              
               
            }

    2007年5月20日 上午 11:35

所有回覆