Ejemplo n.º 1
0
        protected virtual uint queueTasks(Profile profile, TaskManager task_man)
        {
            uint level = 0;

            foreach (MapLayerLevelOfDetail i in map_layer.getLevels())
            {
                MapLayerLevelOfDetail level_def = i;

                string s = level.ToString();

                FilterEnv cell_env = getSession().createFilterEnv();
                cell_env.setExtent(map_layer.getAreaOfInterest()); //GeoExtent.infinite() );
                cell_env.setTerrainNode(getTerrainNode());
                cell_env.setTerrainSRS(getTerrainSRS());
                foreach (Property prop in level_def.getEnvProperties())
                {
                    cell_env.setProperty(prop);
                }

                Task task = new CellCompiler(s,
                                             s,
                                             level_def.getFeatureLayer(),
                                             level_def.getFilterGraph(),
                                             level_def.getMinRange(),
                                             level_def.getMaxRange(),
                                             cell_env,
                                             null, null, null);

                task_man.queueTask(task);
            }
            return(level);
        }
Ejemplo n.º 2
0
        public SpatialReference getOutputSRS(Session session, SpatialReference terrain_srs)
        {
            if (!grid_valid || output_srs == null)
            {
                if (levels.Count > 0 && levels[0].getFilterGraph() != null)
                {
                    FilterEnv env = session.createFilterEnv();
                    env.setTerrainSRS(terrain_srs);

                    FilterList filters = levels[0].getFilterGraph().getFilters();

                    for (int ind = filters.Count - 1; ind >= 0; ind--) //reverse iterator?
                    {
                        if (output_srs != null)
                        {
                            break;
                        }
                        Filter i = filters[ind];
                        if (i is TransformFilter)
                        {
                            TransformFilter xf = (TransformFilter)i;
                            if (xf.getUseTerrainSRS())
                            {
                                if (env.getTerrainSRS() != null)
                                {
                                    this.output_srs = env.getTerrainSRS();
                                }
                            }
                            else if (xf.getSRS())
                            {
                                this.output_srs = (SpatialReference)(xf.getSRS());
                            }
                            else if (xf.getSRSScript())
                            {
                                ScriptResult r = env.getScriptEngine().run(xf.getSRSScript(), env);
                                if (r.isValid())
                                {
                                    this.output_srs = session.getResources().getSRS(r.asString());
                                }
                                else
                                {
                                    env.getReport().error(r.asString());
                                }
                            }
                        }
                    }

                    if (output_srs == null) // no reproject..assume input srs
                    {
                        this.output_srs = levels[0].getFeatureLayer().getSRS();
                    }
                }
            }

            return(output_srs);
        }
Ejemplo n.º 3
0
        protected Task createQuadKeyTask(QuadKey key)
        {
            // construct a filter environment template to use for all tasks:
            FilterEnv cell_env = getSession().createFilterEnv();

            cell_env.setTerrainNode(getTerrainNode());
            cell_env.setTerrainSRS(getTerrainSRS());

            string abs_path = createAbsPathFromTemplate("g" + key.toString());

            Task task = null;

            MapLayerLevelOfDetail def = getDefinition(key.createParentKey(), map_layer);

            if (def != null)
            {
                cell_env.setInputSRS(def.getFeatureLayer().getSRS());
                cell_env.setExtent(map_layer.getAreaOfInterest().getSRS().transform(key.getExtent()));
                cell_env.setProperty(new Property("compiler.cell_id", key.toString()));
                foreach (Property i in def.getEnvProperties())
                {
                    cell_env.setProperty(i);
                }

                task = new CellCompiler(
                    key.toString(),
                    abs_path,
                    def.getFeatureLayer(),
                    def.getFilterGraph(),
                    def.getMinRange(),
                    def.getMaxRange(),
                    cell_env,
                    def.getResourcePackager() ? def.getResourcePackager() : resource_packager.get(),
                    getArchive(),
                    def.getUserData());

                // osgGIS.info()
                //    << "Task: Key = " << key.toString() << ", LOD = " << key.getLOD() << ", Extent = " << key.getExtent().toString()
                //    << " (w=" << key.getExtent().getWidth() << ", h=" << key.getExtent().getHeight() << ")"
                //    << std.endl;
            }

            return(task);
        }