本文整理汇总了C++中LASreadOpener::reopen方法的典型用法代码示例。如果您正苦于以下问题:C++ LASreadOpener::reopen方法的具体用法?C++ LASreadOpener::reopen怎么用?C++ LASreadOpener::reopen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LASreadOpener
的用法示例。
在下文中一共展示了LASreadOpener::reopen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
MPI_Barrier(MPI_COMM_WORLD);
}
laswriter = laswriteopener.open(&lasreader->header);
if (laswriter == 0)
{
fprintf(stderr, "ERROR: could not open laswriter\n");
byebye(true, argc==1);
}
// **************************************************************************************************
if(is_mpi == 1){ // jdw, we do this because only rank 0 now writes the header in laswriter_las.cpp
MPI_File fh = laswriter->get_MPI_File();
MPI_Offset offset;
//MPI_File_get_position(fh, &offset);
//printf ("offset %lld, rank %i fh %lld\n", offset, rank, fh);
if(rank==0){
MPI_File_get_position(fh, &offset);
}
MPI_Bcast(&offset, 1, MPI_OFFSET, 0, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
MPI_File_seek(fh, offset, MPI_SEEK_SET);
}
// ****************************************************************************************************
// for piped output we need to re-open the input file
if (extra_pass)
{
if (!lasreadopener.reopen(lasreader))
{
fprintf(stderr, "ERROR: could not re-open lasreader\n");
byebye(true);
}
}
else
{
if (reproject_quantizer)
{
lasreader->header = *saved_quantizer;
delete saved_quantizer;
}
}
// maybe seek to start position
if (subsequence_start) lasreader->seek(subsequence_start);
// loop over points
if (point)
{
while (lasreader->read_point())
{
if (lasreader->p_count > subsequence_stop) break;
if (clip_to_bounding_box)
{
if (!lasreader->point.inside_box(lasreader->header.min_x, lasreader->header.min_y, lasreader->header.min_z, lasreader->header.max_x, lasreader->header.max_y, lasreader->header.max_z))
{
示例2: main
//.........这里部分代码省略.........
if (!laswriteopener.active())
{
// create name from input name
laswriteopener.make_file_name(lasreadopener.get_file_name(), -2);
}
// if the output was piped we need to precompute the bounding box, etc ...
if (laswriteopener.is_piped())
{
// because the output goes to a pipe we have to precompute the header
// information with an additional pass.
if (verbose) { fprintf(stderr, "piped output. extra read pass over file '%s' ...\n", lasreadopener.get_file_name()); }
while (lasreader->read_point());
lasreader->close();
// output some stats
if (verbose)
{
#ifdef _WIN32
fprintf(stderr, "npoints %I64d min %g %g %g max %g %g %g\n", lasreader->npoints, lasreader->header.min_x, lasreader->header.min_y, lasreader->header.min_z, lasreader->header.max_x, lasreader->header.max_y, lasreader->header.max_z);
#else
fprintf(stderr, "npoints %lld min %g %g %g max %g %g %g\n", lasreader->npoints, lasreader->header.min_x, lasreader->header.min_y, lasreader->header.min_z, lasreader->header.max_x, lasreader->header.max_y, lasreader->header.max_z);
#endif
fprintf(stderr, "return histogram %d %d %d %d %d\n", lasreader->header.number_of_points_by_return[0], lasreader->header.number_of_points_by_return[1], lasreader->header.number_of_points_by_return[2], lasreader->header.number_of_points_by_return[3], lasreader->header.number_of_points_by_return[4]);
fprintf(stderr,"took %g sec.\n", taketime()-start_time); start_time = taketime();
}
// reopen lasreader for the second pass
if (!lasreadopener.reopen(lasreader))
{
fprintf(stderr, "ERROR: could not reopen '%s' for main pass\n", lasreadopener.get_file_name());
byebye(true, argc==1);
}
}
// populate header
for (i = 0; i < 32; i++)
{
lasreader->header.system_identifier[i] = '\0';
lasreader->header.generating_software[i] = '\0';
}
if (set_system_identifier)
{
strncpy(lasreader->header.system_identifier, set_system_identifier, 32);
lasreader->header.system_identifier[31] = '\0';
}
else
{
strncpy(lasreader->header.system_identifier, "LAStools (c) by rapidlasso GmbH", 32);
lasreader->header.system_identifier[31] = '\0';
}
if (set_generating_software)
{
strncpy(lasreader->header.generating_software, set_generating_software, 32);
lasreader->header.generating_software[31] = '\0';
}
else
{
示例3: main
//.........这里部分代码省略.........
}
// check output
if (!laswriteopener.active())
{
// create name from input name
laswriteopener.make_file_name(lasreadopener.get_file_name());
}
// prepare the header for the surviving points
strncpy(lasreader->header.system_identifier, "LAStools (c) by Martin Isenburg", 32);
lasreader->header.system_identifier[31] = '\0';
char temp[64];
sprintf(temp, "las2las (version %d)", LAS_TOOLS_VERSION);
strncpy(lasreader->header.generating_software, temp, 32);
lasreader->header.generating_software[31] = '\0';
// open laswriter
LASwriter* laswriter = laswriteopener.open(&lasreader->header);
if (laswriter == 0)
{
fprintf(stderr, "ERROR: could not open laswriter\n");
byebye(true, argc==1);
}
// for piped output we need to re-open the input file
if (extra_pass)
{
if (!lasreadopener.reopen(lasreader))
{
fprintf(stderr, "ERROR: could not re-open lasreader\n");
byebye(true);
}
}
else
{
if (reproject_quantizer)
{
lasreader->header = *saved_quantizer;
delete saved_quantizer;
}
}
// maybe seek to start position
if (subsequence_start) lasreader->seek(subsequence_start);
// loop over points
if (point)
{
while (lasreader->read_point())
{
if (lasreader->p_count > subsequence_stop) break;
if (clip_to_bounding_box)
{
if (!lasreader->point.inside_box(lasreader->header.min_x, lasreader->header.min_y, lasreader->header.min_z, lasreader->header.max_x, lasreader->header.max_y, lasreader->header.max_z))
{
continue;
}