update
This commit is contained in:
68
frontend/src/types.rs
Normal file
68
frontend/src/types.rs
Normal file
@@ -0,0 +1,68 @@
|
||||
//! Data types for map features and tile data
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// A map node (point feature with tags)
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct MapNode {
|
||||
pub id: i64,
|
||||
pub lat: f64,
|
||||
pub lon: f64,
|
||||
pub tags: HashMap<String, String>,
|
||||
}
|
||||
|
||||
/// A map way (line/polygon feature with tags and geometry)
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct MapWay {
|
||||
pub id: i64,
|
||||
pub tags: HashMap<String, String>,
|
||||
pub points: Vec<u8>,
|
||||
}
|
||||
|
||||
/// Combined tile data from the backend
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct TileData {
|
||||
pub nodes: Vec<MapNode>,
|
||||
pub ways: Vec<MapWay>,
|
||||
pub buildings: Vec<MapWay>,
|
||||
pub landuse: Vec<MapWay>,
|
||||
pub water: Vec<MapWay>,
|
||||
pub railways: Vec<MapWay>,
|
||||
}
|
||||
|
||||
/// GPU buffers for a single tile's geometry
|
||||
#[allow(dead_code)]
|
||||
pub struct TileBuffers {
|
||||
// Road Buffers
|
||||
pub road_motorway_vertex_buffer: wgpu::Buffer,
|
||||
pub road_motorway_vertex_count: u32,
|
||||
pub road_primary_vertex_buffer: wgpu::Buffer,
|
||||
pub road_primary_vertex_count: u32,
|
||||
pub road_secondary_vertex_buffer: wgpu::Buffer,
|
||||
pub road_secondary_vertex_count: u32,
|
||||
pub road_residential_vertex_buffer: wgpu::Buffer,
|
||||
pub road_residential_vertex_count: u32,
|
||||
|
||||
pub building_vertex_buffer: wgpu::Buffer,
|
||||
pub building_index_count: u32,
|
||||
|
||||
// Landuse Buffers
|
||||
pub landuse_green_vertex_buffer: wgpu::Buffer,
|
||||
pub landuse_green_index_count: u32,
|
||||
pub landuse_residential_vertex_buffer: wgpu::Buffer,
|
||||
pub landuse_residential_index_count: u32,
|
||||
pub landuse_sand_vertex_buffer: wgpu::Buffer,
|
||||
pub landuse_sand_index_count: u32,
|
||||
|
||||
pub water_vertex_buffer: wgpu::Buffer,
|
||||
pub water_index_count: u32,
|
||||
pub railway_vertex_buffer: wgpu::Buffer,
|
||||
pub railway_vertex_count: u32,
|
||||
|
||||
pub water_line_vertex_buffer: wgpu::Buffer,
|
||||
pub water_line_vertex_count: u32,
|
||||
}
|
||||
Reference in New Issue
Block a user