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


C# IFeatureSet.SaveAs方法代码示例

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


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

示例1: Execute

        /// <summary>
        /// Executes the Union Opaeration tool programaticaly
        /// </summary>
        /// <param name="input">The input are feature sets</param>
        /// <param name="output">The output feature set</param>
        /// <param name="CancelProgressHandler">The progress handler</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet self, IFeatureSet output, MapWindow.Tools.ICancelProgressHandler cancelProgressHandler)
        {
            //Validates the input and output data
            if (self == null || self.Features == null || self.Features.Count == 0 || output == null)
            {
                return false;
            }

            IFeature result = self.Features[0];
            MapWindow.Main.ProgressMeter pm = new MapWindow.Main.ProgressMeter(cancelProgressHandler, "Unioning Shapes", self.Features.Count);
            for(int i = 1; i < self.Features.Count; i++)
            {
                if (self.Features[i] == null) continue;
                result = result.Union(self.Features[i]);
                pm.CurrentValue = i;
            }
            pm.Reset();
            output.Features.Add(result);
            output.SaveAs(output.Filename, true);
            return true;
                
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:29,代码来源:mwAggregate.cs

示例2: Execute

        /// <summary>
        /// Executes the add features Opaeration tool programaticaly.
        /// Ping deleted "static" for external Testing
        /// </summary>
        /// <param name="input1">The input FeatureSet.</param>
        /// <param name="input2">The input2 featureSet which has the new features to add.</param>
        /// <param name="output">The output FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(
            IFeatureSet input1, IFeatureSet input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input1 == null || input2 == null || output == null)
            {
                return false;
            }

            int previous = 0;
            int i = 0;
            int maxFeature = input2.Features.Count;
            output.FeatureType = input1.FeatureType;
            foreach (IFeature f1 in input1.Features)
            {
                output.Features.Add(f1);
            }

            // go through new featureset that wanted to add.
            foreach (IFeature f in input2.Features)
            {
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }

                if (input1.FeatureType == input2.FeatureType)
                {
                    output.Features.Add(f);
                }

                int current = Convert.ToInt32(Math.Round(i * 100D / maxFeature));

                // only update when increment in percentage
                if (current > previous)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                }

                previous = current;
                i++;
            }

            output.SaveAs(output.Filename, true);

            // cancelProgressHandler.Progress("", 100, 100.ToString() + TextStrings.progresscompleted);
            return true;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:57,代码来源:AddFeature.cs

