forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Rust-specific C++ wrapper, renderer args
- Loading branch information
Showing
7 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
#include "rust/cxx.h" | ||
#include "mbgl/math/log2.hpp" | ||
|
||
namespace ml { | ||
namespace rust { | ||
|
||
uint32_t get_42(); | ||
|
||
} // namespace rust | ||
} // namespace ml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
use clap::Parser; | ||
|
||
/// MapLibre Native render tool | ||
#[derive(Parser, Debug)] | ||
struct Args { | ||
/// Rendering backend | ||
#[arg(long)] | ||
backend: Option<String>, | ||
|
||
/// API key | ||
#[arg(short = 't', long = "apikey", env = "MLN_API_KEY")] | ||
apikey: Option<String>, | ||
|
||
/// Map stylesheet | ||
#[arg(short = 's', long = "style")] | ||
style: Option<String>, | ||
|
||
/// Output file name | ||
#[arg(short = 'o', long = "output", default_value = "out.png")] | ||
output: String, | ||
|
||
/// Cache database file name | ||
#[arg(short = 'c', long = "cache", default_value = "cache.sqlite")] | ||
cache: String, | ||
|
||
/// Directory to which asset:// URLs will resolve | ||
#[arg(short = 'a', long = "assets", default_value = ".")] | ||
assets: String, | ||
|
||
/// Debug mode | ||
#[arg(long)] | ||
debug: bool, | ||
|
||
/// Image scale factor | ||
#[arg(short = 'r', long = "ratio", default_value_t = 1.0)] | ||
ratio: f64, | ||
|
||
/// Zoom level | ||
#[arg(short = 'z', long = "zoom", default_value_t = 0.0)] | ||
zoom: f64, | ||
|
||
/// Longitude | ||
#[arg(short = 'x', long = "lon", default_value_t = 0.0)] | ||
lon: f64, | ||
|
||
/// Latitude | ||
#[arg(short = 'y', long = "lat", default_value_t = 0.0)] | ||
lat: f64, | ||
|
||
/// Bearing | ||
#[arg(short = 'b', long = "bearing", default_value_t = 0.0)] | ||
bearing: f64, | ||
|
||
/// Pitch | ||
#[arg(short = 'p', long = "pitch", default_value_t = 0.0)] | ||
pitch: f64, | ||
|
||
/// Image width | ||
#[arg(long = "width", default_value_t = 512)] | ||
width: u32, | ||
|
||
/// Image height | ||
#[arg(long = "height", default_value_t = 512)] | ||
height: u32, | ||
|
||
/// Map mode (e.g. 'static', 'tile', 'continuous') | ||
#[arg(short = 'm', long = "mode")] | ||
mode: Option<String>, | ||
} | ||
|
||
fn main() { | ||
let args = Args::parse(); | ||
|
||
println!("Parsed arguments: {:?}", args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "maplibre-native/include/wrapper.h" | ||
#include "maplibre-native/src/lib.rs.h" | ||
|
||
namespace ml { | ||
namespace rust { | ||
|
||
uint32_t get_42() { | ||
return 42; | ||
} | ||
|
||
} // namespace rust | ||
} // namespace ml |