无人机海图调用介绍——算法

本文介绍了无人机海图调用的C#实现,利用projNet库进行坐标转换。在Form1_Load事件中初始化加载,通过ReadWMSMap2函数加载和变换海图,记录瓦片坐标和显示位置。坐标转换函数如TransformTileWorld,注意Google转换公式存在位置偏移。源码可供参考。
摘要由CSDN通过智能技术生成

主要的海图调用过程和思路上一篇文章已经介绍

本文将介绍下该Demo中的一些函数和数值模式(源码比较乱,前后几种方式实现都在一起,仅供参考)

工程介绍:VS2013,C#实现,其中用到projNet库

1、通过程序运行的前后来介绍:

Form1_Load(初始化加载)

private void Form1_Load(object sender, EventArgs e)
        {
            //将窗口置顶并始终显示在右下角
            SetWindowPos(this.Handle, -1, 0, 0, 0, 0, 1 | 2);
            win_X = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - this.Width;
            win_Y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - this.Height;
            this.SetDesktopLocation(win_X, win_Y);

            //设置界面
            this.MinimizeBox = false;
           // this.OnFormClosed = false;
            this.MaximizeBox = true;
            //设置加载皮肤
            path = System.Environment.CurrentDirectory + "\\UAVShowWindow\\";
            skin.SkinFile = path + "SportsBlack.ssk";
            skin.Active = true;            
            //
            image_file = System.Environment.CurrentDirectory +"\\"+ "20.PNG";
            image_1 = Image.FromFile(image_file);

           // Image
            p_label_map = 0;           
        }

海图层级变化

public void ScaleLevel_ValueChanged(object sender, EventArgs e)//EventArgs e
        {
            //鼠标放大缩小地图
            p_CenterX = p_LUpointX + 0.5 * (p_RUpointX - p_LUpointX);
            p_CenterY = p_LDpointY + 0.5 * (p_LUpointY - p_LDpointY);

            //m_Cpoint = Tran_TW.WorldToTilePos(p_CenterX, p_CenterY, (int)ScaleLevel.Value);
            //鼠标放大缩小地图        
            double l_x = (double)p_picMou_x;
            double l_y = (double)p_picMou_y;
            p_CenterX = p_LUpointX + (l_x / pictureBox1.Width) * (p_RUpointX - p_LUpointX);
            p_CenterY = p_LUpointY - (l_y / pictureBox1.Height) * (p_LUpointY - p_LDpointY);

            //m_Cpoint = Tran_TW.WorldToTilePos(p_CenterX, p_CenterY, (int)ScaleLevel.Value);
            Vector2D m_point = new Vector2D(0, 0);
            m_point = TransformTileWorld.CalculationNum(p_CenterX, p_CenterY, (int)ScaleLevel.Value);
            m_Cpoint.X = (float)m_point.X;
            m_Cpoint.Y = (float)m_point.Y;
           // p_TileIndex = TransformTileWorld.calculateTileIndex(p_CenterX, p_CenterY, (int)ScaleLevel.Value);
            
            if (MapConfig != null)
            {
                int level = (int)ScaleLevel.Value;
                MapConfig.DefaultLevel = level;
                CreatCacheDir();
                //DoMetho
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值