//Must be on QueuedTask.Run(() => { ... //Build geometry List<Coordinate2D> plCoords = new List<Coordinate2D>(); plCoords.Add(new Coordinate2D(1.5, 10.5)); plCoords.Add(new Coordinate2D(1.25, 9.5)); plCoords.Add(new Coordinate2D(1, 10.5)); plCoords.Add(new Coordinate2D(0.75, 9.5)); plCoords.Add(new Coordinate2D(0.5, 10.5)); plCoords.Add(new Coordinate2D(0.5, 1)); plCoords.Add(new Coordinate2D(0.75, 2)); plCoords.Add(new Coordinate2D(1, 1)); Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords); //Set symbolology, create and add element to layout CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol( ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid); //var graphic = GraphicFactory.Instance.CreateShapeGraphic(linePl, lineSym); var ge = ElementFactory.Instance.CreateGraphicElement( container, linePl, lineSym, "New Freehand");
//Must be on QueuedTask.Run(() => { ... List<Coordinate2D> plyCoords = new List<Coordinate2D>(); plyCoords.Add(new Coordinate2D(1, 1)); plyCoords.Add(new Coordinate2D(1.25, 2)); plyCoords.Add(new Coordinate2D(1.5, 1.1)); plyCoords.Add(new Coordinate2D(1.75, 2)); plyCoords.Add(new Coordinate2D(2, 1.1)); plyCoords.Add(new Coordinate2D(2.25, 2)); plyCoords.Add(new Coordinate2D(2.5, 1.1)); plyCoords.Add(new Coordinate2D(2.75, 2)); plyCoords.Add(new Coordinate2D(3, 1)); Polygon poly = PolygonBuilderEx.CreatePolygon(plyCoords); //Set symbolology, create and add element to layout CIMStroke outline = SymbolFactory.Instance.ConstructStroke( ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid); CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol( ColorFactory.Instance.RedRGB, SimpleFillStyle.ForwardDiagonal, outline); ElementFactory.Instance.CreateGraphicElement( container, poly, polySym, "New Lasso");
Target Platforms: Windows 11, Windows 10