当前位置: 首页>>代码示例>>C#>>正文


C# IFeatureSet.Save方法代码示例

本文整理汇总了C#中IFeatureSet.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureSet.Save方法的具体用法?C# IFeatureSet.Save怎么用?C# IFeatureSet.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFeatureSet的用法示例。


在下文中一共展示了IFeatureSet.Save方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ErasePolygonShapefileWithPolygonShapefile

        /// <summary>
        /// Removes portions of the input polygon shapefile that are within the erase polygons.
        /// </summary>
        /// <param name="inputShapefile">The input polygon shapefile.</param>
        /// <param name="eraseShapefile">The erase polygon shapefile.</param>
        /// <param name="resultShapefile">The resulting shapefile, with portions removed.</param>
        public static void ErasePolygonShapefileWithPolygonShapefile(
            IFeatureSet inputShapefile, IFeatureSet eraseShapefile, IFeatureSet resultShapefile)
        {
            // Validates the input and resultSF data
            if (inputShapefile == null || eraseShapefile == null || resultShapefile == null)
            {
                return;
            }

            resultShapefile.CopyTableSchema(inputShapefile); // Fill the 1st Featureset fields
            IFeatureSet tempSet = inputShapefile.CombinedFields(eraseShapefile);

            // go through every feature in 1st featureSet
            foreach (IFeature t in inputShapefile.Features)
            {
                // go through every feature in 2nd featureSet
                foreach (IFeature t1 in eraseShapefile.Features)
                {
                    t.Difference(t1, tempSet, FieldJoinType.All);
                }
            }

            // Add to the resultSF Feature Set
            for (int a = 0; a < tempSet.Features.Count; a++)
            {
                resultShapefile.Features.Add(tempSet.Features[a]);
            }

            resultShapefile.Save();
            return;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:37,代码来源:ClipPolygonWithLine.cs

示例2: Execute


//.........这里部分代码省略.........
                    {
                        lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMax), new Coordinate(((x + 1) * width) + xMin, yMax)));
                        if (input.Value[y + 1, x] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMax - height), new Coordinate(((x + 1) * width) + xMin, yMax - height)));
                        }
                    }
                    else if (y == (numRows - 1))
                    {
                        lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMin), new Coordinate(((x + 1) * width) + xMin, yMin)));
                        if (input.Value[y - 1, x] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMin + height), new Coordinate(((x + 1) * width) + xMin, yMin + height)));
                        }
                    }
                    else
                    {
                        if (input.Value[y + 1, x] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMax - ((y + 1) * height)), new Coordinate(((x + 1) * width) + xMin, yMax - ((y + 1) * height))));
                        }
                        if (input.Value[y - 1, x] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate((x * width) + xMin, yMax - (y * height)), new Coordinate(((x + 1) * width) + xMin, yMax - (y * height))));
                        }
                    }
                    if (x == 0)
                    {
                        lineList.Add(new LineSegment(new Coordinate(xMin, yMax - (y * height)), new Coordinate(xMin, yMax - ((y + 1) * height))));
                        if (input.Value[y, x + 1] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate(xMin + width, yMax - (y * height)), new Coordinate(xMin + width, yMax - ((y + 1) * height))));
                        }
                    }
                    else if (x == (numColumns - 1))
                    {
                        lineList.Add(new LineSegment(new Coordinate(xMax, yMax - (y * height)), new Coordinate(xMax, yMax - ((y + 1) * height))));
                        if (input.Value[y, x - 1] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate(xMax - width, yMax - (y * height)), new Coordinate(xMax - width, yMax - ((y + 1) * height))));
                        }
                    }
                    else
                    {
                        if (input.Value[y, x + 1] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate(xMin + ((x + 1) * width), yMax - (y * height)), new Coordinate(xMin + ((x + 1) * width), yMax - ((y + 1) * height))));
                        }
                        if (input.Value[y, x - 1] != value)
                        {
                            lineList.Add(new LineSegment(new Coordinate(xMin + (x * width), yMax - (y * height)), new Coordinate(xMin + (x * width), yMax - ((y + 1) * height))));
                        }
                    }
                    if (cancelProgressHandler.Cancel)
                    {
                        return false;
                    }
                }
            }
            Stopwatch sw = new Stopwatch();
            foreach (double key in featureHash.Keys)
            {
                sw.Reset();
                sw.Start();
                List<LineSegment> lineSegList = featureHash[key] as List<LineSegment>;
                if (lineSegList == null) break;
                List<Polygon> polyList = new List<Polygon>();
                while (lineSegList.Count != 0)
                {
                    List<Coordinate> polyShell = new List<Coordinate>();
                    LineSegment start = lineSegList[0];
                    polyShell.Add(start.P0);
                    polyShell.Add(start.P1);
                    lineSegList.Remove(start);
                    while (!polyShell[0].Equals2D(polyShell[polyShell.Count - 1]))
                    {
                        LineSegment segment = lineSegList.Find(delegate (LineSegment o) {return o.P0.Equals2D(polyShell[polyShell.Count - 1]) || o.P1.Equals2D(polyShell[polyShell.Count - 1]);});
                        if (segment.P0.Equals2D(polyShell[polyShell.Count - 1]))
                        {
                            polyShell.Add(segment.P1);
                        }
                        else
                        {
                            polyShell.Add(segment.P0);
                        }
                        lineSegList.Remove(segment);
                    }
                    polyList.Add(new Polygon(polyShell));
                }
                if (polyList.Count == 1)
                {
                    Feature feat = new Feature(polyList[0], output);
                    feat.DataRow["Value"] = key;
                }
                sw.Stop();
                Debug.WriteLine(sw.ElapsedMilliseconds);
            }
            output.Save();
            return true;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:101,代码来源:RasterToPolygon.cs