示例3: Execute

 /// <summary>
 /// Executes the ReprojectFeatureSet Operation tool programaticaly.
 /// </summary>
 /// <param name="featureSet">The input FeatureSet.</param>
 /// <param name="sourceProjection">The input Expression string to select features to Delete.</param>
 /// <param name="destProjection">The target projected coordinate system to reproject the featureset to</param>
 /// <param name="output">The output FeatureSet.</param>
 /// <param name="cancelProgressHandler">The progress handler.</param>
 /// Ping deleted "static" for external testing 
 /// <returns></returns>
 public bool Execute(IFeatureSet featureSet, ProjectionInfo sourceProjection, ProjectionInfo destProjection, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
 {             
         output.CopyFeatures(featureSet, true);
         output.Projection = featureSet.Projection;
         if(sourceProjection != null) output.Projection = sourceProjection;
         output.Reproject(destProjection);
         output.SaveAs(output.Filename, true);
         return true;      
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:19,代码来源:ReprojectFeatures.cs

示例4: Execute

        /// <summary>
        /// Executes the ClipPolygonWithPolygon tool with programatic input
        /// </summary>
        /// <param name="input">The input feature set to clip</param>
        /// <param name="input2">The input polygon feature set to clip with</param>
        /// <param name="output">The output feature set</param>
        /// <param name="cancelProgressHandler">The progress handler for progress message updates</param>
        /// <returns></returns>
        /// Ping delete "static" for external testing
        public bool Execute(
            IFeatureSet input, IFeatureSet input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input == null || input2 == null || output == null)
            {
                cancelProgressHandler.Progress(string.Empty, 100, TextStrings.Oneparameterinnull);
                return false;
            }

            if (input2.FeatureType != FeatureType.Polygon)
            {
                cancelProgressHandler.Progress(string.Empty, 100, TextStrings.secondinputlayer);
                return false;
            }

            output.FeatureType = input.FeatureType;

            // we add all the old features to output
            IFeatureSet tempoutput = input.Intersection(input2, FieldJoinType.LocalOnly, cancelProgressHandler);

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

            foreach (var fe in tempoutput.Features)
            {
                output.Features.Add(fe);
            }

            output.SaveAs(output.Filename, true);
            return true;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:44,代码来源:ClipPolygonWithPolygon.cs

示例5: Execute


//.........这里部分代码省略.........

            IFeatureSet tempOutput = self.Intersection(other, FieldJoinType.All, null);
            IFeatureSet tempFeatureSet = self.CombinedFields(other);

            int previous = 0;
            int max = self.Features.Count;

            // Take (Self-Intersect Featureset)
            List<IFeature> intersectList;
            for (int i = 0; i < self.Features.Count; i++)
            {
                intersectList = other.Select(self.Features[i].Envelope.ToExtent());
                foreach (IFeature feat in intersectList)
                {
                    if (cancelProgressHandler.Cancel)
                    {
                        return false;
                    }

                    self.Features[i].Difference(feat, tempFeatureSet, FieldJoinType.LocalOnly);
                }

                if (Math.Round(i * 40D / max) <= previous)
                {
                    continue;
                }

                previous = Convert.ToInt32(Math.Round(i * 40D / max));
                cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
            }

            max = other.Features.Count;

            // Take (Other-Intersect Featureset)
            for (int i = 0; i < other.Features.Count; i++)
            {
                intersectList = self.Select(other.Features[i].Envelope.ToExtent());
                foreach (IFeature feat in intersectList)
                {
                    if (cancelProgressHandler.Cancel)
                    {
                        return false;
                    }

                    other.Features[i].Difference(feat, tempFeatureSet, FieldJoinType.LocalOnly);
                }

                if (Math.Round((i * 40D / max) + 40D) <= previous)
                {
                    continue;
                }

                previous = Convert.ToInt32(Math.Round((i * 40D / max) + 40D));
                cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
            }

            max = tempFeatureSet.Features.Count;
            output.CopyTableSchema(tempFeatureSet);

            // Add the individual feature to output
            for (int i = 0; i < tempFeatureSet.Features.Count; i++)
            {
                output.Features.Add(tempFeatureSet.Features[i]);
                if (Math.Round((i * 10D / max) + 80D) <= previous)
                {
                    continue;
                }

                previous = Convert.ToInt32(Math.Round((i * 10D / max) + 80D));
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }

                cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
            }

            max = tempOutput.Features.Count;

            // Add the Intersect feature to output
            for (int i = 0; i < tempOutput.Features.Count; i++)
            {
                output.Features.Add(tempOutput.Features[i]);
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }

                if (Math.Round((i * 10D / max) + 90D) <= previous)
                {
                    continue;
                }

                previous = Convert.ToInt32(Math.Round((i * 10D / max) + 90D));
                cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
            }

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

示例6: Execute

        /// <summary>
        /// Executes the generate centroid FeatureSet Opaeration tool programaticaly.
        /// Ping deleted static for external testing 01/2010
        /// </summary>
        /// <param name="input1">The input FeatureSet.</param>
        /// <param name="output">The output FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input1, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input1 == null || output == null)
            {
                return false;
            }

            bool multiPoint = false;
            foreach (IFeature f1 in input1.Features)
            {
                if (f1.NumGeometries > 1)
                {
                    multiPoint = true;
                }
            }

            output.FeatureType = multiPoint == false ? FeatureType.Point : FeatureType.MultiPoint;

            int previous = 0;
            int i = 0;
            int maxFeature = input1.Features.Count;
            output.CopyTableSchema(input1);
            foreach (IFeature f in input1.Features)
            {
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }

                IFeature fnew = new Feature(f.Centroid());

                // Add the centroid to output
                output.Features.Add(fnew);

                fnew.CopyAttributes(f);

                int current = Convert.ToInt32(Math.Round(i * 100D / maxFeature));

                // only update when increment in percentage
                if (current > previous)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                }

                previous = current;
                i++;
            }

            output.SaveAs(output.Filename, true);
            return true;
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:60,代码来源:GenerateCentroid.cs

