agrobot_base/Exemplos/Aspose.GIS-for-.NET-master/Examples/CSharp/Geometries/CreateCompoundCurve.cs

42 lines
1.5 KiB
C#

using Aspose.Gis;
using Aspose.Gis.Geometries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aspose.GIS.Examples.CSharp.Geometries
{
class CreateCompoundCurve
{
public static void Run()
{
//ExStart: CreateCompoundCurve
string path = RunExamples.GetDataDir() + "CreateCompoundCurve_out.shp";
using (VectorLayer layer = VectorLayer.Create(path, Drivers.Shapefile))
{
var feature = layer.ConstructFeature();
// create an 'S' letter (starts at bottom left end)
var compoundCurve = new CompoundCurve();
var bottom = (ILineString)Geometry.FromText("LineString (0 0, 3 0)");
var firstArc = (ICircularString)Geometry.FromText("CircularString (3 0, 4 1, 3 2)");
var middle = (ILineString)Geometry.FromText("LineString (3 2, 1 2)");
var secondArc = (ICircularString)Geometry.FromText("CircularString (1 2, 0 3, 1 4)");
var top = (ILineString)Geometry.FromText("LineString (1 4, 4 4)");
compoundCurve.AddCurve(bottom);
compoundCurve.AddCurve(firstArc);
compoundCurve.AddCurve(middle);
compoundCurve.AddCurve(secondArc);
compoundCurve.AddCurve(top);
feature.Geometry = compoundCurve;
layer.Add(feature);
}
//ExEnd: CreateCompoundCurve
}
}
}