예제 #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimWellLogFile::readFile(QString* errorMessage)
{
    if (!m_wellLogDataFile.p())
    {
        m_wellLogDataFile = new RigWellLogFile;
    }

    m_name = QFileInfo(m_fileName).fileName();

    if (!m_wellLogDataFile->open(m_fileName, errorMessage))
    {
        m_wellLogDataFile = nullptr;
        return false;
    }

    m_wellName = m_wellLogDataFile->wellName();

    QDateTime date = RiaDateStringParser::parseDateString(m_wellLogDataFile->date());
    m_lasFileHasValidDate = isDateValid(date);
    if (m_lasFileHasValidDate)
    {
        m_date = date;
    }
    else if(!isDateValid(m_date()))
    {
        QMessageBox msgBox;

        QString message = QString("The LAS-file '%1' contains no recognizable date. Please assign a date in the LAS-file property panel")
                                .arg(m_name());
        msgBox.setText(message);
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.exec();

        m_date = DEFAULT_DATE_TIME;
    }

    m_wellLogChannelNames.deleteAllChildObjects();

    QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
    for (int logIdx = 0; logIdx < wellLogNames.size(); logIdx++)
    {
        RimWellLogFileChannel* wellLog = new RimWellLogFileChannel();
        wellLog->setName(wellLogNames[logIdx]);
        m_wellLogChannelNames.push_back(wellLog);
    }

    RimWellPath* wellPath;
    firstAncestorOrThisOfType(wellPath);
    if (wellPath)
    {
        if (wellPath->filepath().isEmpty())
        {
            wellPath->setName(m_wellName);
        }
    }

    return true;
}
예제 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray)
{
    caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file");

    const caf::ColorTable& colorTable = RiaColorTables::wellLogPlotPaletteColors();
    cvf::Color3ubArray wellColors = colorTable.color3ubArray();
    cvf::Color3ubArray interpolatedWellColors = wellColors;

    if (wellPathArray.size() > 1)
    {
        interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellPathArray.size());
    }

    for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++)
    {
        RimWellPath* wellPath = wellPathArray[wpIdx];
        wellPath->readWellPathFile(nullptr, m_wellPathImporter);

        progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name()));

        // If a well path with this name exists already, make it read the well path file
        RimWellPath* existingWellPath = tryFindMatchingWellPath(wellPath->name());
        if (existingWellPath)
        {
            existingWellPath->filepath = wellPath->filepath;
            existingWellPath->wellPathIndexInFile = wellPath->wellPathIndexInFile;
            existingWellPath->readWellPathFile(nullptr, m_wellPathImporter);

            // Let name from well path file override name from well log file
            existingWellPath->setName(wellPath->name());

            m_mostRecentlyUpdatedWellPath = existingWellPath;
            delete wellPath;
        }
        else
        {
            wellPath->wellPathColor = cvf::Color3f(interpolatedWellColors[wpIdx]);
            wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath));
            m_mostRecentlyUpdatedWellPath = wellPath;
            wellPaths.push_back(wellPath);
        }

        progress.incrementProgress();
    }

    this->sortWellsByName();
}