2018-01-15 07:52:22 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2018- 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
#include "Rim2dIntersectionView.h"
|
|
|
|
#include "RimIntersection.h"
|
|
|
|
#include "RimCase.h"
|
2018-01-15 07:52:22 -06:00
|
|
|
#include "RiuViewer.h"
|
2018-01-17 01:00:36 -06:00
|
|
|
#include "RimGridView.h"
|
|
|
|
#include "RivIntersectionPartMgr.h"
|
2018-01-15 07:52:22 -06:00
|
|
|
|
|
|
|
#include "cvfPart.h"
|
2018-01-17 01:00:36 -06:00
|
|
|
#include "cvfModelBasicList.h"
|
2018-01-15 07:52:22 -06:00
|
|
|
#include "cvfTransform.h"
|
2018-01-17 01:00:36 -06:00
|
|
|
#include "cvfScene.h"
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(Rim2dIntersectionView, "Intersection2dView");
|
2018-01-15 07:52:22 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
Rim2dIntersectionView::Rim2dIntersectionView(void)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
CAF_PDM_InitObject("Intersection View", ":/CrossSection16x16.png", "", "");
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_intersection, "Intersection", "Intersection", ":/CrossSection16x16.png", "", "");
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
m_scaleTransform = new cvf::Transform();
|
|
|
|
m_intersectionVizModel = new cvf::ModelBasicList;
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
Rim2dIntersectionView::~Rim2dIntersectionView(void)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-17 04:05:31 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void Rim2dIntersectionView::setIntersection(RimIntersection* intersection)
|
|
|
|
{
|
|
|
|
m_intersection = intersection;
|
|
|
|
}
|
|
|
|
|
2018-01-15 07:52:22 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
bool Rim2dIntersectionView::isUsingFormationNames() const
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
// Todo:
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
return false;
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::scheduleGeometryRegen(RivCellSetEnum geometryType)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
RimCase* Rim2dIntersectionView::ownerCase() const
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
RimCase* rimCase = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(rimCase);
|
|
|
|
return rimCase;
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
QList<caf::PdmOptionItemInfo> Rim2dIntersectionView::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
if (fieldNeedingOptions == &m_intersection)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
std::vector<RimIntersection*> intersections;
|
|
|
|
|
|
|
|
this->ownerCase()->descendantsIncludingThisOfType(intersections);
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
for (auto intersection : intersections)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
options.push_back(caf::PdmOptionItemInfo(intersection->name(), intersection));
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
return options;
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::createDisplayModel()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
if (m_viewer.isNull()) return;
|
|
|
|
if (!m_intersection()) return;
|
|
|
|
|
|
|
|
m_intersectionVizModel->removeAllParts();
|
|
|
|
|
|
|
|
m_intersection()->intersectionPartMgr()->appendNativeCrossSectionFacesToModel(m_intersectionVizModel.p(), scaleTransform());
|
|
|
|
m_intersection()->intersectionPartMgr()->appendMeshLinePartsToModel(m_intersectionVizModel.p(), scaleTransform());
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
m_viewer->addStaticModelOnce(m_intersectionVizModel.p());
|
2018-01-15 07:52:22 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::updateDisplayModelVisibility()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::clampCurrentTimestep()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::updateCurrentTimeStep()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::onTimeStepChanged()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::updateStaticCellColors()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::updateScaleTransform()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
|
|
|
|
scale(2, 2) = scaleZ();
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
this->scaleTransform()->setLocalTransform(scale);
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
cvf::Transform* Rim2dIntersectionView::scaleTransform()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
return m_scaleTransform.p();
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::resetLegendsInViewer()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
m_viewer->showAxisCross(false);
|
|
|
|
m_viewer->showAnimationProgress(false);
|
|
|
|
m_viewer->setMainScene(new cvf::Scene());
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::onLoadDataAndUpdate()
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
updateMdiWindowVisibility();
|
2018-01-15 07:52:22 -06:00
|
|
|
|
|
|
|
this->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
Rim3dView::fieldChangedByUi(changedField, oldValue, newValue);
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
if (changedField == & m_intersection)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
this->loadDataAndUpdate();
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 01:00:36 -06:00
|
|
|
void Rim2dIntersectionView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2018-01-15 07:52:22 -06:00
|
|
|
{
|
2018-01-17 01:00:36 -06:00
|
|
|
uiOrdering.add(&m_intersection);
|
2018-01-15 07:52:22 -06:00
|
|
|
|
2018-01-17 01:00:36 -06:00
|
|
|
Rim3dView::defineUiOrdering(uiConfigName, uiOrdering);
|
2018-01-15 07:52:22 -06:00
|
|
|
}
|