本文整理汇总了C++中TerrainTile::setChildSE方法的典型用法代码示例。如果您正苦于以下问题:C++ TerrainTile::setChildSE方法的具体用法?C++ TerrainTile::setChildSE怎么用?C++ TerrainTile::setChildSE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TerrainTile
的用法示例。
在下文中一共展示了TerrainTile::setChildSE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CTBException
TerrainTile *
ctb::TerrainTiler::createTile(const TileCoordinate &coord) const {
// Get a terrain tile represented by the tile coordinate
TerrainTile *terrainTile = new TerrainTile(coord);
GDALTile *rasterTile = createRasterTile(coord); // the raster associated with this tile coordinate
GDALRasterBand *heightsBand = rasterTile->dataset->GetRasterBand(1);
// Copy the raster data into an array
float rasterHeights[TerrainTile::TILE_CELL_SIZE];
if (heightsBand->RasterIO(GF_Read, 0, 0, TILE_SIZE, TILE_SIZE,
(void *) rasterHeights, TILE_SIZE, TILE_SIZE, GDT_Float32,
0, 0) != CE_None) {
throw CTBException("Could not read heights from raster");
}
delete rasterTile;
// Convert the raster data into the terrain tile heights. This assumes the
// input raster data represents meters above sea level. Each terrain height
// value is the number of 1/5 meter units above -1000 meters.
// TODO: try doing this using a VRT derived band:
// (http://www.gdal.org/gdal_vrttut.html)
for (unsigned short int i = 0; i < TerrainTile::TILE_CELL_SIZE; i++) {
terrainTile->mHeights[i] = (i_terrain_height) ((rasterHeights[i] + 1000) * 5);
}
// If we are not at the maximum zoom level we need to set child flags on the
// tile where child tiles overlap the dataset bounds.
if (coord.zoom != maxZoomLevel()) {
CRSBounds tileBounds = mGrid.tileBounds(coord);
if (! (bounds().overlaps(tileBounds))) {
terrainTile->setAllChildren(false);
} else {
if (bounds().overlaps(tileBounds.getSW())) {
terrainTile->setChildSW();
}
if (bounds().overlaps(tileBounds.getNW())) {
terrainTile->setChildNW();
}
if (bounds().overlaps(tileBounds.getNE())) {
terrainTile->setChildNE();
}
if (bounds().overlaps(tileBounds.getSE())) {
terrainTile->setChildSE();
}
}
}
return terrainTile;
}