Crate libshumate

Source
Expand description

§Rust Shumate bindings

This library contains safe Rust bindings for Shumate, a library that offers a GTK4 widget to display maps.

See also

§Example

The libshumate crate is usually renamed to shumate. You can do this globally in your Cargo.toml file:

[dependencies.shumate]
package = "libshumate"
version = "0.x.y"
use shumate::prelude::*;

use shumate::{Map};
use gtk::{Application, Box, ListBox, Orientation, ApplicationWindow};

fn main() {
    let application = Application::builder()
        .application_id("com.example.FirstShumateApp")
        .build();

    application.connect_activate(|app| {
        let content = Map::new();

        let window = ApplicationWindow::builder()
            .application(app)
            .default_width(350)
            // add content to window
            .child(&content)
            .build();
        window.show();
    });

    application.run();
}

Re-exports§

pub use ffi;

Modules§

functions
prelude
subclass
Traits intended for creating custom types.

Structs§

Compass
A widget displaying a compass.
Coordinate
A simple object implementing Location.
DataSource
The base class used to retrieve tiles as [glib::Bytes][crate::glib::Bytes].
DataSourceRequest
Represents a request to a DataSource for a tile.
FileCache
A cache that stores and retrieves tiles from the file system. It is mainly used by TileDownloader, but can also be used by custom data sources.
Layer
Every layer (overlay that moves together with the map) has to inherit this class and implement its virtual methods.
License
A widget that displays license text.
Location
An interface common to objects having latitude and longitude
Map
The Map widget is a [gtk::Widget][crate::gtk::Widget] that show and allows interaction with the user.
MapLayer
A Layer implementation that fetches tiles from a MapSource and draws them as a grid.
MapSource
The base class for all map sources. Map sources fill Tile objects with images from various sources: a web API, for example, or a test pattern generated on demand.
MapSourceRegistry
This object allows you to hold MapSource instances, you can access a default set of sources with populate_defaults().
Marker
Markers represent points of interest on a map. Markers need to be placed on a layer (a MarkerLayer). Layers have to be added to a Map for the markers to show on the map.
MarkerLayer
Displays markers on the map. It is responsible for positioning markers correctly, marker selections and group marker operations.
PathLayer
A layer displaying line path between inserted Location objects
Point
A simple variant of Marker showing the location of the point as a circle on the map.
RasterRenderer
Properties
Scale
A widget displaying a scale.
SimpleMap
A ready-to-use map [gtk::Widget][crate::gtk::Widget].If you want to use your own implementation, you can look at the Map widget.
SymbolEvent
An object containing the details of a map feature that has been clicked. It is the argument of the symbol-clicked and symbol-clicked signals.
Tile
An object that represents map tiles. Tiles are loaded by a MapSource.
TileDownloader
A DataSource that asynchronously downloads tiles from an online service using a given template.
VectorReader
Provides low-level access to the contents of a vector tile.
VectorReaderIter
Reads the layers and features of a vector tile.
VectorRenderer
A MapSource that renders tiles from a given vector data source.
VectorSprite
GLib type: GObject with reference counted clone semantics.
VectorSpriteSheet
A collection of VectorSprites.
Viewport
The object holding the coordinate, zoom-level, and rotation state of the current view.

Enums§

FileCacheError
Error codes in the #SHUMATE_FILE_CACHE_ERROR domain.
GeometryType
A type of geometry.
MapProjection
Projections supported by the library.
State
Tile loading state.
StyleError
Error codes that occurs while parsing the style in VectorRenderer.
TileDownloaderError
Error codes in the #SHUMATE_TILE_DOWNLOADER_ERROR domain.
Unit
Units used by the scale.

Constants§

MAX_LATITUDE
The maximal possible latitude value.
MAX_LONGITUDE
The maximal possible longitude value.
MIN_LATITUDE
The minimal possible latitude value.
MIN_LONGITUDE
The minimal possible longitude value.

Statics§

MAP_SOURCE_MFF_RELIEF
Maps for Free Relief
MAP_SOURCE_OSM_CYCLE_MAP
OpenStreetMap Cycle Map
MAP_SOURCE_OSM_MAPNIK
OpenStreetMap Mapnik
MAP_SOURCE_OSM_TRANSPORT_MAP
OpenStreetMap Transport Map
MAP_SOURCE_OWM_CLOUDS
OpenWeatherMap clouds layer
MAP_SOURCE_OWM_PRECIPITATION
OpenWeatherMap precipitation
MAP_SOURCE_OWM_PRESSURE
OpenWeatherMap sea level pressure
MAP_SOURCE_OWM_TEMPERATURE
OpenWeatherMap temperature
MAP_SOURCE_OWM_WIND
OpenWeatherMap wind