Run formatter

This commit is contained in:
Maximilian Ammann 2022-09-17 13:50:08 +02:00
parent 3f1e165cda
commit 76bf7a6ecf
22 changed files with 156 additions and 132 deletions

View File

@ -1,7 +1,6 @@
use maplibre::environment::DefaultTransferables;
use maplibre::io::apc::SchedulerAsyncProcedureCall;
use maplibre::{
environment::DefaultTransferables,
io::apc::SchedulerAsyncProcedureCall,
platform::{http_client::ReqwestHttpClient, scheduler::TokioScheduler},
MapBuilder,
};

View File

@ -1,9 +1,8 @@
use maplibre::headless::HeadlessEnvironment;
use maplibre::io::apc::SchedulerAsyncProcedureCall;
use maplibre::{
coords::{LatLon, WorldTileCoords},
error::Error,
headless::HeadlessMapWindowConfig,
headless::{HeadlessEnvironment, HeadlessMapWindowConfig},
io::apc::SchedulerAsyncProcedureCall,
platform::{http_client::ReqwestHttpClient, scheduler::TokioScheduler},
render::settings::{RendererSettings, TextureFormat},
util::grid::google_mercator,

View File

@ -1,18 +1,18 @@
use std::{cell::RefCell, marker::PhantomData, ops::Deref, rc::Rc};
use instant::Instant;
use maplibre::environment::{DefaultTransferables, Environment};
use maplibre::io::apc::{AsyncProcedureCall, Message};
use maplibre::io::scheduler::Scheduler;
use maplibre::io::transferables::Transferables;
use maplibre::{
environment::{DefaultTransferables, Environment},
error::Error,
io::source_client::HttpClient,
io::{
apc::{AsyncProcedureCall, Message},
scheduler::Scheduler,
source_client::HttpClient,
transferables::Transferables,
},
map_schedule::InteractiveMapSchedule,
window::{EventLoop, HeadedMapWindow, MapWindowConfig},
};
use std::cell::RefCell;
use std::marker::PhantomData;
use std::ops::Deref;
use std::rc::Rc;
use winit::{
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
event_loop::ControlFlow,

View File

@ -8,6 +8,7 @@ use std::{
use bytemuck_derive::{Pod, Zeroable};
use cgmath::{num_traits::Pow, AbsDiffEq, Matrix4, Point3, Vector3};
use serde::{Deserialize, Serialize};
use crate::{
style::source::TileAddressingScheme,
@ -16,7 +17,6 @@ use crate::{
SignificantlyDifferent,
},
};
use serde::{Deserialize, Serialize};
pub const EXTENT_UINT: u32 = 4096;
pub const EXTENT_SINT: i32 = EXTENT_UINT as i32;

View File

@ -1,9 +1,12 @@
use crate::io::apc::AsyncProcedureCall;
use crate::io::transferables::Transferables;
use crate::io::transferables::{
DefaultTessellatedLayer, DefaultTileTessellated, DefaultUnavailableLayer,
use crate::{
io::{
apc::AsyncProcedureCall,
transferables::{
DefaultTessellatedLayer, DefaultTileTessellated, DefaultUnavailableLayer, Transferables,
},
},
HttpClient, MapWindowConfig, Scheduler,
};
use crate::{HttpClient, MapWindowConfig, Scheduler};
pub trait Environment: 'static {
type MapWindowConfig: MapWindowConfig;

View File

@ -1,10 +1,10 @@
use std::marker::PhantomData;
use std::{
collections::HashSet,
fs::File,
future::Future,
io::Write,
iter,
marker::PhantomData,
ops::{Deref, Range},
sync::Arc,
};
@ -12,20 +12,19 @@ use std::{
use tokio::{runtime::Handle, task};
use wgpu::{BufferAsyncError, BufferSlice};
use crate::environment::DefaultTransferables;
use crate::io::apc::AsyncProcedureCall;
use crate::io::apc::SchedulerAsyncProcedureCall;
use crate::io::transferables::Transferables;
use crate::{
context::{MapContext, ViewState},
coords::{LatLon, ViewRegion, WorldCoords, WorldTileCoords, Zoom, TILE_SIZE},
environment::DefaultTransferables,
error::Error,
headless::utils::HeadlessPipelineProcessor,
io::{
apc::{AsyncProcedureCall, SchedulerAsyncProcedureCall},
pipeline::{PipelineContext, Processable},
source_client::HttpSourceClient,
tile_pipelines::build_vector_tile_pipeline,
tile_repository::{StoredLayer, TileRepository},
transferables::Transferables,
TileRequest,
},
render::{

View File

@ -1,16 +1,25 @@
use crate::coords::WorldTileCoords;
use crate::environment::DefaultTransferables;
use crate::io::source_client::{HttpSourceClient, SourceClient};
use crate::io::transferables::Transferables;
use crate::io::TileRequest;
use crate::Scheduler;
use crate::{Environment, HttpClient};
use std::{
collections::HashMap,
future::Future,
pin::Pin,
sync::{
mpsc,
mpsc::{Receiver, Sender},
},
};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::future::Future;
use std::pin::Pin;
use std::sync::mpsc;
use std::sync::mpsc::{Receiver, Sender};
use crate::{
coords::WorldTileCoords,
environment::DefaultTransferables,
io::{
source_client::{HttpSourceClient, SourceClient},
transferables::Transferables,
TileRequest,
},
Environment, HttpClient, Scheduler,
};
/// The result of the tessellation of a tile.
/// `TessellatedLayer` contains the result of the tessellation for a specific layer, otherwise

View File

@ -2,9 +2,10 @@
use std::{collections::HashSet, fmt};
use crate::coords::WorldTileCoords;
use serde::{Deserialize, Serialize};
use crate::coords::WorldTileCoords;
pub mod apc;
pub mod geometry_index;
pub mod pipeline;

View File

@ -1,9 +1,11 @@
use crate::coords::WorldTileCoords;
use crate::io::tile_repository::StoredLayer;
use crate::render::ShaderVertex;
use crate::tessellation::{IndexDataType, OverAlignedVertexBuffer};
use geozero::mvt::tile;
use geozero::mvt::tile::Layer;
use geozero::mvt::{tile, tile::Layer};
use crate::{
coords::WorldTileCoords,
io::tile_repository::StoredLayer,
render::ShaderVertex,
tessellation::{IndexDataType, OverAlignedVertexBuffer},
};
pub trait TileTessellated: Send {
fn new(coords: WorldTileCoords) -> Self;

View File

@ -16,8 +16,14 @@
//! maplibre = "0.0.2"
//! ```
use crate::environment::Environment;
use std::{
borrow::{Borrow, BorrowMut},
cell::RefCell,
rc::Rc,
};
use crate::{
environment::Environment,
io::{scheduler::Scheduler, source_client::HttpClient},
map_schedule::InteractiveMapSchedule,
render::{
@ -27,9 +33,6 @@ use crate::{
style::Style,
window::{EventLoop, HeadedMapWindow, MapWindow, MapWindowConfig, WindowSize},
};
use std::borrow::{Borrow, BorrowMut};
use std::cell::RefCell;
use std::rc::Rc;
pub mod context;
pub mod coords;

View File

@ -1,6 +1,4 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::{marker::PhantomData, mem};
use std::{cell::RefCell, marker::PhantomData, mem, rc::Rc};
use crate::{
context::{MapContext, ViewState},

View File

@ -1,7 +1,6 @@
use std::future::Future;
use crate::error::Error;
use crate::Scheduler;
use crate::{error::Error, Scheduler};
/// Multi-threading with Tokio.
pub struct TokioScheduler;

View File

@ -1,28 +1,29 @@
//! [Stages](Stage) for requesting and preparing data
use std::cell::RefCell;
use std::marker::PhantomData;
use std::rc::Rc;
use std::sync::{mpsc, Arc, Mutex};
use std::{
cell::RefCell,
marker::PhantomData,
rc::Rc,
sync::{mpsc, Arc, Mutex},
};
use geozero::{mvt::tile, GeozeroDatasource};
use request_stage::RequestStage;
use crate::environment::DefaultTransferables;
use crate::io::apc::{AsyncProcedureCall, Context, Message};
use crate::io::transferables::Transferables;
use crate::io::transferables::{
DefaultTessellatedLayer, DefaultTileTessellated, DefaultUnavailableLayer, TessellatedLayer,
TileTessellated, UnavailableLayer,
};
use crate::{
coords::{WorldCoords, WorldTileCoords, Zoom, ZoomLevel},
environment::DefaultTransferables,
error::Error,
io::{
apc::{AsyncProcedureCall, Context, Message},
geometry_index::{GeometryIndex, IndexedGeometry, TileIndex},
pipeline::{PipelineContext, PipelineProcessor, Processable},
source_client::HttpSourceClient,
tile_pipelines::build_vector_tile_pipeline,
transferables::{
DefaultTessellatedLayer, DefaultTileTessellated, DefaultUnavailableLayer,
TessellatedLayer, TileTessellated, Transferables, UnavailableLayer,
},
TileRequest,
},
render::ShaderVertex,

View File

@ -1,12 +1,17 @@
//! Receives data from async threads and populates the [`crate::io::tile_repository::TileRepository`].
use crate::io::apc::{AsyncProcedureCall, Message};
use crate::io::transferables::{TessellatedLayer, TileTessellated, UnavailableLayer};
use crate::{context::MapContext, io::tile_repository::StoredLayer, schedule::Stage, Environment};
use std::borrow::BorrowMut;
use std::cell::RefCell;
use std::ops::Deref;
use std::rc::Rc;
use std::{borrow::BorrowMut, cell::RefCell, ops::Deref, rc::Rc};
use crate::{
context::MapContext,
io::{
apc::{AsyncProcedureCall, Message},
tile_repository::StoredLayer,
transferables::{TessellatedLayer, TileTessellated, UnavailableLayer},
},
schedule::Stage,
Environment,
};
pub struct PopulateTileStore<E: Environment> {
apc: Rc<RefCell<E::AsyncProcedureCall>>,

View File

@ -1,32 +1,33 @@
//! Requests tiles which are currently in view
use crate::coords::ZoomLevel;
use crate::io::apc::{AsyncProcedureCall, AsyncProcedureFuture, Context, Input};
use crate::io::pipeline::PipelineContext;
use crate::io::pipeline::Processable;
use crate::io::tile_pipelines::build_vector_tile_pipeline;
use crate::stages::HeadedPipelineProcessor;
use std::{
borrow::Borrow,
cell::RefCell,
collections::{HashMap, HashSet},
future::Future,
ops::Deref,
pin::Pin,
process::Output,
rc::Rc,
str::FromStr,
};
use crate::{
context::MapContext,
coords::{ViewRegion, WorldTileCoords},
coords::{ViewRegion, WorldTileCoords, ZoomLevel},
error::Error,
io::{
apc::{AsyncProcedureCall, AsyncProcedureFuture, Context, Input},
pipeline::{PipelineContext, Processable},
source_client::{HttpSourceClient, SourceClient},
tile_pipelines::build_vector_tile_pipeline,
tile_repository::TileRepository,
TileRequest,
},
schedule::Stage,
stages::HeadedPipelineProcessor,
Environment, HttpClient, Scheduler, Style,
};
use std::borrow::Borrow;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::future::Future;
use std::ops::Deref;
use std::pin::Pin;
use std::process::Output;
use std::rc::Rc;
use std::str::FromStr;
pub struct RequestStage<E: Environment> {
apc: Rc<RefCell<E::AsyncProcedureCall>>,

View File

@ -1,8 +1,8 @@
//! Utilities for the window system.
use std::{cell::RefCell, rc::Rc};
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use std::cell::RefCell;
use std::rc::Rc;
use crate::{Environment, HttpClient, InteractiveMapSchedule};

View File

@ -1,13 +1,8 @@
#![feature(allocator_api, new_uninit)]
use std::borrow::BorrowMut;
use std::cell::RefCell;
use std::ops::Deref;
use std::rc::Rc;
use std::{mem, panic};
use std::{borrow::BorrowMut, cell::RefCell, mem, ops::Deref, panic, rc::Rc};
use maplibre::io::scheduler::NopScheduler;
use maplibre::{Map, MapBuilder};
use maplibre::{io::scheduler::NopScheduler, Map, MapBuilder};
use maplibre_winit::winit::{WinitEnvironment, WinitMapWindowConfig};
use wasm_bindgen::prelude::*;

View File

@ -1,5 +1,6 @@
use maplibre::error::Error;
use std::future::Future;
use maplibre::error::Error;
pub mod http_client;
#[cfg(target_feature = "atomics")]

View File

@ -2,9 +2,7 @@
//! web workers which can be used to execute work.
//! Adopted from [wasm-bindgen example](https://github.com/rustwasm/wasm-bindgen/blob/0eba2efe45801b71f8873bc368c58a8ed8e894ff/examples/raytrace-parallel/src/pool.rs)
use std::borrow::BorrowMut;
use std::future::Future;
use std::{cell::RefCell, rc::Rc};
use std::{borrow::BorrowMut, cell::RefCell, future::Future, rc::Rc};
use js_sys::Promise;
use rand::prelude::*;

View File

@ -1,11 +1,12 @@
use log::warn;
use std::future::Future;
use super::pool::WorkerPool;
use log::warn;
use maplibre::{error::Error, io::scheduler::Scheduler};
use wasm_bindgen::{prelude::*, JsCast};
use web_sys::Worker;
use super::pool::WorkerPool;
pub struct WebWorkerPoolScheduler {
pool: WorkerPool,
}

View File

@ -1,30 +1,38 @@
use crate::platform::unsync::transferables::{
InnerData, LinearTessellatedLayer, LinearTransferables,
use std::{
borrow::Borrow,
cell::RefCell,
collections::HashMap,
marker::PhantomData,
mem,
mem::{size_of, MaybeUninit},
ops::Deref,
pin::Pin,
rc::Rc,
sync::{
mpsc,
mpsc::{Receiver, Sender},
},
};
use crate::{MapType, WHATWGFetchHttpClient};
use js_sys::Uint8Array;
use maplibre::environment::Environment;
use maplibre::io::apc::{AsyncProcedure, AsyncProcedureCall, Context, Input, Message};
use maplibre::io::scheduler::Scheduler;
use maplibre::io::source_client::{HttpClient, HttpSourceClient, SourceClient};
use maplibre::io::transferables::Transferables;
use maplibre::{
environment::Environment,
io::{
apc::{AsyncProcedure, AsyncProcedureCall, Context, Input, Message},
scheduler::Scheduler,
source_client::{HttpClient, HttpSourceClient, SourceClient},
transferables::Transferables,
},
};
use serde::Serialize;
use std::borrow::Borrow;
use std::cell::RefCell;
use std::collections::HashMap;
use std::marker::PhantomData;
use std::mem;
use std::mem::{size_of, MaybeUninit};
use std::ops::Deref;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::mpsc;
use std::sync::mpsc::{Receiver, Sender};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen::{prelude::*, JsCast, JsValue};
use web_sys::{DedicatedWorkerGlobalScope, Worker};
use crate::{
platform::unsync::transferables::{InnerData, LinearTessellatedLayer, LinearTransferables},
MapType, WHATWGFetchHttpClient,
};
type UsedTransferables = LinearTransferables;
type UsedHttpClient = WHATWGFetchHttpClient;
type UsedContext = PassingContext;

View File

@ -1,13 +1,15 @@
use bytemuck::{TransparentWrapper, Zeroable};
use bytemuck_derive::{Pod, Zeroable};
use maplibre::benchmarking::tessellation::{IndexDataType, OverAlignedVertexBuffer};
use maplibre::coords::WorldTileCoords;
use maplibre::io::tile_repository::StoredLayer;
use maplibre::io::transferables::{
TessellatedLayer, TileTessellated, Transferables, UnavailableLayer,
use maplibre::{
benchmarking::tessellation::{IndexDataType, OverAlignedVertexBuffer},
coords::WorldTileCoords,
io::{
tile_repository::StoredLayer,
transferables::{TessellatedLayer, TileTessellated, Transferables, UnavailableLayer},
},
render::ShaderVertex,
tile::Layer,
};
use maplibre::render::ShaderVertex;
use maplibre::tile::Layer;
// FIXME: properly do this!, fix this whole file
#[derive(Copy, Clone, Debug)]