-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
883 additions
and
202 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"airmail", "airmail_common", | ||
"airmail_parser", | ||
"parser_demo", | ||
"airmail", "airmail_common", "airmail_index", "airmail_parser", "parser_demo", | ||
] |
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
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#[macro_use] | ||
extern crate lazy_static; | ||
|
||
pub mod index; | ||
pub mod parser; | ||
pub mod poi; |
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,51 @@ | ||
use std::error::Error; | ||
|
||
use airmail_common::categories::PoiCategory; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct AirmailPoi { | ||
pub name: Vec<String>, | ||
pub source: String, | ||
pub category: Vec<String>, | ||
pub house_number: Vec<String>, | ||
pub road: Vec<String>, | ||
pub unit: Vec<String>, | ||
pub locality: Vec<String>, | ||
pub region: Vec<String>, | ||
pub country: Vec<String>, | ||
pub s2cell: u64, | ||
pub tags: Vec<(String, String)>, | ||
} | ||
|
||
impl AirmailPoi { | ||
pub fn new( | ||
name: Vec<String>, | ||
source: String, | ||
category: Vec<PoiCategory>, | ||
house_number: Vec<String>, | ||
road: Vec<String>, | ||
unit: Vec<String>, | ||
lat: f64, | ||
lng: f64, | ||
tags: Vec<(String, String)>, | ||
) -> Result<Self, Box<dyn Error>> { | ||
let s2cell = s2::cellid::CellID::from(s2::latlng::LatLng::from_degrees(lat, lng)).0; | ||
|
||
Ok(Self { | ||
name, | ||
source, | ||
category: category | ||
.iter() | ||
.map(|category| category.to_facet()) | ||
.collect(), // FIXME. | ||
house_number, | ||
road, | ||
unit, | ||
locality: Vec::new(), | ||
region: Vec::new(), | ||
country: Vec::new(), | ||
s2cell, | ||
tags, | ||
}) | ||
} | ||
} |
Oops, something went wrong.