示例3: ErasePolySFWithPolySF

        /// <summary>
        /// Removes portions of the input polygon shapefile that are within the erase polygons.
        /// </summary>
        /// <param name="inputSF">The input polygon shapefile.</param>
        /// <param name="eraseSF">The erase polygon shapefile.</param>
        /// <param name="resultSF">The resulting shapefile, with portions removed.</param>
        /// <returns>False if an error was encountered, true otherwise.</returns>
        public static void ErasePolySFWithPolySF(ref IFeatureSet inputSF, ref IFeatureSet eraseSF, ref IFeatureSet resultSF)
        {
            //Validates the input and resultSF data
            if (inputSF == null || eraseSF == null || resultSF == null)
            {
                return;
            }

            resultSF.CopyTableSchema(inputSF);//Fill the 1st Featureset fields
            IFeatureSet tempSet = inputSF.CombinedFields(eraseSF);
            //go through every feature in 1st featureSet
            for (int i = 0; i < inputSF.Features.Count; i++)
            {

                //go through every feature in 2nd featureSet
                for (int j = 0; j < eraseSF.Features.Count; j++)
                {
                    inputSF.Features[i].Difference(eraseSF.Features[j], tempSet, FieldJoinType.All);

                }
            }
            //Add to the resultSF Feature Set
            for (int a = 0; a < tempSet.Features.Count; a++)
            {
                resultSF.Features.Add(tempSet.Features[a]);

            }

            resultSF.Save();
            return;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:38,代码来源:ClipPolygonWithLine.cs

示例4: Execute


//.........这里部分代码省略.........
                    {
                        if (!con_2r && !con_2l && !con_1 && !con_3)
                        {
                            lineList.AddSegment(cr, bc);
                        }
                    }

                    // Left Top out diagonals
                    if (con_6r)
                    {
                        lineList.AddSegment(tc, new Coordinate(xMin + x*width, yMax - (y + 1 + 0.5)*height));
                    }
                    if (con_6l)
                    {
                        lineList.AddSegment(cl, new Coordinate(xMin + (x - 0.5) * width, yMax - (y + 1) * height));
                    }

                    // Left In diagonals
                    if (con_6r || con_2r)
                    {
                        if (!con_8r && !con_8l && !con_7 && !con_1)
                        {
                            lineList.AddSegment(tc, cr);
                        }
                    }
                    if (con_6l || con_2l)
                    {
                        if (!con_4r && !con_4l && !con_5 && !con_3)
                        {
                            lineList.AddSegment(cl, bc);
                        }
                    }
                    
                    if (cancelProgressHandler.Cancel)
                    {
                        return false;
                    }
                }
            }

            var sw = new Stopwatch();
            foreach (var pair in featureHash)
            {
                sw.Restart();

                var key = pair.Key;
                var lineSegList = pair.Value.List;

                var polyList = new List<Polygon>();
                var ind = 0;
                while (ind != lineSegList.Count)
                {
                    var polyShell = new List<Coordinate>();

                    var start = lineSegList[ind++];
                    polyShell.Add(start.P0);
                    polyShell.Add(start.P1);

                    while (!polyShell[0].Equals2D(polyShell[polyShell.Count - 1]))
                    {
                        var last = polyShell[polyShell.Count - 1];
                        LineSegment segment = null;
                        for (int i = ind; i < lineSegList.Count; i++)
                        {
                            var cur = lineSegList[i];
                            if (cur.P0.Equals2D(last) || cur.P1.Equals2D(last))
                            {
                                segment = cur;
                                if (ind != i)
                                {
                                    var swap = lineSegList[ind];
                                    lineSegList[ind] = cur;
                                    lineSegList[i] = swap;
                                }

                                ind++;
                                break;
                            }
                        }
                        Debug.Assert(segment != null);
                        polyShell.Add(segment.P0.Equals2D(last) ? segment.P1 : segment.P0);
                    }

                    polyList.Add(new Polygon(polyShell));
                }

                var geometry = polyList.Count == 1
                                   ? (IBasicGeometry)polyList[0]
                                   : new MultiPolygon(polyList.ToArray());
                var f = output.AddFeature(geometry);
                f.DataRow["Value"] = key;

                sw.Stop();
                Debug.WriteLine(sw.ElapsedMilliseconds);
            }

            output.AttributesPopulated = true;
            output.Save();
            return true;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:101,代码来源:RasterToPolygon.cs