示例7: Execute


//.........这里部分代码省略.........
            output.FeatureType = poly.FeatureType;
            foreach (IFeature f in poly.Features)
            {
                output.Features.Add(f);
            }

            output.DataTable.Columns.Add("FID", typeof(int));
            output.DataTable.Columns.Add(TextStrings.AveSlope, typeof(Double));

            IRaster slopeGrid = new Raster { DataType = ras.DataType, Bounds = ras.Bounds };

            // FeatureSet polyShape = new FeatureSet();
            int previous = 0;

            if (Slope(ref ras, zFactor, false, ref slopeGrid, cancelProgressHandler) == false)
            {
                return false;
            }

            int shapeCount = output.Features.Count;
            int[] areaCount = new int[shapeCount];
            double[] areaTotal = new double[shapeCount];
            double[] areaAve = new double[shapeCount];
            double dxHalf = slopeGrid.CellWidth / 2;
            double dyHalf = slopeGrid.CellHeight / 2;

            // check whether those two envelope are intersect
            if (ras.Extent.Intersects(output.Extent) == false)
            {
                return false;
            }

            RcIndex start = slopeGrid.ProjToCell(output.Extent.MinX, output.Extent.MaxY);
            RcIndex stop = slopeGrid.ProjToCell(output.Extent.MaxX, output.Extent.MinY);

            int rowStart = start.Row;
            int colStart = start.Column;
            int rowStop = stop.Row;
            int colStop = stop.Column;
            for (int row = rowStart - 1; row < rowStop + 1; row++)
            {
                int current = Convert.ToInt32((row - rowStart + 1) * 100.0 / (rowStop + 1 - rowStart + 1));

                // only update when increment in percentage
                if (current > previous + 5)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                    previous = current;
                }

                for (int col = colStart - 1; col < colStop + 1; col++)
                {
                    Coordinate cent = slopeGrid.CellToProj(row, col);
                    double xCent = cent.X;
                    double yCent = cent.Y;
                    for (int shpindx = 0; shpindx < output.Features.Count; shpindx++)
                    {
                        IFeature tempFeat = output.Features[shpindx];
                        Point pt1 = new Point(xCent, yCent);
                        Point pt2 = new Point(xCent - dxHalf, yCent - dyHalf);
                        Point pt3 = new Point(xCent + dxHalf, yCent - dyHalf);
                        Point pt4 = new Point(xCent + dxHalf, yCent + dyHalf);
                        Point pt5 = new Point(xCent - dxHalf, yCent + dyHalf);
                        if ((((!tempFeat.Covers(pt1) && !tempFeat.Covers(pt2)) && !tempFeat.Covers(pt3))
                             && !tempFeat.Covers(pt4)) && !tempFeat.Covers(pt5))
                        {
                            continue;
                        }

                        areaCount[shpindx]++;
                        areaTotal[shpindx] += slopeGrid.Value[row, col] / 100;

                        if (cancelProgressHandler.Cancel)
                        {
                            return false;
                        }
                    }
                }
            }

            for (int shpindx = 0; shpindx < output.Features.Count; shpindx++)
            {
                if (areaCount[shpindx] == 0)
                {
                    areaAve[shpindx] = 0;
                }
                else
                {
                    areaAve[shpindx] = areaTotal[shpindx] / areaCount[shpindx];
                }

                output.Features[shpindx].DataRow["FID"] = shpindx;
                output.Features[shpindx].DataRow[TextStrings.AveSlope] = areaAve[shpindx];
            }

            poly.Close();
            slopeGrid.Close();
            output.SaveAs(output.Filename, true);
            return true;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:101,代码来源:FindAverageSlope.cs

