## ChamplainBoundingBox ChamplainBoundingBox — A basic struct to describe a bounding box |

## Synopsis

    struct              ChamplainBoundingBox;
    ChamplainBoundingBox * champlain_bounding_box_new       (void);
    ChamplainBoundingBox * champlain_bounding_box_copy      (const ChamplainBoundingBox *bbox);
    void                champlain_bounding_box_free         (ChamplainBoundingBox *bbox);
    void                champlain_bounding_box_get_center   (ChamplainBoundingBox *bbox,
                                                             gdouble *latitude,
                                                             gdouble *longitude);
    void                champlain_bounding_box_compose      (ChamplainBoundingBox *bbox,
                                                             ChamplainBoundingBox *other);
    void                champlain_bounding_box_extend       (ChamplainBoundingBox *bbox,
                                                             gdouble latitude,
                                                             gdouble longitude);
    gboolean            champlain_bounding_box_is_valid     (ChamplainBoundingBox *bbox);
    gboolean            champlain_bounding_box_covers       (ChamplainBoundingBox *bbox,
                                                             gdouble latitude,
                                                             gdouble longitude);

## Object Hierarchy

      GBoxed
       +----ChamplainBoundingBox

## Description

A basic struct to describe a bounding box.

## Details

### struct ChamplainBoundingBox

    struct ChamplainBoundingBox {
      gdouble left;
      gdouble top;
      gdouble right;
      gdouble bottom;
    };

Defines the area of a ChamplainMapDataSource that contains data.

gdouble `left`; | left coordinate
gdouble `top`; | top coordinate
gdouble `right`; | right coordinate
gdouble `bottom`; | bottom coordinate

Since 0.6

### champlain_bounding_box_new ()

    ChamplainBoundingBox * champlain_bounding_box_new       (void);

Creates a newly allocated ChamplainBoundingBox to be freed with `champlain_bounding_box_free()`.

Returns : | a ChamplainBoundingBox

Since 0.6

### champlain_bounding_box_copy ()

    ChamplainBoundingBox * champlain_bounding_box_copy      (const ChamplainBoundingBox *bbox);

Makes a copy of the bounding box structure. The result must be freed using `champlain_bounding_box_free()`.

`bbox` : | a ChamplainBoundingBox
Returns : | an allocated copy of `bbox`.

Since 0.6

### champlain_bounding_box_free ()

    void                champlain_bounding_box_free         (ChamplainBoundingBox *bbox);

Frees a bounding box structure created with `champlain_bounding_box_new()` or `champlain_bounding_box_copy()`.

`bbox` : | a ChamplainBoundingBox

Since 0.6

### champlain_bounding_box_get_center ()

    void                champlain_bounding_box_get_center   (ChamplainBoundingBox *bbox,
                                                             gdouble *latitude,
                                                             gdouble *longitude);

Gets the center's latitude and longitude of the box to `latitude` and `longitude`.

`bbox` : | a ChamplainBoundingBox
`latitude` : | the latitude of the box center. [out]
`longitude` : | the longitude of the box center. [out]

Since 0.6

### champlain_bounding_box_compose ()

    void                champlain_bounding_box_compose      (ChamplainBoundingBox *bbox,
                                                             ChamplainBoundingBox *other);

Sets bbox equal to the bounding box containing both `bbox` and `other`.

`bbox` : | a ChamplainBoundingBox
`other` : | a ChamplainBoundingBox

Since 0.10

### champlain_bounding_box_extend ()

    void                champlain_bounding_box_extend       (ChamplainBoundingBox *bbox,
                                                             gdouble latitude,
                                                             gdouble longitude);

Extend the bounding box so it contains a point with `latitude` and `longitude`. Do nothing if the point is already inside the bounding box.

`bbox` : | a ChamplainBoundingBox
`latitude` : | the latitude of the point
`longitude` : | the longitude of the point

Since 0.10

### champlain_bounding_box_is_valid ()

    gboolean            champlain_bounding_box_is_valid     (ChamplainBoundingBox *bbox);

Checks whether `bbox` represents a valid bounding box on the map.

`bbox` : | a ChamplainBoundingBox
Returns : | TRUE when the bounding box is valid, FALSE otherwise.

Since 0.10

### champlain_bounding_box_covers ()

    gboolean            champlain_bounding_box_covers       (ChamplainBoundingBox *bbox,
                                                             gdouble latitude,
                                                             gdouble longitude);

Checks whether `bbox` covers the given coordinates.

`bbox` : | a ChamplainBoundingBox
`latitude` : | the latitude of the point
`longitude` : | the longitude of the point
Returns : | TRUE when the bounding box covers given coordinates, FALSE otherwise.

Since 0.12.4