Example #1
0
        /// <summary>
        /// Add a map feature of the given dimensions at the given geo coordinate.
        /// </summary>
        /// <param name="Id">The unique identification of the feature.</param>
        /// <param name="GeoCoordinate">The geo coordinate of the feature.</param>
        /// <param name="Width">The longitude of the feature.</param>
        /// <param name="Height">The longitude of the feature.</param>
        /// <param name="Color">The fill color of the feature.</param>
        public Feature AddFeature(String Id,
                                  GeoCoordinate GeoCoordinate,
                                  Double Width,
                                  Double Height,
                                  Color Color)
        {
            var radialBrush = new RadialGradientBrush();
            var ColorHigh   = Color; ColorHigh.A = 0xFF;
            var ColorLow    = Color; ColorLow.A = 0x00;

            radialBrush.GradientStops.Add(new GradientStop(ColorHigh, 0.0));
            radialBrush.GradientStops.Add(new GradientStop(ColorLow, 1.0));

            var XY = GeoCalculations.GeoCoordinate2ScreenXY(GeoCoordinate, this.MapControl.ZoomLevel);


            var Feature = new Feature(Id, new EllipseGeometry()
            {
                RadiusX = Width / 2, RadiusY = Height / 2
            })
            {
                Latitude  = GeoCoordinate.Latitude,
                Longitude = GeoCoordinate.Longitude,
                Altitude  = GeoCoordinate.Altitude,
                Width     = Width,
                Height    = Height,
                Fill      = radialBrush,
                ToolTip   = Id
            };

            // The position on the map will be set within the PaintMap() method!
            this.Children.Add(Feature);

            return(Feature);
        }
Example #2
0
        /// <summary>
        /// Redraws this mapping layer.
        /// </summary>
        public override void Redraw()
        {
            if (this.IsVisible && !IsCurrentlyPainting)
            {
                IsCurrentlyPainting = true;

                if (!DesignerProperties.GetIsInDesignMode(this))
                {
                    this.Children.Clear();
                    Calc();

                    this.Children.
                    ForEach <Feature>(AFeature => {
                        var ScreenXY = GeoCalculations.GeoCoordinate2ScreenXY(AFeature.Latitude,
                                                                              AFeature.Longitude,
                                                                              MapControl.ZoomLevel);

                        Canvas.SetLeft(AFeature, this.MapControl.ScreenOffset.X + ScreenXY.X);
                        Canvas.SetTop(AFeature, this.MapControl.ScreenOffset.Y + ScreenXY.Y);
                    });
                }

                IsCurrentlyPainting = false;
            }
        }
Example #3
0
        /// <summary>
        /// Create a new pipe to transform an enumeration of geo coordinates
        /// into their corresponding tile identification.
        /// </summary>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="IEnumerable">An optional IEnumerable&lt;S&gt; as element source.</param>
        /// <param name="IEnumerator">An optional IEnumerator&lt;S&gt; as element source.</param>
        public GeoCoordinate2TilesXYPipe(UInt32 ZoomLevel,
                                         IEnumerable <GeoCoordinate> IEnumerable = null,
                                         IEnumerator <GeoCoordinate> IEnumerator = null)

            : base(IEnumerable,
                   Item => GeoCalculations.GeoCoordinate2TilesXY(Item, ZoomLevel))

        {
        }
Example #4
0
        /// <summary>
        /// Create a new pipe to transform an enumeration of mouse positions
        /// on the map into their corresponding geo coordinates.
        /// </summary>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="IEnumerable">An optional IEnumerable&lt;S&gt; as element source.</param>
        /// <param name="IEnumerator">An optional IEnumerator&lt;S&gt; as element source.</param>
        public Mouse2GeoCoordinatePipe(UInt32 ZoomLevel,
                                       IEnumerable <Tuple <Double, Double> > IEnumerable = null,
                                       IEnumerator <Tuple <Double, Double> > IEnumerator = null)

            : base(IEnumerable,
                   Item => GeoCalculations.Mouse2GeoCoordinate(Item.Item1, Item.Item2, ZoomLevel))

        {
        }
