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


C# IFeatureSet.AddFeature方法代码示例

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


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

示例1: UpdateLocalitiesGisData

        private void UpdateLocalitiesGisData(IFeatureSet dataset)
        {
            foreach (var locality in context.Localities)
            {
                if (string.IsNullOrEmpty(locality.Code) || locality.Location == null)
                    continue;

                var coord = new Coordinate(locality.Location.Longitude ?? 0, locality.Location.Latitude ?? 0);
                var feature = dataset.AddFeature(new Point(coord));

                feature.DataRow["Code"] = locality.Code;
            }
        }
开发者ID:ondrejpialek,项目名称:Genesis,代码行数:13,代码来源:MapSectionViewModel.cs

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

示例3: UpdateFrequenciesGisData

        private void UpdateFrequenciesGisData(IFeatureSet dataset)
        {
            dataset.DataTable.Columns.Add(new DataColumn("Frequency", typeof (double)));
            dataset.DataTable.Columns.Add(new DataColumn("Dimension", typeof (string)));

            if (selectedAnalysis == null) return;
            if (string.IsNullOrEmpty(dimension)) return;

            foreach (var frequency in selectedAnalysis.Frequencies)
            {
                if (!frequency.Name.StartsWith(dimension))
                    continue;

                var location = frequency.Locality.Location;
                if (location == null)
                    continue;

                //should it instead skip the locality if part of the coordinate is missing?
                var coord = new Coordinate(location.Longitude ?? 0, location.Latitude ?? 0);
                var feature = dataset.AddFeature(new Point(coord));

                feature.DataRow["Code"] = frequency.Locality.Code;
                feature.DataRow["Frequency"] = frequency.Value;
                feature.DataRow["Dimension"] = frequency.Name;
            }
        }
开发者ID:ondrejpialek,项目名称:Genesis,代码行数:26,代码来源:MapSectionViewModel.cs


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