本文整理匯總了C#中NetTopologySuite.Geometries.GeometryFactory.AsText方法的典型用法代碼示例。如果您正苦於以下問題:C# GeometryFactory.AsText方法的具體用法?C# GeometryFactory.AsText怎麽用?C# GeometryFactory.AsText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NetTopologySuite.Geometries.GeometryFactory
的用法示例。
在下文中一共展示了GeometryFactory.AsText方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreatePolygonFromLines
public static string CreatePolygonFromLines()
{
// arrange
const string firstline =
"LINESTRING (122804.613000002 485610.0381, 122794.59 485612.74013569974)";
var line1 = (ILineString)new WKTReader().Read(firstline);
const string secondline =
"LINESTRING (122794.039999999 485635.864100002, 122794.58999999998 485635.7686024924)";
var line2 = (ILineString)new WKTReader().Read(secondline);
var poly = new GeometryFactory().CreatePolygon(new Coordinate[] {
new Coordinate(line1.Coordinates[0].X, line1.Coordinates[0].Y),
new Coordinate(line1.Coordinates[1].X, line1.Coordinates[1].Y),
new Coordinate(line2.Coordinates[0].X, line2.Coordinates[0].Y),
new Coordinate(line2.Coordinates[0].X, line2.Coordinates[0].Y),
new Coordinate(line1.Coordinates[0].X, line1.Coordinates[0].Y)
});
return poly.AsText();
}