コード例 #1
0
        /// <summary>
        /// 计算指定范围内在某一级别中的行列号
        /// </summary>
        /// <param name="minX">最小经度</param>
        /// <param name="minY">最小纬度</param>
        /// <param name="maxX">最大经度</param>
        /// <param name="maxY">最大纬度</param>
        /// <param name="zoom">层级数</param>
        /// <returns>行列号存储类型</returns>
        public RowColumns GetGoogleRowColomns(double minX, double minY, double maxX, double maxY, int zoom)
        {
            RowColumns rc = new RowColumns();

            rc.minRow = (int)Math.Floor((minX + maxExtent) / (maxResolution / (Math.Pow(2, zoom)) * 256.0));
            rc.maxRow = (int)Math.Ceiling((maxX + maxExtent) / (maxResolution / (Math.Pow(2, zoom)) * 256.0));
            rc.minCol = (int)Math.Floor((maxExtent - maxY) / (maxResolution / (Math.Pow(2, zoom)) * 256.0));
            rc.maxCol = (int)Math.Ceiling((maxExtent - minY) / (maxResolution / (Math.Pow(2, zoom)) * 256.0));
            rc.zoom   = zoom;
            return(rc);
        }
コード例 #2
0
ファイル: Row.razor.cs プロジェクト: weiplanet/Blazorise
        /// <inheritdoc/>
        protected override void BuildClasses(ClassBuilder builder)
        {
            builder.Append(ClassProvider.Row());
            builder.Append(ClassProvider.RowNoGutters(), NoGutters);

            if (RowColumns != null && RowColumns.HasSizes)
            {
                builder.Append(RowColumns.Class(ClassProvider));
            }

            base.BuildClasses(builder);
        }
コード例 #3
0
        public RowColumns GetTdtRowColomns(double minX, double minY, double maxX, double maxY, int zoom)
        {
            RowColumns rc   = new RowColumns();
            double     coef = 360.0 / Math.Pow(2, zoom);

            rc.minRow = (int)Math.Floor((minX - this.topTileFromX) / coef);
            rc.maxRow = (int)Math.Ceiling((maxX - this.topTileFromX) / coef);
            rc.minCol = (int)Math.Floor((this.topTileFromY - maxY) / coef);
            rc.maxCol = (int)Math.Ceiling((this.topTileFromY - minY) / coef);
            rc.zoom   = zoom;
            return(rc);
        }
コード例 #4
0
ファイル: OSMTile.cs プロジェクト: zhongshuiyuan/TileDownLoad
        public override RowColumns GetRowColomns(double minX, double minY, double maxX, double maxY, int zoom)
        {
            var rc = new RowColumns
            {
                zoom   = zoom,
                minRow = (int)Math.Floor((minX + this.maxExtent) / (this.maxResolution / (Math.Pow(2, zoom)) * 256.0)),
                maxRow = (int)Math.Ceiling((maxX + this.maxExtent) / (this.maxResolution / (Math.Pow(2, zoom)) * 256.0)),
                minCol = (int)Math.Floor((this.maxExtent - maxY) / (this.maxResolution / (Math.Pow(2, zoom)) * 256.0)),
                maxCol = (int)Math.Ceiling((this.maxExtent - minY) / (this.maxResolution / (Math.Pow(2, zoom)) * 256.0))
            };

            rc.zoom = zoom;
            return(rc);
        }
コード例 #5
0
        public override RowColumns GetRowColomns(double minX, double minY, double maxX, double maxY, int zoom)
        {
            RowColumns titleInfo = new RowColumns()
            {
                zoom = zoom
            };
            double resolution = Math.Pow(2, 18 - zoom);

            titleInfo.minRow = (int)(Math.Ceiling((minX - 0) / (resolution * 256)));
            titleInfo.minCol = (int)(Math.Ceiling((minY - 23000) / (resolution * 256)));
            titleInfo.maxRow = (int)(Math.Floor((maxX - 0) / (resolution * 256)));
            titleInfo.maxCol = (int)(Math.Floor((maxY - 23000) / (resolution * 256)));
            return(titleInfo);
        }
コード例 #6
0
        private void AddLevels()
        {
            var tile = WorkInfo.CreateTitle(this.mapType);

            for (int i = 6; i < tile.MaxTileCount; i++)
            {
                RowColumns rc         = tile.GetRowColomns(this.minX, this.minY, this.maxX, this.maxY, i);
                int        count      = (rc.maxRow - rc.minRow + 1) * (rc.maxCol - rc.minCol + 1);
                double     memorySize = count * tile.TileSize / 1024.0;
                int        index      =
                    this.dataGridViewX.Rows.Add(
                        new object[]
                {
                    false, "第" + i.ToString() + "级", rc.maxRow - rc.minRow + 1, rc.maxCol - rc.minCol + 1,
                    count, memorySize.ToString("0.00") + "MB"
                });
                this.dataGridViewX.Rows[index].Tag = i;
            }
        }
