Exemplo n.º 1
0
        //返回插入junction的id
        protected int InsterDB(Cover c)
        {
            if (c == null)
            {
                return(0);
            }
            //change the coordinate Mercator to WGS84
            Coords.Point p = new Coords.Point();
            p.x = c.Location.X;
            p.y = c.Location.Y;
            p   = Coords.Mercator2WGS84(p);
            //store to
            CJuncInfo info = new CJuncInfo();

            info.X_Coor = p.x + Constants.COOR_X_OFFSET;
            info.Y_Coor = p.y + Constants.COOR_Y_OFFSET;

            info.Junc_Category = c.juncInfo.Junc_Category;

            //数据库操作
            TJuncInfo    juncinfo    = new TJuncInfo(App._dbpath, App.PassWord);
            TJuncExtInfo juncextinfo = new TJuncExtInfo(App._dbpath, App.PassWord);

            if (!juncinfo.Insert_JuncInfo(ref info))
            {
                return(0);
            }
            CJuncExtInfo extinfo = new CJuncExtInfo();

            extinfo.JuncID = info.ID;
            juncextinfo.Insert_JuncExtInfo(ref extinfo);
            return(info.ID);
        }
Exemplo n.º 2
0
        private void MapGrid_MouseMove(object sender, MouseEventArgs e)
        {
            foreach (var item in listLayer)                                    //每个图层接收消息
            {
                // if (!item.IsHidden)
                item.OnMouseMove(sender, e);
            }
            //更新信息
            Point p = e.GetPosition(MapGrid);

            if (p.X < 0)
            {
                return;
            }
            int Column = (int)p.X / 256;
            int Row    = (int)p.Y / 256;

            double dx = p.X - Column * 256;
            double dy = p.Y - Row * 256;

            Tile   tile = App.Tiles[Row * Level.Total_Column + Column];
            double x    = tile.X + tile.Dx * dx;
            double y    = tile.Y - tile.Dy * dy;

            Coords.Point point;
            point.x = x; point.y = y;
            Coords.Point mp  = Coords.Mercator2WGS84(point);
            String       Msg = "";

            Msg += "经纬度坐标:\nX:" + mp.x.ToString("0.00000000") + "\nY:" + mp.y.ToString("0.00000000") + "\n";
            Lbl_Detail.Content = Msg;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 转换为GIS坐标
        /// </summary>
        /// <param name="p"> 屏幕上实际坐标</param>
        /// <returns></returns>
        public Point GetGIS842(Point p)
        {
            Point point = new Point();

            point = GetMercator(p);
            Coords.Point cp = new Coords.Point();
            cp.x    = point.X;
            cp.y    = point.Y;
            cp      = Coords.Mercator2WGS84(cp);
            point.X = cp.x + Constants.COOR_X_OFFSET;
            point.Y = cp.y + Constants.COOR_Y_OFFSET;
            return(point);
        }