Exemplo n.º 1
0
 // Creates new bounding box
 //
 // @param origin Origin point
 // @param width Width
 // @param height Height
 // @return New bounding box
 public static GLMapBBox GLMapBBoxMake(GLMapPoint origin, double width, double height)
 {
     return(new GLMapBBox()
     {
         origin = origin, size = GLMapPointMake(width, height)
     });
 }
Exemplo n.º 2
0
        // Adds point into existing bounding box.
        //
        // @param bbox Bounding box
        // @param point Point to add into bounding box
        public static GLMapBBox GLMapBBoxAddPoint(GLMapBBox bbox, GLMapPoint point)
        {
            if (bbox.size.x < 0 && bbox.size.y < 0)
            {
                bbox.size   = GLMapPointMake(0, 0);
                bbox.origin = point;
            }
            else
            {
                if (point.x < bbox.origin.x)
                {
                    bbox.size.x  += bbox.origin.x - point.x;
                    bbox.origin.x = point.x;
                }
                if (point.x > bbox.origin.x + bbox.size.x)
                {
                    bbox.size.x = point.x - bbox.origin.x;
                }

                if (point.y < bbox.origin.y)
                {
                    bbox.size.y  += bbox.origin.y - point.y;
                    bbox.origin.y = point.y;
                }
                if (point.y > bbox.origin.y + bbox.size.y)
                {
                    bbox.size.y = point.y - bbox.origin.y;
                }
            }
            return(bbox);
        }
Exemplo n.º 3
0
        // Check if the bbox contains the point
        //
        // @param bbox Bounding box
        // @param point Point to check
        // @return true if point is in bbox
        public static bool GLMapBBoxContains(GLMapBBox bbox, GLMapPoint point)
        {
            if (point.y < bbox.origin.y)
            {
                return(false);
            }
            if (point.y > bbox.origin.y + bbox.size.y)
            {
                return(false);
            }

            if (point.x >= bbox.origin.x && point.x <= bbox.origin.x + bbox.size.x)
            {
                return(true);
            }

            if (point.x >= bbox.origin.x - Constants.GLMapPointMax && point.x <= bbox.origin.x + bbox.size.x - Constants.GLMapPointMax)
            {
                return(true);
            }

            if (point.x >= bbox.origin.x + Constants.GLMapPointMax && point.x <= bbox.origin.x + bbox.size.x + Constants.GLMapPointMax)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
 // Checks equality of two map points
 //
 // @param a First map point
 // @param b Second map point
 // @return `true` if map points is equal
 public static bool GLMapPointEqual(GLMapPoint a, GLMapPoint b)
 {
     return(a.x == b.x && a.y == b.y);
 }
Exemplo n.º 5
0
 //[Verify (PlatformInvoke)]
 static extern double GLMapMetersBetweenPoints(GLMapPoint a, GLMapPoint b);
Exemplo n.º 6
0
 //[Verify (PlatformInvoke)]
 static extern GLMapGeoPoint GLMapGeoPointFromMapPoint(GLMapPoint point);
Exemplo n.º 7
0
 //[Verify (PlatformInvoke)]
 static extern unsafe void GLMapMarkerSetLocation(void *data, GLMapPoint point);