private void AnimateTank()
        {
            // Return if tank already arrived.
            if (_tankEndPoint == null)
            {
                return;
            }

            // Get current location and distance from the destination.
            MapPoint location = (MapPoint)_tank.Geometry;
            GeodeticDistanceResult distance = GeometryEngine.DistanceGeodetic(
                location, _tankEndPoint, _metersUnit, _degreesUnit, GeodeticCurveType.Geodesic);

            // Move the tank a short distance.
            location = GeometryEngine.MoveGeodetic(new List <MapPoint>()
            {
                location
            }, 1.0, _metersUnit, distance.Azimuth1, _degreesUnit,
                                                   GeodeticCurveType.Geodesic).First();
            _tank.Geometry = location;

            // Rotate to face the destination.
            double heading = (double)_tank.Attributes["HEADING"];

            heading = heading + (distance.Azimuth1 - heading) / 10;
            _tank.Attributes["HEADING"] = heading;

            // Clear the destination if the tank already arrived.
            if (distance.Distance < 5)
            {
                _tankEndPoint = null;
            }
        }
        private void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            // Check that there are remaining nodes.
            if (_nodeIndex > _gpsPoints.Count - 1)
            {
                _driveTimer.Enabled = false;
                return;
            }

            // Check if there is a privious node.
            if (_nodeIndex > 0)
            {
                // Get the distance between the current node and the previous node.
                GeodeticDistanceResult distance = GeometryEngine.DistanceGeodetic(_gpsPoints[_nodeIndex], _gpsPoints[_nodeIndex - 1],
                                                                                  LinearUnits.Meters, AngularUnits.Degrees, GeodeticCurveType.Geodesic);

                // Get the cours in degrees.
                _course = distance.Azimuth2;

                // Calculate the speed in m/s by using the distance and the timer interval.
                _speed = distance.Distance / (_timerValue / 1000);
            }

            // Set the new fake location.
            UpdateLocation(new Location(_gpsPoints[_nodeIndex], 5, _speed, _course, false));

            // Increment the node index.
            _nodeIndex++;
        }
        private void AnimationTimer_Elapsed(object sender, EventArgs e)
        {
            // Note: the contents of this function are solely related to animating the taxi

            // Increment the frame counter
            _frameIndex++;

            // Reset the frame counter once one segment of the path has been travelled
            if (_frameIndex == _frameMax)
            {
                _frameIndex = 0;

                // Start navigating toward the next point
                _pointIndex++;

                // Restart if finished circuit
                if (_pointIndex == _points.Length)
                {
                    _pointIndex = 0;
                }
            }

            // Get the point the taxi is travelling from
            MapPoint starting = _points[_pointIndex];
            // Get the point the taxi is travelling to
            MapPoint ending = _points[(_pointIndex + 1) % _points.Length];
            // Calculate the progress based on the current frame
            double progress = _frameIndex / (double)_frameMax;
            // Calculate the position of the taxi when it is {progress}% of the way through
            MapPoint intermediatePoint = InterpolatedPoint(starting, ending, progress);

            // Update the taxi geometry
            _taxiGraphic.Geometry = intermediatePoint;

            // Update the taxi rotation.
            GeodeticDistanceResult distance = GeometryEngine.DistanceGeodetic(starting, ending, LinearUnits.Meters, AngularUnits.Degrees, GeodeticCurveType.Geodesic);

            ((ModelSceneSymbol)_taxiGraphic.Symbol).Heading = distance.Azimuth1;
        }
        public void PlotButton_Click(object sender, RoutedEventArgs e)
        {
            azimuthPoint = double.Parse(textAzimuth.Text);

            distancePoint = double.Parse(textDistance.Text);
            //distanceList.Add(distancePoint);


            if (azimuthPoint <= 360)
            {
                if (azimuthPoint <= 180)
                {
                    var result = azimuthPoint;
                    //azimuthList.Add(result);
                    //TraverseData.AzimuthList.Add(result);
                    //azimuthList.Add(result);
                }

                if (azimuthPoint > 180)
                {
                    var result = 180 - (azimuthPoint);
                    //azimuthList.Add(result);
                    //TraverseData.AzimuthList.Add(result);
                    //azimuthList.Add(result);
                }

                textAzimuth.Text  = "";
                textDistance.Text = "";
            }

            double result1;
            double result2;

            //GeodeticDistanceResult distance = GeometryEngine.DistanceGeodetic(start, destination, LinearUnits.Meters, AngularUnits.Degrees, GeodeticCurveType.NormalSection);

            IReadOnlyList <MapPoint> coordinateList = GeometryEngine.MoveGeodetic(mapPoints, distancePoint, LinearUnits.Meters, azimuthPoint, AngularUnits.Degrees, GeodeticCurveType.NormalSection);
            GeodeticDistanceResult   travel         = GeometryEngine.DistanceGeodetic(start, coordinateList[0], LinearUnits.Meters, AngularUnits.Degrees, GeodeticCurveType.NormalSection);



            graphic1.Geometry = coordinateList[0];

            if (travel.Azimuth1 >= 0)
            {
                result1 = travel.Azimuth1;
            }
            else
            {
                result1 = travel.Azimuth1 + 360;
            }
            if (travel.Azimuth2 >= 0)
            {
                result2 = travel.Azimuth2;
            }
            else
            {
                result2 = travel.Azimuth2 + 360;
            }
            textBox.Text = string.Format($"Distance:{travel.Distance} | Azimuth1:{result1} | Azimuth2:{result2} |Initial Point :410175.775805, 552181.881083");


            //textBox.Text = string.Format("{0} kilometers", (int)distance);
            // Get the points that define the route polyline.
            Esri.ArcGISRuntime.Geometry.PointCollection polylinePoints = new Esri.ArcGISRuntime.Geometry.PointCollection(new SpatialReference(3168))
            {
                (MapPoint)_startLocationGraphic.Geometry,
                coordinateList[0]
            };

            // Create the polyline for the two points.
            Polyline routeLine = new Polyline(polylinePoints);


            // Densify the polyline to show the geodesic curve.
            Esri.ArcGISRuntime.Geometry.Geometry pathGeometry = GeometryEngine.DensifyGeodetic(routeLine, 1, LinearUnits.Kilometers, GeodeticCurveType.Geodesic);
            // Apply the curved line to the path graphic.
            _pathGraphic.Geometry = pathGeometry;
        }