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


C# IFeatureSet.CopyTableSchema方法代码示例

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


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

        /// <summary>
        /// Executes the Union Opaeration tool programaticaly
        /// </summary>
        /// <param name="self">The input are feature set</param>
        /// <param name="other">The second input feature set</param>
        /// <param name="output">The output feature set</param>
        /// <param name="cancelProgressHandler">The progress handler</param>
        /// <returns></returns>
        public 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;
            }

            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)
//.........这里部分代码省略.........
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:101,代码来源:Union.cs

示例3: ClipPolygonFeatureSetWithPolygon

        /// <summary>
        /// Returns the portions of the polygons in polySF that lie within polygon as a
        /// new shapefile of polygons: resultPolySF.
        /// </summary>
        /// <param name="polygonFeatureSet">The shapefile of polygons that are to be clipped.</param>
        /// <param name="polygon">The polygon used for clipping.</param>
        /// <param name="resultFeatureSet">The result shapefile for the resulting polygons to be saved (in-memory).</param>
        /// <param name="copyAttributes">True if copying attrs</param>
        /// <returns>False if an error was encountered, true otherwise.</returns>
        public static bool ClipPolygonFeatureSetWithPolygon(
            IFeatureSet polygonFeatureSet, IFeature polygon, IFeatureSet resultFeatureSet, bool copyAttributes)
        {
            if (copyAttributes)
            {
                polygonFeatureSet.FillAttributes();
                resultFeatureSet.CopyTableSchema(polygonFeatureSet);
            }

            if (polygonFeatureSet.Features.Count != 0 && polygon.NumPoints != 0
                && polygonFeatureSet.FeatureType == FeatureType.Polygon)
            {
                int numShapes = polygonFeatureSet.Features.Count;
                for (int i = 0; i <= numShapes - 1; i++)
                {
                    polygonFeatureSet.Features[i].Intersection(polygon, resultFeatureSet, FieldJoinType.LocalOnly);
                }
            }

            return true;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:30,代码来源:ClipPolygonWithLine.cs

示例4: 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

示例5: 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

示例6: 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

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