1#![doc(html_root_url = "https://docs.rs/shape-contour/0.2.2")]
2pub mod contours;
16
17#[cfg(test)]
18mod tests {
19 use super::contours::{self, shape};
20 use std::path::PathBuf;
21
22 #[test]
24 fn check_shape_contour() {
25 let rp = "../shapelib-rs";
26 let s_path: String = if cfg!(docsrs) {
27 std::env::var("OUT_DIR").unwrap()
28 }else{
29 rp.to_string()
30 }; let o_path: &str = s_path.as_str();
32 if o_path != rp { return; }
33 let bp = PathBuf::from(o_path).join("shp").join("ESRIJ_com_japan_ver84");
34 println!("{}", bp.join("japan_ver84.shp").to_str().unwrap());
35 println!("{}", bp.join("japan_ver84.dbf").to_str().unwrap());
36 let s = bp.join("japan_ver84"); let u = s.to_str().unwrap(); let shp = shape::ShapeF::new(u, "cp932").unwrap();
39 shp.disp_record_inf().unwrap();
40 let sci = shp.get_shp_contours(false).unwrap();
41 drop(shp);
42 let mut gci = contours::GrpContoursInf::new(sci).unwrap();
43 gci.grp_contours.clear();
44 gci.get_grp_contours(50.0, 26, 343, false).unwrap(); println!("n_grp_contours: {}", gci.grp_contours.len());
46 gci.grp_contours.clear();
47 gci.get_grp_contours(50.0, 0, 0, false).unwrap(); println!("n_grp_contours: {}", gci.grp_contours.len());
49 }
50}