Exemplo n.º 1
0
        public static bool TryParse(String str, out GeoCircle circle)
        {
            circle = null;

            String[] parts = str.Split('R');
            GeoPoint p;
            Double   r;

            if (parts.Length == 2 && GeoPoint.TryParse(parts[0].Trim(), out p) && Double.TryParse(parts[1].Trim(), out r))
            {
                circle = new GeoCircle(p, r);
            }

            return(circle != null);
        }
Exemplo n.º 2
0
        public bool Intersects(GeoCircle circle)
        {
            bool intersects = false;

            foreach (GeoLine line in this)
            {
                GeoPoint p1, p2;
                int      intersections;
                if (circle.Intersects(line, out p1, out p2, out intersections))
                {
                    intersects = true;
                    break;
                }
            }
            return(intersects);
        }
Exemplo n.º 3
0
        public Double GetMiniumumPossibleDistance(GeoCircle postion)
        {
            Double distance = Double.MaxValue;

            if (postion.Intersects(this))
            {
                distance = 0;
            }
            else
            {
                distance = DistanceToEdgeFrom(postion.Center as GeoPoint);
                distance = Math.Max(0, distance - postion.Radius);
            }

            return(distance);
        }
Exemplo n.º 4
0
        public static Double GetMiniumumPossibleDistanceFromAnyPolygon(GeoCircle postion, IEnumerable <GeoPolygon> polygons)
        {
            Double distance = Double.MaxValue;

            foreach (GeoPolygon polygon in polygons)
            {
                if (postion.Intersects(polygon) || polygon.Contains(postion.Center as GeoPoint))
                {
                    distance = 0;
                }
                else
                {
                    Double thisDistance = polygon.DistanceToEdgeFrom(postion.Center as GeoPoint);
                    thisDistance = Math.Max(0, thisDistance - postion.Radius);
                    distance     = Math.Min(distance, thisDistance);
                }

                if (distance == 0)
                {
                    break;
                }
            }
            return(distance);
        }
Exemplo n.º 5
0
 public GeoCircle(GeoCircle other)
     : this(other.Latitude, other.Longitude, other.Radius)
 {
 }
Exemplo n.º 6
0
 public bool Intersects(GeoCircle circle)
 {
     return(circle.Intersects(this));
 }
Exemplo n.º 7
0
 public bool Contains(GeoCircle circle, Double rayLength = DEFAULT_RAY_LENGTH)
 {
     /** see if this polygon entirely contains the given circle */
     return(this.Contains(circle.Center as GeoPoint) == true && circle.Intersects(this) == false);
 }
Exemplo n.º 8
0
 public GeoEllipse(GeoCircle circle)
     : this(circle.Center, circle.Radius, circle.Radius, 0)
 {
 }