#![doc(html_root_url = "https://docs.rs/cv-contour/0.2.0")]
pub mod cvc;
#[cfg(test)]
mod tests {
use super::cvc::{self, shape, contours};
use std::path::PathBuf;
#[test]
fn check_cv_contour() {
let rp = "../shapelib-rs";
let s_path: String = if cfg!(docsrs) {
std::env::var("OUT_DIR").unwrap()
}else{
rp.to_string()
}; let o_path: &str = s_path.as_str();
if o_path != rp { return; }
let bp = PathBuf::from(o_path).join("shp").join("ESRIJ_com_japan_ver84");
println!("{}", bp.join("japan_ver84.shp").to_str().unwrap());
println!("{}", bp.join("japan_ver84.dbf").to_str().unwrap());
let s = bp.join("japan_ver84"); let u = s.to_str().unwrap(); let shp = shape::ShapeF::new(u, "cp932").unwrap();
shp.disp_record_inf().unwrap();
let sci = shp.get_shp_contours(false).unwrap();
drop(shp);
let mut gci = contours::GrpContoursInf::new(sci).unwrap();
gci.grp_contours.clear();
gci.get_grp_contours(50.0, 26, 343, false).unwrap(); assert_eq!(gci.grp_contours.len(), 1);
gci.grp_contours.clear();
gci.get_grp_contours(50.0, 0, 0, false).unwrap(); assert_eq!(gci.grp_contours.len(), 1907);
gci.grp_scaled_contours.clear();
gci.whole_scaled().unwrap();
assert_eq!(gci.grp_scaled_contours.len(), 1907);
let contours = gci.grp_scaled_contours.get_mut(&0).unwrap();
assert_eq!(cvc::cv_contours(contours).unwrap().len(), 1);
}
}