(#592) Fixed autoscale for track move delete toggle

Also avoid to always do updateConnectedEditors on project when deleting a curve
This commit is contained in:
Jacob Støren 2015-10-29 10:29:48 +01:00
parent 669bacb2a5
commit 21b1e6c6e6
7 changed files with 73 additions and 54 deletions

View File

@ -110,23 +110,30 @@ void RicDeleteItemExec::redo()
wellPathColl->scheduleGeometryRegenAndRedrawViews();
}
// Update due to deletion of curves (not tracks, handled separatly)
RimWellLogPlot* wellLogPlot;
parentObj->firstAnchestorOrThisOfType(wellLogPlot);
if (wellLogPlot)
{
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth();
}
RimWellLogPlotTrack* wellLogPlotTrack;
parentObj->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
wellLogPlotTrack->zoomAllXAndZoomAllDepthOnOwnerPlot();
wellLogPlotTrack->zoomAllXAxis();
}
RimWellLogPlotCollection* wellLogPlotCollection = NULL;
parentObj->firstAnchestorOrThisOfType(wellLogPlotCollection);
// Update due to delete plots
// Make sure the plot collection disappears with the last plot
RimWellLogPlotCollection* wellLogPlotCollection = dynamic_cast<RimWellLogPlotCollection*>(parentObj);
if (wellLogPlotCollection)
{
if (wellLogPlotCollection->wellLogPlots.empty())
{
RimProject* project = NULL;
parentObj->firstAnchestorOrThisOfType(project);
@ -135,6 +142,7 @@ void RicDeleteItemExec::redo()
project->updateConnectedEditors();
}
}
}
RimViewLinkerCollection* viewLinkerCollection = NULL;
parentObj->firstAnchestorOrThisOfType(viewLinkerCollection);

View File

@ -67,12 +67,12 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
if (wellLogPlot && wellLogPlot->trackCount() > 1)
{
wellLogPlot->removeTrack(track);
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->uiCapability()->updateConnectedEditors();
caf::SelectionManager::instance()->removeObjectFromAllSelections(track);
delete track;
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth();
wellLogPlot->uiCapability()->updateConnectedEditors();
}
}
}

View File

@ -32,7 +32,7 @@
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* destTrack,
const std::vector<RimWellLogPlotCurve*>& curves,
RimWellLogPlotCurve* insertAfterCurve)
RimWellLogPlotCurve* curveToInsertAfter)
{
CVF_ASSERT(destTrack );
@ -57,7 +57,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
}
size_t insertionStartIndex = 0;
if (insertAfterCurve) insertionStartIndex = destTrack->curveIndex(insertAfterCurve) + 1;
if (curveToInsertAfter) insertionStartIndex = destTrack->curveIndex(curveToInsertAfter) + 1;
for (size_t cIdx = 0; cIdx < curves.size(); cIdx++)
{
@ -88,22 +88,31 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
{
CVF_ASSERT(dstWellLogPlot);
RimWellLogPlotTrack* track = NULL;
std::set<RimWellLogPlot*> srcPlots;
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
{
track = tracksToMove[tIdx];
RimWellLogPlotTrack* track = tracksToMove[tIdx];
RimWellLogPlot* oldPlot;
track->firstAnchestorOrThisOfType(oldPlot);
if (oldPlot)
RimWellLogPlot* srcPlot;
track->firstAnchestorOrThisOfType(srcPlot);
if (srcPlot)
{
oldPlot->removeTrack(track);
oldPlot->updateTrackNames();
oldPlot->updateConnectedEditors();
srcPlot->removeTrack(track);
srcPlots.insert(srcPlot);
}
}
for (std::set<RimWellLogPlot*>::iterator pIt = srcPlots.begin(); pIt != srcPlots.end(); ++pIt)
{
(*pIt)->calculateAvailableDepthRange();
(*pIt)->updateTrackNames();
(*pIt)->zoomAllDepth();
(*pIt)->updateConnectedEditors();
}
size_t insertionStartIndex = 0;
if (trackToInsertAfter) insertionStartIndex = dstWellLogPlot->trackIndex(trackToInsertAfter) + 1;
@ -116,21 +125,3 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
dstWellLogPlot->updateTracks();
dstWellLogPlot->updateConnectedEditors();
}
/*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks)
{
CVF_ASSERT(insertAfterTrack);
RimWellLogPlot* wellLogPlot;
insertAfterTrack->firstAnchestorOrThisOfType(wellLogPlot);
if (wellLogPlot)
{
wellLogPlot->moveTracks(insertAfterTrack, tracks);
wellLogPlot->updateConnectedEditors();
}
}
*/

View File

@ -38,5 +38,4 @@ public:
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot,
const std::vector<RimWellLogPlotTrack*>& tracks,
RimWellLogPlotTrack* trackToInsertAfter);
//static void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracks);
};

View File

@ -291,6 +291,8 @@ void RimWellLogPlot::calculateAvailableDepthRange()
double minTrackDepth = HUGE_VAL;
double maxTrackDepth = -HUGE_VAL;
if (m_tracks[tIdx]->isVisible())
{
m_tracks[tIdx]->availableDepthRange(&minTrackDepth, &maxTrackDepth);
if (minTrackDepth < minDepth)
@ -302,7 +304,7 @@ void RimWellLogPlot::calculateAvailableDepthRange()
{
maxDepth = maxTrackDepth;
}
}
}
m_minAvailableDepth = minDepth;

View File

@ -80,7 +80,18 @@ void RimWellLogPlotTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
{
if (changedField == &m_show)
{
if (m_wellLogTrackPlotWidget) m_wellLogTrackPlotWidget->setVisible(m_show());
if (m_wellLogTrackPlotWidget)
{
m_wellLogTrackPlotWidget->setVisible(m_show());
}
RimWellLogPlot* wellLogPlot;
this->firstAnchestorOrThisOfType(wellLogPlot);
if (wellLogPlot)
{
wellLogPlot->calculateAvailableDepthRange();
wellLogPlot->zoomAllDepth();
}
}
else if (changedField == &m_visibleXRangeMin || changedField == &m_visibleXRangeMax)
{
@ -353,3 +364,11 @@ size_t RimWellLogPlotTrack::curveIndex(RimWellLogPlotCurve* curve)
{
return curves.index(curve);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotTrack::isVisible()
{
return m_show;
}

View File

@ -44,7 +44,7 @@ public:
virtual ~RimWellLogPlotTrack();
void setDescription(const QString& description);
bool isVisible();
void addCurve(RimWellLogPlotCurve* curve);
void insertCurve(RimWellLogPlotCurve* curve, size_t index);
void removeCurve(RimWellLogPlotCurve* curve);
@ -59,6 +59,7 @@ public:
void availableDepthRange(double* minimumDepth, double* maximumDepth);
void zoomAllXAndZoomAllDepthOnOwnerPlot();
void alignDepthZoomToPlotAndZoomAllX();
void zoomAllXAxis();
RiuWellLogTrackPlot* viewer();
@ -73,7 +74,6 @@ protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
private:
void zoomAllXAxis();
private:
caf::PdmField<bool> m_show;
caf::PdmField<QString> m_userName;