Exemple #1
0
        private void btnDistance_Click(object sender, EventArgs e)
        {
            // Winner is  MapUtil.GetDistance for pole to pole
            listBox1.Items.Add("");
            var bb = new LLBoundingBox(0, 0, 0, 0, false);

            bb.West = -180.0; bb.East = -179.0; bb.South = 0.0; bb.North = 0.0;
            var d1 = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);

            listBox1.Items.Add($"Distance1:{d1}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            Char myChar = 'K';
            var  d2     = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);

            listBox1.Items.Add($"Distance2:{d2}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            var d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);

            listBox1.Items.Add($"Distance3:{d3}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");

            bb.West = -180.0; bb.East = -179.0; bb.South = -45.0; bb.North = -45.0;
            d1      = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);
            listBox1.Items.Add($"Distance1:{Math.Round(d1,6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d2 = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance2:{Math.Round(d2,6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance3:{Math.Round(d3,6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");

            bb.West = 0.0; bb.East = 1.0; bb.South = 0.0; bb.North = 0.0;
            d1      = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);
            listBox1.Items.Add($"Distance1:{Math.Round(d1, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d2 = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance2:{Math.Round(d2, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance3:{Math.Round(d3, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");

            bb.West = -179.0; bb.East = 170.0; bb.South = 0.0; bb.North = 0.0;
            d1      = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);
            listBox1.Items.Add($"Distance1:{Math.Round(d1, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d2 = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance2:{Math.Round(d2, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance3:{Math.Round(d3, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");

            bb.West = -90.0; bb.East = 90.0; bb.South = 0.0; bb.North = 0.0;
            d1      = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);
            listBox1.Items.Add($"Distance1:{Math.Round(d1, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d2 = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance2:{Math.Round(d2, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance3:{Math.Round(d3, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");

            bb.West = 1.0; bb.East = 1.1; bb.South = 0.0; bb.North = 1.0;
            d1      = MapUtil.GetDistance(bb.West, bb.South, bb.East, bb.North);
            listBox1.Items.Add($"Distance1:{Math.Round(d1, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d2 = MapUtil.Distance3(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance2:{Math.Round(d2, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
            d3 = MapUtil.DistanceTo(bb.West, bb.South, bb.East, bb.South, myChar);
            listBox1.Items.Add($"Distance3:{Math.Round(d3, 6)}, (W,S - E,N) ,({bb.West} , {bb.South}) - ({bb.East} , {bb.North})");
        }