Example #5
0
        /// <summary>
        /// Create a new pipe to transform an enumeration of tiles
        /// into their corresponding geo coordinates.
        /// </summary>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="IEnumerable">An optional IEnumerable&lt;S&gt; as element source.</param>
        /// <param name="IEnumerator">An optional IEnumerator&lt;S&gt; as element source.</param>
        public TilesXY2GeoCoordinatePipe(UInt32 ZoomLevel,
                                         IEnumerable <TilesXY> IEnumerable = null,
                                         IEnumerator <TilesXY> IEnumerator = null)

            : base(IEnumerable,
                   Item => GeoCalculations.TilesXY2GeoCoordinate(Item, ZoomLevel))

        {
        }
Example #6
0
        /// <summary>
        /// Create a new arrow to transform an enumeration of geo coordinates
        /// into their corresponding tile identification.
        /// </summary>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="OnError">A delegate to transform an incoming error into an outgoing error.</param>
        /// <param name="ArrowSender">The sender of the messages/objects.</param>
        public GeoCoordinate2TilesXYArrow(UInt32 ZoomLevel,
                                          Func <Exception, Exception> OnError      = null,
                                          IArrowSender <GeoCoordinate> ArrowSender = null)

            : base(Item => GeoCalculations.GeoCoordinate2TilesXY(Item, ZoomLevel),
                   OnError,
                   ArrowSender)

        {
        }
Example #7
0
        /// <summary>
        /// Create a new arrow to transform an enumeration of mouse positions
        /// on the map into their corresponding geo coordinates.
        /// </summary>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="OnError">A delegate to transform an incoming error into an outgoing error.</param>
        /// <param name="ArrowSender">The sender of the messages/objects.</param>
        public Mouse2GeoCoordinateArrow(UInt32 ZoomLevel,
                                        Func <Exception, Exception> OnError = null,
                                        IArrowSender <Tuple <Double, Double> > ArrowSender = null)

            : base(Item => GeoCalculations.Mouse2GeoCoordinate(Item.Item1, Item.Item2, ZoomLevel),
                   OnError,
                   ArrowSender)

        {
        }
Example #8
0
        private void DrawLine(GeoCoordinate P1, GeoCoordinate P2, Brush Stroke, Double StrokeThickness)
        {
            var Line = new Line()
            {
                X1              = GeoCalculations.GeoCoordinate2ScreenXY(P1, this.MapControl.ZoomLevel).X + this.MapControl.ScreenOffset.X,
                Y1              = GeoCalculations.GeoCoordinate2ScreenXY(P1, this.MapControl.ZoomLevel).Y + this.MapControl.ScreenOffset.Y,
                X2              = GeoCalculations.GeoCoordinate2ScreenXY(P2, this.MapControl.ZoomLevel).X + this.MapControl.ScreenOffset.X,
                Y2              = GeoCalculations.GeoCoordinate2ScreenXY(P2, this.MapControl.ZoomLevel).Y + this.MapControl.ScreenOffset.Y,
                Stroke          = Stroke,
                StrokeThickness = StrokeThickness
            };

            this.Children.Add(Line);
        }
