Пример #1
0
function get_next_file_to_process()
{
    $srcdir = get_config_var("src_dir");
    if ($curdir = opendir($srcdir)) {
        while ($file = readdir($curdir)) {
            if ($file != '.' && $file != '..') {
                $srcfile = $srcdir . '\\' . $file;
                //				$dstfile = $dstdir . '\\dump.txt';
                if (is_file($srcfile)) {
                    closedir($curdir);
                    return $srcfile;
                }
                closedir($curdir);
                return "";
            }
        }
    }
    closedir($curdir);
    return "";
}
Пример #2
0
function get_eliminated_pointcount($slide, $len, $path1)
{
    $WP_EXACT_MATCH_ERROR = get_config_var("min_wp_dist");
    //	$WP_EXACT_MATCH_ERROR=3;
    $pointcount = 0;
    $iend = (int) (($path1['lk'] - $slide) / $len);
    for ($i = 0; $i < $iend; $i++) {
        $matchcount = 0;
        $start = $slide + $len * $i;
        $end = $start + $len;
        for ($j = $start; $j <= $end; $j++) {
            $dist_x = ABS($path1[$j + $len]['x'] - $path1[$j]['x']);
            $dist_y = ABS($path1[$j + $len]['y'] - $path1[$j]['y']);
            $dist = sqrt($dist_x * $dist_x + $dist_y * $dist_y);
            //parse_debug_report("len=$len, slide=$slide,iend=$iend, start=$start, end=$end,j=$j,j2=".($j+$len)." total nodes =".$path1['lk']." dist=$dist x1=".$path1[$j+$len]['x']." y1 =".$path1[$j+$len]['y']." x2=".$path1[$j]['x']." y2=".$path1[$j]['y']."");
            if ($dist < $WP_EXACT_MATCH_ERROR) {
                $matchcount++;
            }
        }
        if ($matchcount == $len) {
            $pointcount += $len;
        }
        //		$pointcount += $matchcount;
    }
    return $pointcount;
}