本文整理汇总了C++中StageFactory::createWriter方法的典型用法代码示例。如果您正苦于以下问题:C++ StageFactory::createWriter方法的具体用法?C++ StageFactory::createWriter怎么用?C++ StageFactory::createWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StageFactory
的用法示例。
在下文中一共展示了StageFactory::createWriter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nitfReader
TEST(NitfReaderTest, optionSrs)
{
StageFactory f;
Options nitfOpts;
nitfOpts.add("filename", Support::datapath("nitf/autzen-utm10.ntf"));
std::string sr = "PROJCS[\"NAD83 / UTM zone 11N\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-123],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"26910\"]]";
nitfOpts.add("spatialreference", sr);
PointContext ctx;
ReaderPtr nitfReader(f.createReader("readers.nitf"));
EXPECT_TRUE(nitfReader.get());
nitfReader->setOptions(nitfOpts);
Options lasOpts;
lasOpts.add("filename", "/dev/null");
WriterPtr lasWriter(f.createWriter("writers.las"));
EXPECT_TRUE(lasWriter.get());
lasWriter->setInput(nitfReader.get());
lasWriter->setOptions(lasOpts);;
lasWriter->prepare(ctx);
PointBufferSet pbSet = lasWriter->execute(ctx);
EXPECT_EQ(sr, nitfReader->getSpatialReference().getWKT());
EXPECT_EQ("", lasWriter->getSpatialReference().getWKT());
EXPECT_EQ(sr, ctx.spatialRef().getWKT());
}
示例2: visualize
void Kernel::visualize(PointBufferPtr buffer) const
{
BufferReader bufferReader;
bufferReader.addBuffer(buffer);
StageFactory f;
WriterPtr writer(f.createWriter("writers.pclvisualizer"));
writer->setInput(&bufferReader);
PointContext ctx;
writer->prepare(ctx);
writer->execute(ctx);
}
示例3: execute
//.........这里部分代码省略.........
" outs['Mask'] = keep\n"
" return True\n"
);
Option module("module", "MyModule");
Option function("function", "yow1");
Options opts;
opts.add(source);
opts.add(module);
opts.add(function);
// and create a PointBuffer of only ground returns
std::unique_ptr<Filter> pred(f.createFilter("filters.predicate"));
pred->setOptions(opts);
pred->setInput(input.get());
pred->prepare(ground_ctx);
pbSetGround = pred->execute(ground_ctx);
ground_buf = *pbSetGround.begin();
}
else
{
// the user has provided a file containing only ground returns, setup
// the reader, inferring driver type from the filename
std::string ground_driver = f.inferReaderDriver(m_ground_file);
std::unique_ptr<Reader> ground(f.createReader(ground_driver));
Options ro;
ro.add("filename", m_ground_file);
ground->setOptions(ro);
// go ahead and execute to get the PointBuffer
ground->prepare(ground_ctx);
pbSetGround = ground->execute(ground_ctx);
ground_buf = *pbSetGround.begin();
}
typedef pcl::PointXYZ PointT;
typedef pcl::PointCloud<PointT> Cloud;
typedef Cloud::Ptr CloudPtr;
// convert the input PointBuffer to a PointCloud
CloudPtr cloud(new Cloud);
BOX3D const& bounds = input_buf->calculateBounds();
pclsupport::PDALtoPCD(*input_buf, *cloud, bounds);
// convert the ground PointBuffer to a PointCloud
CloudPtr cloud_g(new Cloud);
// here, we offset the ground cloud by the input bounds so that the two are aligned
pclsupport::PDALtoPCD(*ground_buf, *cloud_g, bounds);
// create a set of planar coefficients with X=Y=0,Z=1
pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());
coefficients->values.resize(4);
coefficients->values[0] = coefficients->values[1] = 0;
coefficients->values[2] = 1.0;
coefficients->values[3] = 0;
// create the filtering object and project ground returns into xy plane
pcl::ProjectInliers<PointT> proj;
proj.setModelType(pcl::SACMODEL_PLANE);
proj.setInputCloud(cloud_g);
proj.setModelCoefficients(coefficients);
CloudPtr cloud_projected(new Cloud);
proj.filter(*cloud_projected);
// setup the KdTree
pcl::KdTreeFLANN<PointT> tree;
tree.setInputCloud(cloud_projected);
// loop over all points in the input cloud, finding the nearest neighbor in
// the ground returns (XY plane only), and calculating the difference in z
int32_t k = 1;
for (size_t idx = 0; idx < cloud->points.size(); ++idx)
{
// Search for nearesrt neighbor of the query point
std::vector<int32_t> neighbors(k);
std::vector<float> distances(k);
PointT temp_pt = cloud->points[idx];
temp_pt.z = 0.0f;
int num_neighbors = tree.nearestKSearch(temp_pt, k, neighbors, distances);
double hag = cloud->points[idx].z - cloud_g->points[neighbors[0]].z;
input_buf->setField(Dimension::Id::HeightAboveGround, idx, hag);
}
// populate BufferReader with the input PointBuffer, which now has the
// HeightAboveGround dimension
BufferReader bufferReader;
bufferReader.addBuffer(input_buf);
// we require that the output be BPF for now, to house our non-standard
// dimension
Options wo;
wo.add("filename", m_output_file);
std::unique_ptr<Writer> writer(f.createWriter("writers.bpf"));
writer->setOptions(wo);
writer->setInput(&bufferReader);
writer->prepare(input_ctx);
writer->execute(input_ctx);
return 0;
}