Пример #1
0
 private void clearValues()
 {
     NodesById.Clear();
     WaysById.Clear();
     RelationsById.Clear();
     Intersections.Clear();
     Bounds = new BoundingBox();
 }
Пример #2
0
        private async void UpdateIntersections()
        {
            try
            {
                Logging.LogMethodCall(ClassName);
                var qf        = new QueryParameters();
                var gemStreet = GeometryEngine.Union(_selectedStreet.Value);
                qf.Geometry            = gemStreet;
                qf.SpatialRelationship = SpatialRelationship.Touches;
                var results = await FeatureSource.QueryFeaturesAsync(qf);

                Intersections.Clear();
                foreach (var result in results)
                {
                    var streetName = result.Attributes[StreetNameField].ToString();
                    if (SelectedStreet.Key == streetName)
                    {
                        continue;
                    }
                    var loc = GeometryEngine.Intersections(result.Geometry, gemStreet);
                    if (loc[0] is MapPoint)
                    {
                        Intersections.Add(new Tuple <string, Geometry>(streetName, loc[0]));
                    }
                    else if (loc[0] is Multipoint)
                    {
                        Intersections.Add(new Tuple <String, Geometry>(streetName, ((Multipoint)loc[0]).Points[0]));
                    }
                    else if (loc[0] is Multipart)
                    {
                        var geom = ((Multipart)loc[0]).Parts[0].Points[0];
                        Intersections.Add(new Tuple <string, Geometry>(streetName, geom));
                    }
                }
            }
            catch (Exception ex)
            {
                var message = "Error updating intersections";
                ErrorHelper.OnError(MethodBase.GetCurrentMethod().DeclaringType.Name, message, ex);
                Logging.LogMessage(Logging.LogType.Error, message, ex);
            }
        }
Пример #3
0
        public void GenerateIntersections()
        {
            Intersections.Clear();
            try
            {
                if (!DistancesCalculated)
                {
                    CalculateNodeDistances();
                }

                generateIntersections();
                cleanSplitWays();
                createEndIntersections();
                findConnectedIntersections();
                flagIntersectionInNodes();
                IntersectionsGenerated = true;
            }
            catch (Exception ex)
            {
                IntersectionsGenerated = false;
            }
        }
 public override void Reset()
 {
     Intersections.Clear();
 }