Example #9
0
        private void ProcessPreviewMouseRightButtonDown(Object Sender, MouseEventArgs MouseEventArgs)
        {
            var Mouse = MouseEventArgs.GetPosition(this);

            AddFeature("NewFeature",
                       GeoCalculations.Mouse2GeoCoordinate(Mouse.X - this.MapControl.ScreenOffset.X,
                                                           Mouse.Y - this.MapControl.ScreenOffset.Y,
                                                           this.MapControl.ZoomLevel),
                       5, 5,
                       Brushes.Blue,
                       Brushes.Black,
                       1.0);

            Redraw();
        }
        /// <summary>
        /// Transform the given enumeration of geo coordinates into a shape definition.
        /// </summary>
        /// <param name="GeoCoordinates">An enumeration of geo coordinates.</param>
        /// <param name="OnScreenUpperLeft">The upper-left screen offset.</param>
        /// <param name="ZoomLevel">The current zoom level of the Aegir map.</param>
        /// <param name="CloseShape">Whether to close the shape (polygon), or not (line).</param>
        public static SDL GeoCoordinates2ShapeDefinition(this IEnumerable <GeoCoordinate> GeoCoordinates,
                                                         ScreenXY OnScreenUpperLeft,
                                                         UInt32 ZoomLevel,
                                                         Boolean CloseShape)

        {
            if (GeoCoordinates == null)
            {
                throw new ArgumentNullException("GeoCoordinates");
            }

            var StringBuilder = new StringBuilder("M ");

            Action <ScreenXY> ApplyScreenOffset = ScreenXY => {
                StringBuilder.Append(((Int64)ScreenXY.X) - OnScreenUpperLeft.X);
                StringBuilder.Append(" ");
                StringBuilder.Append(((Int64)ScreenXY.Y) - OnScreenUpperLeft.Y);
                StringBuilder.Append(" ");
            };

            var GeoCoordinates2 = GeoCoordinates.ToArray();
            var BoundingBox     = GeoCoordinates2.GeoCoordinate2BoundingBox();


            GeoCoordinates2.

            // Project the geo coordinate onto the current screen (without offset!)
            Select(GeoCoordinate => GeoCalculations.GeoCoordinate2ScreenXY(GeoCoordinate, ZoomLevel)).

            ForEach(
                // For the first...
                OnScreenXY => {
                ApplyScreenOffset(OnScreenXY);
                StringBuilder.Append("L ");
            },

                // For the rest..
                OnScreenXY => ApplyScreenOffset(OnScreenXY));


            if (CloseShape)
            {
                StringBuilder.Append("Z ");
            }

            return(new SDL(StringBuilder.ToString()));
        }
Example #11
0
        public Feature AddPath(String Id, Latitude Latitude, Longitude Longitude, Double Width, Double Height, Color Color)
        {
            var XY = GeoCalculations.GeoCoordinate2ScreenXY(Latitude, Longitude, MapControl.ZoomLevel);

            var PathGeometry1 = PathGeometry.Parse("M51,42c-5-4-11-7-19-7c-6,0-12,1-20,5l10-35c20-8,30-4,39,2l-10,35z");
            var PathGeometry2 = PathGeometry.Parse("M106,13c-21,9-31,4-40-2l-10,35c9,6,20,11,40,2l10-35z");
            var PathGeometry3 = PathGeometry.Parse("M39,83c-9-6-18-10-39-2l10-35c21-9,31-4,39,2l-10,35z");
            var PathGeometry4 = PathGeometry.Parse("M55,52c9,6,18,10,39,2l-10,35c-21,8-30,3-39-3l10-34z");

            var pathText = PathGeometry1.ToString();

            var GD1 = new GeometryDrawing(new SolidColorBrush(Color.FromRgb(0xE0, 0x60, 0x30)), null, PathGeometry1);
            var GD2 = new GeometryDrawing(new SolidColorBrush(Color.FromRgb(0x70, 0xB0, 0x40)), null, PathGeometry2);
            var GD3 = new GeometryDrawing(new SolidColorBrush(Color.FromRgb(0x40, 0x90, 0xc0)), null, PathGeometry3);
            var GD4 = new GeometryDrawing(new SolidColorBrush(Color.FromRgb(0xF0, 0xD0, 0x50)), null, PathGeometry4);

            var DrawingGroup = new DrawingGroup();

            DrawingGroup.Children.Add(GD1);
            DrawingGroup.Children.Add(GD2);
            DrawingGroup.Children.Add(GD3);
            DrawingGroup.Children.Add(GD4);

            var DrawingBrush = new DrawingBrush()
            {
                Drawing  = DrawingGroup,
                TileMode = TileMode.None
            };

            var Feature = new Feature(Id, new RectangleGeometry()
            {
                Rect = DrawingGroup.Bounds
            })
            {
                Latitude  = Latitude,
                Longitude = Longitude,
                Width     = DrawingGroup.Bounds.Width,
                Height    = DrawingGroup.Bounds.Height,
                Fill      = DrawingBrush,
                ToolTip   = Id
            };

            // The position on the map will be set within the PaintMap() method!
            this.Children.Add(Feature);

            return(Feature);
        }
