當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。