osgEarth 2.1.1
|
Public Member Functions | |
UnifiedCubeProfile () | |
virtual void | getIntersectingTiles (const GeoExtent &extent, std::vector< TileKey > &out_intersectingKeys) const |
Static Public Member Functions | |
static int | getFace (const TileKey &key) |
Private Member Functions | |
GeoExtent | transformGcsExtentOnFace (const GeoExtent &gcsExtent, int face) const |
Private Attributes | |
GeoExtent | _faceExtent_gcs [6] |
Custom profile for the unified cube tile layout.
This is a whole-earth profile consisting of 6 cube faces. The first 4 faces represent the equatorial regions between -45 and 45 degrees latitude. The lat 2 faces represent the polar regions.
The face extents in lat/long are: (lat,lon min => lat,lon max)
Face 0 : (-180, -45 => -90, 45) Face 1 : (-90, -45 => 0, 45) Face 2 : (0, -45 => 90, 45) Face 3 : (90, -45 => 180, 45 ) Face 4 : (-180, 45 => 180, 90) Face 5 : (-180, -90 => 180, -45)
Each face was a local unit coordinate system of (0.0, 0.0 => 1.0, 1.0). The profile lays the 6 faces out in a row, making a cube coordinate system of (0.0, 0.0 => 6.0, 1.0).
NOTE! This profile is non-contiguous and cannot be created as a single rectangular domain.
UnifiedCubeProfile::UnifiedCubeProfile | ( | ) |
Definition at line 578 of file Cube.cpp.
: Profile(SpatialReference::create( "unified-cube" ), 0.0, 0.0, 6.0, 1.0, -180.0, -90.0, 180.0, 90.0, 0L, // let it automatically create a VSRS 6, 1 ) { const SpatialReference* srs = getSRS()->getGeographicSRS(); // set up some constant extents _faceExtent_gcs[0] = GeoExtent( srs, -180, -45, -90, 45 ); _faceExtent_gcs[1] = GeoExtent( srs, -90, -45, 0, 45 ); _faceExtent_gcs[2] = GeoExtent( srs, 0, -45, 90, 45 ); _faceExtent_gcs[3] = GeoExtent( srs, 90, -45, 180, 45 ); _faceExtent_gcs[4] = GeoExtent( srs, -180, 45, 180, 90 ); // north polar _faceExtent_gcs[5] = GeoExtent( srs, -180, -90, 180, -45 ); // south polar }
int UnifiedCubeProfile::getFace | ( | const TileKey & | key | ) | [static] |
Gets the cube face associated with a tile key (in cube srs).
Definition at line 616 of file Cube.cpp.
{ return key.getTileX() >> key.getLevelOfDetail(); }
void UnifiedCubeProfile::getIntersectingTiles | ( | const GeoExtent & | extent, |
std::vector< TileKey > & | out_intersectingKeys | ||
) | const [virtual] |
Gets the intersecting tiles of this Profile with the given extents
Reimplemented from osgEarth::Profile.
Definition at line 664 of file Cube.cpp.
{ if ( getSRS()->isEquivalentTo( remoteExtent.getSRS() ) ) { addIntersectingTiles( remoteExtent, out_intersectingKeys ); } else { // the cube profile is non-contiguous. so there may be multiple local extents required // to fully intersect the remote extent. // first transform the remote extent to lat/long. GeoExtent remoteExtent_gcs = remoteExtent.getSRS()->isGeographic() ? remoteExtent : remoteExtent.transform( remoteExtent.getSRS()->getGeographicSRS() ); // Chop the input extent into three separate extents: for the equatorial, north polar, // and south polar tile regions. for( int face=0; face<6; ++face ) { GeoExtent partExtent_gcs = _faceExtent_gcs[face].intersectionSameSRS( remoteExtent_gcs.bounds() ); if ( partExtent_gcs.isValid() ) { GeoExtent partExtent = transformGcsExtentOnFace( partExtent_gcs, face ); addIntersectingTiles( partExtent, out_intersectingKeys ); } } } }
GeoExtent UnifiedCubeProfile::transformGcsExtentOnFace | ( | const GeoExtent & | gcsExtent, |
int | face | ||
) | const [private] |
Definition at line 622 of file Cube.cpp.
{ if ( face < 4 ) { const GeoExtent& fex = _faceExtent_gcs[face]; return GeoExtent( getSRS(), (double)face + (gcsExtent.xMin()-fex.xMin()) / fex.width(), (gcsExtent.yMin()-fex.yMin()) / fex.height(), (double)face + (gcsExtent.xMax()-fex.xMin()) / fex.width(), (gcsExtent.yMax()-fex.yMin()) / fex.height() ); } else { // transform all 4 corners; then do the min/max for x/y. double lon[4] = { gcsExtent.xMin(), gcsExtent.xMax(), gcsExtent.xMax(), gcsExtent.xMin() }; double lat[4] = { gcsExtent.yMin(), gcsExtent.yMin(), gcsExtent.yMax(), gcsExtent.yMax() }; double x[4], y[4]; for( int i=0; i<4; ++i ) { int dummy; if ( ! CubeUtils::latLonToFaceCoords( lat[i], lon[i], x[i], y[i], dummy, face ) ) { OE_WARN << LC << "transformGcsExtentOnFace, ll2fc failed" << std::endl; } } double xmin = SMALLEST( x[0], x[1], x[2], x[3] ); double xmax = LARGEST( x[0], x[1], x[2], x[3] ); double ymin = SMALLEST( y[0], y[1], y[2], y[3] ); double ymax = LARGEST( y[0], y[1], y[2], y[3] ); CubeUtils::faceToCube( xmin, ymin, face ); CubeUtils::faceToCube( xmax, ymax, face ); return GeoExtent( getSRS(), xmin, ymin, xmax, ymax ); } }
GeoExtent osgEarth::UnifiedCubeProfile::_faceExtent_gcs[6] [private] |