Example #12
0
        private void SetScreenGeometry()
        {
            this.OnScreenUpperLeft  = GeoCalculations.GeoCoordinate2ScreenXY(GeoBounding.Latitude, GeoBounding.Longitude, _ZoomLevel);
            this.OnScreenLowerRight = GeoCalculations.GeoCoordinate2ScreenXY(GeoBounding.Latitude2, GeoBounding.Longitude2, _ZoomLevel);

            this.OnScreenWidth  = (UInt64)Math.Abs(OnScreenLowerRight.X - OnScreenUpperLeft.X);
            this.OnScreenHeight = (UInt64)Math.Abs(OnScreenLowerRight.Y - OnScreenUpperLeft.Y);

            if (GeoCoordinates != null)
            {
                var DrawingGroup = new DrawingGroup();

                DrawingGroup.Children.Add(
                    new GeometryDrawing(
                        new SolidColorBrush(FillColor),
                        new Pen(new SolidColorBrush(StrokeColor),
                                StrokeThickness),
                        PathGeometry.Parse(GeoCoordinates.GeoCoordinates2ShapeDefinition(OnScreenUpperLeft, _ZoomLevel, true).Value)
                        )
                    );

                this.Fill = new DrawingBrush()
                {
                    Drawing = DrawingGroup,
                    //Viewport = new Rect(0, 0, 1, 1),
                    TileMode = TileMode.None,
                    Stretch  = Stretch.UniformToFill
                };

                Bounds = DrawingGroup.Bounds;
            }

            this._DefiningGeometry = new RectangleGeometry()
            {
                Rect = new Rect(new Size(OnScreenWidth, Bounds.Height / Bounds.Width * OnScreenWidth))
            };
        }
