コード例 #1
0
ファイル: Builder.cs プロジェクト: andyhebear/mogregis3d
        protected bool build(Source source, Session session)
        {
            //osgGIS.notice() << "Building source " << source.getName() << std.endl;

            // only need to build intermediate sources.
            if (!source.isIntermediate())
            {
                //osgGIS.info() << "...source " << source.getName() << " does not need building (not intermediate)." << std.endl;
                return(true);
            }

            Source parent = source.getParentSource();

            if (parent == null)
            {
                //osgGIS.warn()  << "...ERROR: No parent source found for intermediate source \"" << source.getName() << "\"" << std.endl;
                return(false);
            }

            // check whether a rebuild is required:
            if (parent.getTimeLastModified() < source.getTimeLastModified())
            {
                //osgGIS.info() << "...source " << source.getName() << " does not need building (newer than parent)." << std.endl;
                return(true);
            }

            // build it's parent first:
            if (!build(parent, session))
            {
                //osgGIS.warn() << "...ERROR: Failed to build source \"" << parent.getName() << "\", parent of source \"" << source.getName() << "\"" << std.endl;
                return(false);
            }

            // validate the existence of a filter graph:
            FilterGraph graph = source.getFilterGraph();

            if (graph == null)
            {
                //osgGIS.warn() << "...ERROR: No filter graph set for intermediate source \"" << source.getName() << "\"" << std.endl;
                return(false);
            }

            // establish a feature layer for the parent source:
            FeatureLayer feature_layer = Registry.instance().createFeatureLayer(parent.getAbsoluteURI());

            if (feature_layer == null)
            {
                //osgGIS.warn() << "...ERROR: Cannot access source \"" << source.getName() << "\"" << std.endl;
                return(false);
            }

            //TODO: should we allow terrains for a source compile?? No. Because we would need to transform
            // the source into terrain SRS space, which we do not want to do until we're building nodes.

            // initialize a source data compiler. we use a temporary session because this source build
            // is unrelated to the current "master" build. If we used the same session, the new feature
            // store would hang around and not get properly closed out for use in the next round.
            Session   temp_session = session.derive();
            FilterEnv source_env   = temp_session.createFilterEnv();

            FeatureStoreCompiler compiler = new FeatureStoreCompiler(feature_layer, graph);

            if (!compiler.compile(source.getAbsoluteURI(), source_env))
            {
                //osgGIS.warn() << "...ERROR: failure compiling source \"" << source.getName() << "\"" << std.endl;
                return(false);
            }

            //osgGIS.notice() << "...done compiling source \"" << source.getName() << "\"" << std.endl;

            return(true);
        }
コード例 #2
0
ファイル: Builder.cs プロジェクト: agustinsantos/mogregis3d
        protected bool build(Source source, Session session)
        {
            //osgGIS.notice() << "Building source " << source.getName() << std.endl;

            // only need to build intermediate sources.
            if (!source.isIntermediate())
            {
                //osgGIS.info() << "...source " << source.getName() << " does not need building (not intermediate)." << std.endl;
                return true;
            }

            Source parent = source.getParentSource();
            if (parent == null)
            {
                //osgGIS.warn()  << "...ERROR: No parent source found for intermediate source \"" << source.getName() << "\"" << std.endl;
                return false;
            }

            // check whether a rebuild is required:
            if (parent.getTimeLastModified() < source.getTimeLastModified())
            {
                //osgGIS.info() << "...source " << source.getName() << " does not need building (newer than parent)." << std.endl;
                return true;
            }

            // build it's parent first:
            if (!build(parent, session))
            {
                //osgGIS.warn() << "...ERROR: Failed to build source \"" << parent.getName() << "\", parent of source \"" << source.getName() << "\"" << std.endl;
                return false;
            }

            // validate the existence of a filter graph:
            FilterGraph graph = source.getFilterGraph();
            if (graph == null)
            {
                //osgGIS.warn() << "...ERROR: No filter graph set for intermediate source \"" << source.getName() << "\"" << std.endl;
                return false;
            }

            // establish a feature layer for the parent source:
            FeatureLayer feature_layer = Registry.instance().createFeatureLayer(parent.getAbsoluteURI());
            if (feature_layer == null)
            {
                //osgGIS.warn() << "...ERROR: Cannot access source \"" << source.getName() << "\"" << std.endl;
                return false;
            }

            //TODO: should we allow terrains for a source compile?? No. Because we would need to transform
            // the source into terrain SRS space, which we do not want to do until we're building nodes.

            // initialize a source data compiler. we use a temporary session because this source build
            // is unrelated to the current "master" build. If we used the same session, the new feature
            // store would hang around and not get properly closed out for use in the next round.
            Session temp_session = session.derive();
            FilterEnv source_env = temp_session.createFilterEnv();

            FeatureStoreCompiler compiler = new FeatureStoreCompiler(feature_layer, graph);

            if (!compiler.compile(source.getAbsoluteURI(), source_env))
            {
                //osgGIS.warn() << "...ERROR: failure compiling source \"" << source.getName() << "\"" << std.endl;
                return false;
            }

            //osgGIS.notice() << "...done compiling source \"" << source.getName() << "\"" << std.endl;

            return true;
        }