예제 #1
0
        private async void UpdateManualFeedback()
        {
            if (LineFromType == LineFromTypes.BearingAndDistance && Azimuth.HasValue && HasPoint1 && Point1 != null)
            {
                CurveType  curveType = DeriveCurveType(LineType);
                LinearUnit lu        = DeriveUnit(LineDistanceType);
                // update feedback
                var segment = QueuedTask.Run(() =>
                {
                    var mpList = new List <MapPoint>()
                    {
                        Point1
                    };
                    // get point 2
                    // SDK Bug, GeometryEngine.GeodesicMove seems to not honor the LinearUnit passed in, always does Meters
                    var tempDistance = ConvertFromTo(LineDistanceType, DistanceTypes.Meters, Distance);
                    var results      = GeometryEngine.GeodeticMove(mpList, MapView.Active.Map.SpatialReference, tempDistance, LinearUnit.Meters /*GetLinearUnit(LineDistanceType)*/, GetAzimuthAsRadians().Value, GetCurveType());
                    foreach (var mp in results)
                    {
                        Point2 = mp;
                    }
                    if (Point2 != null)
                    {
                        return(LineBuilder.CreateLineSegment(Point1, Point2));
                    }
                    else
                    {
                        return(null);
                    }
                }).Result;

                if (segment != null)
                {
                    await UpdateFeedbackWithGeoLine(segment, curveType, lu);
                }
            }
        }
        /// <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);
            }
        }