2016-12-20 08:28:37 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-01-02 07:01:31 -06:00
|
|
|
#include "RicNewWellPathFractureAtPosFeature.h"
|
2016-12-20 08:28:37 -06:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RimCase.h"
|
|
|
|
#include "RimProject.h"
|
2017-01-02 04:59:30 -06:00
|
|
|
#include "RimView.h"
|
|
|
|
#include "RimWellPath.h"
|
2016-12-20 08:28:37 -06:00
|
|
|
#include "RimWellPathCollection.h"
|
2017-01-02 04:59:30 -06:00
|
|
|
#include "RimWellPathFracture.h"
|
|
|
|
#include "RimWellPathFractureCollection.h"
|
|
|
|
|
2017-01-03 02:34:31 -06:00
|
|
|
#include "RivWellPathSourceInfo.h"
|
|
|
|
|
2017-01-04 03:08:27 -06:00
|
|
|
#include "RiuMainWindow.h"
|
2017-01-02 04:59:30 -06:00
|
|
|
#include "RiuSelectionManager.h"
|
|
|
|
#include "RiuViewer.h"
|
|
|
|
|
2016-12-20 08:28:37 -06:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
#include "cvfRenderState_FF.h"
|
2017-01-02 04:59:30 -06:00
|
|
|
|
2017-01-02 03:10:45 -06:00
|
|
|
#include <QAction>
|
2016-12-21 06:40:53 -06:00
|
|
|
|
2016-12-20 08:28:37 -06:00
|
|
|
|
|
|
|
|
2017-01-02 07:01:31 -06:00
|
|
|
CAF_CMD_SOURCE_INIT(RicNewWellPathFractureAtPosFeature, "RicNewWellPathFractureAtPosFeature");
|
2016-12-20 08:28:37 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-02 07:01:31 -06:00
|
|
|
void RicNewWellPathFractureAtPosFeature::onActionTriggered(bool isChecked)
|
2016-12-20 08:28:37 -06:00
|
|
|
{
|
|
|
|
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
|
|
|
if (!activeView) return;
|
|
|
|
|
2016-12-21 06:40:53 -06:00
|
|
|
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
|
|
|
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
2016-12-20 08:28:37 -06:00
|
|
|
|
2016-12-21 06:40:53 -06:00
|
|
|
RiuWellPathSelectionItem* wellPathItem = nullptr;
|
|
|
|
if (selItem->type() == RiuSelectionItem::WELLPATH_SELECTION_OBJECT)
|
|
|
|
{
|
|
|
|
wellPathItem = static_cast<RiuWellPathSelectionItem*>(selItem);
|
|
|
|
if (!wellPathItem) return;
|
|
|
|
}
|
2016-12-20 08:28:37 -06:00
|
|
|
|
2017-01-04 02:08:10 -06:00
|
|
|
RimWellPath* wellPath = wellPathItem->m_wellpath;
|
2016-12-20 08:28:37 -06:00
|
|
|
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(wellPath);
|
|
|
|
if (!objHandle) return;
|
|
|
|
|
2016-12-21 07:19:52 -06:00
|
|
|
RimWellPath* wellPathObj = nullptr;
|
|
|
|
objHandle->firstAncestorOrThisOfType(wellPathObj);
|
|
|
|
if (!wellPathObj) return;
|
|
|
|
|
2017-01-02 04:59:30 -06:00
|
|
|
RimWellPathFractureCollection* fractureCollection = wellPathObj->fractureCollection();
|
2016-12-20 08:28:37 -06:00
|
|
|
|
2017-01-02 04:59:30 -06:00
|
|
|
RimWellPathFracture* fracture = new RimWellPathFracture();
|
2016-12-20 08:28:37 -06:00
|
|
|
fractureCollection->fractures.push_back(fracture);
|
|
|
|
|
2017-01-04 03:41:46 -06:00
|
|
|
fracture->name = "Well Path Fracture";
|
2017-01-04 02:08:10 -06:00
|
|
|
fracture->positionAtWellpath = wellPathItem->m_pipeCenterlineIntersectionInDomainCoords;
|
|
|
|
fracture->measuredDepth = wellPathItem->m_measuredDepth;
|
2016-12-20 08:28:37 -06:00
|
|
|
|
2017-01-04 03:08:27 -06:00
|
|
|
fractureCollection->updateConnectedEditors();
|
|
|
|
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
|
2016-12-20 08:28:37 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-02 07:01:31 -06:00
|
|
|
void RicNewWellPathFractureAtPosFeature::setupActionLook(QAction* actionToSetup)
|
2016-12-20 08:28:37 -06:00
|
|
|
{
|
|
|
|
// actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
|
|
|
actionToSetup->setText("New Fracture");
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-02 07:01:31 -06:00
|
|
|
bool RicNewWellPathFractureAtPosFeature::isCommandEnabled()
|
2016-12-20 08:28:37 -06:00
|
|
|
{
|
|
|
|
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
|
|
|
if (!pdmUiItem) return false;
|
|
|
|
|
|
|
|
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
|
|
|
if (!objHandle) return false;
|
|
|
|
|
|
|
|
RimWellPathCollection* wellPathColl = nullptr;
|
|
|
|
objHandle->firstAncestorOrThisOfType(wellPathColl);
|
|
|
|
|
|
|
|
if (wellPathColl)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|