private Geometry CreatePolyline() { if (Point1 == null || Point2 == null) { return(null); } CurveType curveType = DeriveCurveType(LineType); LinearUnit lu = DeriveUnit(LineDistanceType); try { // create line var polyline = QueuedTask.Run(() => { var segment = LineBuilder.CreateLineSegment(Point1, Point2); return(PolylineBuilder.CreatePolyline(segment)); }).Result; Geometry newline = GeometryEngine.GeodeticDensifyByLength(polyline, 0, lu, curveType); AddGraphicToMap(newline); ResetPoints(); return(newline as Geometry); } catch (Exception ex) { // do nothing return(null); } }
internal async Task UpdateFeedbackWithGeoLine(LineSegment segment, CurveType type, LinearUnit lu) { if (Point1 == null || segment == null) { return; } var polyline = await QueuedTask.Run(() => { return(PolylineBuilder.CreatePolyline(segment)); }); ClearTempGraphics(); Geometry newline = GeometryEngine.GeodeticDensifyByLength(polyline, 0, lu, type); await AddGraphicToMap(Point1, ColorFactory.GreenRGB, true, 5.0); await AddGraphicToMap(newline, ColorFactory.GreyRGB, true); }
/// <summary> /// Method to draw the radials inside the range rings /// Must have at least 1 radial /// All radials are drawn from the center point to the farthest ring /// </summary> private void DrawRadials() { // must have at least 1 if (NumberOfRadials < 1) { return; } double azimuth = 0.0; double interval = 360.0 / NumberOfRadials; double radialLength = 0.0; if (IsInteractive) { radialLength = maxDistance; } else { radialLength = Distance * NumberOfRings; } try { // for each radial, draw from center point for (int x = 0; x < NumberOfRadials; x++) { var polyline = QueuedTask.Run(() => { MapPoint movedMP = null; var mpList = new List <MapPoint>() { Point1 }; // get point 2 var results = GeometryEngine.GeodeticMove(mpList, MapView.Active.Map.SpatialReference, radialLength, GetLinearUnit(LineDistanceType), GetAzimuthAsRadians(azimuth), GetCurveType()); // update feedback //UpdateFeedback(); foreach (var mp in results) { movedMP = mp; } if (movedMP != null) { var segment = LineBuilder.CreateLineSegment(Point1, movedMP); return(PolylineBuilder.CreatePolyline(segment)); } else { return(null); } }).Result; Geometry newline = GeometryEngine.GeodeticDensifyByLength(polyline, 0, LinearUnit.Meters, CurveType.Loxodrome); if (newline != null) { AddGraphicToMap(newline); } azimuth += interval; } } catch (Exception ex) { Console.WriteLine(ex); } }