// 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) }); }
// 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); }
// 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); }
// 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); }
//[Verify (PlatformInvoke)] static extern double GLMapMetersBetweenPoints(GLMapPoint a, GLMapPoint b);
//[Verify (PlatformInvoke)] static extern GLMapGeoPoint GLMapGeoPointFromMapPoint(GLMapPoint point);
//[Verify (PlatformInvoke)] static extern unsafe void GLMapMarkerSetLocation(void *data, GLMapPoint point);