コード例 #7
0
ファイル: ImageTool.cs プロジェクト: ssjylsg/TileDownLoad
        /// <summary>
        /// 自动拼接图片
        /// </summary>
        /// <param name="dicImage"></param>
        /// <param name="path">保存路径</param>
        public static void CreateImage(Dictionary <string, List <Image> > dicImage, string path, Handlers.ProcessNotifyHandler processNotifyHandler, RowColumns rc)
        {
            try
            {
                //图片列表
                if (dicImage.Count <= 0)
                {
                    return;
                }
                int width  = 0;
                int height = 0;
                //计算总长度
                List <Image> temp = null;
                foreach (var i in dicImage)
                {
                    if (i.Value.Count == 0)
                    {
                        width += 256;
                    }
                    else
                    {
                        width += i.Value[0].Width;
                    }
                    temp = i.Value;
                }
                foreach (Image image in temp)
                {
                    height += image.Height;
                }
                //构造最终的图片白板
                Bitmap   tableChartImage = new Bitmap(width, height);
                Graphics graph           = Graphics.FromImage(tableChartImage);
                //初始化这个大图
                graph.DrawImage(tableChartImage, width, height);

                int currentWidth = 0;
                int k            = 0;
                int count        = (rc.maxRow - rc.minRow + 1) * (rc.maxCol - rc.minCol + 1);
                foreach (var i in dicImage)
                {
                    //拼图
                    Image currentImage  = null;
                    int   currentHeight = 0;
                    foreach (Image image in i.Value)
                    {
                        graph.DrawImage(image, currentWidth, currentHeight);
                        //拼接改图后,当前宽度
                        currentHeight += image.Height;
                        currentImage   = image;
                        k++;
                        string msg = "提示:已处理第" + rc.zoom.ToString() + "级," + k.ToString() + "条,共" + count.ToString() + "条";
                        if (processNotifyHandler != null)
                        {
                            processNotifyHandler(msg, (k * 100) / count);
                        }
                    }
                    currentWidth += currentImage.Width;
                }
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                tableChartImage.Save(path + "\\temp.tif", System.Drawing.Imaging.ImageFormat.Tiff);
                graph.Dispose();
                tableChartImage.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txbSavePath.Text))
            {
                MessageBox.Show("请输入有效存储路径");
                this.DialogResult = DialogResult.None;
                return;
            }
            if (txbName.Text.Trim() == string.Empty)
            {
                MessageBox.Show("请输入任务名称");
                this.DialogResult = DialogResult.None;
                return;
            }

            try
            {
                this.minX = double.Parse(this.txbLeftBottom.Text.Split(',')[0]);
                this.minY = double.Parse(this.txbLeftBottom.Text.Split(',')[1]);
                this.maxX = double.Parse(this.txbRightTop.Text.Split(',')[0]);
                this.maxY = double.Parse(this.txbRightTop.Text.Split(',')[1]);
            }
            catch (Exception)
            {
            }


            int count = 0;

            NPMapTiles.ImageTools.MapTool mapTool = new ImageTools.MapTool();
            List <RowColumns>             rcList  = new List <RowColumns>();
            var tile = WorkInfo.CreateTitle(this.mapType);

            for (int i = 0; i < this.dataGridViewX.Rows.Count; i++)
            {
                if ((bool)this.dataGridViewX.Rows[i].Cells[0].Value)
                {
                    int z = (int)this.dataGridViewX.Rows[i].Tag;
                    count = count + (int)this.dataGridViewX.Rows[i].Cells[4].Value;
                    RowColumns rc = tile.GetRowColomns(this.minX, this.minY, this.maxX, this.maxY, z);
                    rcList.Add(rc);
                }
            }
            if (rcList.Count == 0)
            {
                MessageBox.Show("请至少选择一个层级");
                this.DialogResult = DialogResult.None;
                return;
            }
            string name  = this.txbName.Text.Trim();
            int    index = this.dataGridViewWorks.Rows.Add(
                name,
                "0/" + count.ToString(),
                "0/" + count.ToString(),
                "0/" + count.ToString(),
                "0/" + count.ToString(),
                count.ToString(),
                "暂停下载");
            WorkInfo workInfo = new WorkInfo();

            if (checkBoxAusterityFile.Checked)
            {
                workInfo.isAusterityFile = true;
            }
            else
            {
                workInfo.isAusterityFile = false;
            }
            workInfo.maxX     = this.maxX;
            workInfo.maxY     = this.maxY;
            workInfo.minX     = this.minX;
            workInfo.minY     = this.minY;
            workInfo.mapType  = this.mapType;
            workInfo.rcList   = rcList;
            workInfo.filePath = this.txbSavePath.Text.Trim();
            workInfo.workName = name;
            workInfo.processDownImage.count = count;
            workInfo.id = System.Guid.NewGuid().ToString();
            this.dataGridViewWorks.Rows[index].Tag = workInfo;
            WorkConfig.GetInstance().Commandconfig.workInfoList.Add(workInfo);
            WorkConfig.GetInstance().saveConfig();
        }
コード例 #9
0
ファイル: TableRow.cs プロジェクト: uutilsplugin/tables
        ////////////////////////////////////////////////////////////////////////

        #region Check Columns

        public bool HasAllColumnsEmpty()
        {
            return(RowColumns.Count(_x => _x.Value == string.Empty) == RowColumns.Count);
        }