示例5: GetBuffer

        public static bool GetBuffer(IFeatureSet input, double bufferDistance, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            int previous = 0;
            int maxNo = input.Features.Count;
            for (int i = 0; i < maxNo; i++)
            {
                input.Features[i].Buffer(bufferDistance, output);

                //Here we update the progress
                int current = Convert.ToInt32(i * 100 / maxNo);
                if (current > previous)
                {
                    cancelProgressHandler.Progress("", current, current + TextStrings.progresscompleted);
                    previous = current;
                }

                if (cancelProgressHandler.Cancel)
                    return false;
            }

            output.Save();
            return true;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:23,代码来源:Buffer.cs

示例6: Execute

        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="cancelProgressHandler"></param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input == null || output == null)
            {
                return false;
            }

            // We add all the fields
            foreach (DataColumn inputColumn in input.DataTable.Columns)
            {
                output.DataTable.Columns.Add(new DataColumn(inputColumn.ColumnName, inputColumn.DataType));
            }

            // We add the area field
            bool addField = true;
            string fieldCount = string.Empty;
            int i = 0;
            while (addField)
            {
                if (output.DataTable.Columns.Contains(TextStrings.Area + fieldCount) == false)
                {
                    output.DataTable.Columns.Add(new DataColumn(TextStrings.Area + fieldCount, typeof(double)));
                    addField = false;
                }
                else
                {
                    fieldCount = i.ToString();
                    i++;
                }
            }

            // we add all the old features to output
            for (int j = 0; j < input.Features.Count; j++)
            {
                Feature newFeature = new Feature(input.Features[j].BasicGeometry, output);
                foreach (DataColumn colSource in input.DataTable.Columns)
                {
                    newFeature.DataRow[colSource.ColumnName] = input.Features[j].DataRow[colSource.ColumnName];
                }

                newFeature.DataRow[TextStrings.Area + fieldCount] =
                    MultiPolygon.FromBasicGeometry(output.Features[j].BasicGeometry).Area;

                // Status updates is done here
                cancelProgressHandler.Progress(
                    string.Empty,
                    Convert.ToInt32((Convert.ToDouble(j) / Convert.ToDouble(input.Features.Count)) * 100),
                    input.Features[j].DataRow[0].ToString());
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }
            }

            output.Save();
            return true;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:65,代码来源:Area.cs

