mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 22:13:27 +03:00
2181d8a56d
- btreeset macro - switch to "ID #123" by default
31 lines
777 B
Rust
31 lines
777 B
Rust
use geom::Polygon;
|
|
use serde_derive::{Deserialize, Serialize};
|
|
use std::collections::BTreeMap;
|
|
use std::fmt;
|
|
|
|
// TODO reconsider pub usize. maybe outside world shouldnt know.
|
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
|
|
pub struct AreaID(pub usize);
|
|
|
|
impl fmt::Display for AreaID {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
write!(f, "Area #{}", self.0)
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
|
pub enum AreaType {
|
|
Park,
|
|
Water,
|
|
PedestrianIsland,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct Area {
|
|
pub id: AreaID,
|
|
pub area_type: AreaType,
|
|
pub polygon: Polygon,
|
|
pub osm_tags: BTreeMap<String, String>,
|
|
pub osm_id: i64,
|
|
}
|