本文整理汇总了C++中Options::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Options::add方法的具体用法?C++ Options::add怎么用?C++ Options::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getReaderOptions
Options getReaderOptions()
{
Options options;
options.add("spatialreference", "EPSG:2926");
options.add("connection", tempFilename);
options.add("query", "SELECT b.schema, l.cloud, l.block_id, "
"l.num_points, l.bbox, l.extent, l.points, b.cloud "
"FROM PDAL_TEST_BLOCKS l, PDAL_TEST_BASE b "
"WHERE l.cloud = b.cloud and l.cloud in (1) "
"order by l.cloud");
return options;
}
示例2: Options
Options *TTestBayesianOneSample::createDefaultOptions()
{
Options *options = new Options();
options->add("variables", new OptionFields());
options->add("testValue", new OptionNumber(0));
options->add("meanDifference", new OptionBoolean());
options->add("confidenceInterval", new OptionBoolean());
options->add("confidenceIntervalInterval", new OptionNumber(.95, 0, 1, "%"));
options->add("descriptives", new OptionBoolean());
vector<string> missingValues;
missingValues.push_back("excludeAnalysisByAnalysis");
missingValues.push_back("excludeListwise");
options->add("missingValues", new OptionList(missingValues));
vector<string> tails;
tails.push_back("twoTailed");
tails.push_back("oneTailedGreaterThan");
tails.push_back("oneTailedLessThan");
options->add("tails", new OptionList(tails));
return options;
}
示例3:
TEST(SplitterTest, test_buffer)
{
Options readerOptions;
readerOptions.add("filename", Support::datapath("las/1.2-with-color.las"));
LasReader reader;
reader.setOptions(readerOptions);
Options splitterOptions;
splitterOptions.add("length", 1000);
splitterOptions.add("buffer", 20);
SplitterFilter splitter;
splitter.setOptions(splitterOptions);
splitter.setInput(reader);
PointTable table;
splitter.prepare(table);
PointViewSet viewSet = splitter.execute(table);
std::vector<PointViewPtr> views;
std::map<PointViewPtr, BOX2D> bounds;
for (auto it = viewSet.begin(); it != viewSet.end(); ++it)
{
BOX2D b;
PointViewPtr v = *it;
v->calculateBounds(b);
EXPECT_TRUE(b.maxx - b.minx <= 1040);
EXPECT_TRUE(b.maxy - b.miny <= 1040);
bounds[v] = b;
views.push_back(v);
}
auto sorter = [&bounds](PointViewPtr p1, PointViewPtr p2)
{
BOX2D b1 = bounds[p1];
BOX2D b2 = bounds[p2];
return b1.minx < b2.minx ? true :
b1.minx > b2.minx ? false :
b1.miny < b2.miny;
};
std::sort(views.begin(), views.end(), sorter);
EXPECT_EQ(views.size(), 24u);
size_t counts[] = {26, 26, 3, 28, 27, 13, 14, 65, 80, 47, 80, 89, 94,
77, 5, 79, 65, 34, 63, 67, 74, 69, 36, 5};
size_t i = 0;
for (PointViewPtr view : views)
EXPECT_EQ(view->size(), counts[i++]);
}
示例4: getDefaultOptions
Options Predicate::getDefaultOptions()
{
Options options;
Option script("script", "");
options.add(script);
Option module("module", "");
options.add(module);
Option function("function", "");
options.add(function);
return options;
}
示例5: getDefaultOptions
Options Crop::getDefaultOptions()
{
Options options;
Option bounds("bounds",BOX3D(),"bounds to crop to");
Option polygon("polygon", std::string(""),
"WKT POLYGON() string to use to filter points");
Option inside("inside", true, "keep points that are inside or outside "
"the given polygon");
options.add(inside);
options.add(polygon);
options.add(bounds);
return options;
}
示例6: view
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);
}
示例7: readData
void readData()
{
std::ostringstream oss;
oss << "SELECT l.\"OBJ_ID\", l.\"BLK_ID\", l.\"BLK_EXTENT\", " <<
"l.\"BLK_DOMAIN\", l.\"PCBLK_MIN_RES\", l.\"PCBLK_MAX_RES\", " <<
"l.\"NUM_POINTS\", l.\"NUM_UNSORTED_POINTS\", l.\"PT_SORT_DIM\", " <<
"l.\"POINTS\", b.cloud "
"FROM PDAL_TEST_BLOCKS l, PDAL_TEST_BASE b "
"WHERE b.id = l.obj_id ORDER BY l.blk_id ";
Options options = readerOptions();
options.add("query", oss.str());
StageFactory f;
Stage* reader(f.createStage("readers.oci"));
EXPECT_TRUE(reader);
reader->setOptions(options);
PointTable table;
reader->prepare(table);
PointViewSet viewSet = reader->execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 1065u);
compare(view, Support::datapath("autzen/autzen-utm.las"));
}
示例8: getDefaultOptions
Options QfitReader::getDefaultOptions()
{
Options options;
Option filename("filename", "", "file to read from");
Option flip_coordinates("flip_coordinates", true,
"Flip coordinates from 0-360 to -180-180");
Option convert_z_units("scale_z", 0.001f,
"Z scale. Use 0.001 to go from mm to m");
Option little_endian("little_endian", false,
"Are data in little endian format?");
options.add(filename);
options.add(flip_coordinates);
options.add(convert_z_units);
options.add(little_endian);
return options;
}
示例9: setup
void InfoKernel::setup(const std::string& filename)
{
m_manager = makePipeline(filename, !m_needPoints);
Stage *stage = m_manager->getStage();
if (m_showStats)
{
m_statsStage = &(m_manager->addFilter("filters.stats"));
if (m_dimensions.size())
{
Options ops;
ops.add("dimensions", m_dimensions);
m_statsStage->addOptions(ops);
}
m_statsStage->setInput(*stage);
stage = m_statsStage;
}
if (m_boundary)
{
m_hexbinStage = &(m_manager->addFilter("filters.hexbin"));
if (!m_hexbinStage) {
throw pdal_error("Unable to compute boundary -- "
"http://github.com/hobu/hexer is not linked. "
"See the \"boundary\" member in \"stats\" for a coarse "
"bounding box");
}
m_hexbinStage->setInput(*stage);
}
}
示例10: main
int main(int argc, char * const *argv)
{
bool readable = false;
vector<string> graphs;
options.add('h', "human", readable, true, "Human readable output.");
std::set_new_handler(out_of_memory);
std::locale::global(std::locale(""));
graphs = options.parseArgs(argc, argv);
if (graphs.size() != 1) {
cerr << "Wrong number of arguments!" << endl;
options.usage(cerr);
}
if (readable) cout.imbue(std::locale());
Graph<uint64_t, uint64_t> graph(graphs[0]);
for (auto v : graph.vertices) {
for (auto &e : v.edges) {
cout << v.id << " " << e << endl;
}
}
return 0;
}
示例11: getDefaultOptions
Options FauxReader::getDefaultOptions()
{
Options options;
Option count("num_points", 10, "Number of points");
options.add(count);
return options;
}
示例12:
TEST(OptionsTest, implicitdefault)
{
Options ops;
ops.add("a", "This, is,a, test ,,");
ops.add("b", 25);
int i = ops.getValueOrDefault<int>("c");
EXPECT_EQ(i, 0);
i = ops.getValueOrDefault<int>("b");
EXPECT_EQ(i, 25);
std::vector<std::string> slist =
ops.getValueOrDefault<std::vector<std::string>>("d");
EXPECT_EQ(slist.size(), (size_t)0);
slist = ops.getValueOrDefault<std::vector<std::string>>("a");
EXPECT_EQ(slist.size(), (size_t)4);
}
示例13: getDefaultOptions
Options Splitter::getDefaultOptions()
{
Options options;
Option length("length", 1000, "Splitter length");
options.add(length);
return options;
}
示例14: makeFilterOptions
Options makeFilterOptions(int threadNum, int filterNum, bool log)
{
using namespace std;
ostringstream id;
id << "T" << threadNum << "F" << filterNum;
ostringstream function_id;
function_id << "function_" << id.str();
ostringstream module_id;
function_id << "module_" << id.str();
ostringstream script;
script <<
"import numpy as np\n"
"def " << function_id.str() << "(ins,outs):\n"
" #print 'hi1 " << id.str() << "'\n"
" X = ins['X']\n"
" #print 'hi2 " << id.str() << "'\n"
" X = X + 1.0\n"
" #print 'hi2 " << id.str() << "'\n"
" outs['X'] = X\n"
" #print 'hi4 " << id.str() << "'\n"
" return True\n"
;
Options opts;
{
const pdal::Option source("source", script.str());
const pdal::Option module("module", module_id.str());
const pdal::Option function("function", function_id.str());
opts.add(source);
opts.add(module);
opts.add(function);
if (log)
{
ostringstream log_id;
log_id << "log_" << id.str() << ".txt";
Option optlog("log", Support::temppath(log_id.str()));
opts.add(optlog);
}
}
return opts;
}
示例15: getDefaultOptions
Options ColorizationFilter::getDefaultOptions()
{
Options options;
options.add("dimensions", "Red:1:1.0, Green:2:1.0, Blue:3");
return options;
}