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§
Structs§
- Compass
- A widget displaying a compass.
- Coordinate
- A simple object implementing
Location
. - Data
Source - The base class used to retrieve tiles as [
glib::Bytes
][crate::glib::Bytes]. - Data
Source Request - Represents a request to a
DataSource
for a tile. - File
Cache - 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 aMapSource
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. - MapSource
Registry - This object allows you to hold
MapSource
instances, you can access a default set of sources withpopulate_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 aMap
for the markers to show on the map. - Marker
Layer - Displays markers on the map. It is responsible for positioning markers correctly, marker selections and group marker operations.
- Path
Layer - 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. - Raster
Renderer - Properties
- Scale
- A widget displaying a scale.
- Simple
Map - A ready-to-use map [
gtk::Widget
][crate::gtk::Widget].If you want to use your own implementation, you can look at theMap
widget. - Symbol
Event - An object containing the details of a map feature that has been clicked.
It is the argument of the
symbol-clicked
andsymbol-clicked
signals. - Tile
- An object that represents map tiles. Tiles are loaded by a
MapSource
. - Tile
Downloader - A
DataSource
that asynchronously downloads tiles from an online service using a given template. - Vector
Reader - Provides low-level access to the contents of a vector tile.
- Vector
Reader Iter - Reads the layers and features of a vector tile.
- Vector
Renderer - A
MapSource
that renders tiles from a given vector data source. - Vector
Sprite - GLib type: GObject with reference counted clone semantics.
- Vector
Sprite Sheet - A collection of
VectorSprite
s. - Viewport
- The object holding the coordinate, zoom-level, and rotation state of the current view.
Enums§
- File
Cache Error - Error codes in the #SHUMATE_FILE_CACHE_ERROR domain.
- Geometry
Type - A type of geometry.
- MapProjection
- Projections supported by the library.
- State
- Tile loading state.
- Style
Error - Error codes that occurs while parsing the style in
VectorRenderer
. - Tile
Downloader Error - 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