pub fn execute_polygon(filename: &str, delay: bool) -> String {
    let second = time::Duration::from_millis(1000);
    // let start = get_current_time();
    let u = get_json_info(filename);
    let cor: Vec<Coordinates> = u.shape_coordinate;
    let run: Vec<Coordinates> = u.moving_coordinate;
    //let mut vec_ret:Vec<String> = Vec:new();
    let mut ret_val = "".to_string();
    display_bold(
        "Created Polygon Fence, with the below coordinates",
        Colour::Blue,
    );
    display(&format!("{:?}", cor), Colour::Blue);
    display_bold("Tracking and Verifying, if the below moving objects position is within or outside the fence", Colour::Black);

    for x in run {
        let mut str = "is out of the fence";
        if delay {
            thread::sleep(second);
        }
        if contains(&x, &cor) {
            str = "is inside the fence";
        }
        display(
            &format!(
                "The {} positioned at latitude {}, longitude {}, {} ",
                u.vehicle, x.lat, x.lon, &str
            ),
            Colour::Black,
        );

        ret_val.push_str(
            format!(
                "The {} positioned at latitude {}, longitude {}, {} \n ",
                u.vehicle, x.lat, x.lon, &str
            )
            .as_str(),
        );
    }
    // println!("The time taken for the execute method to perform this operation is {:?}", calculate_run_time(&start));
    ret_val
}
/// The function does the below
/// Reads the input file
/// Creates polygon fence based on the coordinates given in the input file
/// Executes set of coordinates for which position has to be determined.
/// Prints if the coordinates are within or outside the fence
///The function the below parameters
/// filename -> contains the json file which contains the coordinates
///
The function does the below
Reads the input file
Creates polygon fence based on the coordinates given in the input file
Executes set of coordinates for which position has to be determined.
Prints if the coordinates are within or outside the fence
The function the below parameters
filename -> contains the json file which contains the coordinates
The function does the below Reads the input file Creates polygon fence based on the coordinates given in the input file Executes set of coordinates for which position has to be determined . Prints if the coordinates are within or outside the fence The function the below parameters filename - > contains the json file which contains the coordinates
pub fn execute_polygon(filename: &str, delay: bool) -> String {
    let second = time::Duration::from_millis(1000);
    // let start = get_current_time();
    let u = get_json_info(filename);
    let cor: Vec<Coordinates> = u.shape_coordinate;
    let run: Vec<Coordinates> = u.moving_coordinate;
    //let mut vec_ret:Vec<String> = Vec:new();
    let mut ret_val = "".to_string();
    display_bold(
        "Created Polygon Fence, with the below coordinates",
        Colour::Blue,
    );
    display(&format!("{:?}", cor), Colour::Blue);
    display_bold("Tracking and Verifying, if the below moving objects position is within or outside the fence", Colour::Black);
    for x in run {
        let mut str = "is out of the fence";
        if delay {
            thread::sleep(second);
        }
        if contains(&x, &cor) {
            str = "is inside the fence";
        }
        display(
            &format!(
                "The {} positioned at latitude {}, longitude {}, {} ",
                u.vehicle, x.lat, x.lon, &str
            ),
            Colour::Black,
        );
        ret_val.push_str(
            format!(
                "The {} positioned at latitude {}, longitude {}, {} \n ",
                u.vehicle, x.lat, x.lon, &str
            )
            .as_str(),
        );
    }
    // println!("The time taken for the execute method to perform this operation is {:?}", calculate_run_time(&start));
    ret_val
}
pub fn execute_polygon ( filename : & str , delay : bool ) -> String { let second = time :: Duration :: from_millis ( 1000 ) ; // let start = get_current_time(); let u = get_json_info ( filename ) ; let cor : Vec < Coordinates > = u . shape_coordinate ; let run : Vec < Coordinates > = u . moving_coordinate ; //let mut vec_ret:Vec<String> = Vec:new(); let mut ret_val = " " . to_string ( ) ; display_bold ( " " , Colour :: Blue , ) ; display ( & format ! ( " " cor ) , Colour :: Blue ) ; display_bold ( " " , Colour :: Black ) ; for x in run { let mut str = " " ; if delay { thread :: sleep ( second ) ; } if contains ( & x , & cor ) { str = " " ; } display ( & format ! ( " " u vehicle x lat x lon str ) , Colour :: Black , ) ; ret_val . push_str ( format ! ( " \n " u vehicle x lat x lon str ) . as_str ( ) , ) ; } // println!("The time taken for the execute method to perform this operation is {:?}", calculate_run_time(&start)); ret_val }
The function does the below
Reads the input file
Creates polygon fence based on the coordinates given in the input file
Executes set of coordinates for which position has to be determined.
The function does the below Reads the input file Creates polygon fence based on the coordinates given in the input file Executes set of coordinates for which position has to be determined .
filename
&str
delay
bool
filename
&str
delay
bool