Esempio n. 1
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellLogFile::readWellLogFile(const QString& logFilePath)
{
    QFileInfo fi(logFilePath);

    RimWellLogFile* wellLogFile = nullptr;

    if (fi.suffix().toUpper().compare("LAS") == 0)
    {
        QString errorMessage;
        wellLogFile = new RimWellLogFile();
        wellLogFile->setFileName(logFilePath);
        if (!wellLogFile->readFile(&errorMessage))
        {
            QString displayMessage = "Could not open the LAS file: \n" + logFilePath;

            if (!errorMessage.isEmpty())
            {
                displayMessage += "\n\n";
                displayMessage += errorMessage;
            }

            QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
                                 "File open error",
                                 displayMessage);

            delete wellLogFile;
            wellLogFile = nullptr;
        }
    }

    return wellLogFile;
}
//--------------------------------------------------------------------------------------------------
/// Read JSON files containing well path data
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readWellPathFiles()
{
    caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");

    for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
    {
        if (!wellPaths[wpIdx]->filepath().isEmpty())
        {
            QString errorMessage;
            if (!wellPaths[wpIdx]->readWellPathFile(&errorMessage, this->asciiFileReader()))
            {
                QMessageBox::warning(RiuMainWindow::instance(),
                                     "File open error",
                                     errorMessage);
            }
        }

        RimWellLogFile* wellLogFile = wellPaths[wpIdx]->m_wellLogFile;
        if (wellLogFile)
        {
            QString errorMessage;
            if (!wellLogFile->readFile(&errorMessage))
            {
                QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName();

                if (!errorMessage.isEmpty())
                {
                    displayMessage += "\n\n";
                    displayMessage += errorMessage;
                }

                QMessageBox::warning(RiuMainWindow::instance(), 
                    "File open error", 
                    displayMessage);
            }
        }

        progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name));
        progress.incrementProgress();
    }

    this->sortWellsByName();
}