Click or drag to resize

BoundingBox Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Represents a rectangular area, defined by two corners: bottom-left (P1) and top-right (P2). Used for specifying map sizes and determining feature limits.
Inheritance Hierarchy

Namespace:  Telogis.GeoBase
Assembly: (in Version:
public class BoundingBox : IMapRenderer

The BoundingBox type exposes the following members.

Public methodCode exampleBoundingBox
Create a BoundingBox with no boundaries set.
Public methodCode exampleBoundingBox(BoundingBox)
Create a BoundingBox that contains the given BoundingBox.
Public methodCode exampleBoundingBox(LatLon)
Constructs a new BoundingBox around the specified points.
Public propertyAllowCrossAntimeridian
Whether the BoundingBox is allowed to straddle the antimeridian (the meridian at +/- 180 degrees). The default is true.
Public propertyCode exampleBorderWidth
Gets or sets the width of the BoundingBox border.
Public propertyCode exampleBottomLeft
The bottom-left corner of the BoundingBox.
Public propertyCode exampleBottomRight
The bottom-right corner of the BoundingBox.
Public propertyCode exampleCenter
Gets a LatLon representing the center of the BoundingBox.
Public propertyColor
Gets or sets the color of the bounding box if it were to be rendered on the map.
Public propertyCode exampleHeight
Gets the height of the BoundingBox in degrees.
Public propertyCode exampleInnerColor
Gets or sets the inner color of the BoundingBox. Default is transparent.
Public propertyCode exampleIsValid
Returns true only if this BoundingBox's corner points have been assigned valid values.
Public propertyCode exampleRectangle
Gets a Rectangle representing this BoundingBox's coordinates, or sets this BoundingBox to match the coordinates of a given Rectangle.
Public propertyCode exampleRequiredRendermodes
Gets the RenderMode required by this BoundingBox.
Public propertyCode exampleTopLeft
The top-left corner of the BoundingBox.
Public propertyCode exampleTopRight
The top-right corner of the BoundingBox.
Public propertyCode exampleWidth
Gets the width of the BoundingBox in degrees.
Public propertyCode exampleWKT
A string that describes the BoundingBox in WKT (Well-Known Text) format.
Public propertyStatic memberWorldBounds
Returns a BoundingBox that covers the whole world.
Public methodCode exampleAdd(BoundingBox)
Inflate the BoundingBox to include this box.
Public methodCode exampleAdd(LatLon)
Inflate the BoundingBox to contain the given point.
Public methodCode exampleClone
Makes a clone of the BoundingBox.
Public methodCode exampleContains(BoundingBox)
Tests to see if this BoundingBox fully contains another bounding box.
Public methodCode exampleContains(LatLon)
Test if a given point lies within this BoundingBox. Points on the edge of the BoundingBox are considered to be outside.
Public methodEquals(Object)
Compares this object to the parameter object.
(Overrides ObjectEquals(Object).)
Public methodCode exampleEquals(BoundingBox)
Compares this object to the parameter BoundingBox.
Public methodGetHashCode
Returns a unique integer for this object.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode exampleInflate(Double)
Make each side of the BoundingBox bigger or smaller by the given number of degrees.
Public methodCode exampleInflate(Double, Double)
Makes each side of the BoundingBox bigger or smaller by the given number of degrees.
Public methodCode exampleInflateBy
Multiply the BoundingBox dimensions by the given amount.
Public methodIntersection
Gets the intersection of two BoundingBoxes. There can be anywhere between zero and two intersection areas.
Public methodCode exampleIntersects
Test whether this BoundingBox intersects with the specified BoundingBox.
Public methodNormalize
Normalize the BoundingBox. Should be called after manual changes to P1 or P2.
Public methodRender
Renders the BoundingBox on a given graphics output with a given context.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public fieldP1
Represents the Min point (bottom-left corner).
Public fieldP2
Represents the Max point (top-right corner).

A general purpose object used to represent a rectangular area. It has methods to allow resizing and to determine whether a given point lies within the box area. Some of the uses for BoundingBoxes are: zooming, or hit-testing a given area.

If adjusting points manually, please refer to remarks on P1 for important usage information.

Related articles: Data Query Concept, Avoiding a Given Area.

BoundingBox bb = new BoundingBox();

// using the Add method is a safe and easy way of
// setting up the BoundingBox. These are arbitrary points
// in Los Angeles, USA.
bb.Add(new LatLon(33.94, -118.34));
bb.Add(new LatLon(33.78, -117.95));

// we can calculate the center of the BoundingBox:
LatLon ll = bb.Center;

// and we can check if the center of the BoundingBox
// is *in* the BoundingBox...
Console.WriteLine("Center is in BB? " + bb.Contains(ll));
// ... this will, of course, be true...

// we can also dump the box in WKT format:

// if we have a Map object, we can zoom the Map to our BoundingBox. We need to set a buffer, which is the
// number of pixels between the edge of the box and the edge of the visible map area.
int edgeBuffer = 10;
myMap.ZoomToBoundingBox(bb, edgeBuffer);
See Also