public virtual bool continueCompiling(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; cs.clearTaskQueue(); if (cs.getTaskManager().wait(1000L)) { Task completed_task = cs.getTaskManager().getNextCompletedTask(); if (completed_task != null) { CellCompiler cell_compiler = (CellCompiler)completed_task; if (cell_compiler.isInExceptionState()) { //TODO: replace this with Report facility //osgGIS.notify( osg.WARN ) << "ERROR: cell failed; unhandled exception state." // << std.endl; cs.getTaskQueue().Enqueue(cell_compiler); } else if (cell_compiler.getResult().isOK()) { cell_compiler.runSynchronousPostProcess(cs.getReport()); // give the layer compiler an opportunity to do something: processCompletedTask(cell_compiler); // record the completed task to the caller can see it cs.getTaskQueue().Enqueue(cell_compiler); uint total_tasks = cs.getTotalTasks(); uint tasks_completed = total_tasks - cs.getTaskManager().getNumTasks(); float p = 100.0f * (float)tasks_completed / (float)total_tasks; float elapsed = (float)cs.getElapsedTimeSeconds(); float avg_task_time = elapsed / (float)tasks_completed; float time_remaining = ((float)total_tasks - (float)tasks_completed) * avg_task_time; uint hrs, mins, secs; TimeUtils.getHMSDuration(time_remaining, hrs, mins, secs); //char buf[10]; //sprintf( buf, "%02d:%02d:%02d", hrs, mins, secs ); // osgGIS.notify(osg.NOTICE) << tasks_completed << "/" << total_tasks // << " tasks (" << (int)p << "%) complete, " // << buf << " remaining" << std.endl; } else { //TODO: replace this with Report facility //osgGIS.notify( osg.WARN ) << "ERROR: compilation of cell " // << cell_compiler.getName() << " failed : " // << cell_compiler.getResult().getMessage() // << std.endl; } } } return(cs.getTaskManager().hasMoreTasks()); }
public virtual osg.Group compileIndexOnly(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; // make a profile describing this compilation setup: Profile profile = createProfile(); buildIndex(profile, cs.getOrCreateSceneGraph()); if (cs.getOrCreateSceneGraph() != null) { osgUtil.Optimizer opt; opt.optimize(cs.getOrCreateSceneGraph(), osgUtil.Optimizer.SPATIALIZE_GROUPS | osgUtil.Optimizer.STATIC_OBJECT_DETECTION | osgUtil.Optimizer.SHARE_DUPLICATE_STATE); } return(cs.getOrCreateSceneGraph()); }
/** * Compiles the entire cell graph. * * @param task_man * Task manager to employ for parallel/distributed compilation * * @return * True if the compilation succeeded, false if it failed. */ //public virtual osg.Group compile( TaskManager task_man =NULL) public virtual osg.Group compile(TaskManager my_task_man) { CompileSession cs = (CompileSessionImpl)startCompiling(my_task_man); while (continueCompiling(cs)) { ; } if (finishCompiling(cs)) { osg.Group result = cs.getOrCreateSceneGraph(); //result.ref(); // since the CS will be destroyed, unref'ing the result return(result); } else { return(null); } }
public virtual bool finishCompiling(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; cs.clearTaskQueue(); buildIndex(cs.getProfile(), cs.getOrCreateSceneGraph()); if (cs.getOrCreateSceneGraph() != null) { osgUtil.Optimizer opt; opt.optimize(cs.getOrCreateSceneGraph(), osgUtil.Optimizer.SPATIALIZE_GROUPS | osgUtil.Optimizer.STATIC_OBJECT_DETECTION | osgUtil.Optimizer.SHARE_DUPLICATE_STATE); } //osgGIS.notify( osg.NOTICE ) // << "Compilation finished, total time = " << cs.getElapsedTimeSeconds() << " seconds" // << std.endl; return(true); }
public virtual bool finishCompiling(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; cs.clearTaskQueue(); buildIndex(cs.getProfile(), cs.getOrCreateSceneGraph()); if (cs.getOrCreateSceneGraph() != null) { osgUtil.Optimizer opt; opt.optimize(cs.getOrCreateSceneGraph(), osgUtil.Optimizer.SPATIALIZE_GROUPS | osgUtil.Optimizer.STATIC_OBJECT_DETECTION | osgUtil.Optimizer.SHARE_DUPLICATE_STATE); } //osgGIS.notify( osg.NOTICE ) // << "Compilation finished, total time = " << cs.getElapsedTimeSeconds() << " seconds" // << std.endl; return true; }
public virtual bool continueCompiling(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; cs.clearTaskQueue(); if (cs.getTaskManager().wait(1000L)) { Task completed_task = cs.getTaskManager().getNextCompletedTask(); if (completed_task != null) { CellCompiler cell_compiler = (CellCompiler)completed_task; if (cell_compiler.isInExceptionState()) { //TODO: replace this with Report facility //osgGIS.notify( osg.WARN ) << "ERROR: cell failed; unhandled exception state." // << std.endl; cs.getTaskQueue().Enqueue(cell_compiler); } else if (cell_compiler.getResult().isOK()) { cell_compiler.runSynchronousPostProcess(cs.getReport()); // give the layer compiler an opportunity to do something: processCompletedTask(cell_compiler); // record the completed task to the caller can see it cs.getTaskQueue().Enqueue(cell_compiler); uint total_tasks = cs.getTotalTasks(); uint tasks_completed = total_tasks - cs.getTaskManager().getNumTasks(); float p = 100.0f * (float)tasks_completed / (float)total_tasks; float elapsed = (float)cs.getElapsedTimeSeconds(); float avg_task_time = elapsed / (float)tasks_completed; float time_remaining = ((float)total_tasks - (float)tasks_completed) * avg_task_time; uint hrs, mins, secs; TimeUtils.getHMSDuration(time_remaining, hrs, mins, secs); //char buf[10]; //sprintf( buf, "%02d:%02d:%02d", hrs, mins, secs ); // osgGIS.notify(osg.NOTICE) << tasks_completed << "/" << total_tasks // << " tasks (" << (int)p << "%) complete, " // << buf << " remaining" << std.endl; } else { //TODO: replace this with Report facility //osgGIS.notify( osg.WARN ) << "ERROR: compilation of cell " // << cell_compiler.getName() << " failed : " // << cell_compiler.getResult().getMessage() // << std.endl; } } } return cs.getTaskManager().hasMoreTasks(); }
public virtual osg.Group compileIndexOnly(CompileSession cs_interface) { CompileSessionImpl cs = (CompileSessionImpl)cs_interface; // make a profile describing this compilation setup: Profile profile = createProfile(); buildIndex(profile, cs.getOrCreateSceneGraph()); if (cs.getOrCreateSceneGraph() != null) { osgUtil.Optimizer opt; opt.optimize(cs.getOrCreateSceneGraph(), osgUtil.Optimizer.SPATIALIZE_GROUPS | osgUtil.Optimizer.STATIC_OBJECT_DETECTION | osgUtil.Optimizer.SHARE_DUPLICATE_STATE); } return cs.getOrCreateSceneGraph(); }