Example #1
0
        public bool TryGetDistanceFromEnd(GeoPoint point, out Double distance)
        {
            bool success = false;

            distance = 0;
            GeoLineList list = new GeoLineList(this);

            list.Reverse();

            for (int index = 0; index < list.Count; index++)
            {
                GeoLine  line = list[index];
                GeoPoint closest;

                Double thisDistance;
                closest = line.ClosestPointTo(point, out thisDistance);

                /** less than this distance, he is on the line */
                if (thisDistance > .1)
                {
                    distance += line.Length;
                }
                else
                {
                    distance += EarthGeo.GetDistance(line.P2 as GeoPoint, closest);
                    success   = true;
                    break;
                }
            }
            return(success);
        }
Example #2
0
        public bool TryGetPointAtDistanceFromEnd(Double distance, out GeoPoint point)
        {
            point = null;

            Double      totalLength = 0;
            GeoLineList list        = new GeoLineList(this);

            list.Reverse();

            for (int index = 0; point == null && index < list.Count; index++)
            {
                GeoLine line      = list[index];
                Double  newLength = totalLength + line.Length;
                if (newLength > distance)
                {
                    Double segLength = distance - totalLength;
                    point = EarthGeo.GetPoint(line.P2 as GeoPoint, Angle.Reverse(line.Bearing), segLength);
                }
                else
                {
                    totalLength = newLength;
                }
            }
            return(point != null);
        }
Example #3
0
        public GeoLineList ToGeoLineList()
        {
            GeoLineList list = new GeoLineList();

            for (int x = 0; x < Count - 1; x++)
            {
                list.Add(new GeoLine(this[x], this[x + 1]));
            }
            return(list);
        }
Example #4
0
        public bool ContainsAnyEndPoint(GeoLineList other, int precision = 0)
        {
            bool result = false;

            foreach (GeoLine l1 in this)
            {
                foreach (GeoLine l2 in other)
                {
                    if (l1.IsEndPoint(l2.P1, precision) || l1.IsEndPoint(l2.P2, precision))
                    {
                        result = true;
                        break;
                    }
                }
            }
            return(result);
        }
Example #5
0
 public GeoLineList(GeoLineList other)
     : base(other)
 {
 }
Example #6
0
 public GeoPath(GeoLineList lines)
     : base(lines)
 {
 }