예제 #1
0
        private void recalculateGrid()
        {
            num_rows = 0;
            num_cols = 0;
            dx       = 0.0;
            last_dx  = 0.0;
            dy       = 0.0;
            last_dy  = 0.0;

            GeoExtent aoi = getAreaOfInterest();

            if (aoi.isValid())
            {
                GeoPoint         sw  = aoi.getSouthwest();
                GeoPoint         ne  = aoi.getNortheast();
                SpatialReference srs = aoi.getSRS();

                if (getCellHeight() > 0.0)
                {
                    num_rows = (uint)Math.Ceiling(aoi.getHeight() / getCellHeight());
                    dy       = getCellHeight();
                    last_dy  = aoi.getHeight() % getCellHeight();
                    if (last_dy == 0.0)
                    {
                        last_dy = dy;
                    }
                }
                else
                {
                    num_rows = 1;
                    dy       = last_dy = aoi.getHeight();
                }

                if (getCellWidth() > 0.0)
                {
                    num_cols = (uint)Math.Ceiling(aoi.getWidth() / getCellWidth());
                    dx       = getCellWidth();
                    last_dx  = aoi.getWidth() % getCellWidth();
                    if (last_dx == 0.0)
                    {
                        last_dx = dx;
                    }
                }
                else
                {
                    num_cols = 1;
                    dx       = last_dx = aoi.getWidth();
                }

                grid_valid = true;
            }
        }
예제 #2
0
        // 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));
        }