Changeset 528

Show
Ignore:
Timestamp:
03/07/08 14:42:54 (16 months ago)
Author:
hobu
Message:

fix some dumb stuf in las2las

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/apps/las2las.c

    r503 r528  
    7878    char* file_name_in = 0; 
    7979    char* file_name_out = 0; 
    80     int clip_xy_min[2]; 
    81     int clip_xy_max[2]; 
     80    double *clip_xy_min = NULL; 
     81    double *clip_xy_max = NULL; 
    8282    int clip = FALSE; 
    8383    int remove_extra_header = FALSE; 
     
    156156                ) 
    157157        { 
    158             i++; 
    159             clip_xy_min[0] = atoi(argv[i]); 
    160             i++; 
    161             clip_xy_min[1] = atoi(argv[i]); 
    162             i++; 
    163             clip_xy_max[0] = atoi(argv[i]); 
    164             i++; 
    165             clip_xy_max[1] = atoi(argv[i]); 
     158            clip_xy_min = (double*) malloc (2 * sizeof(double)); 
     159            clip_xy_max = (double*) malloc( 2 * sizeof(double)); 
     160            i++; 
     161            clip_xy_min[0] = atof(argv[i]); 
     162            i++; 
     163            clip_xy_min[1] = atof(argv[i]); 
     164            i++; 
     165            clip_xy_max[0] = atof(argv[i]); 
     166            i++; 
     167            clip_xy_max[1] = atof(argv[i]); 
    166168            clip = TRUE; 
    167169        } 
     
    553555 
    554556    if (use_stdout) file_name_out = "stdout"; 
    555     writer = LASWriter_Create(file_name_out, surviving_header, LAS_MODE_APPEND); 
     557    writer = LASWriter_Create(file_name_out, surviving_header, LAS_MODE_WRITE); 
    556558    if (!writer) {  
    557559        LASError_Print("Could not open file to write"); 
     
    570572*/ 
    571573 
     574  LASReader_Destroy(reader); 
     575  reader = NULL; 
     576  if (file_name_in) 
     577  { 
     578      reader = LASReader_Create(file_name_in); 
     579    if (!reader) {  
     580        LASError_Print("Could not open file to read"); 
     581        exit(1); 
     582    }  
     583  } 
     584  else 
     585  { 
     586      LASError_Print("no input specified"); 
     587      usage(); 
     588      exit(1); 
     589  } 
    572590 
    573591    p = LASReader_GetNextPoint(reader); 
     
    581599     
    582600    while (p) { 
     601        printf("fetching..."); 
    583602 
    584603        if (last_only && LASPoint_GetReturnNumber(p) != LASPoint_GetNumberOfReturns(p)) 
    585604        { 
     605            printf("last_only..."); 
    586606            p = LASReader_GetNextPoint(reader); 
    587607            continue; 
     
    589609        if (first_only && LASPoint_GetReturnNumber(p) != 1) 
    590610        { 
     611            printf("first_only..."); 
    591612            p = LASReader_GetNextPoint(reader); 
    592613            continue; 
     
    595616        if (clip_xy_min && (LASPoint_GetX(p) < clip_xy_min[0] || LASPoint_GetY(p) < clip_xy_min[1])) 
    596617        { 
     618            printf("clip_xy_min..."); 
    597619            p = LASReader_GetNextPoint(reader); 
    598620            continue; 
     
    600622        if (clip_xy_max && (LASPoint_GetX(p) > clip_xy_max[0] || LASPoint_GetY(p) > clip_xy_max[1])) 
    601623        { 
     624            printf("\nclip_xy_max..."); 
     625            printf("LASPoint_GetX(p): %.2f ", LASPoint_GetX(p)); 
     626            printf("clip_xy_max[0] %.2f ", clip_xy_max[0]); 
     627            printf("clip_xy_max[1] %.2f\n ", clip_xy_max[1]); 
    602628            p = LASReader_GetNextPoint(reader); 
    603629            continue; 
     
    605631        if (elim_return && (elim_return & (1 << LASPoint_GetReturnNumber(p)))) 
    606632        { 
     633            printf("elim_return..."); 
    607634            p = LASReader_GetNextPoint(reader); 
    608635            continue; 
     
    610637        if (elim_scan_angle_above && (LASPoint_GetScanAngleRank(p) > elim_scan_angle_above || LASPoint_GetScanAngleRank(p) < -elim_scan_angle_above)) 
    611638        { 
     639            printf("elim_scan_anble..."); 
    612640            p = LASReader_GetNextPoint(reader); 
    613641            continue; 
     
    615643        if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below) 
    616644        { 
     645            printf("elim_intensity..."); 
    617646            p = LASReader_GetNextPoint(reader); 
    618647            continue; 
    619648        } 
    620649        LASWriter_WritePoint(writer,p); 
     650        printf("Writing point..."); 
    621651 
    622652        p  = LASReader_GetNextPoint(reader);