Example #13
0
        public static ShapeInfo Polyfile2ShapeInfo(IEnumerable <String> InputData, UInt32 min_resolution, UInt32 max_resolution)
        {
            #region Init

            var Integer     = 1U;
            var ShapeNumber = 1U;
            var IsFirstLine = true;
            var Description = String.Empty;

            var min_lat = Double.MaxValue;
            var min_lng = Double.MaxValue;
            var max_lat = Double.MinValue;
            var max_lng = Double.MinValue;

            var Shapes = new Dictionary <UInt32, Tuple <List <GeoCoordinate>,
                                                        Dictionary <UInt32,
                                                                    Tuple <List <ScreenXY>, StringBuilder> > > >();

            GeoCoordinate GeoCoordinate = default(GeoCoordinate);

            #endregion

            foreach (var Line in InputData)
            {
                #region Process first line

                if (IsFirstLine)
                {
                    Description = Line;
                    IsFirstLine = false;
                }

                #endregion

                #region A single Integer on a line indicates the start of a new shape

                else if (UInt32.TryParse(Line, out Integer))
                {
                    ShapeNumber = Integer;
                    Shapes.Add(ShapeNumber, new Tuple <List <GeoCoordinate>, Dictionary <UInt32, Tuple <List <ScreenXY>, StringBuilder> > >(
                                   new List <GeoCoordinate>(),
                                   new Dictionary <UInt32, Tuple <List <ScreenXY>, StringBuilder> >()));
                }

                #endregion

                #region "END" indicates the end of a shape

                else if (Line == "END")
                {
                    continue;
                }

                #endregion

                #region The rest of the file are "Longitude Latitude" encoded geo coordinates

                else if (GeoCoordinate.TryParseString(Line, out GeoCoordinate))
                {
                    // Polyfiles store "Longitude Latitude"!!!
                    Shapes[ShapeNumber].Item1.Add(new GeoCoordinate(new Latitude(GeoCoordinate.Longitude.Value),
                                                                    new Longitude(GeoCoordinate.Latitude.Value)));

                    if (min_lat > GeoCoordinate.Longitude.Value)
                    {
                        min_lat = GeoCoordinate.Longitude.Value;
                    }

                    if (min_lng > GeoCoordinate.Latitude.Value)
                    {
                        min_lng = GeoCoordinate.Latitude.Value;
                    }

                    if (max_lat < GeoCoordinate.Longitude.Value)
                    {
                        max_lat = GeoCoordinate.Longitude.Value;
                    }

                    if (max_lng < GeoCoordinate.Latitude.Value)
                    {
                        max_lng = GeoCoordinate.Latitude.Value;
                    }
                }

                #endregion

                #region Unknown data found...

                else
                {
                    throw new Exception("Unknown data found!");
                }

                #endregion
            }


            //var Output1 = new StreamWriter("PolyfileReader/" + Filename.Name.Replace(".poly", ".data"));
            //var Array = new StringBuilder();

            //var Output2 = new StreamWriter("PolyfileReader/" + "ghjk".Replace(".poly", ".geo"));
            //var Language = new StringBuilder();

            //Shapes.ForEach((shape) =>
            //{
            //    Array.AppendLine(shape.Key.ToString());
            //    shape.Value.Item1.ForEach(c =>
            //    {
            //        Array.AppendLine("            { " + c.Latitude.ToString("00.000000").Replace(",", ".") + ", " + c.Longitude.ToString("00.000000").Replace(",", ".") + " },");
            //    });
            //});

            //Output1.WriteLine(Array.ToString());
            //Output1.Flush();
            //Output1.Close();


            var diff_lat = Math.Abs(min_lat - max_lat);
            var diff_lng = Math.Abs(min_lng - max_lng);

            //Output2.WriteLine("From:       " + max_lat.ToString("00.000000").Replace(",", ".")  + ", " +  min_lng.ToString("00.000000").Replace(",", "."));
            //Output2.WriteLine("To:         " + min_lat.ToString("00.000000").Replace(",", ".")  + ", " +  max_lng.ToString("00.000000").Replace(",", "."));
            //Output2.WriteLine("Diff:       " + diff_lat.ToString("00.000000").Replace(",", ".") + ", " + diff_lng.ToString("00.000000").Replace(",", "."));
            //Output2.WriteLine("Resolution: " + min_resolution + " -> " + max_resolution);

            Shapes.ForEach(shape => {
                for (var resolution = min_resolution; resolution <= max_resolution; resolution++)
                {
                    shape.Value.Item2.Add(resolution, new Tuple <List <ScreenXY>, StringBuilder>(new List <ScreenXY>(), new StringBuilder()));

                    shape.Value.Item1.ForEach(GeoCoord =>
                                              shape.Value.Item2[resolution].Item1.Add(GeoCalculations.GeoCoordinate2ScreenXY(GeoCoord, resolution))
                                              );
                }
            });

            var min_x = 0L;
            var min_y = 0L;

            for (var resolution = min_resolution; resolution <= max_resolution; resolution++)
            {
                min_x = Int64.MaxValue;
                min_y = Int64.MaxValue;

                Shapes.ForEach((shape) => {
                    shape.Value.Item2[resolution].Item1.ForEach(XY => {
                        if (XY.X < min_x)
                        {
                            min_x = XY.X;
                        }
                        if (XY.Y < min_y)
                        {
                            min_y = XY.Y;
                        }
                    });
                });

                Shapes.ForEach((shape) =>
                {
                    var Char = "M ";

                    shape.Value.Item2[resolution].Item1.ForEach(XY => {
                        shape.Value.Item2[resolution].Item2.Append(Char + (XY.X - min_x) + " " + (XY.Y - min_y) + " ");
                        if (Char == "L ")
                        {
                            Char = "";
                        }
                        if (Char == "M ")
                        {
                            Char = "L ";
                        }
                    });

                    shape.Value.Item2[resolution].Item2.Append("Z ");
                });
            }


            var ShapeLanguage = String.Empty;

            var ShapeDic = new Dictionary <UInt32, String>();

            for (var resolution = min_resolution; resolution <= max_resolution; resolution++)
            {
                ShapeLanguage = "\"";
                Shapes.ForEach((shape) => ShapeLanguage += shape.Value.Item2[resolution].Item2.ToString().Trim() + " ");
                ShapeDic.Add(resolution, ShapeLanguage.TrimEnd() + "\",");
            }

            return(new ShapeInfo(Description, max_lat, max_lng, min_lat, min_lng, ShapeDic));
        }
