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


C# GeometryFactory.CreateLineString方法代码示例

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


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

示例1: ToString

 public override String ToString()
 {
     var fact = new GeometryFactory();
     var line = fact.CreateLineString(GetCoordinates());
     return line.ToString();
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:6,代码来源:OffsetSegmentString.cs

示例2: testWrite3D_withNaN

 public void testWrite3D_withNaN()
 {
     IGeometryFactory geometryFactory = new GeometryFactory();
     Coordinate[] coordinates = { new Coordinate(1, 1),
                          new Coordinate(2, 2, 2) };
     ILineString line = geometryFactory.CreateLineString(coordinates);
     String wkt = _writer3D.Write(line);
     Assert.AreEqual("LINESTRING (1 1, 2 2 2)", wkt);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:9,代码来源:WKTWriterTest.cs

示例3: ConvertSegStrings

 private static IGeometry ConvertSegStrings(IEnumerator<ISegmentString> it)
 {
     var fact = new GeometryFactory();
     var lines = new List<IGeometry>();
     while (it.MoveNext())
     {
         ISegmentString ss = it.Current;
         ILineString line = fact.CreateLineString(ss.Coordinates);
         lines.Add(line);
     }
     return fact.BuildGeometry(lines);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:12,代码来源:BufferBuilder.cs

示例4: AddVectorLayers

        /// <summary>        
        /// /// Add a list of vector layers to the map.
        /// </summary>
        /// <param name="vectorLayers"></param>
        public void AddVectorLayers(List<FeatureInfo> vectorLayers)
        {
            int counter = 0;
            if (vectorLayers == null) return;
            vectorLayers.ForEach(layer => {

                VectorLayer vectorLayer = new VectorLayer("VectorLayer-" + counter);
                GeometryFactory factory = new GeometryFactory();
                List<IGeometry> geometries = new List<IGeometry>();

                FeatureDataTable featureData = new FeatureDataTable();
                featureData.Columns.Add("text", typeof(String));
                featureData.Columns.Add("style", typeof(MapExport.Style));

                layer.features.ForEach(feature =>
                {
                    FeatureDataRow dataRow = featureData.NewRow();
                    dataRow["text"] = feature.attributes.text;
                    dataRow["style"] = feature.attributes.style;

                    List<GeoAPI.Geometries.Coordinate> vertices = new List<GeoAPI.Geometries.Coordinate>();

                    feature.coordinates.ForEach(coordinate =>
                    {
                        double x = coordinate[0];
                        double y = coordinate[1];
                        vertices.Add((new GeoAPI.Geometries.Coordinate(x, y)));
                    });

                    switch (feature.type)
                    {
                        case "Text":
                        case "Point":
                            if (vertices.Count > 0)
                            {
                                var point = factory.CreatePoint(new GeoAPI.Geometries.Coordinate(vertices[0]));
                                dataRow.Geometry = point;
                            }
                            break;
                        case "LineString":
                            var lineString = factory.CreateLineString(vertices.ToArray());
                            dataRow.Geometry = lineString;
                            break;
                        case "Polygon":
                            var polygon = factory.CreatePolygon(vertices.ToArray());
                            dataRow.Geometry = polygon;
                            break;
                    }

                    featureData.AddRow(dataRow);
                });

                vectorLayer.DataSource = new SharpMap.Data.Providers.GeometryFeatureProvider(featureData);
                //vectorLayer.DataSource = new SharpMap.Data.Providers.FeatureProvider(featureData);

                //vectorLayer.Theme = new CustomTheme(GetFeatureStyle);
                vectorLayer.Theme = new CustomTheme(GetFeatureStyle);
                map.Layers.Add(vectorLayer);

                LabelLayer labels = new LabelLayer("Labels");

                labels.DataSource = vectorLayer.DataSource;
                labels.Enabled = true;
                labels.LabelColumn = "text";
                labels.Theme = new CustomTheme(GetLabelStyle);
                labels.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                labels.SmoothingMode = SmoothingMode.HighQuality;
                labels.SRID = vectorLayer.SRID;

                map.Layers.Add(labels);
                counter++;
            });
        }
开发者ID:Johkar,项目名称:Hajk2,代码行数:77,代码来源:MapExporter.cs


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