Exemplo n.º 1
0
        /// <summary>
        /// 保存矢量数据到文件
        /// </summary>
        /// <param name="shpFileName"></param>
        /// <param name="features"></param>
        private void SaveToShp(string shpFileName, Feature[] features)
        {
            IEsriShapeFilesWriter writer = null;

            try
            {
                writer = new EsriShapeFilesWriterII(shpFileName, enumShapeType.Polygon);
                writer.BeginWrite();
                writer.Write(features);
            }
            finally
            {
                if (writer != null)
                {
                    writer.EndWriter();
                }
            }
        }
Exemplo n.º 2
0
        private void TryExportIceLine2Shp(Feature[] iceLines, string shpFileName)
        {
            int    cntCount = iceLines.Length;
            string tip      = "正在将等值线导出为矢量文件({0}/{1})...";
            int    progress = 0;
            float  interval = 100f / cntCount;
            IEsriShapeFilesWriter writer = null;

            try
            {
                writer = new EsriShapeFilesWriterII(shpFileName, enumShapeType.Polyline);
                writer.BeginWrite();
                Feature[] buffer = new Feature[1];
                for (int i = 0; i < cntCount; i++)
                {
                    if (iceLines[i] == null)
                    {
                        continue;
                    }
                    progress = (int)(Math.Floor(interval * i));
                    //Feature fet = GetIceLineFeature(iceLines[i], resX, resY, minX, maxY, i);
                    Feature fet = iceLines[i];
                    if (fet != null)
                    {
                        buffer[0] = fet;
                        writer.Write(buffer);
                    }
                    if (_progressTracker != null)
                    {
                        _progressTracker(progress, string.Format(tip, i, cntCount));
                    }
                }
            }
            finally
            {
                if (writer != null)
                {
                    writer.EndWriter();
                }
            }
        }