示例7: Execute

        /// <summary>
        /// Executes the DP line simplefy tool programaticaly
        /// </summary>
        /// <param name="input">The input polygon feature set</param>
        /// <param name="tolerance">The tolerance to use when simplefiying</param>
        /// <param name="output">The output polygon feature set</param>
        /// <param name="cancelProgressHandler">The progress handler</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input, double tolerance, IFeatureSet output, 
            ICancelProgressHandler cancelProgressHandler)
        {
            //Validates the input and output data
            if (input == null || output == null)
                return false;

            //We copy all the fields 
            foreach (DataColumn inputColumn in input.DataTable.Columns)
                output.DataTable.Columns.Add(new DataColumn(inputColumn.ColumnName, inputColumn.DataType));

            int numTotalOldPoints = 0;
                int numTotalNewPoints = 0;

            for (int j = 0; j < input.Features.Count; j++)
            {
                int numOldPoints = 0;
                int numNewPoints = 0;
                
                
                Geometry geom = input.Features[j].BasicGeometry as Geometry;
                if (geom != null) numOldPoints = geom.NumPoints;
                numTotalOldPoints += numOldPoints;
                if (geom != null)
                {
                    for (int part = 0; part < geom.NumGeometries; part++)
                    {
                        Geometry geomPart = (Geometry)geom.GetGeometryN(part);
                        //do the simplification
                        IList<Coordinate> oldCoords = geomPart.Coordinates;
                        IList<Coordinate> newCoords = 
                            MapWindow.Analysis.Topology.Simplify.DouglasPeuckerLineSimplifier.Simplify(oldCoords, tolerance);
                   
                        //convert the coordinates back to a geometry
                        Geometry newGeom = new LineString(newCoords);
                        numNewPoints += newGeom.NumPoints;
                        numTotalNewPoints += numNewPoints;
                        Feature newFeature = new Feature(newGeom, output);
                        foreach (DataColumn colSource in input.DataTable.Columns)
                            newFeature.DataRow[colSource.ColumnName] = input.Features[j].DataRow[colSource.ColumnName];
                    }
                }

                //Status updates is done here, shows number of old / new points
                cancelProgressHandler.Progress("", Convert.ToInt32((Convert.ToDouble(j) / Convert.ToDouble(input.Features.Count)) * 100), 
                    numOldPoints + "-->" + numNewPoints);
                if (cancelProgressHandler.Cancel)
                    return false;
            }
            cancelProgressHandler.Progress("", 100, TextStrings.Originalnumberofpoints + numTotalOldPoints + " " + TextStrings.Newnumberofpoints + numTotalNewPoints);

            output.Save();
            return true;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:62,代码来源:DPSimplification.cs

示例8: Execute

        /// <summary>
        /// Executes the DP line simplefy tool programaticaly
        /// Ping Yang Added it for external Testing
        /// </summary>
        /// <param name="input">The input polygon feature set</param>
        /// <param name="tolerance">The tolerance to use when simplefiying</param>
        /// <param name="output">The output polygon feature set</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input, double tolerance, IFeatureSet output)
        {
            // Validates the input and output data
            if (input == null || output == null)
            {
                return false;
            }

            // We copy all the fields
            foreach (DataColumn inputColumn in input.DataTable.Columns)
            {
                output.DataTable.Columns.Add(new DataColumn(inputColumn.ColumnName, inputColumn.DataType));
            }

            foreach (IFeature t in input.Features)
            {
                Geometry geom = t.BasicGeometry as Geometry;
                if (geom != null)
                {
                    for (int part = 0; part < geom.NumGeometries; part++)
                    {
                        Geometry geomPart = (Geometry)geom.GetGeometryN(part);

                        // do the simplification
                        IList<Coordinate> oldCoords = geomPart.Coordinates;
                        IList<Coordinate> newCoords = DouglasPeuckerLineSimplifier.Simplify(
                            oldCoords, tolerance);

                        // convert the coordinates back to a geometry
                        Geometry newGeom = new LineString(newCoords);
                        Feature newFeature = new Feature(newGeom, output);
                        foreach (DataColumn colSource in input.DataTable.Columns)
                        {
                            newFeature.DataRow[colSource.ColumnName] = t.DataRow[colSource.ColumnName];
                        }
                    }
                }
            }

            output.Save();
            return true;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:50,代码来源:DPSimplification.cs

示例9: Execute

 /// <summary>
 /// computes voronoi polygons around each of the points,
 /// defining the regions that are closer to that point than any other points
 /// Ping deleted static for external testing 01/2010
 /// </summary>
 /// <param name="input">The input polygon feature set</param>
 /// <param name="output">The output polygon feature set</param>
 /// <param name="cancelProgressHandler">The progress handler</param>
 /// <returns></returns>
 public bool Execute(IFeatureSet input,  IFeatureSet output, 
     ICancelProgressHandler cancelProgressHandler)
 {
     Analysis.Voronoi.VoronoiPolygons(input, output, true, cancelProgressHandler);
     output.Save();
     return true;
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:16,代码来源:Voronoi.cs


注:本文中的IFeatureSet.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。