示例8: Execute

        /// <summary>
        /// Finds the average slope in the given polygons.
        /// </summary>
        /// <param name="gridIn">The Polygon Raster(Grid file).</param>
        /// <param name="polyOut">The Polygon shapefile path.</param>
        /// <param name="progress">The progress handler.</param>
        public bool Execute(IRaster gridIn, IFeatureSet polyOut, ICancelProgressHandler cancelProgressHandler)
        {
            //Validates the input and output data
            if (gridIn == null || polyOut == null)
            {
                return false;
            }
            int maxX, maxY;
            int current = 0;
            int previous = 0;
            double noData, currVal, currTrack;
            string strTrackPath;
            IRaster gridTrack = new Raster();


            maxX = gridIn.NumRows - 1;
            maxY = gridIn.NumColumns - 1;
            noData = gridIn.NoDataValue;

            //strTrackPath = System.IO.Path.GetDirectoryName(strInRast) + "\\" + System.IO.Path.GetFileNameWithoutExtension(strInRast) + "_track.bgd";
            gridTrack = Raster.Create("gridTrack.bgd", "", gridIn.NumColumns, gridIn.NumRows, 1, gridIn.DataType, new string[] { "" });
            //gridTrack.CreateNew("gridTrack", "", gridIn.NumColumns, gridIn.NumRows, 1, gridIn.DataType, new string[] { "" });
            gridTrack.Bounds = gridIn.Bounds;
            gridTrack.NoDataValue = gridIn.NoDataValue;

            polyOut.DataTable.Columns.Add("Value", typeof(int));
            polyOut.DataTable.Columns.Add("Zone", typeof(string));
            polyOut.DataTable.Columns.Add("Area", typeof(double));
            polyOut.DataTable.Columns.Add("COMID", typeof(string));
            polyOut.DataTable.Columns.Add("AveSlope", typeof(double));

            for (int i = 0; i <= maxX; i++)
            {

                current = Convert.ToInt32(i * 100 / maxX);
                //only update when increment in percentage
                if (current > previous+5)
                {
                    cancelProgressHandler.Progress("", current, current.ToString() + "% progress completed");
                    previous = current;
                }
                    

                for (int j = 0; j <= maxY; j++)
                {
                    if (i > 0 && j > 0)
                    {
                        currVal = Convert.ToInt16(gridIn.Value[i, j]);
                        currTrack = Convert.ToInt16(gridTrack.Value[i, j]);
                        if (currVal == gridIn.NoDataValue)
                        {
                            gridTrack.Value[i, j] = 1;

                            if (cancelProgressHandler.Cancel == true)
                                return false;
                        }
                        else
                        {
                            if (currTrack == 1)
                            {
                            }
                            else
                            {
                                formPolyFromCell(gridIn, gridTrack, i, j, polyOut, cancelProgressHandler);

                                if (cancelProgressHandler.Cancel == true)
                                    return false;
                            }
                        }
                    }
                    else
                    {
                        gridTrack.Value[i, j] = gridIn.NoDataValue;
                    }

                    

                }
            }
            gridIn.Close();
            gridTrack.Close();
            polyOut.SaveAs(polyOut.Filename, true);
            polyOut.Close();
            return true;

        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:92,代码来源:mwSimpleRasterToPolygon.cs

示例9: Execute

        /// <summary>
        /// Executes the Erase Opaeration tool programaticaly
        /// </summary>
        /// <param name="self">The input feature that is to be erased</param>
        /// <param name="other">The other feature defining the area to remove</param>
        /// <param name="output">The resulting erased content</param>
        /// <param name="cancelProgressHandler">The progress handler</param>
        /// <returns>Boolean, true if the operation was a success</returns>
        public static bool Execute(
            IFeatureSet self, IFeatureSet other, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (self == null || other == null || output == null)
            {
                return false;
            }

            int previous;
            int max = self.Features.Count * other.Features.Count;

            output.CopyTableSchema(self); // Fill the 1st Featureset fields
            IFeatureSet tempSet = self.CombinedFields(other);

            // go through every feature in 1st featureSet
            for (int i = 0; i < self.Features.Count; i++)
            {
                // go through every feature in 2nd featureSet
                for (int j = 0; j < other.Features.Count; j++)
                {
                    self.Features[i].Difference(other.Features[j], tempSet, FieldJoinType.All);
                    previous = Convert.ToInt32(Math.Round(i * j * 50D / max));
                    if (cancelProgressHandler.Cancel)
                    {
                        return false;
                    }

                    cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
                }
            }

            // Add to the Output Feature Set
            for (int a = 0; a < tempSet.Features.Count; a++)
            {
                output.Features.Add(tempSet.Features[a]);
                previous = Convert.ToInt32(Math.Round((a * 50D / tempSet.Features.Count) + 50D));
                if (cancelProgressHandler.Cancel)
                {
                    return false;
                }

                cancelProgressHandler.Progress(string.Empty, previous, previous + TextStrings.progresscompleted);
            }

            output.SaveAs(output.Filename, true);

            // add to map?
            return true;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:58,代码来源:Erase.cs

示例10: Execute


//.........这里部分代码省略.........
            IRaster ras,
            double inZFactor,
            bool slopeInPercent,
            IFeatureSet poly,
            string fldInPolyToStoreSlope,
            IFeatureSet outerShpFile,
            int outerShpIndex,
            IFeatureSet output,
            ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (ras == null || poly == null || outerShpFile == null || output == null)
            {
                return false;
            }

            if (poly.FeatureType != FeatureType.Polygon || outerShpFile.FeatureType != FeatureType.Polygon)
            {
                return false;
            }

            int previous = 0;
            IRaster slopegrid = new Raster();

            int[] areaCount = new int[poly.Features.Count];
            double[] areaTotal = new double[poly.Features.Count];
            double[] areaAve = new double[poly.Features.Count];

            Slope(ras, inZFactor, slopeInPercent, slopegrid, cancelProgressHandler);
            if (slopegrid == null)
            {
                throw new SystemException(TextStrings.Slopegridfileisnull);
            }

            foreach (IFeature f in poly.Features)
            {
                output.Features.Add(f);
            }

            for (int i = 0; i < slopegrid.NumRows; i++)
            {
                int current = Convert.ToInt32(Math.Round(i * 100D / slopegrid.NumRows));

                // only update when increment in percentage
                if (current > previous + 5)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                    previous = current;
                }

                for (int j = 0; j < slopegrid.NumColumns; j++)
                {
                    Coordinate coordin = slopegrid.CellToProj(i, j);
                    IPoint pt = new Point(coordin);
                    IFeature point = new Feature(pt);
                    if (!outerShpFile.Features[outerShpIndex].Covers(point))
                    {
                        continue; // not found the point inside.
                    }

                    for (int c = 0; c < poly.Features.Count; c++)
                    {
                        if (output.Features[c].Covers(point))
                        {
                            areaCount[c]++;
                            areaTotal[c] += slopegrid.Value[i, j] / 100;
                        }

                        if (cancelProgressHandler.Cancel)
                        {
                            return false;
                        }
                    }
                }
            }

            // Add the column
            output.DataTable.Columns.Add("FID", typeof(int));
            output.DataTable.Columns.Add(fldInPolyToStoreSlope, typeof(Double));
            for (int c = 0; c < output.Features.Count; c++)
            {
                if (areaCount[c] == 0)
                {
                    areaAve[c] = 0.0;
                }
                else
                {
                    areaAve[c] = areaTotal[c] / areaCount[c];
                }

                // Add the field values
                output.Features[c].DataRow["FID"] = c;
                output.Features[c].DataRow[fldInPolyToStoreSlope] = areaAve[c];
            }

            output.SaveAs(output.Filename, true);
            slopegrid.Close();
            ras.Close();
            return true;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:101,代码来源:FindAverageSlopeExtented.cs

示例11: Execute

        /// <summary>
        /// Executes the overwrite feature Opaeration tool programaticaly.
        /// </summary>
        /// <param name="input1">The input FeatureSet.</param>
        /// <param name="index">The Index to overwrite</param>
        /// <param name="input2">The input2 featureSet which has the new feature to overwrite.</param>
        /// <param name="output">The output FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input1,int index,IFeatureSet input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            //Validates the input and output data
            if (input1 == null|| input2 == null || output == null)
            {
                return false;
            }
            if (cancelProgressHandler.Cancel)
                return false;

            IFeature newFeature = input2.Features[0];
            output.FeatureType = input1.FeatureType;
            foreach (IFeature f in input1.Features)
                output.Features.Add(f);

            if (index > -1)
            {
                if (index < output.Features.Count)
                {
                    output.Features.RemoveAt(index);
                    output.Features.Insert(index, newFeature);
                }
            }
            output.SaveAs(output.Filename, true);
            cancelProgressHandler.Progress("", 100, 100 + TextStrings.progresscompleted);
            return true;

        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:37,代码来源:OverWriteFeature.cs

示例12: Execute

        /// <summary>
        /// Executes the Union Opaeration tool programaticaly
        /// </summary>
        /// <param name="sourceData">The source FeatureSet to aggregate the features for..</param>
        /// <param name="resultData">The result FeatureSet of aggregated features..</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns>Boolean if the result is true.</returns>
        public bool Execute(
            IFeatureSet sourceData, IFeatureSet resultData, ICancelProgressHandler cancelProgressHandler)
        // removed "static" dpa 12/2009 so that this can be run from an external call directly.
        {
            // Validates the input and output data
            if (sourceData == null || sourceData.Features == null || sourceData.Features.Count == 0
                || resultData == null)
            {
                return false;
            }

            IFeature oneFeature = sourceData.Features[0];

            // MapWindow.Main.ProgressMeter pm = new MapWindow.Main.ProgressMeter(cancelProgressHandler, TextStrings.UnioningShapes, self.Features.Count);
            for (int i = 1; i < sourceData.Features.Count; i++)
            {
                if (sourceData.Features[i] == null)
                {
                    continue;
                }

                oneFeature = oneFeature.Union(sourceData.Features[i]);

                // pm.CurrentValue = i;
            }

            // pm.Reset();
            resultData.Features.Add(oneFeature);
            resultData.SaveAs(resultData.Filename, true);
            return true;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:38,代码来源:Aggregate.cs

示例13: Execute

        /// <summary>
        /// Executes the Erase Opaeration tool programaticaly.
        /// Ping deleted static for external testing 01/2010
        /// </summary>
        /// <param name="input1">The input FeatureSet.</param>
        /// <param name="input2">The input Expression string to select features to Delete.</param>
        /// <param name="output">The output FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(
            IFeatureSet input1, string input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            // Validates the input and output data
            if (input1 == null || input2 == null || output == null)
            {
                return false;
            }

            if (cancelProgressHandler.Cancel)
            {
                return false;
            }

            int previous = 0;
            List<IFeature> fetList = input1.SelectByAttribute(input2);
            int noOfFeaturesToDelete = fetList.Count;
            int noOfFeatures = input1.Features.Count;
            output.FeatureType = input1.FeatureType;
            foreach (IFeature f in input1.Features)
            {
                output.Features.Add(f);
            }

            // Go through every item in the list
            for (int i = 0; i < noOfFeaturesToDelete; i++)
            {
                int current = Convert.ToInt32(Math.Round(i * 100D / noOfFeaturesToDelete));

                // only update when increment in percentage
                if (current > previous)
                {
                    cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
                }

                previous = current;

                // loop through every item in the list
                for (int j = 0; j < noOfFeatures; j++)
                {
                    // Select the Feature from Feature set to detlete
                    if (fetList[i] == input1.Features[j])
                    {
                        output.Features.Remove(input1.Features[j]);
                    }
                }
            }

            output.SaveAs(output.Filename, true);
            return true;
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:60,代码来源:DeleteFeatures.cs

示例14: Execute

        /// <summary>
        /// Ping Yang Overwrite the function for Executes the Erase Opaeration tool for external testing
        /// </summary>
        public bool Execute(IFeatureSet self, IFeatureSet other, IFeatureSet output)
        {
            if (self == null || other == null || output == null)
            {
                return false;
            }

            int previous;
            int max = self.Features.Count * other.Features.Count;

            output.CopyTableSchema(self);//Fill the 1st Featureset fields
            IFeatureSet tempSet = self.CombinedFields(other);
            //go through every feature in 1st featureSet
            for (int i = 0; i < self.Features.Count; i++)
            {
                //go through every feature in 2nd featureSet
                for (int j = 0; j < other.Features.Count; j++)
                {
                    self.Features[i].Difference(other.Features[j], tempSet, FieldJoinType.All);
                    previous = Convert.ToInt32(Math.Round((i * j * 50D / max)));
                  }
            }
            //Add to the Output Feature Set
            for (int a = 0; a < tempSet.Features.Count; a++)
            {
                output.Features.Add(tempSet.Features[a]);
                previous = Convert.ToInt32(Math.Round((a * 50D / tempSet.Features.Count) + 50D));
            }

            output.SaveAs(output.Filename, true);
            //add to map?
            return true;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:36,代码来源:Erase.cs


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