2017-12-12 06:22:16 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-12-12 06:22:16 -06:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-12-12 06:22:16 -06:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-12-12 06:22:16 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicPasteSummaryCrossPlotCurveFeature.h"
|
|
|
|
|
|
|
|
#include "RiaSummaryTools.h"
|
|
|
|
|
|
|
|
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimSummaryCrossPlot.h"
|
2017-12-12 06:22:16 -06:00
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
#include "RimSummaryCurveFilter.h"
|
|
|
|
|
|
|
|
#include "cafPdmDefaultObjectFactory.h"
|
|
|
|
#include "cafPdmDocument.h"
|
|
|
|
#include "cafPdmObjectGroup.h"
|
|
|
|
#include "cafSelectionManagerTools.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicPasteSummaryCrossPlotCurveFeature, "RicPasteSummaryCrossPlotCurveFeature" );
|
2017-12-12 06:22:16 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicPasteSummaryCrossPlotCurveFeature::isCommandEnabled()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmObject* destinationObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
2017-12-12 06:22:16 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !RiaSummaryTools::parentCrossPlot( destinationObject ) )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( summaryCurvesOnClipboard().size() == 0 )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( caf::PdmPointer<RimSummaryCurve> curve : summaryCurvesOnClipboard() )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
|
|
|
// Check that owner plot is correct type
|
|
|
|
RimSummaryCrossPlot* ownerPlot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->firstAncestorOrThisOfType( ownerPlot );
|
2017-12-12 06:22:16 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !ownerPlot ) return false;
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
// void RicPasteSummaryCrossPlotCurveFeature::onActionTriggered(bool isChecked)
|
2017-12-12 06:22:16 -06:00
|
|
|
//{
|
|
|
|
// std::vector<caf::PdmPointer<RimSummaryCurve> > sourceObjects = RicPasteSummaryCurveFeature::summaryCurves();
|
|
|
|
//
|
|
|
|
// for (size_t i = 0; i < sourceObjects.size(); i++)
|
|
|
|
// {
|
|
|
|
// copyCurveAndAddToPlot(sourceObjects[i]);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicPasteSummaryCrossPlotCurveFeature::setupActionLook( QAction* actionToSetup )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Paste Summary Cross Plot Curve" );
|
2017-12-12 06:22:16 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|