本文整理汇总了C++中PointLayoutPtr::findDim方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLayoutPtr::findDim方法的具体用法?C++ PointLayoutPtr::findDim怎么用?C++ PointLayoutPtr::findDim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointLayoutPtr
的用法示例。
在下文中一共展示了PointLayoutPtr::findDim方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ready
void FerryFilter::ready(PointTableRef table)
{
const PointLayoutPtr layout(table.layout());
for (const auto& dim_par : m_name_map)
{
Dimension::Id f = layout->findDim(dim_par.first);
Dimension::Id t = layout->findDim(dim_par.second);
m_dimensions_map.insert(std::make_pair(f,t));
}
}
示例2:
TEST(TextReaderTest, insertHeader)
{
TextReader reader;
Options options;
options.add("header", "A,B,C,G");
options.add("filename", Support::datapath("text/crlf_test.txt"));
reader.setOptions(options);
PointTable table;
reader.prepare(table);
PointViewSet pointViewSet = reader.execute(table);
PointViewPtr pointViewPtr = *pointViewSet.begin();
EXPECT_EQ(pointViewPtr->size(), 11U);
PointLayoutPtr layout = table.layout();
EXPECT_TRUE(layout->findDim("A") != Dimension::Id::Unknown);
EXPECT_TRUE(layout->findDim("B") != Dimension::Id::Unknown);
EXPECT_TRUE(layout->findDim("C") != Dimension::Id::Unknown);
EXPECT_TRUE(layout->findDim("G") != Dimension::Id::Unknown);
}
示例3: prepared
void RangeFilter::prepared(PointTableRef table)
{
const PointLayoutPtr layout(table.layout());
for (auto& r : m_range_list)
{
r.m_id = layout->findDim(r.m_name);
if (r.m_id == Dimension::Id::Unknown)
throwError("Invalid dimension name in 'limits' option: '" +
r.m_name + "'.");
}
std::sort(m_range_list.begin(), m_range_list.end());
}
示例4: verify
TEST(GDALReaderTest, simple)
{
Options ro;
ro.add("filename", Support::datapath("png/autzen-height.png"));
GDALReader gr;
gr.setOptions(ro);
PointTable t;
gr.prepare(t);
PointViewSet s = gr.execute(t);
PointViewPtr v = *s.begin();
PointLayoutPtr l = t.layout();
Dimension::Id::Enum id1 = l->findDim("band-1");
Dimension::Id::Enum id2 = l->findDim("band-2");
Dimension::Id::Enum id3 = l->findDim("band-3");
EXPECT_EQ(v->size(), (size_t)(735 * 973));
auto verify = [v, id1, id2, id3]
(PointId idx, double xx, double xy, double xr, double xg, double xb)
{
double r, g, b, x, y;
x = v->getFieldAs<double>(Dimension::Id::X, idx);
y = v->getFieldAs<double>(Dimension::Id::Y, idx);
r = v->getFieldAs<double>(id1, idx);
g = v->getFieldAs<double>(id2, idx);
b = v->getFieldAs<double>(id3, idx);
EXPECT_DOUBLE_EQ(x, xx);
EXPECT_DOUBLE_EQ(y, xy);
EXPECT_DOUBLE_EQ(r, xr);
EXPECT_DOUBLE_EQ(g, xg);
EXPECT_DOUBLE_EQ(b, xb);
};
verify(0, .5, .5, 0, 0, 0);
verify(120000, 195.5, 163.5, 255, 213, 0);
verify(290000, 410.5, 394.5, 0, 255, 206);
verify(715154, 734.5, 972.5, 0, 0, 0);
}
示例5: addDimensions
void FerryFilter::addDimensions(PointLayoutPtr layout)
{
for (auto& info : m_dims)
{
const Dimension::Id fromId = layout->findDim(info.m_fromName);
// Dimensions being created with the "=>Dim" syntax won't
// be in the layout, so we have to assign a default type.
Dimension::Type fromType = layout->dimType(fromId);
if (fromType == Dimension::Type::None)
fromType = Dimension::Type::Double;
info.m_toId = layout->registerOrAssignDim(info.m_toName, fromType);
}
}
示例6: loadBpfDimensions
void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)
{
Dimension::IdList dims;
if (m_outputDims.size())
{
for (std::string& s : m_outputDims)
{
Dimension::Id::Enum id = layout->findDim(s);
if (id == Dimension::Id::Unknown)
{
std::ostringstream oss;
oss << "Invalid dimension '" << s << "' specified for "
"'output_dims' option.";
throw pdal_error(oss.str());
}
dims.push_back(id);
}
}
else
dims = layout->dims();
// Verify that we have X, Y and Z and that they're the first three
// dimensions.
std::sort(dims.begin(), dims.end());
if (dims.size() < 3 || dims[0] != Dimension::Id::X ||
dims[1] != Dimension::Id::Y || dims[2] != Dimension::Id::Z)
{
throw pdal_error("Missing one of dimensions X, Y or Z. "
"Can't write BPF.");
}
for (auto id : dims)
{
BpfDimension dim;
dim.m_id = id;
dim.m_label = layout->dimName(id);
m_dims.push_back(dim);
}
}