Example #14
0
        private void Calc()
        {
            if (VoronoiFeatures.Count > 2)
            {
                #region Draw Delaunay

                if (DelaunayTriangleList == null)
                {
                    DelaunayTriangleList = VoronoiFeatures.DelaunayTriangulation().ToList();
                }

                if (DelaunayTriangleList != null)
                {
                    foreach (var DelaunayTriangle in DelaunayTriangleList)
                    {
                        var P1OnScreen = GeoCalculations.GeoCoordinate2ScreenXY(DelaunayTriangle.Triangle.P1, this.MapControl.ZoomLevel);
                        var P2OnScreen = GeoCalculations.GeoCoordinate2ScreenXY(DelaunayTriangle.Triangle.P2, this.MapControl.ZoomLevel);
                        var P3OnScreen = GeoCalculations.GeoCoordinate2ScreenXY(DelaunayTriangle.Triangle.P3, this.MapControl.ZoomLevel);

                        ////DrawLine(P1OnScreen, P2OnScreen, Brushes.Blue, 1.0);
                        ////DrawLine(P2OnScreen, P3OnScreen, Brushes.Blue, 1.0);
                        ////DrawLine(P3OnScreen, P1OnScreen, Brushes.Blue, 1.0);

                        //var GeoCircle      = new GeoCircle(_Triangle.P1, _Triangle.P2, _Triangle.P3);
                        var ScreenCircle = new Circle <Double>(new Pixel <Double>(P1OnScreen.X + this.MapControl.ScreenOffset.X, P1OnScreen.Y + this.MapControl.ScreenOffset.Y),
                                                               new Pixel <Double>(P2OnScreen.X + this.MapControl.ScreenOffset.X, P2OnScreen.Y + this.MapControl.ScreenOffset.Y),
                                                               new Pixel <Double>(P3OnScreen.X + this.MapControl.ScreenOffset.X, P3OnScreen.Y + this.MapControl.ScreenOffset.Y));

                        //var r1 = ScreenCircle.Center.DistanceTo(P1OnScreen.X + this.MapControl.ScreenOffset.X, P1OnScreen.Y + this.MapControl.ScreenOffset.Y);
                        //var r2 = ScreenCircle.Center.DistanceTo(P2OnScreen.X + this.MapControl.ScreenOffset.X, P2OnScreen.Y + this.MapControl.ScreenOffset.Y);
                        //var r3 = ScreenCircle.Center.DistanceTo(P3OnScreen.X + this.MapControl.ScreenOffset.X, P3OnScreen.Y + this.MapControl.ScreenOffset.Y);

                        //var CenterOnScreen = GeoCalculations.GeoCoordinate2ScreenXY(GeoCircle.Center, this.MapControl.ZoomLevel);

                        #region DrawCircumCircles

                        if (DrawCircumCircles)
                        {
                            var CircumCircle = new Ellipse()
                            {
                                Width           = ScreenCircle.Diameter,
                                Height          = ScreenCircle.Diameter,
                                Stroke          = Brushes.DarkGreen,
                                StrokeThickness = 1.0
                            };

                            this.Children.Add(CircumCircle);
                            //Canvas.SetLeft(CircumCircle, CenterOnScreen.X + this.MapControl.ScreenOffset.X);
                            //Canvas.SetTop (CircumCircle, CenterOnScreen.Y + this.MapControl.ScreenOffset.Y);
                            Canvas.SetLeft(CircumCircle, ScreenCircle.X - ScreenCircle.Radius); // + this.MapControl.ScreenOffset.X);
                            Canvas.SetTop(CircumCircle, ScreenCircle.Y - ScreenCircle.Radius);  // + this.MapControl.ScreenOffset.Y);
                        }

                        #endregion
                    }
                }

                foreach (var tr1 in DelaunayTriangleList)
                {
                    tr1.Neighbors.Clear();
                }

                HashSet <GeoCoordinate>     tr1_h, tr2_h;
                IEnumerable <GeoCoordinate> Intersection;

                foreach (var tr1 in DelaunayTriangleList)
                {
                    foreach (var tr2 in DelaunayTriangleList)
                    {
                        tr1_h = new HashSet <GeoCoordinate>();
                        tr1_h.Add(tr1.Triangle.P1);
                        tr1_h.Add(tr1.Triangle.P2);
                        tr1_h.Add(tr1.Triangle.P3);

                        tr2_h = new HashSet <GeoCoordinate>();
                        tr2_h.Add(tr2.Triangle.P1);
                        tr2_h.Add(tr2.Triangle.P2);
                        tr2_h.Add(tr2.Triangle.P3);

                        Intersection = tr1_h.Intersect(tr2_h);

                        if (Intersection.Count() == 2)
                        {
                            tr1.Neighbors.Add(tr2);
                            tr2.Neighbors.Add(tr1);

                            foreach (var bo in tr1.Triangle.Borders)
                            {
                                if (Intersection.Contains(bo.P1) && Intersection.Contains(bo.P2))
                                {
                                    bo.Tags.Add("shared");
                                }
                            }

                            foreach (var bo in tr2.Triangle.Borders)
                            {
                                if (Intersection.Contains(bo.P1) && Intersection.Contains(bo.P2))
                                {
                                    bo.Tags.Add("shared");
                                }
                            }
                        }
                    }
                }

                var aaa = DelaunayTriangleList.SelectMany(v => v.Triangle.Borders).Select(v => v.Tags);

                foreach (var DelaunayTriangle in DelaunayTriangleList)
                {
                    foreach (var Edge in DelaunayTriangle.Triangle.Borders)
                    {
                        DrawLine(GeoCalculations.GeoCoordinate2ScreenXY(Edge.P1, this.MapControl.ZoomLevel),
                                 GeoCalculations.GeoCoordinate2ScreenXY(Edge.P2, this.MapControl.ZoomLevel),
                                 (Edge.Tags.Contains("shared"))
                                ? Brushes.LightBlue
                                : Brushes.Blue,
                                 1.0);
                    }
                }

                foreach (var tr1 in DelaunayTriangleList)//.Skip(2).Take(1))
                {
                    var Borders = tr1.Triangle.Borders.ToList();

                    var Center = new GeoLine(Borders[0].Center, Borders[0].Normale).
                                 Intersection(new GeoLine(Borders[1].Center, Borders[1].Normale));

                    var Vector1 = Borders[0].Vector;
                    var Vector2 = Borders[0].Vector;
                    var Vector3 = Borders[0].Vector;

                    var Normale1 = Borders[0].Normale;
                    var Normale2 = Borders[0].Normale;
                    var Normale3 = Borders[0].Normale;

                    //var Center1  = new GeoCoordinate(new Latitude(Borders[0].Center.Longitude.Value), new Longitude(Borders[0].Center.Latitude.Value));
                    //var Center2  = new GeoCoordinate(new Latitude(Borders[1].Center.Longitude.Value), new Longitude(Borders[1].Center.Latitude.Value));
                    //var Center3  = new GeoCoordinate(new Latitude(Borders[2].Center.Longitude.Value), new Longitude(Borders[2].Center.Latitude.Value));

                    DrawLine(Center, Borders[0].Center, Brushes.Green, 1.0);
                    DrawLine(Center, Borders[1].Center, Brushes.Green, 1.0);
                    DrawLine(Center, Borders[2].Center, Brushes.Green, 1.0);
                }

                #endregion


                //var Center1                 = new GeoCoordinate(new Latitude(49.7316155727453), new Longitude(10.1409612894059));

                //var LineX_3_4               = new GeoLine(new GeoCoordinate(new Latitude(49.732745964269350), new Longitude(10.135724544525146)),
                //                                          new GeoCoordinate(new Latitude(49.731761237693235), new Longitude(10.135746002197264)));

                //var Line_S3S4               = new GeoLine(new GeoCoordinate(new Latitude(49.732552), new Longitude(10.139216)),
                //                                          new GeoCoordinate(new Latitude(49.731004), new Longitude(10.138913)));

                //var Line_S3S4Center2Center1 = new GeoLine(Line_S3S4.Center,
                //                                          Center1);

                //var Intersection1           = Line_S3S4Center2Center1.Intersection(LineX_3_4);

                //DrawLine(Line_S3S4.Center, Intersection1, Brushes.Red, 1.0);

                //// ------------------------------------------------------------------------

                //var LineX_7_8               = new GeoLine(new GeoCoordinate(new Latitude(49.729930425324014), new Longitude(10.137097835540771)),
                //                                          new GeoCoordinate(new Latitude(49.729347879633465), new Longitude(10.138492584228516)));

                //var Line_S4S5               = new GeoLine(new GeoCoordinate(new Latitude(49.731004), new Longitude(10.138913)),
                //                                          new GeoCoordinate(new Latitude(49.730237), new Longitude(10.140107)));

                //var Line_S4S5Center2Center1 = new GeoLine(Line_S4S5.Center,
                //                                          Center1);

                //var Intersection2           = Line_S4S5Center2Center1.Intersection(LineX_7_8);

                //DrawLine(Line_S4S5.Center, Intersection2, Brushes.Red, 1.0);

                //// ------------------------------------------------------------------------

                //var Center2                 = new GeoCoordinate(new Latitude(49.7302216912131), new Longitude(10.1434879302979));

                //var LineX_14_15             = new GeoLine(new GeoCoordinate(new Latitude(49.728695974976030), new Longitude(10.143170356750488)),
                //                                          new GeoCoordinate(new Latitude(49.728987252607084), new Longitude(10.144414901733398)));

                //var Line_S5S7               = new GeoLine(new GeoCoordinate(new Latitude(49.730237), new Longitude(10.140107)),
                //                                          new GeoCoordinate(new Latitude(49.730664), new Longitude(10.146802)));

                //var Line_S5S7Center2Center2 = new GeoLine(Line_S5S7.Center,
                //                                          Center2);

                //var Intersection3           = Line_S5S7Center2Center2.Intersection(LineX_14_15);

                //DrawLine(Center2, Intersection3, Brushes.Red, 1.0);

                //// ------------------------------------------------------------------------

                //var LineX_17_18             = new GeoLine(new GeoCoordinate(new Latitude(49.732413101183180), new Longitude(10.149564743041992)),
                //                                          new GeoCoordinate(new Latitude(49.731469976708340), new Longitude(10.148684978485107)));

                //var Line_S7S6               = new GeoLine(new GeoCoordinate(new Latitude(49.730664), new Longitude(10.146802)),
                //                                          new GeoCoordinate(new Latitude(49.731791), new Longitude(10.145903)));

                //var Line_S7S6Center2Center2 = new GeoLine(Line_S7S6.Center,
                //                                          Center2);

                //var Intersection4           = Line_S7S6Center2Center2.Intersection(LineX_17_18);

                //DrawLine(Line_S7S6.Center, Intersection4, Brushes.Red, 1.0);

                //// ------------------------------------------------------------------------

                //var Center3                 = new GeoCoordinate(new Latitude(49.7318726185525), new Longitude(10.1424804925919));

                //var LineX_23_24             = new GeoLine(new GeoCoordinate(new Latitude(49.734146738072006), new Longitude(10.144844055175781)),
                //                                          new GeoCoordinate(new Latitude(49.733966442720840), new Longitude(10.142934322357178)));

                //var Line_S6S3               = new GeoLine(new GeoCoordinate(new Latitude(49.731791), new Longitude(10.145903)),
                //                                          new GeoCoordinate(new Latitude(49.732552), new Longitude(10.139216)));

                //var Line_S6S3Center2Center3 = new GeoLine(Line_S6S3.Center,
                //                                          Center3);

                //var Intersection5           = Line_S6S3Center2Center3.Intersection(LineX_23_24);

                //DrawLine(Line_S6S3.Center, Intersection5, Brushes.Red, 1.0);
            }
        }