Example #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove)
{
    for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
    {
        RimWellLogTrack* track = tracksToMove[tIdx];

        RimWellLogPlot* wellLogPlot;
        track->firstAncestorOrThisOfType(wellLogPlot);
        if (wellLogPlot)
        {
            wellLogPlot->removeTrack(track);
            wellLogPlot->updateTrackNames();
            wellLogPlot->updateConnectedEditors();
        }
    }

    size_t index = m_tracks.index(insertAfterTrack) + 1;

    for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
    {
        insertTrack(tracksToMove[tIdx], index + tIdx);
    }

    updateTrackNames();
}
Example #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
{
    if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;

    std::vector<RimWellLogTrack*> selection;
    caf::SelectionManager::instance()->objectsByType(&selection);

    for (size_t i = 0; i < selection.size(); i++)
    {
        RimWellLogTrack* track = selection[i];

        RimWellLogPlot* wellLogPlot = nullptr;
        track->firstAncestorOrThisOfType(wellLogPlot);
        if (wellLogPlot && wellLogPlot->trackCount() > 1)
        {
            wellLogPlot->removeTrack(track);
            caf::SelectionManager::instance()->removeObjectFromAllSelections(track);
            delete track;

            wellLogPlot->calculateAvailableDepthRange();
            wellLogPlot->updateDepthZoom();
            wellLogPlot->uiCapability()->updateConnectedEditors();
        }
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrack* destTrack, 
                                                                  const std::vector<RimWellLogCurve*>& curves, 
                                                                  RimWellLogCurve* curveToInsertAfter)
{
    CVF_ASSERT(destTrack );

    std::set<RimWellLogTrack*> srcTracks;
    std::set<RimWellLogPlot*> srcPlots;

    for (size_t cIdx = 0; cIdx < curves.size(); cIdx++)
    {
        RimWellLogCurve* curve = curves[cIdx];

        RimWellLogTrack* wellLogPlotTrack;
        curve->firstAncestorOrThisOfType(wellLogPlotTrack);
        if (wellLogPlotTrack)
        {
            wellLogPlotTrack->removeCurve(curve);
            wellLogPlotTrack->updateConnectedEditors();
            srcTracks.insert(wellLogPlotTrack);
            RimWellLogPlot* plot;
            wellLogPlotTrack->firstAncestorOrThisOfType(plot);
            if (plot) srcPlots.insert(plot);
        }
    }

    size_t insertionStartIndex = 0;
    if (curveToInsertAfter) insertionStartIndex = destTrack->curveIndex(curveToInsertAfter) + 1;

    for (size_t cIdx = 0; cIdx < curves.size(); cIdx++)
    {
        destTrack->insertCurve(curves[cIdx], insertionStartIndex + cIdx);
    }

    for (std::set<RimWellLogPlot*>::iterator pIt = srcPlots.begin(); pIt != srcPlots.end(); ++pIt)
    {
        (*pIt)->calculateAvailableDepthRange();
    }

    for (std::set<RimWellLogTrack*>::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt)
    {
        (*tIt)->updateXZoomAndParentPlotDepthZoom();
    }

    destTrack->loadDataAndUpdate();
    destTrack->updateXZoomAndParentPlotDepthZoom();
    destTrack->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dstWellLogPlot, 
                                                             const std::vector<RimWellLogTrack*>& tracksToMove, 
                                                             RimWellLogTrack* trackToInsertAfter)
{
    CVF_ASSERT(dstWellLogPlot);

    std::set<RimWellLogPlot*> srcPlots;

    for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
    {
        RimWellLogTrack* track = tracksToMove[tIdx];

        RimWellLogPlot* srcPlot;
        track->firstAncestorOrThisOfType(srcPlot);
        if (srcPlot)
        {
            srcPlot->removeTrack(track);
          
            srcPlots.insert(srcPlot);
        }
    }

    for (std::set<RimWellLogPlot*>::iterator pIt = srcPlots.begin(); pIt != srcPlots.end(); ++pIt)
    {
        (*pIt)->calculateAvailableDepthRange();
        (*pIt)->updateTrackNames();
        (*pIt)->updateDepthZoom();
        (*pIt)->updateConnectedEditors();
    }


    size_t insertionStartIndex = 0;
    if (trackToInsertAfter) insertionStartIndex = dstWellLogPlot->trackIndex(trackToInsertAfter) + 1;

    for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
    {
        dstWellLogPlot->insertTrack(tracksToMove[tIdx], insertionStartIndex + tIdx);
    }

    dstWellLogPlot->updateTrackNames();
    dstWellLogPlot->updateTracks();
    dstWellLogPlot->updateConnectedEditors();
}