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


C# SpatialContext.ReadShapeFromWkt方法代码示例

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


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

示例1: GetTestData

        /** Reads the stream, consuming a format that is a tab-separated values of 3 columns:
         * an "id", a "name" and the "shape".  Empty lines and lines starting with a '#' are skipped.
         * The stream is closed.
         */
        public static IEnumerator<SpatialTestData> GetTestData(Stream @in, SpatialContext ctx)
        {
            List<SpatialTestData> results = new List<SpatialTestData>();
            TextReader bufInput = new StreamReader(@in, Encoding.UTF8);
            try
            {
                String line;
                while ((line = bufInput.ReadLine()) != null)
                {
                    if (line.Length == 0 || line[0] == '#')
                        continue;

                    SpatialTestData data = new SpatialTestData();
                    String[] vals = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (vals.Length != 3)
                        throw new ArgumentException("bad format; expecting 3 tab-separated values for line: " + line);
                    data.id = vals[0];
                    data.name = vals[1];
                    try
                    {
                        data.shape = ctx.ReadShapeFromWkt(vals[2]);
                    }
                    catch (ParseException e)
                    {
                        throw new ApplicationException(e.Message, e);
                    }
                    results.Add(data);
                }
            }
            finally
            {
                bufInput.Dispose();
            }
            return results.GetEnumerator();
        }
开发者ID:apache,项目名称:lucenenet,代码行数:39,代码来源:SpatialTestData.cs

示例2: ParseShape

 protected virtual IShape ParseShape(string str, SpatialContext ctx) 
 {
     //return ctx.readShape(str);//still in Spatial4n 0.4 but will be deleted
     return ctx.ReadShapeFromWkt(str);
 }
开发者ID:apache,项目名称:lucenenet,代码行数:5,代码来源:SpatialArgsParser.cs


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