libchamplain Reference Manual: ChamplainBoundingBox

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

## Functions

ChamplainBoundingBox * | champlain_bounding_box_new ()
ChamplainBoundingBox * | champlain_bounding_box_copy ()
void | champlain_bounding_box_free ()
void | champlain_bounding_box_get_center ()
void | champlain_bounding_box_compose ()
void | champlain_bounding_box_extend ()
gboolean | champlain_bounding_box_is_valid ()
gboolean | champlain_bounding_box_covers ()

## Types and Values

struct | ChamplainBoundingBox

## Object Hierarchy

        GBoxed
        ╰── ChamplainBoundingBox

## Description

A basic struct to describe a bounding box.

## Functions

### 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()`.

#### Parameters

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()`.

#### Parameters

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` .

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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

## Types and Values

### struct ChamplainBoundingBox

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

Defines the area of a ChamplainMapDataSource that contains data.

#### Members

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

Since 0.6