当前位置: 首页>>代码示例>>C++>>正文


C++ LASreadOpener::set_parse_string方法代码示例

本文整理汇总了C++中LASreadOpener::set_parse_string方法的典型用法代码示例。如果您正苦于以下问题:C++ LASreadOpener::set_parse_string方法的具体用法?C++ LASreadOpener::set_parse_string怎么用?C++ LASreadOpener::set_parse_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LASreadOpener的用法示例。


在下文中一共展示了LASreadOpener::set_parse_string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

/*
==================================
 LoadWorker::run()

 Starts the worker.
==================================
*/
void LoadWorker::run()
{
	int num_files = filenames.size();

	// Has a new quadtree been created?
	bool newQuadtree = false;

	try
	{
		// For each file
		for (int i = 0; i < num_files; ++i)
		{
			std::string filename = filenames[i];
			send_message(filename);

			if (filename != "")
			{
				filetype_t file_type = test_filename(filename);

				if (file_type == UNKNOWN_FILE)
				{
					send_message(
							"Unrecognised file type. Supported formats: las, txt, csv.");
					sig_fail();
					return;
				}

				LASreadOpener lasreadopener;

				lasreadopener.set_file_name(filename.c_str());

				// ASCII files
				if (file_type == ASCII_FILE)
				{
					lasreadopener.set_parse_string(ascii_code.c_str());
					if (!use_default_scale_factors)
					{
						lasreadopener.set_scale_factor(scale_factor);
					}
				}

				// Point filter
				if (point_filter.argc != 0)
				{
					std::vector<char*> argv;
					std::transform(point_filter.args.begin(), point_filter.args.end(), std::back_inserter(argv), convert_string);
					argv.push_back(0);

					if (!lasreadopener.parse(point_filter.argc, &argv[0]))
					{
						for (size_t i = 0; i < argv.size(); ++i)
							delete[] argv[i];

						send_message("Error parsing filter parameters.");
						sig_fail();
						return;
					}

					for (size_t i = 0; i < argv.size(); ++i)
						delete[] argv[i];
				}

				reader = lasreadopener.open();

				if (reader == NULL)
				{
					send_message("Error opening the file.");
					sig_fail();
					return;
				}

				// Check if we have a latlong file
				latlong = is_latlong(reader);

				// If we have latlong convert to UTM
				if (latlong)
					convert_projection();

				// Get file boundary
				Boundary boundary = get_boundary();

				fileopener->set_utm_zone(get_utm_zone());

				// If refreshing
				if ((i == 0
						&& (create_new_quadtree
								|| !fileopener->get_loadedanyfiles()))
						|| fileopener->get_lidardata() == NULL)
				{
					// Delete old quadtree
					fileopener->delete_lidardata();

					// Create new quadree
//.........这里部分代码省略.........
开发者ID:bsmaldon,项目名称:lag,代码行数:101,代码来源:LoadWorker.cpp

示例2: main


//.........这里部分代码省略.........
#else
      fprintf(stderr, "WARNING: not compiled with GUI support. ignoring '-gui' ...\n");
#endif
    }
    else if (strcmp(argv[i],"-cores") == 0)
    {
#ifdef COMPILE_WITH_MULTI_CORE
      if ((i+1) >= argc)
      {
        fprintf(stderr,"ERROR: '%s' needs 1 argument: number\n", argv[i]);
        usage(true);
      }
      argv[i][0] = '\0';
      i++;
      cores = atoi(argv[i]);
      argv[i][0] = '\0';
#else
      fprintf(stderr, "WARNING: not compiled with multi-core batching. ignoring '-cores' ...\n");
      i++;
#endif
    }
    else if (strcmp(argv[i],"-quiet") == 0)
    {
      quiet = true;
    }
    else if (strcmp(argv[i],"-parse") == 0)
    {
      if ((i+1) >= argc)
      {
        fprintf(stderr,"ERROR: '%s' needs 1 argument: parse_string\n", argv[i]);
        usage(true);
      }
      i++;
      lasreadopener.set_parse_string(argv[i]);
    }
    else if (strcmp(argv[i],"-skip") == 0)
    {
      if ((i+1) >= argc)
      {
        fprintf(stderr,"ERROR: '%s' needs 1 argument: number_of_lines\n", argv[i]);
        usage(true);
      }
      i++;
      lasreadopener.set_skip_lines(atoi(argv[i]));
    }
    else if (strcmp(argv[i],"-set_scale") == 0)
    {
      if ((i+3) >= argc)
      {
        fprintf(stderr,"ERROR: '%s' needs 3 arguments: x y z\n", argv[i]);
        usage(true);
      }
      F64 scale_factor[3];
      i++;
      sscanf(argv[i], "%lf", &(scale_factor[0]));
      i++;
      sscanf(argv[i], "%lf", &(scale_factor[1]));
      i++;
      sscanf(argv[i], "%lf", &(scale_factor[2]));
      lasreadopener.set_scale_factor(scale_factor);
    }
    else if (strcmp(argv[i],"-set_offset") == 0)
    {
      if ((i+3) >= argc)
      {
        fprintf(stderr,"ERROR: '%s' needs 3 arguments: x y z\n", argv[i]);
开发者ID:GrowthRing,项目名称:LAStools,代码行数:67,代码来源:txt2las.cpp


注:本文中的LASreadOpener::set_parse_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。