private void buildFlightPath() { // Use geometry engine to create a circle around the center of the scene Geometry circle = GeometryEngine.EllipseGeodesic(new GeodesicEllipseParameters(centerPoint, 1700, 1700)); // Create a path around the perimeter of the circle routePath = (Polyline)GeometryEngine.Boundary(circle); // Store the length of the route for use later routeLength = GeometryEngine.Length(routePath); }
// Calculates the geometric boundaries for each test graphic private void CalculateBoundaries() { var lineSymbol = (Esri.ArcGISRuntime.Symbology.Symbol) new SimpleLineSymbol() { Color = Colors.Blue, Style = SimpleLineStyle.Solid, Width = 2 }; var pointSymbol = (Esri.ArcGISRuntime.Symbology.Symbol) new SimpleMarkerSymbol() { Color = Colors.Blue, Style = SimpleMarkerStyle.Circle, Size = 12 }; foreach (var testGraphic in _testGraphics.Graphics) { var boundary = GeometryEngine.Boundary(testGraphic.Geometry); var graphic = new Graphic(boundary, (boundary.GeometryType == GeometryType.Polyline) ? lineSymbol : pointSymbol); _boundaryGraphics.Graphics.Add(graphic); } }
protected override Task <bool> OnSketchCompleteAsync(ArcGIS.Core.Geometry.Geometry geometry) { //Check we only have one feature to extend to if (MapView.Active.Map.SelectionCount != 1) { MessageBox.Show("Please select one polyline or polygon feature to extend to", "Extend"); return(Task.FromResult(true)); } //Run on MCT return(QueuedTask.Run(() => { //get selected feature geometry var selectedFeatures = MapView.Active.Map.GetSelection(); var insp = new Inspector(); insp.Load(selectedFeatures.Keys.First(), selectedFeatures.Values.First()); var selGeom = insp.Shape; if (!(selGeom.GeometryType == GeometryType.Polygon || selGeom.GeometryType == GeometryType.Polyline)) { MessageBox.Show("Please choose as the selected feature either a polyline or polygon feature to extend to"); return false; } //find feature at the click var clickFeatures = MapView.Active.GetFeatures(geometry); var featuresOids = clickFeatures[clickFeatures.Keys.First()]; insp.Load(clickFeatures.First().Key, featuresOids.First()); var clickGeom = insp.Shape as Polyline; if (clickGeom == null) { MessageBox.Show("Please select a polyline feature to extend"); return false; } //extend the line to the poly? ArcGIS.Core.Geometry.Polyline extPolyline; extPolyline = GeometryEngine.Extend(clickGeom, (selGeom.GeometryType == GeometryType.Polygon ? GeometryEngine.Boundary(selGeom) as Polyline : selGeom as Polyline), ExtendFlags.Default); if (extPolyline == null) { MessageBox.Show(string.Format("Unable to extend the clicked {0} to the selected {1}", clickGeom.GeometryType, selGeom.GeometryType)); return false; } //set the new geometry back on the feature insp.Shape = extPolyline; //create and execute the edit operation var op = new EditOperation(); op.Name = "Extend"; op.SelectModifiedFeatures = false; op.SelectNewFeatures = false; op.Modify(insp); return op.Execute(); })); }