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


C# Curve.CreatePolygonFromCurve方法代码示例

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


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

示例1: CanCreatePolygonFromLine3

 public void CanCreatePolygonFromLine3(string wkt, double from, double to, double padding)
 {
     var start = wkt.IndexOf("(");
     var end = wkt.LastIndexOf(")");
     var points = wkt
         .Substring(start + 1, end - start - 1)
         .Split(',')
         .Select(s => s.Trim().Split(' '))
         .Select(s => new Point(double.Parse(s[0], CultureInfo.InvariantCulture), double.Parse(s[1], CultureInfo.InvariantCulture)))
         .ToList();
     var line = new Curve(points);
     var polygon = line.CreatePolygonFromCurve(from, to, padding);
     Assert.That(polygon, Is.Not.Null);
     Assert.DoesNotThrow(() => polygon.ValidatePolygon());
 }
开发者ID:behrenfeldt,项目名称:geometry-padding,代码行数:15,代码来源:TestCurve.cs

示例2: CanCreatePolygonFromLine1

 public void CanCreatePolygonFromLine1()
 {
     var line = new Curve(new Point(0, 0), new Point(10, 0));
     var polygon = line.CreatePolygonFromCurve(0.2, 0.8, 1.0);
     Assert.That(polygon.Points.Count, Is.EqualTo(5));
     Assert.That(polygon.Points[0].X, Is.EqualTo(2));
     Assert.That(polygon.Points[0].Y, Is.EqualTo(1));
     Assert.That(polygon.Points[1].X, Is.EqualTo(8));
     Assert.That(polygon.Points[1].Y, Is.EqualTo(1));
     Assert.That(polygon.Points[2].X, Is.EqualTo(8));
     Assert.That(polygon.Points[2].Y, Is.EqualTo(-1));
     Assert.That(polygon.Points[3].X, Is.EqualTo(2));
     Assert.That(polygon.Points[3].Y, Is.EqualTo(-1));
     Assert.That(polygon.Points[4].X, Is.EqualTo(2));
     Assert.That(polygon.Points[4].Y, Is.EqualTo(1));
 }
开发者ID:johlits,项目名称:geometry-padding,代码行数:16,代码来源:TestCurve.cs

示例3: CanCreatePolygonFromLine2

 public void CanCreatePolygonFromLine2()
 {
     var line = new Curve(new Point(0, 0), new Point(0, 10), new Point(10, 10));
     var polygon = line.CreatePolygonFromCurve(0, 1, 5.0);
     Assert.That(polygon.Points.Count, Is.EqualTo(7));
     Assert.That(polygon.Points[0].X, Is.EqualTo(-5));
     Assert.That(polygon.Points[0].Y, Is.EqualTo(0));
     Assert.That(polygon.Points[1].X, Is.EqualTo(-5));
     Assert.That(polygon.Points[1].Y, Is.EqualTo(15));
     Assert.That(polygon.Points[2].X, Is.EqualTo(10));
     Assert.That(polygon.Points[2].Y, Is.EqualTo(15));
     Assert.That(polygon.Points[3].X, Is.EqualTo(10));
     Assert.That(polygon.Points[3].Y, Is.EqualTo(5));
     Assert.That(polygon.Points[4].X, Is.EqualTo(5));
     Assert.That(polygon.Points[4].Y, Is.EqualTo(5));
     Assert.That(polygon.Points[5].X, Is.EqualTo(5));
     Assert.That(polygon.Points[5].Y, Is.EqualTo(0));
     Assert.That(polygon.Points[6].X, Is.EqualTo(-5));
     Assert.That(polygon.Points[6].Y, Is.EqualTo(0));
     var s = polygon.ToWkt();
     Assert.AreEqual(s, "((-5 0, -5 15, 10 15, 10 5, 5 5, 5 0, -5 0))");
 }
开发者ID:johlits,项目名称:geometry-padding,代码行数:22,代码来源:TestCurve.cs

示例4: CanCreatePolygonRemoveOverlappingOffsettedPoints

        public void CanCreatePolygonRemoveOverlappingOffsettedPoints()
        {
            var line = new Curve(
                new Point(140269.53480959567, 6570034.62979288),
                new Point(140265.811, 6569999.782),
                new Point(140264.6760465, 6569990.5984698),
                new Point(140264.6760465, 6569990.5984698),
                new Point(140260.972, 6569960.627),
                new Point(140260.972, 6569960.627),
                new Point(140260.454, 6569956.429),
                new Point(140258.1810254, 6569940.8646021),
                new Point(140258.1810254, 6569940.8646021),
                new Point(140255.205, 6569920.486),
                new Point(140255.205, 6569920.486),
                new Point(140252.873, 6569904.517),
                new Point(140248.809, 6569871.397),
                new Point(140246.11606674892, 6569853.680439134)
                );

            line.CreatePolygonFromCurve(0.0, 1.0, 1.0);
        }
开发者ID:johlits,项目名称:geometry-padding,代码行数:21,代码来源:TestCurve.cs


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