Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into coord_zoom_overflow
Browse files Browse the repository at this point in the history
# Conflicts:
#	maplibre/src/coords.rs
  • Loading branch information
terrorfisch committed Apr 23, 2023
2 parents 89a1a57 + 90872eb commit 68618b5
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ runs:
shell: bash
run: just nightly-targets ${{ inputs.targets }}
- uses: Swatinem/rust-cache@v2
# Install just again because Swatinem/rust-cache might removed it while restoring the cache
# Install just again because Swatinem/rust-cache might remove it while restoring the cache
- name: Install just
uses: ./.github/actions/cargo-install
with:
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<h1 align="center">
<h1 style="text-align:center">
<img width="350px" alt="maplibre-rs" src="./docs/logo/maplibre-rs-with-text.svg">
</h1>

<div align="center">
<div style="text-align:center">
<strong>Native Maps for Web, Mobile and Linux</strong>
</div>
<div align="center">
<div style="text-align:center">
A map rendering library written in Rust.
</div>

<div align="center">
<div style="text-align:center">
<img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square"
alt="Stability" />
<a href="https://github.com/maplibre/maplibre-rs/actions/workflows/on_main_push.yml">
Expand All @@ -22,18 +22,17 @@
</a>
</div>

<div align="center">
<div style="text-align:center">
<h3>
<a href="https://webgl.demo.maplibre-rs.maplibre.org">
WebGL Demo
</a>
<span> | </span>
</a> |
<a href="https://maplibre.org/maplibre-rs/docs/book/">
Book
</a> | </span>
</a> |
<a href="https://maplibre.org/maplibre-rs/docs/api/maplibre/">
API
</a> | </span>
</a> |
<a href="https://matrix.to/#/#maplibre:matrix.org">
Chat in Matrix Space
</a>
Expand Down
1 change: 0 additions & 1 deletion android/gradle/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ gradle-app.setting
.classpath

*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
Expand Down
4 changes: 2 additions & 2 deletions docs/src/development-documents/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Instead, caching functionality of HTTP client libraries of the web platform are
honor HTTP headers which configure caching. This is very important for fetched tiles, as they can have an expiry date.

