mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Spell fixes, possibly breaking "Uninizalized" rename (#271)
* Spell fixes, possibly breaking "Uninizalized" rename A few minor tweaks, including `InitializationResult` enum and `unwarp_renderer` spelling fixes --------- Co-authored-by: Max Ammann <max@maxammann.org>
This commit is contained in:
parent
7d1fb6e663
commit
c7f93b10b7
2
.github/actions/setup/action.yml
vendored
2
.github/actions/setup/action.yml
vendored
@ -49,7 +49,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: just nightly-targets ${{ inputs.targets }}
|
run: just nightly-targets ${{ inputs.targets }}
|
||||||
- uses: Swatinem/rust-cache@v2
|
- 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
|
- name: Install just
|
||||||
uses: ./.github/actions/cargo-install
|
uses: ./.github/actions/cargo-install
|
||||||
with:
|
with:
|
||||||
|
|||||||
17
README.md
17
README.md
@ -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">
|
<img width="350px" alt="maplibre-rs" src="./docs/logo/maplibre-rs-with-text.svg">
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div align="center">
|
<div style="text-align:center">
|
||||||
<strong>Native Maps for Web, Mobile and Linux</strong>
|
<strong>Native Maps for Web, Mobile and Linux</strong>
|
||||||
</div>
|
</div>
|
||||||
<div align="center">
|
<div style="text-align:center">
|
||||||
A map rendering library written in Rust.
|
A map rendering library written in Rust.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div align="center">
|
<div style="text-align:center">
|
||||||
<img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square"
|
<img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square"
|
||||||
alt="Stability" />
|
alt="Stability" />
|
||||||
<a href="https://github.com/maplibre/maplibre-rs/actions/workflows/on_main_push.yml">
|
<a href="https://github.com/maplibre/maplibre-rs/actions/workflows/on_main_push.yml">
|
||||||
@ -22,18 +22,17 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div align="center">
|
<div style="text-align:center">
|
||||||
<h3>
|
<h3>
|
||||||
<a href="https://webgl.demo.maplibre-rs.maplibre.org">
|
<a href="https://webgl.demo.maplibre-rs.maplibre.org">
|
||||||
WebGL Demo
|
WebGL Demo
|
||||||
</a>
|
</a> |
|
||||||
<span> | </span>
|
|
||||||
<a href="https://maplibre.org/maplibre-rs/docs/book/">
|
<a href="https://maplibre.org/maplibre-rs/docs/book/">
|
||||||
Book
|
Book
|
||||||
</a> | </span>
|
</a> |
|
||||||
<a href="https://maplibre.org/maplibre-rs/docs/api/maplibre/">
|
<a href="https://maplibre.org/maplibre-rs/docs/api/maplibre/">
|
||||||
API
|
API
|
||||||
</a> | </span>
|
</a> |
|
||||||
<a href="https://matrix.to/#/#maplibre:matrix.org">
|
<a href="https://matrix.to/#/#maplibre:matrix.org">
|
||||||
Chat in Matrix Space
|
Chat in Matrix Space
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
1
android/gradle/.gitignore
vendored
1
android/gradle/.gitignore
vendored
@ -21,7 +21,6 @@ gradle-app.setting
|
|||||||
.classpath
|
.classpath
|
||||||
|
|
||||||
*.iml
|
*.iml
|
||||||
.gradle
|
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/caches
|
||||||
/.idea/libraries
|
/.idea/libraries
|
||||||
|
|||||||
@ -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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# 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
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
|
|||||||
@ -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.
|
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 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
|
utilizing [reqwest-middleware-cache](https://crates.io/crates/reqwest-middleware-cache/), which writes raw network
|
||||||
requests to disk.
|
requests to disk.
|
||||||
|
|||||||
@ -5,19 +5,19 @@
|
|||||||
## Domain Model
|
## Domain Model
|
||||||
|
|
||||||
<div style="overflow: hidden; border-style: solid; width: 110%">
|
<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>
|
</div>
|
||||||
|
|
||||||
## Data Model
|
## Data Model
|
||||||
|
|
||||||
<div style="overflow: hidden; border-style: solid; width: 110%">
|
<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>
|
</div>
|
||||||
|
|
||||||
## Crate and Project Structure
|
## Crate and Project Structure
|
||||||
|
|
||||||
<div style="overflow: hidden; border-style: solid; width: 110%">
|
<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>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Both assets could be inlined theoretically. This is common for WebWorkers, but n
|
|||||||
|
|
||||||
### UMD
|
### 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
|
> for maplibre-rs. If we support node, then we probably would ship a separate package called "maplibre-rs-node" which
|
||||||
> bundles to CJS directly.
|
> bundles to CJS directly.
|
||||||
|
|
||||||
|
|||||||
@ -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):
|
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 |
|
| Tracy | tracy-client-sys | tracy-client | tracing-tracy |
|
||||||
| ----- | ---------------- | ------------ | ------------- |
|
|--------|------------------|--------------|---------------|
|
||||||
| 0.7.1 | 0.9.0 | 0.8.0 | 0.2.0 |
|
| 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.3 | 0.10.0 | 0.9.0 | 0.3.0 |
|
||||||
| 0.7.4 | 0.11.0 | 0.10.0 | 0.4.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.5 | 0.12.0 | 0.11.0 | 0.5.0 |
|
||||||
| 0.7.6 | 0.13.0, 0.14.0 | 0.12.* | 0.6.* |
|
| 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.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.6.* |
|
||||||
| v0.7.8 | 0.16.0 | 0.12.* | 0.7.* |
|
| v0.7.8 | 0.16.0 | 0.12.* | 0.7.* |
|
||||||
| v0.7.8 | 0.16.0 | 0.12.* | 0.8.* |
|
| 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.13.* | 0.9.* |
|
||||||
| v0.8.1 | 0.17.* | 0.14.* | 0.10.* |
|
| v0.8.1 | 0.17.* | 0.14.* | 0.10.* |
|
||||||
|
|||||||
@ -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
|
There are multiple demos of maplibre-rs for different targets. Some targets have prerequisites
|
||||||
depending on your operating system.
|
depending on your operating system.
|
||||||
|
|
||||||
* **maplibre-demo** - targets Windows, MacOS and Linux, it is built directly with cargo.
|
* **maplibre-demo** - targets Windows, macOS and Linux, it is built directly with cargo.
|
||||||
* **apple** - targets iOS and MacOS and relies on the xcode IDE.
|
* **apple** - targets iOS and macOS and relies on the xcode IDE.
|
||||||
* **android** - targets Android devices and builds in Android Studio.
|
* **android** - targets Android devices and builds in Android Studio.
|
||||||
* **web** - targets the web using a WASM binary.
|
* **web** - targets the web using a WASM binary.
|
||||||
* **maplibre-headless** - *TBD*
|
* **maplibre-headless** - *TBD*
|
||||||
@ -17,7 +17,7 @@ All the targets below require you to install [rustup](https://rustup.rs/) to man
|
|||||||
|
|
||||||
## Maplibre-demo
|
## 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
|
The build for desktop is very simple, you just have to run the following command from the root of the
|
||||||
maplibre-rs project:
|
maplibre-rs project:
|
||||||
@ -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
|
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.
|
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`.
|
> 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).
|
> Note: Android is configured to support OpenGL ES 3.1 (This API specification is supported by Android 5.0 (API level 21) and higher).
|
||||||
@ -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.
|
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.
|
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
|
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.
|
> If you are using a lower version of OSX, you will not be able to run the application on your computer.
|
||||||
|
|
||||||
## Web (WebGL, WebGPU)
|
## Web (WebGL, WebGPU)
|
||||||
@ -123,7 +123,7 @@ just web-lib build --webgl # WebGL
|
|||||||
just web-lib build --webgl --multithreaded # WebGL + multithreaded
|
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
|
```bash
|
||||||
just web-lib watch --webgl
|
just web-lib watch --webgl
|
||||||
|
|||||||
@ -19,7 +19,7 @@ Why are we doing this? What use cases does it support? What is the expected outc
|
|||||||
|
|
||||||
[guide-level-explanation]: #guide-level-explanation
|
[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:
|
That generally means:
|
||||||
|
|
||||||
- Introducing new named concepts.
|
- Introducing new named concepts.
|
||||||
@ -27,7 +27,7 @@ That generally means:
|
|||||||
- Explaining how maplibre-rs users should *think* about the feature, and how it should impact the way they use
|
- 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.
|
maplibre-rs. It should explain the impact as concretely as possible.
|
||||||
- If applicable, provide sample error messages, deprecation warnings, or migration guidance.
|
- 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
|
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
|
think about the change, and give examples of its concrete impact. For policy RFCs, this section should provide an
|
||||||
|
|||||||
@ -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
|
Retain the current informal RFC process. The newly proposed RFC process is
|
||||||
designed to improve over the informal process in the following ways:
|
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
|
* 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
|
understand why new features are being merged
|
||||||
|
|
||||||
As an alternative, we could adopt an even stricter RFC process than the one proposed here.
|
As an alternative, we could adopt an even stricter RFC process than the one proposed here.
|
||||||
|
|||||||
@ -51,7 +51,7 @@ cgmath = "0.18.0"
|
|||||||
geo = "0.23.1"
|
geo = "0.23.1"
|
||||||
geo-types = { version = "0.7.6", features = ["use-rstar_0_9"] }
|
geo-types = { version = "0.7.6", features = ["use-rstar_0_9"] }
|
||||||
rstar = "0.9.3"
|
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"
|
tile-grid = "0.3.0"
|
||||||
|
|
||||||
# Rendering
|
# Rendering
|
||||||
|
|||||||
@ -17,9 +17,9 @@ fn embed_tiles_statically() {
|
|||||||
|
|
||||||
/// Tiles which can be used by StaticTileFetcher.
|
/// Tiles which can be used by StaticTileFetcher.
|
||||||
fn clean_static_tiles() -> std::path::PathBuf {
|
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() {
|
if out.exists() && out.is_dir() {
|
||||||
std::fs::remove_dir_all(&out).unwrap()
|
std::fs::remove_dir_all(&out).unwrap()
|
||||||
|
|||||||
@ -58,7 +58,7 @@ impl Quadkey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Quadkey {
|
impl fmt::Debug for Quadkey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
let key = self.0;
|
let key = self.0;
|
||||||
let ZoomLevel(level) = key[0];
|
let ZoomLevel(level) = key[0];
|
||||||
let len = level as usize;
|
let len = level as usize;
|
||||||
@ -115,8 +115,8 @@ impl std::ops::Sub<u8> for ZoomLevel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ZoomLevel {
|
impl Display for ZoomLevel {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}", self.0)
|
write!(f, "{}", self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,8 +186,8 @@ impl Default for Zoom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Zoom {
|
impl Display for Zoom {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}", (self.0 * 100.0).round() / 100.0)
|
write!(f, "{}", (self.0 * 100.0).round() / 100.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,8 +235,7 @@ impl SignificantlyDifferent for Zoom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Within each tile there is a separate coordinate system. Usually this coordinate system is
|
/// 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
|
/// within [`EXTENT`]. Therefore, `x` and `y` must be within the bounds of [`EXTENT`].
|
||||||
/// [`crate::coords::EXTENT`].
|
|
||||||
///
|
///
|
||||||
/// # Coordinate System Origin
|
/// # Coordinate System Origin
|
||||||
///
|
///
|
||||||
@ -248,7 +247,7 @@ pub struct InnerCoords {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Every tile has tile coordinates. These tile coordinates are also called
|
/// 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
|
/// # Coordinate System Origin
|
||||||
///
|
///
|
||||||
@ -302,7 +301,7 @@ impl From<(u32, u32, ZoomLevel)> for TileCoords {
|
|||||||
|
|
||||||
/// Every tile has tile coordinates. Every tile coordinate can be mapped to a coordinate within
|
/// 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)
|
/// 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
|
/// # Coordinate System Origin
|
||||||
///
|
///
|
||||||
@ -654,8 +653,8 @@ impl ViewRegion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for TileCoords {
|
impl Display for TileCoords {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"T(x={x},y={y},z={z})",
|
"T(x={x},y={y},z={z})",
|
||||||
@ -666,8 +665,8 @@ impl fmt::Display for TileCoords {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for WorldTileCoords {
|
impl Display for WorldTileCoords {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"WT(x={x},y={y},z={z})",
|
"WT(x={x},y={y},z={z})",
|
||||||
@ -677,8 +676,8 @@ impl fmt::Display for WorldTileCoords {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl fmt::Display for WorldCoords {
|
impl Display for WorldCoords {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "W(x={x},y={y})", x = self.x, y = self.y,)
|
write!(f, "W(x={x},y={y})", x = self.x, y = self.y,)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ pub enum TileIndex {
|
|||||||
|
|
||||||
impl TileIndex {
|
impl TileIndex {
|
||||||
pub fn point_query(&self, inner_coords: InnerCoords) -> Vec<&IndexedGeometry<f64>> {
|
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();
|
let coordinate: Coord<_> = point.into();
|
||||||
|
|
||||||
// FIXME: Respect layer order of style
|
// FIXME: Respect layer order of style
|
||||||
|
|||||||
@ -66,12 +66,12 @@ impl StaticTileFetcher {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::StaticTileFetcher;
|
|
||||||
use crate::{coords::WorldTileCoords, style::source::TileAddressingScheme};
|
|
||||||
|
|
||||||
#[cfg(static_tiles_found)]
|
#[cfg(static_tiles_found)]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_tiles_available() {
|
async fn test_tiles_available() {
|
||||||
|
use super::StaticTileFetcher;
|
||||||
|
use crate::{coords::WorldTileCoords, style::source::TileAddressingScheme};
|
||||||
|
|
||||||
const MUNICH_X: i32 = 17425;
|
const MUNICH_X: i32 = 17425;
|
||||||
const MUNICH_Y: i32 = 11365;
|
const MUNICH_Y: i32 = 11365;
|
||||||
const MUNICH_Z: u8 = 15;
|
const MUNICH_Z: u8 = 15;
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Maplibre-rs is a map renderer that can run natively on MacOS, Linux, Windows, Android, iOS and the web.
|
//! 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.
|
//! 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/).
|
//! The official guide book can be found [here](https://maplibre.org/maplibre-rs/docs/book/).
|
||||||
//!
|
//!
|
||||||
|
|||||||
@ -127,7 +127,7 @@ where
|
|||||||
renderer,
|
renderer,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
InitializationResult::Uninizalized(UninitializedRenderer { .. }) => {}
|
InitializationResult::Uninitialized(UninitializedRenderer { .. }) => {}
|
||||||
_ => panic!("Rendering context gone"),
|
_ => panic!("Rendering context gone"),
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -47,7 +47,7 @@ impl Default for RendererBuilder {
|
|||||||
|
|
||||||
pub enum InitializationResult {
|
pub enum InitializationResult {
|
||||||
Initialized(InitializedRenderer),
|
Initialized(InitializedRenderer),
|
||||||
Uninizalized(UninitializedRenderer),
|
Uninitialized(UninitializedRenderer),
|
||||||
Gone,
|
Gone,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +58,10 @@ impl Default for InitializationResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl InitializationResult {
|
impl InitializationResult {
|
||||||
pub fn unwarp_renderer(self) -> InitializedRenderer {
|
pub fn unwrap_renderer(self) -> InitializedRenderer {
|
||||||
match self {
|
match self {
|
||||||
InitializationResult::Initialized(renderer) => renderer,
|
InitializationResult::Initialized(renderer) => renderer,
|
||||||
InitializationResult::Uninizalized(_) => panic!("Renderer is not initialized"),
|
InitializationResult::Uninitialized(_) => panic!("Renderer is not initialized"),
|
||||||
InitializationResult::Gone => panic!("Initialization context is gone"),
|
InitializationResult::Gone => panic!("Initialization context is gone"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ impl InitializationResult {
|
|||||||
InitializationResult::Initialized(InitializedRenderer { renderer, .. }) => {
|
InitializationResult::Initialized(InitializedRenderer { renderer, .. }) => {
|
||||||
Some(renderer)
|
Some(renderer)
|
||||||
}
|
}
|
||||||
InitializationResult::Uninizalized(_) => None,
|
InitializationResult::Uninitialized(_) => None,
|
||||||
InitializationResult::Gone => panic!("Initialization context is gone"),
|
InitializationResult::Gone => panic!("Initialization context is gone"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,8 @@ const MAX_PITCH: Rad<f64> = Rad(0.5);
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Camera {
|
pub struct Camera {
|
||||||
position: Point3<f64>, // The z axis never changes, the zoom is used instead
|
position: Point3<f64>, // The z axis never changes, the zoom is used instead
|
||||||
yaw: cgmath::Rad<f64>,
|
yaw: Rad<f64>,
|
||||||
pitch: cgmath::Rad<f64>,
|
pitch: Rad<f64>,
|
||||||
|
|
||||||
width: f64,
|
width: f64,
|
||||||
height: f64,
|
height: f64,
|
||||||
@ -124,7 +124,7 @@ impl Camera {
|
|||||||
ViewProjection(FLIP_Y * perspective.current_projection * self.calc_matrix())
|
ViewProjection(FLIP_Y * perspective.current_projection * self.calc_matrix())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A transform which can be used to transfrom between clip and window space.
|
/// A transform which can be used to transform between clip and window space.
|
||||||
/// Adopted from [here](https://docs.microsoft.com/en-us/windows/win32/direct3d9/viewports-and-clipping#viewport-rectangle) (Direct3D).
|
/// Adopted from [here](https://docs.microsoft.com/en-us/windows/win32/direct3d9/viewports-and-clipping#viewport-rectangle) (Direct3D).
|
||||||
fn clip_to_window_transform(&self) -> Matrix4<f64> {
|
fn clip_to_window_transform(&self) -> Matrix4<f64> {
|
||||||
let min_depth = 0.0;
|
let min_depth = 0.0;
|
||||||
@ -355,7 +355,7 @@ impl Camera {
|
|||||||
self.position
|
self.position
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn yaw(&self) -> cgmath::Rad<f64> {
|
pub fn yaw(&self) -> Rad<f64> {
|
||||||
self.yaw
|
self.yaw
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ impl Camera {
|
|||||||
self.yaw += delta.into();
|
self.yaw += delta.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pitch(&self) -> cgmath::Rad<f64> {
|
pub fn pitch(&self) -> Rad<f64> {
|
||||||
self.pitch
|
self.pitch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -659,28 +659,33 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert!(input_nodes("A", &graph).is_empty(), "A has no inputs");
|
assert!(input_nodes("A", &graph).is_empty(), "A has no inputs");
|
||||||
assert!(
|
assert_eq!(
|
||||||
output_nodes("A", &graph) == HashSet::from_iter(vec![c_id]),
|
output_nodes("A", &graph),
|
||||||
|
HashSet::from_iter(vec![c_id]),
|
||||||
"A outputs to C"
|
"A outputs to C"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(input_nodes("B", &graph).is_empty(), "B has no inputs");
|
assert!(input_nodes("B", &graph).is_empty(), "B has no inputs");
|
||||||
assert!(
|
assert_eq!(
|
||||||
output_nodes("B", &graph) == HashSet::from_iter(vec![c_id]),
|
output_nodes("B", &graph),
|
||||||
|
HashSet::from_iter(vec![c_id]),
|
||||||
"B outputs to C"
|
"B outputs to C"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(
|
assert_eq!(
|
||||||
input_nodes("C", &graph) == HashSet::from_iter(vec![a_id, b_id]),
|
input_nodes("C", &graph),
|
||||||
|
HashSet::from_iter(vec![a_id, b_id]),
|
||||||
"A and B input to C"
|
"A and B input to C"
|
||||||
);
|
);
|
||||||
assert!(
|
assert_eq!(
|
||||||
output_nodes("C", &graph) == HashSet::from_iter(vec![d_id]),
|
output_nodes("C", &graph),
|
||||||
|
HashSet::from_iter(vec![d_id]),
|
||||||
"C outputs to D"
|
"C outputs to D"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(
|
assert_eq!(
|
||||||
input_nodes("D", &graph) == HashSet::from_iter(vec![c_id]),
|
input_nodes("D", &graph),
|
||||||
|
HashSet::from_iter(vec![c_id]),
|
||||||
"C inputs to D"
|
"C inputs to D"
|
||||||
);
|
);
|
||||||
assert!(output_nodes("D", &graph).is_empty(), "D has no outputs");
|
assert!(output_nodes("D", &graph).is_empty(), "D has no outputs");
|
||||||
|
|||||||
@ -84,7 +84,7 @@ pub enum RenderStageLabel {
|
|||||||
/// For example during this phase textures are created, buffers are allocated and written.
|
/// For example during this phase textures are created, buffers are allocated and written.
|
||||||
Prepare,
|
Prepare,
|
||||||
|
|
||||||
/// Queues [PhaseItems](crate::render::render_phase::PhaseItem) that depend on
|
/// Queues [PhaseItems](render_phase::PhaseItem) that depend on
|
||||||
/// [`Prepare`](RenderStageLabel::Prepare) data and queue up draw calls to run during the
|
/// [`Prepare`](RenderStageLabel::Prepare) data and queue up draw calls to run during the
|
||||||
/// [`Render`](RenderStageLabel::Render) stage.
|
/// [`Render`](RenderStageLabel::Render) stage.
|
||||||
/// For example data is uploaded to the GPU in this stage.
|
/// For example data is uploaded to the GPU in this stage.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//! Executes the [`RenderGraph`] current render graph.
|
//! Executes the [`RenderGraph`] current render graph.
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::{borrow::Cow, error::Error};
|
||||||
|
|
||||||
use log::error;
|
use log::error;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ impl System for GraphRunnerSystem {
|
|||||||
if let Err(e) = RenderGraphRunner::run(render_graph, device, queue, state, world) {
|
if let Err(e) = RenderGraphRunner::run(render_graph, device, queue, state, world) {
|
||||||
error!("Error running render graph:");
|
error!("Error running render graph:");
|
||||||
{
|
{
|
||||||
let mut src: &dyn std::error::Error = &e;
|
let mut src: &dyn Error = &e;
|
||||||
loop {
|
loop {
|
||||||
error!("> {}", src);
|
error!("> {}", src);
|
||||||
match src.source() {
|
match src.source() {
|
||||||
|
|||||||
@ -11,13 +11,11 @@ pub mod singlethreaded;
|
|||||||
#[cfg(target_feature = "atomics")]
|
#[cfg(target_feature = "atomics")]
|
||||||
pub type UsedRasterTransferables = maplibre::raster::DefaultRasterTransferables;
|
pub type UsedRasterTransferables = maplibre::raster::DefaultRasterTransferables;
|
||||||
#[cfg(not(target_feature = "atomics"))]
|
#[cfg(not(target_feature = "atomics"))]
|
||||||
pub type UsedRasterTransferables =
|
pub type UsedRasterTransferables = singlethreaded::transferables::FlatTransferables;
|
||||||
crate::platform::singlethreaded::transferables::FlatTransferables;
|
|
||||||
|
|
||||||
#[cfg(target_feature = "atomics")]
|
#[cfg(target_feature = "atomics")]
|
||||||
pub type UsedVectorTransferables = maplibre::vector::DefaultVectorTransferables;
|
pub type UsedVectorTransferables = maplibre::vector::DefaultVectorTransferables;
|
||||||
#[cfg(not(target_feature = "atomics"))]
|
#[cfg(not(target_feature = "atomics"))]
|
||||||
pub type UsedVectorTransferables =
|
pub type UsedVectorTransferables = singlethreaded::transferables::FlatTransferables;
|
||||||
crate::platform::singlethreaded::transferables::FlatTransferables;
|
|
||||||
|
|
||||||
pub type UsedOffscreenKernelEnvironment = WHATWGOffscreenKernelEnvironment;
|
pub type UsedOffscreenKernelEnvironment = WHATWGOffscreenKernelEnvironment;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user