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()); }
protected virtual void processCompletedTask(CellCompiler task) { if (task.getResult().isOK() && task.getResultNode()) { if (!lod.valid()) { lod = new osg.LOD(); } uint key = uint.Parse(task.getName()); MapLayerLevelOfDetail def = getLodForKey(key, getMapLayer()); if (def != null) { lod.addChild(task.getResultNode(), def.getMinRange(), def.getMaxRange()); } } }