本文整理汇总了C++中LineString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ LineString::size方法的具体用法?C++ LineString::size怎么用?C++ LineString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineString
的用法示例。
在下文中一共展示了LineString::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cloneAs
Geometry*
Ring::cloneAs( const Geometry::Type& newType ) const
{
if ( newType == TYPE_LINESTRING )
{
LineString* line = new LineString( &this->asVector() );
if ( line->size() > 1 && line->front() != line->back() )
line->push_back( front() );
return line;
}
else return Geometry::cloneAs( newType );
}
示例2:
std::unordered_map<std::string, std::vector<Feature>> Source::Impl::queryRenderedFeatures(const QueryParameters& parameters) const {
std::unordered_map<std::string, std::vector<Feature>> result;
if (renderTiles.empty() || parameters.geometry.empty()) {
return result;
}
LineString<double> queryGeometry;
for (const auto& p : parameters.geometry) {
queryGeometry.push_back(TileCoordinate::fromScreenCoordinate(
parameters.transformState, 0, { p.x, parameters.transformState.getSize().height - p.y }).p);
}
mapbox::geometry::box<double> box = mapbox::geometry::envelope(queryGeometry);
auto sortRenderTiles = [](const RenderTile& a, const RenderTile& b) {
return a.id.canonical.z != b.id.canonical.z ? a.id.canonical.z < b.id.canonical.z :
a.id.canonical.y != b.id.canonical.y ? a.id.canonical.y < b.id.canonical.y :
a.id.wrap != b.id.wrap ? a.id.wrap < b.id.wrap : a.id.canonical.x < b.id.canonical.x;
};
std::vector<std::reference_wrapper<const RenderTile>> sortedTiles;
std::transform(renderTiles.cbegin(), renderTiles.cend(), std::back_inserter(sortedTiles),
[](const auto& pair) { return std::ref(pair.second); });
std::sort(sortedTiles.begin(), sortedTiles.end(), sortRenderTiles);
for (const auto& renderTileRef : sortedTiles) {
const RenderTile& renderTile = renderTileRef.get();
GeometryCoordinate tileSpaceBoundsMin = TileCoordinate::toGeometryCoordinate(renderTile.id, box.min);
if (tileSpaceBoundsMin.x >= util::EXTENT || tileSpaceBoundsMin.y >= util::EXTENT) {
continue;
}
GeometryCoordinate tileSpaceBoundsMax = TileCoordinate::toGeometryCoordinate(renderTile.id, box.max);
if (tileSpaceBoundsMax.x < 0 || tileSpaceBoundsMax.y < 0) {
continue;
}
GeometryCoordinates tileSpaceQueryGeometry;
tileSpaceQueryGeometry.reserve(queryGeometry.size());
for (const auto& c : queryGeometry) {
tileSpaceQueryGeometry.push_back(TileCoordinate::toGeometryCoordinate(renderTile.id, c));
}
renderTile.tile.queryRenderedFeatures(result,
tileSpaceQueryGeometry,
parameters.transformState,
parameters.layerIDs);
}
return result;
}