void mafsInRegion(char *regionFile, char *out, int mafCount, char *mafFiles[]) /* Extract MAFs in regions listed in regin file */ { int i = 0; struct hash *bedHash = NULL; FILE *f = NULL; struct mafFile *mf = NULL; verbose(1, "Extracting from %d files to %s\n", mafCount, out); bedHash = loadRegions(regionFile); /* get scoring scheme */ mf = mafOpen(mafFiles[0]); if (!mf) errAbort("can't open MAF file: %s\n", mafFiles[0]); scoring = cloneString(mf->scoring); mafFileFree(&mf); /* set up output dir */ if (outDir) { dir = out; makeDir(dir); } else f = startOutFile(out); for (i = 0; i < mafCount; i++) extractMafs(mafFiles[i], f, bedHash); if (!outDir) endOutFile(f); }
void QgsGrassNewMapset::pageSelected( int index ) { QgsDebugMsg( QString( "title = %1" ).arg( page( index ) ? page( index )->title() : "(null)" ) ); switch ( index ) { case LOCATION: if ( mPreviousPage == DATABASE ) { setLocationPage(); } break; case CRS: // Projection selector if ( !mProjectionSelector ) { QGridLayout *projectionLayout = new QGridLayout( mProjectionFrame ); mProjectionSelector = new QgsProjectionSelector( mProjectionFrame, "Projection", 0 ); mProjectionSelector->setEnabled( false ); projectionLayout->addWidget( mProjectionSelector, 0 , 0 ); mProjectionSelector->show(); connect( mProjectionSelector, SIGNAL( sridSelected( QString ) ), this, SLOT( sridSelected( QString ) ) ); // Se current QGIS projection int srsid = QgsProject::instance()->readNumEntry( "SpatialRefSys", "/ProjectCRSID", 0 ); QgsCoordinateReferenceSystem srs( srsid, QgsCoordinateReferenceSystem::InternalCrsId ); QgsDebugMsg( QString( "current project srsid = %1" ).arg( srsid ) ); QgsDebugMsg( QString( "srs.isValid() = %1" ).arg( srs.isValid() ) ); if ( srs.isValid() ) { mProjectionSelector->setSelectedCrsId( srsid ); mProjRadioButton->setChecked( true ); projRadioSwitched(); } } if ( mPreviousPage == LOCATION ) { setProjectionPage(); } break; case REGION: if ( !mRegionsInited ) { loadRegions(); mRegionsInited = true; } if ( mPreviousPage == CRS ) { setRegionPage(); } break; case MAPSET: if ( mPreviousPage == LOCATION || mPreviousPage == REGION ) { setMapsets(); mapsetChanged(); } break; case FINISH: setFinishPage(); break; } mPreviousPage = index; }
bool loadGame(const Common::String &fname) { Common::InSaveFile *fp = g_system->getSavefileManager()->openForLoading(fname); FILETIME savedGameTime; while (allRunningFunctions) finishFunction(allRunningFunctions); if (fp == NULL) return false; bool headerBad = false; if (fp->readByte() != 'S') headerBad = true; if (fp->readByte() != 'L') headerBad = true; if (fp->readByte() != 'U') headerBad = true; if (fp->readByte() != 'D') headerBad = true; if (fp->readByte() != 'S') headerBad = true; if (fp->readByte() != 'A') headerBad = true; if (headerBad) { fatal(ERROR_GAME_LOAD_NO, fname); return NULL; } char c; c = fp->readByte(); while ((c = fp->readByte())) ; int majVersion = fp->readByte(); int minVersion = fp->readByte(); ssgVersion = VERSION(majVersion, minVersion); if (ssgVersion >= VERSION(1, 4)) { if (!g_sludge->_gfxMan->skipThumbnail(fp)) return fatal(ERROR_GAME_LOAD_CORRUPT, fname); } uint32 bytes_read = fp->read(&savedGameTime, sizeof(FILETIME)); if (bytes_read != sizeof(FILETIME) && fp->err()) { warning("Reading error in loadGame."); } if (savedGameTime.dwLowDateTime != fileTime.dwLowDateTime || savedGameTime.dwHighDateTime != fileTime.dwHighDateTime) { return fatal(ERROR_GAME_LOAD_WRONG, fname); } // DON'T ADD ANYTHING NEW BEFORE THIS POINT! if (ssgVersion >= VERSION(1, 4)) { allowAnyFilename = fp->readByte(); } captureAllKeys = fp->readByte(); fp->readByte(); // updateDisplay (part of movie playing) g_sludge->_txtMan->loadFont(ssgVersion, fp); killAllPeople(); killAllRegions(); int camerX = fp->readUint16BE(); int camerY = fp->readUint16BE(); float camerZ; if (ssgVersion >= VERSION(2, 0)) { camerZ = fp->readFloatLE(); } else { camerZ = 1.0; } brightnessLevel = fp->readByte(); g_sludge->_gfxMan->loadHSI(fp, 0, 0, true); g_sludge->_evtMan->loadHandlers(fp); loadRegions(fp); if (!g_sludge->_cursorMan->loadCursor(fp)) { return false; } LoadedFunction *rFunc; LoadedFunction **buildList = &allRunningFunctions; int countFunctions = fp->readUint16BE(); while (countFunctions--) { rFunc = loadFunction(fp); rFunc->next = NULL; (*buildList) = rFunc; buildList = &(rFunc->next); } for (int a = 0; a < numGlobals; a++) { unlinkVar(globalVars[a]); loadVariable(&globalVars[a], fp); } loadPeople(fp); if (fp->readByte()) { if (!setFloor(fp->readUint16BE())) return false; } else setFloorNull(); if (!g_sludge->_gfxMan->loadZBuffer(fp)) return false; if (!g_sludge->_gfxMan->loadLightMap(ssgVersion, fp)) { return false; } fadeMode = fp->readByte(); g_sludge->_speechMan->load(fp); loadStatusBars(fp); g_sludge->_soundMan->loadSounds(fp); saveEncoding = fp->readUint16BE(); if (ssgVersion >= VERSION(1, 6)) { if (ssgVersion < VERSION(2, 0)) { // aaLoad fp->readByte(); fp->readFloatLE(); fp->readFloatLE(); } blur_loadSettings(fp); } if (ssgVersion >= VERSION(1, 3)) { g_sludge->_gfxMan->loadColors(fp); // Read parallax layers while (fp->readByte()) { int im = fp->readUint16BE(); int fx = fp->readUint16BE(); int fy = fp->readUint16BE(); if (!g_sludge->_gfxMan->loadParallax(im, fx, fy)) return false; } g_sludge->_languageMan->loadLanguageSetting(fp); } g_sludge->_gfxMan->nosnapshot(); if (ssgVersion >= VERSION(1, 4)) { if (fp->readByte()) { if (!g_sludge->_gfxMan->restoreSnapshot(fp)) return false; } } delete fp; g_sludge->_gfxMan->setCamera(camerX, camerY, camerZ); clearStackLib(); return true; }