本文整理汇总了C++中PointView::spatialReference方法的典型用法代码示例。如果您正苦于以下问题:C++ PointView::spatialReference方法的具体用法?C++ PointView::spatialReference怎么用?C++ PointView::spatialReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointView
的用法示例。
在下文中一共展示了PointView::spatialReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateGEOSBuffer
void AttributeFilter::UpdateGEOSBuffer(PointView& view)
{
QuadIndex idx(view);
if (m_layer.size())
m_lyr = OGR_DS_GetLayerByName(m_ds.get(), m_layer.c_str());
else if (m_query.size())
m_lyr = OGR_DS_ExecuteSQL(m_ds.get(), m_query.c_str(), 0, 0);
else
m_lyr = OGR_DS_GetLayer(m_ds.get(), 0);
if (!m_lyr)
{
std::ostringstream oss;
oss << getName() << ": Unable to select layer '" << m_layer << "'";
throw pdal_error(oss.str());
}
OGRFeaturePtr feature = OGRFeaturePtr(OGR_L_GetNextFeature(m_lyr),
OGRFeatureDeleter());
int field_index(1); // default to first column if nothing was set
if (m_column.size())
{
field_index = OGR_F_GetFieldIndex(feature.get(), m_column.c_str());
if (field_index == -1)
{
std::ostringstream oss;
oss << getName() << ": No column name '" << m_column <<
"' was found.";
throw pdal_error(oss.str());
}
}
while (feature)
{
OGRGeometryH geom = OGR_F_GetGeometryRef(feature.get());
OGRwkbGeometryType t = OGR_G_GetGeometryType(geom);
int32_t fieldVal = OGR_F_GetFieldAsInteger(feature.get(), field_index);
if (!(t == wkbPolygon ||
t == wkbMultiPolygon ||
t == wkbPolygon25D ||
t == wkbMultiPolygon25D))
{
std::ostringstream oss;
oss << getName() << ": Geometry is not Polygon or MultiPolygon!";
throw pdal::pdal_error(oss.str());
}
pdal::Polygon p(geom, view.spatialReference(), GlobalEnvironment::get().geos());
// Compute a total bounds for the geometry. Query the QuadTree to
// find out the points that are inside the bbox. Then test each
// point in the bbox against the prepared geometry.
BOX3D box = p.bounds();
std::vector<PointId> ids = idx.getPoints(box);
for (const auto& i : ids)
{
PointRef ref(view, i);
if (p.covers(ref))
view.setField(m_dim, i, fieldVal);
}
feature = OGRFeaturePtr(OGR_L_GetNextFeature(m_lyr),
OGRFeatureDeleter());
}
}