private static IGeometry CreateJ(IGeometry g) { var gf = FunctionsUtil.GetFactoryOrDefault(g); var jTop = new Coordinate[] { new Coordinate(0, HEIGHT), new Coordinate(J_WIDTH, HEIGHT), new Coordinate(J_WIDTH, J_RADIUS) }; var jBottom = new Coordinate[] { new Coordinate(J_WIDTH - J_RADIUS, 0), new Coordinate(0, 0) }; var gsf = new GeometricShapeFactory(gf); gsf.Base = new Coordinate(J_WIDTH - 2 * J_RADIUS, 0); gsf.Size = 2 * J_RADIUS; gsf.NumPoints = 10; var jArc = gsf.CreateArc(1.5 * Math.PI, 0.5 * Math.PI); var coordList = new CoordinateList(); coordList.Add(jTop, false); coordList.Add(((IGeometry)jArc).Reverse().Coordinates, false, 1, jArc.NumPoints - 1); coordList.Add(jBottom, false); return(gf.CreateLineString(coordList.ToCoordinateArray())); }
private static IGeometry CreateS(IGeometry g) { var gf = FunctionsUtil.GetFactoryOrDefault(g); double centreX = WIDTH - S_RADIUS; var top = new[] { new Coordinate(WIDTH, HEIGHT), new Coordinate(centreX, HEIGHT) }; var bottom = new[] { new Coordinate(centreX, 0), new Coordinate(WIDTH - 2 * S_RADIUS, 0) }; var gsf = new GeometricShapeFactory(gf); gsf.Centre = new Coordinate(centreX, HEIGHT - S_RADIUS); gsf.Size = 2 * S_RADIUS; gsf.NumPoints = 10; var arcTop = gsf.CreateArc(0.5 * Math.PI, Math.PI); var gsf2 = new GeometricShapeFactory(gf); gsf2.Centre = new Coordinate(centreX, S_RADIUS); gsf2.Size = 2 * S_RADIUS; gsf2.NumPoints = 10; var arcBottom = (ILineString)((IGeometry)gsf2.CreateArc(1.5 * Math.PI, Math.PI)).Reverse(); var coordList = new CoordinateList(); coordList.Add(top, false); coordList.Add(arcTop.Coordinates, false, 1, arcTop.NumPoints - 1); coordList.Add(new Coordinate(centreX, HEIGHT / 2)); coordList.Add(arcBottom.Coordinates, false, 1, arcBottom.NumPoints - 1); coordList.Add(bottom, false); return(gf.CreateLineString(coordList.ToCoordinateArray())); }