本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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++;
});
}