Spatial4n.Core.Shapes.Impl.RectangleImpl.Relate C# (CSharp) Méthode

Relate() public méthode

public Relate ( System.Point point ) : SpatialRelation
point System.Point
Résultat SpatialRelation
        public SpatialRelation Relate(Point point)
        {
            if (point.GetY() > GetMaxY() || point.GetY() < GetMinY())
                return SpatialRelation.DISJOINT;
            //  all the below logic is rather unfortunate but some dateline cases demand it
            double minX = this.minX;
            double maxX = this.maxX;
            double pX = point.GetX();
            if (ctx.IsGeo())
            {
                //unwrap dateline and normalize +180 to become -180
                double rawWidth = maxX - minX;
                if (rawWidth < 0)
                {
                    maxX = minX + (rawWidth + 360);
                }
                //shift to potentially overlap
                if (pX < minX)
                {
                    pX += 360;
                }
                else if (pX > maxX)
                {
                    pX -= 360;
                } else {
                    return SpatialRelation.CONTAINS; //short-circuit
                }
            }
            if (pX < minX || pX > maxX)
                return SpatialRelation.DISJOINT;
            return SpatialRelation.CONTAINS;
        }

Same methods

RectangleImpl::Relate ( Rectangle rect ) : SpatialRelation
RectangleImpl::Relate ( Shape other ) : SpatialRelation