Skip to content

Commit

Permalink
Add main crate level documentation and badges to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximkaaa committed Jan 13, 2024
1 parent c0da3f0 commit a79ad53
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ exclude = [
]

[workspace.package]
version = "0.0.1"
version = "0.1.0-alpha.0"
authors = ["Maxim Gritsenko <maxim@gritsenko.biz>"]
edition = "2021"
repository = "https://github.com/Maximkaaa/galileo"
license = "MIT OR Apache-2.0"
keywords = ["gis", "map", "rendering"]
categories = ["science::geo"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Galileo on Crates.io](https://img.shields.io/crates/v/galileo.svg?color=brightgreen)](https://crates.io/crates/galileo)
[![Documentation](https://img.shields.io/docsrs/galileo/latest.svg)](https://docs.rs/galileo)

**Galileo** is a general purpose cross-platform geo-rendering library.

# Web examples
Expand Down
9 changes: 8 additions & 1 deletion galileo-mvt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ version.workspace = true
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
documentation = "https://docs.rs/galileo-mvt"
description = "Mapbox Vector Tile format reader"
exclude = [
"test-data/*"
]

[features]
default = []
Expand All @@ -12,7 +19,7 @@ generate_proto = []
[dependencies]
bytes = "1.5.0"
prost = "0.12.2"
galileo-types = { path = "../galileo-types" }
galileo-types = { path = "../galileo-types", version = "0.1.0-alpha.0" }
log = "0.4.20"
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
Expand Down
4 changes: 4 additions & 0 deletions galileo-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version.workspace = true
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
documentation = "https://docs.rs/galileo-types"
description = "Trait based geo geometries and algorithms"

[features]
default = ["geo-types"]
Expand Down
13 changes: 11 additions & 2 deletions galileo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ version.workspace = true
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
documentation = "https://docs.rs/galileo"
description = "Cross-platform general purpose map rendering engine"
readme = "../README.md"
exclude = [
"examples",
]

[features]
default = ["wgpu", "tokio", "image", "serde"]
Expand All @@ -20,8 +28,8 @@ winit = { version ="0.29", features = ["rwh_05"] }
log = "0.4"
image = { version = "0.24", default-features = false, features = ["png", "jpeg"], optional = true }
lyon = { version = "1" }
galileo-types = { path = "../galileo-types" }
galileo-mvt = { path = "../galileo-mvt" }
galileo-types = { path = "../galileo-types", version = "0.1.0-alpha.0" }
galileo-mvt = { path = "../galileo-mvt", version = "0.1.0-alpha.0" }
num-traits = "0.2.17"
serde = { version = "1.0", optional = true, features = ["std", "derive"] }
web-time = "0.2"
Expand Down Expand Up @@ -64,6 +72,7 @@ web-sys = { version = "0.3", features = [
]}

[dev-dependencies]
tokio-test = "0.4"
env_logger = "0.10"
serde_json = "1.0"
notify = "6.1"
Expand Down
4 changes: 4 additions & 0 deletions galileo/src/layer/feature_layer/symbol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pub mod contour;
pub mod point;
pub mod polygon;

pub use contour::SimpleContourSymbol;
pub use point::CirclePointSymbol;
pub use polygon::SimplePolygonSymbol;

pub trait Symbol<F, G> {
fn render(
&self,
Expand Down
4 changes: 4 additions & 0 deletions galileo/src/layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub mod raster_tile;
pub mod tile_provider;
pub mod vector_tile_layer;

pub use feature_layer::FeatureLayer;
pub use raster_tile::RasterTileLayer;
pub use vector_tile_layer::VectorTileLayer;

pub trait Layer: MaybeSend + MaybeSync {
fn render(&self, view: &MapView, canvas: &mut dyn Canvas);
fn prepare(&self, view: &MapView, renderer: &Arc<RwLock<dyn Renderer>>);
Expand Down
79 changes: 79 additions & 0 deletions galileo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
//! Galileo is a cross-platform map rendering engine. It supports raster and vector layers, custom and flexible styling,
//! working with different coordinate systems and projects.
//!
//! <div class="warning">This crate is in pre-release alpha stage. Documentation is not complete and some parts do not
//! work yet.</div>
//!
//! # Quick start
//!
//! You can create a simple interactive map with two layers by this code:
//!
//! ```no_run
//! use galileo::{MapBuilder, TileScheme, Color};
//! use galileo::layer::FeatureLayer;
//! use galileo::symbol::CirclePointSymbol;
//! use galileo::galileo_types::latlon;
//! use galileo_types::geo::crs::Crs;
//!
//! # tokio_test::block_on(async {
//! MapBuilder::new()
//! .center(latlon!(37.566, 126.9784))
//! .resolution(TileScheme::web(18).lod_resolution(8).unwrap())
//! .with_raster_tiles(|index| {
//! format!(
//! "https://tile.openstreetmap.org/{}/{}/{}.png",
//! index.z, index.x, index.y
//! )},
//! TileScheme::web(18))
//! .with_layer(FeatureLayer::new(
//! vec![latlon!(37.566, 126.9784)],
//! CirclePointSymbol::new(Color::BLUE, 5.0),
//! Crs::WGS84,
//! ))
//! .build()
//! .await
//! .run();
//! # });
//! ```
//!
//! This will show a map with Open Street Maps base and one blue circle in the center of the map. Map builder takes
//! care of creating a window, setting up GPU context and configuring user interactions to control the map position
//! with mouse or touch.
//!
//! Calling [`.run()`](galileo_map::GalileoMap) starts `winit` event loop, which will run until the user
//! closes the window.
//!
//! Running the map in a dedicated window is quite straightforward, but to integrate Galileo map into your application
//! and interact with it you will need some understanding of what happens under the hood of the [`MapBuilder`].
//!
//! # Main components of Galileo
//!
//! As surprising as it is, everything in a mapping library revolves around
//!
//! * [`Map`](map::Map) struct, which is quite simple by itself and contains only currently displayed
//! [`MapView`](view::MapView), inner state, such as animation parameters, and a set of
//! * [`layers`](layer) that actually contain data and know how it should be displayed. There are different
//! types of layers depending on what kind of data they use (images, vector tiles, geometric features etc) and on
//! their capabilities for transforming that data into what a user wants to see. To render the data layers use
//! * [`renderer`](render), which is responsible for converting primitives into the images the user sees.
//!
//! As you have probably noticed nothing of the above deals with user interactions or events. You can think of the map
//! (with its layers) as a map you hang on your wall. It just shows some geo-data and does nothing else. So if you
//! create a console utility, server or some kind of presentation application, these three would be all you need.
//!
//! In case a user is supposed to interact with the map in your application, you would also need
//!
//! * [`EventProcessor`](control::event_processor::EventProcessor) to convert raw system event into
//! some intermediate representation, more convenient to deal with, and some
//! * [`controls`](control) that actually change state of the map or layers based on the user input.
//!
//!
pub mod async_runtime;
pub mod bounding_box;
pub mod cache;
Expand All @@ -14,3 +85,11 @@ pub mod render;
pub mod tile_scheme;
pub mod view;
pub mod winit;

pub use galileo_map::MapBuilder;
pub use layer::feature_layer::symbol;
pub use primitives::Color;
pub use tile_scheme::TileScheme;

// Reexport galileo_types
pub use galileo_types;

0 comments on commit a79ad53

Please sign in to comment.