MCPcopy Create free account
hub / github.com/LAStools/LAStools / reopen

Method reopen

LASlib/src/lasreader_shp.cpp:464–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464BOOL LASreaderSHP::reopen(const char* file_name)
465{
466 if (file_name == 0)
467 {
468 laserror("file name pointer is zero");
469 return FALSE;
470 }
471
472 file = fopen_compressed(file_name, "rb", &piped);
473 if (file == 0)
474 {
475 laserror("cannot reopen file '%s'", file_name);
476 return FALSE;
477 }
478
479 // read SHP header again to skip to the right point in the file
480
481 int int_input;
482 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // file code (BIG)
483 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // unused (BIG)
484 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // unused (BIG)
485 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // unused (BIG)
486 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // unused (BIG)
487 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // unused (BIG)
488 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // file length (BIG)
489 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // version (LITTLE)
490 if (fread(&int_input, sizeof(int), 1, file) != 1) return FALSE; // shape type (LITTLE)
491 double double_input;
492 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // xmin (LITTLE)
493 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // ymin (LITTLE)
494 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // xmax (LITTLE)
495 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // ymax (LITTLE)
496 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // zmin (LITTLE)
497 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // zmax (LITTLE)
498 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // mmin (LITTLE)
499 if (fread(&double_input, sizeof(double), 1, file) != 1) return FALSE; // mmax (LITTLE)
500
501 p_idx = 0;
502 p_cnt = 0;
503 return TRUE;
504}
505
506void LASreaderSHP::clean()
507{

Callers

nothing calls this directly

Calls 2

laserrorFunction · 0.85
fopen_compressedFunction · 0.85

Tested by

no test coverage detected