* On the web the browser is automatically caching raw tiles.
* On Linux, MacOs, iOS and Android we are
* On Linux, macOS, iOS and Android we are
utilizing [reqwest-middleware-cache](https://crates.io/crates/reqwest-middleware-cache/), which writes raw network
requests to disk.
requests to disk.
6 changes: 3 additions & 3 deletions docs/src/development-documents/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
## Domain Model

<div style="overflow: hidden; border-style: solid; width: 110%">
<img src="./figures/domain-model.drawio.svg" class="diagram" />
<img src="./figures/domain-model.drawio.svg" class="diagram" alt="diagram" />
</div>

## Data Model

<div style="overflow: hidden; border-style: solid; width: 110%">
<img src="./figures/data-model.drawio.svg" class="diagram" />
<img src="./figures/data-model.drawio.svg" class="diagram" alt="diagram" />
</div>

## Crate and Project Structure

<div style="overflow: hidden; border-style: solid; width: 110%">
<img src="./figures/crate-and-projects-structure.drawio.svg" class="diagram" />
<img src="./figures/crate-and-projects-structure.drawio.svg" class="diagram" alt="diagram" />
</div>

<script>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/development-documents/library-packaging/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Both assets could be inlined theoretically. This is common for WebWorkers, but n

### UMD

> UMD modules are needed when creating a library which should run in Node as well as browsers. This is not a usecase
> UMD modules are needed when creating a library which should run in Node as well as browsers. This is not a use case
> for maplibre-rs. If we support node, then we probably would ship a separate package called "maplibre-rs-node" which
> bundles to CJS directly.
Expand Down
26 changes: 13 additions & 13 deletions docs/src/development-guide/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Unfortunately, the Tracy project does not use semantic versioning, whereas traci

The current version of the Rust client is at v0.8.1 of Tracy. See the correlating versions in the table below (original at https://github.com/nagisa/rust_tracy_client#version-support-table):

| Tracy | tracy-client-sys | tracy-client | tracing-tracy |
| ----- | ---------------- | ------------ | ------------- |
| 0.7.1 | 0.9.0 | 0.8.0 | 0.2.0 |
| 0.7.3 | 0.10.0 | 0.9.0 | 0.3.0 |
| 0.7.4 | 0.11.0 | 0.10.0 | 0.4.0 |
| 0.7.5 | 0.12.0 | 0.11.0 | 0.5.0 |
| 0.7.6 | 0.13.0, 0.14.0 | 0.12.* | 0.6.* |
| v0.7.7 | 0.15.0 | 0.12.* | 0.6.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.6.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.7.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.8.* |
| v0.8.1 | 0.17.* | 0.13.* | 0.9.* |
| v0.8.1 | 0.17.* | 0.14.* | 0.10.* |
| Tracy | tracy-client-sys | tracy-client | tracing-tracy |
|--------|------------------|--------------|---------------|
| 0.7.1 | 0.9.0 | 0.8.0 | 0.2.0 |
| 0.7.3 | 0.10.0 | 0.9.0 | 0.3.0 |
| 0.7.4 | 0.11.0 | 0.10.0 | 0.4.0 |
| 0.7.5 | 0.12.0 | 0.11.0 | 0.5.0 |
| 0.7.6 | 0.13.0, 0.14.0 | 0.12.* | 0.6.* |
| v0.7.7 | 0.15.0 | 0.12.* | 0.6.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.6.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.7.* |
| v0.7.8 | 0.16.0 | 0.12.* | 0.8.* |
| v0.8.1 | 0.17.* | 0.13.* | 0.9.* |
| v0.8.1 | 0.17.* | 0.14.* | 0.10.* |
20 changes: 10 additions & 10 deletions docs/src/development-guide/how-to-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ During development, you will want to run the maplibre demos on your local machin
There are multiple demos of maplibre-rs for different targets. Some targets have prerequisites
depending on your operating system.

* **maplibre-demo** - targets Windows, MacOS and Linux, it is built directly with cargo.
* **apple** - targets iOS and MacOS and relies on the xcode IDE.
* **maplibre-demo** - targets Windows, macOS and Linux, it is built directly with cargo.
* **apple** - targets iOS and macOS and relies on the xcode IDE.
* **android** - targets Android devices and builds in Android Studio.
* **web** - targets the web using a WASM binary.
* **maplibre-headless** - *TBD*
Expand All @@ -17,7 +17,7 @@ All the targets below require you to install [rustup](https://rustup.rs/) to man
## Maplibre-demo

### Linux/MacOS
### Linux/macOS

The build for desktop is very simple, you just have to run the following command from the root of the
maplibre-rs project:
Expand Down Expand Up @@ -63,10 +63,10 @@ ANDROID STUDIO -> tools -> SDK manager -> SDK tools -> tick show package details
```

Open the project within `./android/gradle` and create a new virtual device with the device manager. Minimum SDK version
should be 21. This was tested on a x86_64 emulator. Finally, run the demo configuration. It should open your virtual device and
should be 21. This was tested on an x86_64 emulator. Finally, run the demo configuration. It should open your virtual device and
run the maplibre-rs Android demo on it. Alternatively you can also run it on your own Android device.

> Note: If you are building for a x86 Android device, you probably need to install the following target using
> Note: If you are building for an x86 Android device, you probably need to install the following target using
> rustup with the following command `rustup target add i686-linux-android`.
> Note: Android is configured to support OpenGL ES 3.1 (This API specification is supported by Android 5.0 (API level 21) and higher).
Expand All @@ -89,15 +89,15 @@ Version 9 is the minimum version supported theoretically.

Select the scheme called *example (iOS)* and click on run. This will start the iOS application.

### MacOS
### macOS

As you might have seen in the maplibre-demo section, you can build Unix executables directly with Cargo.
In order to build a proper MacOS application (in OSX terminology) you have to use the `./apple/xcode` project.
In order to build a proper macOS application (in OSX terminology) you have to use the `./apple/xcode` project.

Open the project from the folder `./apple/xcode` with XCode. Select the scheme called *example (macOS)* and
click on run. This will start the MacOS application.
click on run. This will start the macOS application.

> The minimum target OSX version for the MacOS build is defined inside *Build settings -> Deployment -> MacOS deployment target*.
> The minimum target OSX version for the macOS build is defined inside *Build settings -> Deployment -> macOS deployment target*.
> If you are using a lower version of OSX, you will not be able to run the application on your computer.
## Web (WebGL, WebGPU)
Expand All @@ -123,7 +123,7 @@ just web-lib build --webgl # WebGL
just web-lib build --webgl --multithreaded # WebGL + multithreaded
```

Instead of building it is also possible to watch for changes. The same flags like with `web-lib build` are supported:
Instead of building it is also possible to watch for changes. The same flags as with `web-lib build` are supported:

```bash
just web-lib watch --webgl
Expand Down
4 changes: 2 additions & 2 deletions docs/src/rfc/0000-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Why are we doing this? What use cases does it support? What is the expected outc

[guide-level-explanation]: #guide-level-explanation

Explain the proposal as if it was already included in the project and you were teaching it to another maplibre-rs user.
Explain the proposal as if it was already included in the project, and you were teaching it to another maplibre-rs user.
That generally means:

- Introducing new named concepts.
- Explaining the feature largely in terms of examples.
- Explaining how maplibre-rs users should *think* about the feature, and how it should impact the way they use
maplibre-rs. It should explain the impact as concretely as possible.
- If applicable, provide sample error messages, deprecation warnings, or migration guidance.
- If applicable, describe the differences between teaching this to existing maplibre-rs users and new maplibre-rs users.
- If applicable, describe the differences between teaching this to the existing maplibre-rs users and new maplibre-rs users.

For implementation-oriented RFCs (e.g. for internals), this section should focus on how maplibre-rs contributors should
think about the change, and give examples of its concrete impact. For policy RFCs, this section should provide an
Expand Down
4 changes: 2 additions & 2 deletions docs/src/rfc/0001-rfc-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ makes it through the entire process to implementation is considered
Retain the current informal RFC process. The newly proposed RFC process is
designed to improve over the informal process in the following ways:

* Discourage unactionable or vague RFCs
* Discourage non-actionable or vague RFCs
* Ensure that all serious RFCs are considered equally
* Give confidence to those with a stake in maplibre-rs's development that they
* Give confidence to those with a stake in maplibre-rs development that they
understand why new features are being merged

As an alternative, we could adopt an even stricter RFC process than the one proposed here.
Expand Down
7 changes: 3 additions & 4 deletions maplibre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ cgmath = "0.18.0"
geo = "0.23.1"
geo-types = { version = "0.7.6", features = ["use-rstar_0_9"] }
rstar = "0.9.3"
geozero = { version = "0.9.7", default-features = false, features = ["with-mvt", "with-geo"] }
geozero = { version = "0.9.8", default-features = false, features = ["with-mvt", "with-geo"] }
tile-grid = "0.3.0"

# Rendering
#wgpu = "0.15.0"
wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "cfc038aeb9b732019dc03fa7eeaac1c7f37fc71f" }
# wgpu = { git = "https://github.com/gfx-rs/wgpu" }
wgpu = "0.16.0"
#wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "" }
lyon = { version = "1.0.0", features = [] }
raw-window-handle = "0.5.0"

Expand Down
4 changes: 2 additions & 2 deletions maplibre/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ fn embed_tiles_statically() {

/// Tiles which can be used by StaticTileFetcher.
fn clean_static_tiles() -> std::path::PathBuf {
let out_dir = std::env::var("OUT_DIR").unwrap();
let out_dir = env::var("OUT_DIR").unwrap();

let out = std::path::Path::new(&out_dir).join("extracted-tiles");
let out = Path::new(&out_dir).join("extracted-tiles");

if out.exists() && out.is_dir() {
std::fs::remove_dir_all(&out).unwrap()
Expand Down
29 changes: 14 additions & 15 deletions maplibre/src/coords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Quadkey {
}

impl fmt::Debug for Quadkey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let zoom_level = self.zoom_level;
let [x, y]: [u32; 2] = morton_encoding::morton_decode(self.encoded_coords);

Expand Down Expand Up @@ -120,8 +120,8 @@ impl ZoomLevel {
}
}

impl fmt::Display for ZoomLevel {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl Display for ZoomLevel {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
Expand Down Expand Up @@ -184,8 +184,8 @@ impl Default for Zoom {
}
}

impl fmt::Display for Zoom {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl Display for Zoom {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", (self.0 * 100.0).round() / 100.0)
}
}
Expand Down Expand Up @@ -233,8 +233,7 @@ impl SignificantlyDifferent for Zoom {
}

/// Within each tile there is a separate coordinate system. Usually this coordinate system is
/// within [`crate::coords::EXTENT`]. Therefore, `x` and `y` must be within the bounds of
/// [`crate::coords::EXTENT`].
/// within [`EXTENT`]. Therefore, `x` and `y` must be within the bounds of [`EXTENT`].
///
/// # Coordinate System Origin
///
Expand All @@ -246,7 +245,7 @@ pub struct InnerCoords {
}

/// Every tile has tile coordinates. These tile coordinates are also called
/// [Slippy map tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).
/// [Slippy map tile names](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).
///
/// # Coordinate System Origin
///
Expand Down Expand Up @@ -304,7 +303,7 @@ impl From<(u32, u32, ZoomLevel)> for TileCoords {

/// Every tile has tile coordinates. Every tile coordinate can be mapped to a coordinate within
/// the world. This provides the freedom to map from [TMS](https://wiki.openstreetmap.org/wiki/TMS)
/// to [Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).
/// to [Slippy map tile names](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).
///
/// # Coordinate System Origin
///
Expand Down Expand Up @@ -640,8 +639,8 @@ impl ViewRegion {
}
}

impl fmt::Display for TileCoords {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl Display for TileCoords {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(
f,
"T(x={x},y={y},z={z})",
Expand All @@ -652,8 +651,8 @@ impl fmt::Display for TileCoords {
}
}

impl fmt::Display for WorldTileCoords {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl Display for WorldTileCoords {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(
f,
"WT(x={x},y={y},z={z})",
Expand All @@ -663,8 +662,8 @@ impl fmt::Display for WorldTileCoords {
)
}
}
impl fmt::Display for WorldCoords {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl Display for WorldCoords {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "W(x={x},y={y})", x = self.x, y = self.y,)
}
}
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/io/geometry_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub enum TileIndex {

impl TileIndex {
pub fn point_query(&self, inner_coords: InnerCoords) -> Vec<&IndexedGeometry<f64>> {
let point = geo_types::Point::new(inner_coords.x, inner_coords.y);
let point = Point::new(inner_coords.x, inner_coords.y);
let coordinate: Coord<_> = point.into();

// FIXME: Respect layer order of style
Expand Down
6 changes: 3 additions & 3 deletions maplibre/src/io/static_tile_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ impl StaticTileFetcher {

#[cfg(test)]
mod tests {
use super::StaticTileFetcher;
use crate::{coords::WorldTileCoords, style::source::TileAddressingScheme};

#[cfg(static_tiles_found)]
#[tokio::test]
async fn test_tiles_available() {
use super::StaticTileFetcher;
use crate::{coords::WorldTileCoords, style::source::TileAddressingScheme};

const MUNICH_X: i32 = 17425;
const MUNICH_Y: i32 = 11365;
const MUNICH_Z: u8 = 15;
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! Maplibre-rs is a map renderer that can run natively on MacOS, Linux, Windows, Android, iOS and the web.
//! It takes advantage of Lyon to tessellate vector tiles and WebGPU to display them efficiently.
//! Maplibre-rs also has an headless mode (*work in progress*) that can generate rasters.
//! Maplibre-rs also has an headless mode (*work in progress*) that can generate raster images.
//!
//! The official guide book can be found [here](https://maplibre.org/maplibre-rs/docs/book/).
//!
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
renderer,
});
}
InitializationResult::Uninizalized(UninitializedRenderer { .. }) => {}
InitializationResult::Uninitialized(UninitializedRenderer { .. }) => {}
_ => panic!("Rendering context gone"),
};
Ok(())
Expand Down
Loading

0 comments on commit 68618b5

Please sign in to comment.