protected void collectGeometryKeys(QuadMap qmap, QuadKeyList geom_keys) { // the starting LOD is the best fit the the cell size: uint top_lod = getTopLod(qmap, map_layer); foreach (MapLayerLevelOfDetail i in map_layer.getLevels()) { MapLayerLevelOfDetail level_def = i; uint lod = top_lod + level_def.getDepth(); // get the extent of tiles that we will build based on the AOI: uint cell_xmin, cell_ymin, cell_xmax, cell_ymax; qmap.getCells( map_layer.getAreaOfInterest(), lod, cell_xmin, cell_ymin, cell_xmax, cell_ymax); for (uint y = cell_ymin; y <= cell_ymax; y++) { for (uint x = cell_xmin; x <= cell_xmax; x++) { QuadKey key = new QuadKey(x, y, lod, qmap); for (uint k = 0; k < 4; k++) { geom_keys.push_back(key.createSubKey(k)); } } } } }
static uint getTopLod(QuadMap qmap, MapLayer map_layer) { int bottom_lod = qmap.getBestLodForCellsOfSize(map_layer.getCellWidth(), map_layer.getCellHeight()); uint max_depth = map_layer.getMaxDepth(); long top_lod = Math.Max(0, bottom_lod - max_depth); return((uint)top_lod); }
// MapLayerCompiler interface public virtual Profile createProfile() { // determine the output SRS: SpatialReference out_srs = map_layer.getOutputSRS(getSession(), terrain_srs); if (out_srs == null) { //osgGIS.warn() << "Unable to figure out the output SRS; aborting." << std.endl; return(null); } // figure out the bounds of the compilation area and create a Q map. We want a sqaure AOI..maybe GeoExtent aoi = map_layer.getAreaOfInterest(); if (aoi == null) { //osgGIS.warn() << "Invalid area of interest in the map layer - no data?" << std.endl; return(null); } QuadMap qmap; if (out_srs.isGeocentric()) { // for a geocentric map, use a modified GEO quadkey: // (yes, that MIN_LAT of -180 is correct...we want a square) qmap = new QuadMap(new GeoExtent(-180.0, -180.0, 180.0, 90.0, Registry.SRSFactory().createWGS84())); } else { double max_span = Math.Max(aoi.getWidth(), aoi.getHeight()); GeoPoint sw = aoi.getSouthwest(); GeoPoint ne = new GeoPoint(sw.x() + max_span, sw.y() + max_span, aoi.getSRS()); qmap = new QuadMap(new GeoExtent(sw, ne)); } #if TODO qmap.setStringStyle(QuadMap.STYLE_LOD_QUADKEY); #endif // osgGIS.notice() // << "QMAP: " << std.endl // << " Top LOD = " << getTopLod( qmap, map_layer.get() ) << std.endl // << " Depth = " << map_layer.getMaxDepth() << std.endl // << " Extent = " << qmap.getBounds().toString() << ", w=" << qmap.getBounds().getWidth() << ", h=" << qmap.getBounds().getHeight() << std.endl // << std.endl; return(new QuadTreeProfile(qmap)); }
public QuadKey(uint cell_x, uint cell_y, uint lod, QuadMap map);
public QuadKey(string key_string, QuadMap map);
public QuadMap(QuadMap rhs);
public QuadTreeProfile(QuadMap _qmap) : base() { qmap = _qmap; }