本文整理汇总了C++中LasWriter类的典型用法代码示例。如果您正苦于以下问题:C++ LasWriter类的具体用法?C++ LasWriter怎么用?C++ LasWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LasWriter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
// Test auto scale/offset for streaming mode.
TEST(LasWriterTest, issue1940)
{
StageFactory f;
Stage& r = *(f.createStage("readers.faux"));
Options ro;
ro.add("mode", "constant");
ro.add("bounds", "([55,55],[55,55],[55,55])");
ro.add("count", 20);
r.addOptions(ro);
LasWriter w;
Options wo;
//LogPtr log(new Log("TEST", &std::clog));
//log->setLevel((LogLevel)5);
//w.setLog(log);
wo.add("filename", Support::temppath("out.las"));
wo.add("scale_x", "auto");
wo.add("offset_y", "auto");
w.addOptions(wo);
w.setInput(r);
FixedPointTable t(100);
w.prepare(t);
w.execute(t);
LasTester tester;
LasHeader *h = tester.header(w);
EXPECT_DOUBLE_EQ(h->offsetX(), 0);
EXPECT_DOUBLE_EQ(h->offsetY(), 55);
EXPECT_DOUBLE_EQ(h->scaleX(), 1.0);
EXPECT_DOUBLE_EQ(h->scaleY(), .01);
}
示例2: genlas
bool genlas(const ossimFilename& fname)
{
cout << "Generating file <"<<fname<<">"<<endl;
FauxReader reader;
Options roptions;
BOX3D bbox(-0.001, -0.001, -100.0, 0.001, 0.001, 100.0);
roptions.add("bounds", bbox);
roptions.add("num_points", 11);
roptions.add("mode", "ramp");
reader.setOptions(roptions);
LasWriter writer;
Options woptions;
woptions.add("filename", fname.string());
woptions.add("a_srs", "EPSG:4326"); // causes core dump when ossimInit::initialize() called on startup
woptions.add("scale_x", 0.0000001);
woptions.add("scale_y", 0.0000001);
writer.setOptions(woptions);
writer.setInput(reader);
PointTable wtable;
writer.prepare(wtable);
writer.execute(wtable);
return true;
}
示例3: compareTextLasStreaming
void compareTextLasStreaming(const std::string& textFilename,
const std::string& lasFilename)
{
std::string tempname(Support::temppath("testlas.las"));
FileUtils::deleteFile(tempname);
TextReader t;
Options to;
to.add("filename", textFilename);
t.setOptions(to);
LasWriter w;
Options wo;
wo.add("filename", tempname);
w.setInput(t);
w.setOptions(wo);
FixedPointTable in(1000);
w.prepare(in);
w.execute(in);
LasReader l1;
Options l1o;
l1o.add("filename", lasFilename);
l1.setOptions(l1o);
LasReader l2;
Options l2o;
l2o.add("filename", tempname);
l2.setOptions(l2o);
PointTable t1;
l1.prepare(t1);
PointViewSet s1 = l1.execute(t1);
EXPECT_EQ(s1.size(), 1U);
PointViewPtr v1 = *s1.begin();
PointTable t2;
l2.prepare(t2);
PointViewSet s2 = l2.execute(t2);
EXPECT_EQ(s2.size(), 1U);
PointViewPtr v2 = *s2.begin();
EXPECT_EQ(v1->size(), v2->size());
// Validate some point data.
for (PointId i = 0; i < v1->size(); ++i)
{
EXPECT_DOUBLE_EQ(v1->getFieldAs<double>(Dimension::Id::X, i),
v2->getFieldAs<double>(Dimension::Id::X, i));
EXPECT_DOUBLE_EQ(v1->getFieldAs<double>(Dimension::Id::Y, i),
v2->getFieldAs<double>(Dimension::Id::Y, i));
EXPECT_DOUBLE_EQ(v1->getFieldAs<double>(Dimension::Id::Z, i),
v2->getFieldAs<double>(Dimension::Id::Z, i));
}
}
示例4: TEST
TEST(LasWriterTest, auto_offset)
{
using namespace Dimension;
const std::string FILENAME(Support::temppath("offset_test.las"));
PointTable table;
table.layout()->registerDim(Id::X);
BufferReader bufferReader;
PointViewPtr view(new PointView(table));
view->setField(Id::X, 0, 125000.00);
view->setField(Id::X, 1, 74529.00);
view->setField(Id::X, 2, 523523.02);
bufferReader.addView(view);
Options writerOps;
writerOps.add("filename", FILENAME);
writerOps.add("offset_x", "auto");
writerOps.add("scale_x", "auto");
LasWriter writer;
writer.setOptions(writerOps);
writer.setInput(bufferReader);
writer.prepare(table);
writer.execute(table);
Options readerOps;
readerOps.add("filename", FILENAME);
PointTable readTable;
LasReader reader;
reader.setOptions(readerOps);
reader.prepare(readTable);
EXPECT_DOUBLE_EQ(74529.00, reader.header().offsetX());
PointViewSet viewSet = reader.execute(readTable);
EXPECT_EQ(viewSet.size(), 1u);
view = *viewSet.begin();
EXPECT_EQ(view->size(), 3u);
EXPECT_NEAR(125000.00, view->getFieldAs<double>(Id::X, 0), .0001);
EXPECT_NEAR(74529.00, view->getFieldAs<double>(Id::X, 1), .0001);
EXPECT_NEAR(523523.02, view->getFieldAs<double>(Id::X, 2), .0001);
FileUtils::deleteFile(FILENAME);
}
示例5: TEST
TEST(LasWriterTest, metadata_options)
{
Options ops;
Option metadataOp("metadata", "");
Options metadataOps;
metadataOps.add("format", 4);
metadataOps.add("software_id", "MySoftwareId");
metadataOps.add("system_id", "FORWARD");
metadataOps.add("minor_version", "forward");
metadataOp.setOptions(metadataOps);
ops.add(metadataOp);
ops.add("filename", Support::temppath("wontgetwritten"));
LasWriter writer;
writer.setOptions(ops);
PointTable table;
writer.prepare(table);
MetadataNode m = writer.getMetadata();
m.add("minor_version", 56);
uint8_t format =
(uint8_t)LasTester::headerVal<unsigned>(writer, "format");
EXPECT_EQ(format, 4u);
std::string softwareId =
LasTester::headerVal<std::string>(writer, "software_id");
EXPECT_EQ(softwareId, "MySoftwareId");
std::string systemId =
LasTester::headerVal<std::string>(writer, "system_id");
// Since the option specifies forward and there is not associated
// metadata, the value should be the default.
LasHeader header;
EXPECT_EQ(systemId, header.getSystemIdentifier());
// In this case, we should have metadata to override the default.
uint8_t minorVersion =
(uint8_t)LasTester::headerVal<unsigned>(writer, "minor_version");
EXPECT_EQ(minorVersion, 56u);
}
示例6: TEST
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);
PointTable table;
Stage* nitfReader(f.createStage("readers.nitf"));
EXPECT_TRUE(nitfReader);
nitfReader->setOptions(nitfOpts);
Options lasOpts;
lasOpts.add("filename", "/dev/null");
LasWriter writer;
writer.setInput(*nitfReader);
writer.setOptions(lasOpts);;
writer.prepare(table);
PointViewSet pbSet = writer.execute(table);
EXPECT_EQ(sr, nitfReader->getSpatialReference().getWKT());
EXPECT_EQ("", writer.getSpatialReference().getWKT());
EXPECT_EQ(sr, table.spatialReference().getWKT());
}
示例7: addVlr
void addVlr(LasWriter& w, const std::string& userId, uint16_t recordId,
std::string description, std::vector<uint8_t>& data)
{ w.addVlr(userId, recordId, description, data); }