public static void Run() { //ExStart: CreateCurvePolygon string path = RunExamples.GetDataDir() + "CreateCurvePolygon_out.shp"; using (VectorLayer layer = VectorLayer.Create(path, Drivers.Shapefile)) { var feature = layer.ConstructFeature(); // create a torus with center at (0,0), radius equal to 2 and hole radius equal to 1 var curvePolygon = new CurvePolygon(); var exterior = new CircularString(); exterior.AddPoint(-2, 0); exterior.AddPoint(0, 2); exterior.AddPoint(2, 0); exterior.AddPoint(0, -2); exterior.AddPoint(-2, 0); curvePolygon.ExteriorRing = exterior; var interior = new CircularString(); interior.AddPoint(-1, 0); interior.AddPoint(0, 1); interior.AddPoint(1, 0); interior.AddPoint(0, -1); interior.AddPoint(-1, 0); curvePolygon.AddInteriorRing(interior); feature.Geometry = curvePolygon; layer.Add(feature); } //ExEnd: CreateCurvePolygon }
public static void Run() { //ExStart: CreateCircularString string path = RunExamples.GetDataDir() + "CreateCircularString_out.shp"; using (VectorLayer layer = VectorLayer.Create(path, Drivers.Shapefile)) { var feature = layer.ConstructFeature(); // create a circle with center at (1,0) and radius 1. var circularString = new CircularString(); circularString.AddPoint(0, 0); circularString.AddPoint(1, 1); circularString.AddPoint(2, 0); circularString.AddPoint(1, -1); circularString.AddPoint(0, 0); feature.Geometry = circularString; layer.Add(feature); } //ExEnd: CreateCircularString }
/// <summary> /// I think this is correct /// </summary> /// <param name="circularString"></param> public CurvePolygon(CircularString circularString) : base(circularString.Factory.CreateLinearRing(circularString.Coordinates), circularString.Factory) { }