mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3723 Annotations. User editable polyline, both in in view and in property editor
This commit is contained in:
parent
55f980eeb7
commit
b4482d20b0
@ -1,146 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicCreateTextAnnotationPickEventHandler.h"
|
||||
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "RimWellPathTarget.h"
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicCreateTextAnnotationPickEventHandler::RicCreateTextAnnotationPickEventHandler(RimTextAnnotation* textAnnotation)
|
||||
: m_annotationToEdit(textAnnotation)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicCreateTextAnnotationPickEventHandler::~RicCreateTextAnnotationPickEventHandler() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationPickEventHandler::notifyUnregistered()
|
||||
{
|
||||
m_annotationToEdit->enableTargetPointPicking(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationPickEventHandler::handlePickEvent(const Ric3DPickEvent& eventObject)
|
||||
{
|
||||
if (!caf::SelectionManager::instance()->isSelected(m_annotationToEdit.p(), 0))
|
||||
{
|
||||
m_annotationToEdit->enableTargetPointPicking(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_annotationToEdit)
|
||||
{
|
||||
Rim3dView* rimView = eventObject.m_view;
|
||||
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
|
||||
|
||||
// If clicked on an other well path, snap target point to well path center line
|
||||
auto firstPickItem = eventObject.m_pickItemInfos.front();
|
||||
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstPickItem.sourceInfo());
|
||||
|
||||
auto intersectionPointInDomain =
|
||||
rimView->displayCoordTransform()->transformToDomainCoord(firstPickItem.globalPickedPoint());
|
||||
bool doSetAzimuthAndInclination = false;
|
||||
double azimuth = 0.0;
|
||||
double inclination = 0.0;
|
||||
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
targetPointInDomain =
|
||||
wellPathSourceInfo->closestPointOnCenterLine(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
double md = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(
|
||||
md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPointInDomain = intersectionPointInDomain;
|
||||
doSetAzimuthAndInclination = false;
|
||||
}
|
||||
|
||||
if (!m_annotationToEdit->firstActiveTarget())
|
||||
{
|
||||
m_annotationToEdit->setReferencePointXyz(targetPointInDomain);
|
||||
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
double mdrkbAtFirstTarget = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>(wellPathSourceInfo->wellPath());
|
||||
if (modeledWellPath)
|
||||
{
|
||||
mdrkbAtFirstTarget += modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget();
|
||||
}
|
||||
|
||||
m_annotationToEdit->setMdrkbAtFirstTarget(mdrkbAtFirstTarget);
|
||||
}
|
||||
}
|
||||
|
||||
cvf::Vec3d referencePoint = m_annotationToEdit->referencePointXyz();
|
||||
cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
|
||||
|
||||
RimWellPathTarget* newTarget = new RimWellPathTarget;
|
||||
|
||||
if (doSetAzimuthAndInclination)
|
||||
{
|
||||
newTarget->setAsPointXYZAndTangentTarget(
|
||||
cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), relativeTagetPoint.z()), azimuth, inclination);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTarget->setAsPointTargetXYD(cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), -relativeTagetPoint.z()));
|
||||
}
|
||||
|
||||
m_annotationToEdit->insertTarget(nullptr, newTarget);
|
||||
|
||||
m_annotationToEdit->updateConnectedEditors();
|
||||
m_annotationToEdit->updateWellPathVisualization();
|
||||
|
||||
return true; // Todo: See if we really should eat the event instead
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isCh
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
newAnnotation->enablePicking(true);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
|
@ -15,10 +15,15 @@ ${CMAKE_CURRENT_LIST_DIR}/RicWellPathPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPolylineTargetsPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineTargetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeletePolylineTargetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -37,10 +42,15 @@ ${CMAKE_CURRENT_LIST_DIR}/RicWellPathPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPolylineTargetsPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineTargetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeletePolylineTargetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
@ -55,7 +65,8 @@ list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\WellPath" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicPolyline3dEditor.h"
|
||||
|
||||
#include "RicPolylineTarget3dEditor.h"
|
||||
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicPolyline3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolyline3dEditor::RicPolyline3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolyline3dEditor::~RicPolyline3dEditor()
|
||||
{
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolyline3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
auto* geomDef = dynamic_cast<RimUserDefinedPolylinesAnnotation*>(this->pdmObject());
|
||||
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
m_targetEditors.clear();
|
||||
|
||||
if (!geomDef) return;
|
||||
|
||||
|
||||
std::vector<RimPolylineTarget*> targets = geomDef->activeTargets();
|
||||
|
||||
for (auto target: targets)
|
||||
{
|
||||
auto targetEditor = new RicPolylineTarget3dEditor;
|
||||
targetEditor->setViewer(ownerViewer());
|
||||
targetEditor->setPdmObject(target);
|
||||
m_targetEditors.push_back(targetEditor);
|
||||
targetEditor->updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmUi3dObjectEditorHandle.h"
|
||||
|
||||
class RicPolylineTarget3dEditor;
|
||||
|
||||
class RicPolyline3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicPolyline3dEditor();
|
||||
~RicPolyline3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RicPolylineTarget3dEditor*> m_targetEditors;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,195 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicPolylineTarget3dEditor.h"
|
||||
|
||||
#include "RicPointTangentManipulator.h"
|
||||
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicPolylineTarget3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolylineTarget3dEditor::RicPolylineTarget3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolylineTarget3dEditor::~RicPolylineTarget3dEditor()
|
||||
{
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if (m_cvfModel.notNull() && ownerRiuViewer)
|
||||
{
|
||||
|
||||
// Could result in some circularities ....
|
||||
ownerRiuViewer->removeStaticModel(m_cvfModel.p());
|
||||
}
|
||||
|
||||
RimPolylineTarget* oldTarget = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
|
||||
delete m_manipulator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolylineTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimPolylineTarget* target = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if ( !target || !target->isEnabled())
|
||||
{
|
||||
m_cvfModel->removeAllParts();
|
||||
return;
|
||||
}
|
||||
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(polylineDef);
|
||||
|
||||
target->m_targetPoint.uiCapability()->addFieldEditor(this);
|
||||
|
||||
if (m_manipulator.isNull())
|
||||
{
|
||||
m_manipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifySelected() ),
|
||||
this,
|
||||
SLOT( slotSelectedIn3D() ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyDragFinished() ),
|
||||
this,
|
||||
SLOT( slotDragFinished() ) );
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
ownerRiuViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
double handleSize = 1.0;
|
||||
{
|
||||
dispXf = ownerRiuViewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>(ownerRiuViewer->ownerReservoirView());
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
}
|
||||
|
||||
m_manipulator->setOrigin(dispXf->transformToDisplayCoord( target->targetPointXYZ()));
|
||||
//m_manipulator->setTangent(target->tangent());
|
||||
m_manipulator->setHandleSize(handleSize);
|
||||
m_cvfModel->removeAllParts();
|
||||
m_manipulator->appendPartsToModel(m_cvfModel.p());
|
||||
|
||||
m_cvfModel->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolylineTarget3dEditor::cleanupBeforeSettingPdmObject()
|
||||
{
|
||||
RimPolylineTarget* oldTarget = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolylineTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent)
|
||||
{
|
||||
RimPolylineTarget* target = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
}
|
||||
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(polylineDef);
|
||||
|
||||
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin);
|
||||
domainOrigin.z() = -domainOrigin.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainOrigin);
|
||||
|
||||
target->enableFullUpdate(false);
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(target->m_targetPoint.uiCapability(), originVariant);
|
||||
target->enableFullUpdate(true);
|
||||
}
|
||||
|
||||
void RicPolylineTarget3dEditor::slotSelectedIn3D()
|
||||
{
|
||||
RimPolylineTarget* target = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItemAtLevel(target, caf::SelectionManager::FIRST_LEVEL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolylineTarget3dEditor::slotDragFinished()
|
||||
{
|
||||
RimPolylineTarget* target = dynamic_cast<RimPolylineTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimAnnotationCollectionBase* annColl;
|
||||
target->firstAncestorOrThisOfTypeAsserted(annColl);
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUi3dObjectEditorHandle.h"
|
||||
|
||||
class RicPointTangentManipulator;
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace cvf {
|
||||
class ModelBasicList;
|
||||
}
|
||||
|
||||
class QString;
|
||||
#include <QPointer>
|
||||
|
||||
class RicPolylineTarget3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicPolylineTarget3dEditor();
|
||||
~RicPolylineTarget3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
void cleanupBeforeSettingPdmObject() override;
|
||||
|
||||
private slots:
|
||||
void slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent);
|
||||
void slotSelectedIn3D();
|
||||
void slotDragFinished();
|
||||
private:
|
||||
QPointer<RicPointTangentManipulator> m_manipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicDeletePolylineTargetFeature.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeletePolylineTargetFeature, "RicDeletePolylineTargetFeature");
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include <QAction>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeletePolylineTargetFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimPolylineTarget*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||
|
||||
if ( !objects.empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePolylineTargetFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimPolylineTarget*> targets;
|
||||
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL);
|
||||
|
||||
if (!targets.empty())
|
||||
{
|
||||
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef = nullptr;
|
||||
targets[0]->firstAncestorOrThisOfTypeAsserted(polylineDef);
|
||||
|
||||
for ( auto target: targets )
|
||||
{
|
||||
polylineDef->deleteTarget(target);
|
||||
}
|
||||
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePolylineTargetFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete Target");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicDeletePolylineTargetFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -0,0 +1,153 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicNewPolylineTargetFeature.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewPolylineTargetFeature, "RicNewPolylineTargetFeature");
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include <QAction>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineTargetFeature::isCommandEnabled()
|
||||
{
|
||||
{
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if ( !objects.empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<RimPolylineTarget*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||
|
||||
if ( !objects.empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineTargetFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimPolylineTarget*> selectedTargets;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedTargets, caf::SelectionManager::FIRST_LEVEL);
|
||||
if (!selectedTargets.empty())
|
||||
{
|
||||
auto firstTarget = selectedTargets.front();
|
||||
RimUserDefinedPolylinesAnnotation* polylineDef = nullptr;
|
||||
firstTarget->firstAncestorOrThisOfTypeAsserted(polylineDef);
|
||||
|
||||
auto afterBeforePair = polylineDef->findActiveTargetsAroundInsertionPoint(firstTarget);
|
||||
|
||||
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||
|
||||
if (!afterBeforePair.first && afterBeforePair.second)
|
||||
{
|
||||
newPos = afterBeforePair.second->targetPointXYZ();
|
||||
newPos.z() = -newPos.z();
|
||||
}
|
||||
else if (afterBeforePair.first && afterBeforePair.second)
|
||||
{
|
||||
newPos = 0.5*(afterBeforePair.first->targetPointXYZ() + afterBeforePair.second->targetPointXYZ());
|
||||
}
|
||||
else if (afterBeforePair.first && !afterBeforePair.second)
|
||||
{
|
||||
std::vector<RimPolylineTarget*> activeTargets = polylineDef->activeTargets();
|
||||
size_t targetCount = activeTargets.size();
|
||||
if (targetCount > 1)
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ();
|
||||
cvf::Vec3d nextLastToLast = newPos - activeTargets[targetCount-2]->targetPointXYZ();
|
||||
newPos += 0.5*nextLastToLast;
|
||||
}
|
||||
else
|
||||
{
|
||||
newPos = afterBeforePair.first->targetPointXYZ() + cvf::Vec3d(0, 0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
auto* newTarget = new RimPolylineTarget;
|
||||
newTarget->setAsPointTargetXYD({ newPos[0], newPos[1], -newPos[2] });
|
||||
|
||||
polylineDef->insertTarget(firstTarget, newTarget);
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> polylineDefs;
|
||||
caf::SelectionManager::instance()->objectsByType(&polylineDefs);
|
||||
if (!polylineDefs.empty())
|
||||
{
|
||||
auto* polylineDef = polylineDefs[0];
|
||||
std::vector<RimPolylineTarget*> activeTargets = polylineDef->activeTargets();
|
||||
|
||||
size_t targetCount = activeTargets.size();
|
||||
|
||||
if ( targetCount == 0 )
|
||||
{
|
||||
polylineDef->appendTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||
|
||||
if ( targetCount > 1 )
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ();
|
||||
cvf::Vec3d nextLastToLast = newPos - activeTargets[targetCount-2]->targetPointXYZ();
|
||||
newPos += 0.5*nextLastToLast;
|
||||
}
|
||||
else if ( targetCount > 0 )
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ() + cvf::Vec3d(0, 0, 200);
|
||||
}
|
||||
|
||||
auto* newTarget = new RimPolylineTarget;
|
||||
newTarget->setAsPointTargetXYD({ newPos[0], newPos[1], -newPos[2] });
|
||||
polylineDef->insertTarget(nullptr, newTarget);
|
||||
}
|
||||
|
||||
polylineDef->updateConnectedEditors();
|
||||
polylineDef->updateVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineTargetFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New Target");
|
||||
actionToSetup->setIcon(QIcon(":/Well.png"));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineTargetFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -0,0 +1,137 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicPolylineTargetsPickEventHandler.h"
|
||||
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RivPolylinesAnnotationSourceInfo.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolylineTargetsPickEventHandler::RicPolylineTargetsPickEventHandler(RimUserDefinedPolylinesAnnotation* polylineDef)
|
||||
: m_polylineDef(polylineDef)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPolylineTargetsPickEventHandler::~RicPolylineTargetsPickEventHandler() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPolylineTargetsPickEventHandler::notifyUnregistered()
|
||||
{
|
||||
//m_polylineDef->enableTargetPointPicking(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPolylineTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent& eventObject)
|
||||
{
|
||||
if (!caf::SelectionManager::instance()->isSelected(m_polylineDef.p(), 0))
|
||||
{
|
||||
//m_geometryToAddTargetsTo->enableTargetPointPicking(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_polylineDef)
|
||||
{
|
||||
Rim3dView* rimView = eventObject.m_view;
|
||||
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
|
||||
|
||||
// If clicked on an other well path, snap target point to well path center line
|
||||
auto firstPickItem = eventObject.m_pickItemInfos.front();
|
||||
auto wellPathSourceInfo = dynamic_cast<const RivPolylinesAnnotationSourceInfo*>(firstPickItem.sourceInfo());
|
||||
|
||||
auto intersectionPointInDomain =
|
||||
rimView->displayCoordTransform()->transformToDomainCoord(firstPickItem.globalPickedPoint());
|
||||
bool doSetAzimuthAndInclination = false;
|
||||
double azimuth = 0.0;
|
||||
double inclination = 0.0;
|
||||
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
//targetPointInDomain =
|
||||
// wellPathSourceInfo->closestPointOnCenterLine(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
//double md = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
//doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(
|
||||
// md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPointInDomain = intersectionPointInDomain;
|
||||
doSetAzimuthAndInclination = false;
|
||||
}
|
||||
|
||||
//if (!m_polylineDef->firstActiveTarget())
|
||||
//{
|
||||
// m_geometryToAddTargetsTo->setReferencePointXyz(targetPointInDomain);
|
||||
|
||||
// if (wellPathSourceInfo)
|
||||
// {
|
||||
// double mdrkbAtFirstTarget = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
// RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>(wellPathSourceInfo->wellPath());
|
||||
// if (modeledWellPath)
|
||||
// {
|
||||
// mdrkbAtFirstTarget += modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget();
|
||||
// }
|
||||
|
||||
// m_geometryToAddTargetsTo->setMdrkbAtFirstTarget(mdrkbAtFirstTarget);
|
||||
// }
|
||||
//}
|
||||
|
||||
//cvf::Vec3d referencePoint = m_polylineDef->referencePointXyz();
|
||||
//cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
|
||||
|
||||
auto* newTarget = new RimPolylineTarget();
|
||||
|
||||
newTarget->setAsPointTargetXYD(cvf::Vec3d(intersectionPointInDomain.x(), intersectionPointInDomain.y(), -intersectionPointInDomain.z()));
|
||||
|
||||
m_polylineDef->insertTarget(nullptr, newTarget);
|
||||
|
||||
m_polylineDef->updateConnectedEditors();
|
||||
m_polylineDef->updateVisualization();
|
||||
|
||||
return true; // Todo: See if we really should eat the event instead
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -22,23 +22,21 @@
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimTextAnnotation;
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateTextAnnotationPickEventHandler : public RicPickEventHandler
|
||||
class RicPolylineTargetsPickEventHandler : public RicPickEventHandler
|
||||
{
|
||||
public:
|
||||
RicCreateTextAnnotationPickEventHandler(RimTextAnnotation* textAnnotation);
|
||||
~RicCreateTextAnnotationPickEventHandler();
|
||||
RicPolylineTargetsPickEventHandler(RimUserDefinedPolylinesAnnotation* polylineDef);
|
||||
~RicPolylineTargetsPickEventHandler();
|
||||
|
||||
protected:
|
||||
bool handlePickEvent(const Ric3DPickEvent& eventObject) override;
|
||||
void notifyUnregistered() override;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimTextAnnotation> m_annotationToEdit;
|
||||
caf::PdmPointer<RimUserDefinedPolylinesAnnotation> m_polylineDef;
|
||||
};
|
@ -81,7 +81,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay);
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
||||
part->setName("RivPolylineAnnotationPartMgr");
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
|
@ -144,7 +144,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect();
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_labelPart = part;
|
||||
|
@ -17,6 +17,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineTarget.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -37,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineTarget.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,99 @@
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylineTarget, "PolylineTarget");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineTarget::RimPolylineTarget()
|
||||
: m_isFullUpdateEnabled(true)
|
||||
{
|
||||
|
||||
CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", "");
|
||||
//m_targetType.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineTarget::~RimPolylineTarget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineTarget::isEnabled() const
|
||||
{
|
||||
return m_isEnabled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::setAsPointTargetXYD(const cvf::Vec3d& point)
|
||||
{
|
||||
m_targetPoint = point;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::setAsPointXYZAndTangentTarget(const cvf::Vec3d& point,
|
||||
double azimuth,
|
||||
double inclination)
|
||||
{
|
||||
m_targetPoint = cvf::Vec3d(point.x(), point.y(), -point.z());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimPolylineTarget::targetPointXYZ() const
|
||||
{
|
||||
cvf::Vec3d xyzPoint(m_targetPoint());
|
||||
xyzPoint.z() = -xyzPoint.z();
|
||||
return xyzPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::enableFullUpdate(bool enable)
|
||||
{
|
||||
m_isFullUpdateEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPolylineTarget::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimUserDefinedPolylinesAnnotation* polyline;
|
||||
firstAncestorOrThisOfTypeAsserted(polyline);
|
||||
polyline->updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
m_targetPoint.uiCapability()->setUiReadOnly(m_isEnabled());
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 - Equinor
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
#include "RiaLineArcWellPathCalculator.h"
|
||||
|
||||
class RimPolylineTarget : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPolylineTarget();
|
||||
~RimPolylineTarget() override;
|
||||
|
||||
bool isEnabled() const;
|
||||
|
||||
void setAsPointTargetXYD(const cvf::Vec3d& point);
|
||||
void setAsPointXYZAndTangentTarget(const cvf::Vec3d& point, double azimuth, double inclination);
|
||||
|
||||
cvf::Vec3d targetPointXYZ() const;
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
friend class RicPolylineTarget3dEditor;
|
||||
void enableFullUpdate(bool enable);
|
||||
bool m_isFullUpdateEnabled;
|
||||
caf::PdmField<bool> m_isEnabled;
|
||||
caf::PdmField<cvf::Vec3d> m_targetPoint;
|
||||
|
||||
};
|
||||
|
@ -18,11 +18,21 @@
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
||||
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -45,10 +55,22 @@ CAF_PDM_SOURCE_INIT(RimUserDefinedPolylinesAnnotation, "UserDefinedPolylinesAnno
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedPolylinesAnnotation::RimUserDefinedPolylinesAnnotation()
|
||||
: m_pickTargetsEventHandler(new RicPolylineTargetsPickEventHandler(this))
|
||||
{
|
||||
CAF_PDM_InitObject("PolyLines Annotation", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_pointsXyd, "PointsXyd", {}, "", "", "", "");
|
||||
CAF_PDM_InitField(&m_enablePicking, "EnablePicking", false, "", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&m_enablePicking);
|
||||
m_enablePicking.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LabelPosType::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_targets, "Targets", "Targets", "", "", "");
|
||||
m_targets.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName());
|
||||
m_targets.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
m_targets.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled(true);
|
||||
|
||||
this->setUi3dEditorTypeName(RicPolyline3dEditor::uiEditorTypeName());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,20 +86,131 @@ RimUserDefinedPolylinesAnnotation::~RimUserDefinedPolylinesAnnotation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigPolyLinesData> RimUserDefinedPolylinesAnnotation::polyLinesData()
|
||||
{
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
std::vector<std::vector<cvf::Vec3d> > lines;
|
||||
lines.push_back(xydToXyzVector(m_pointsXyd()));
|
||||
pld->setPolyLines(lines);
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
std::vector<cvf::Vec3d> line;
|
||||
std::vector<std::vector<cvf::Vec3d> > lines;
|
||||
for (const RimPolylineTarget* target : m_targets)
|
||||
{
|
||||
line.push_back(target->targetPointXYZ());
|
||||
}
|
||||
pld->setPolyLines({ line });
|
||||
|
||||
return pld;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimUserDefinedPolylinesAnnotation::activeTargets() const
|
||||
{
|
||||
return m_targets.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimUserDefinedPolylinesAnnotation::isEmpty()
|
||||
{
|
||||
return m_pointsXyd().empty();
|
||||
return m_targets.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::appendTarget()
|
||||
{
|
||||
RimPolylineTarget* wellPathTarget = nullptr;
|
||||
|
||||
auto targets = m_targets.childObjects();
|
||||
if (targets.empty())
|
||||
{
|
||||
wellPathTarget = new RimPolylineTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
wellPathTarget = dynamic_cast<RimPolylineTarget*>(
|
||||
targets.back()->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
}
|
||||
|
||||
if (wellPathTarget)
|
||||
{
|
||||
m_targets.push_back(wellPathTarget);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::insertTarget(const RimPolylineTarget* targetToInsertBefore,
|
||||
RimPolylineTarget* targetToInsert)
|
||||
{
|
||||
size_t index = m_targets.index(targetToInsertBefore);
|
||||
if (index < m_targets.size())
|
||||
m_targets.insert(index, targetToInsert);
|
||||
else
|
||||
m_targets.push_back(targetToInsert);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::deleteTarget(RimPolylineTarget* targetTodelete)
|
||||
{
|
||||
m_targets.removeChildObject(targetTodelete);
|
||||
delete targetTodelete;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<RimPolylineTarget*, RimPolylineTarget*>
|
||||
RimUserDefinedPolylinesAnnotation::findActiveTargetsAroundInsertionPoint(const RimPolylineTarget* targetToInsertBefore)
|
||||
{
|
||||
RimPolylineTarget* before = nullptr;
|
||||
RimPolylineTarget* after = nullptr;
|
||||
|
||||
bool foundTarget = false;
|
||||
for (const auto& wt : m_targets)
|
||||
{
|
||||
if (wt == targetToInsertBefore)
|
||||
{
|
||||
foundTarget = true;
|
||||
}
|
||||
|
||||
if (wt->isEnabled() && !after && foundTarget) after = wt;
|
||||
|
||||
if (wt->isEnabled() && !foundTarget) before = wt;
|
||||
}
|
||||
|
||||
return {before, after};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::updateVisualization()
|
||||
{
|
||||
RimAnnotationCollection* annColl = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(annColl);
|
||||
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::enablePicking(bool enable)
|
||||
{
|
||||
m_enablePicking = enable;
|
||||
if (enable)
|
||||
{
|
||||
RiuViewerCommands::setPickEventHandler(m_pickTargetsEventHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuViewerCommands::removePickEventHandlerIfActive(m_pickTargetsEventHandler);
|
||||
}
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -85,7 +218,8 @@ bool RimUserDefinedPolylinesAnnotation::isEmpty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_pointsXyd);
|
||||
uiOrdering.add(&m_targets);
|
||||
uiOrdering.add(&m_enablePicking);
|
||||
|
||||
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
||||
@ -100,10 +234,65 @@ void RimUserDefinedPolylinesAnnotation::fieldChangedByUi(const caf::PdmFieldHand
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
RimAnnotationCollection* annColl = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(annColl);
|
||||
if (changedField == &m_enablePicking)
|
||||
{
|
||||
enablePicking(m_enablePicking);
|
||||
}
|
||||
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu,
|
||||
QMenu* menu,
|
||||
QWidget* fieldEditorWidget)
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicNewPolylineTargetFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeletePolylineTargetFeature";
|
||||
|
||||
menuBuilder.appendToMenu(menu);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedPolylinesAnnotation::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_enablePicking)
|
||||
{
|
||||
auto* pbAttribute = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
|
||||
if (pbAttribute)
|
||||
{
|
||||
if (!m_enablePicking)
|
||||
{
|
||||
pbAttribute->m_buttonText = "Start Picking Points";
|
||||
}
|
||||
else
|
||||
{
|
||||
pbAttribute->m_buttonText = "Stop Picking Points";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (field == &m_targets)
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
||||
if (tvAttribute)
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||
|
||||
if (m_enablePicking)
|
||||
{
|
||||
tvAttribute->baseColor.setRgb(255, 220, 255);
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
class RicPolylineTargetsPickEventHandler;
|
||||
class RimPolylineTarget;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -38,14 +42,33 @@ public:
|
||||
~RimUserDefinedPolylinesAnnotation();
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||||
std::vector<RimPolylineTarget*> activeTargets() const;
|
||||
virtual bool isEmpty() override;
|
||||
|
||||
void appendTarget();
|
||||
void insertTarget(const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert);
|
||||
void deleteTarget(RimPolylineTarget* targetTodelete);
|
||||
|
||||
std::pair<RimPolylineTarget*, RimPolylineTarget*>
|
||||
findActiveTargetsAroundInsertionPoint(const RimPolylineTarget* targetToInsertBefore);
|
||||
void updateVisualization();
|
||||
|
||||
void enablePicking(bool enable);
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<Vec3d>> m_pointsXyd;
|
||||
void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_enablePicking;
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
RicPolylineTargetsPickEventHandler* m_pickTargetsEventHandler;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ PdmUiSelection3dEditorVisualizer::PdmUiSelection3dEditorVisualizer(QWidget* owne
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiSelection3dEditorVisualizer::~PdmUiSelection3dEditorVisualizer()
|
||||
{
|
||||
for (auto editor: m_active3DEditors)
|
||||
for (const auto& editor: m_active3DEditors)
|
||||
{
|
||||
delete editor;
|
||||
}
|
||||
@ -73,7 +73,7 @@ PdmUiSelection3dEditorVisualizer::~PdmUiSelection3dEditorVisualizer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiSelection3dEditorVisualizer::updateVisibleEditors()
|
||||
{
|
||||
for (auto editor: m_active3DEditors)
|
||||
for (const auto& editor: m_active3DEditors)
|
||||
{
|
||||
if (editor) editor->updateUi();
|
||||
}
|
||||
@ -86,7 +86,7 @@ void PdmUiSelection3dEditorVisualizer::onSelectionManagerSelectionChanged( const
|
||||
{
|
||||
if (!changedSelectionLevels.count(0)) return;
|
||||
|
||||
for (auto editor: m_active3DEditors)
|
||||
for (const auto& editor: m_active3DEditors)
|
||||
{
|
||||
delete editor;
|
||||
}
|
||||
@ -114,7 +114,7 @@ void PdmUiSelection3dEditorVisualizer::onSelectionManagerSelectionChanged( const
|
||||
PdmUi3dObjectEditorHandle* editor3d = caf::Factory<PdmUi3dObjectEditorHandle, QString>::instance()->create(editor3dTypeName);
|
||||
editor3d->setViewer(m_ownerViewer);
|
||||
editor3d->setPdmObject(itemObject);
|
||||
m_active3DEditors.push_back(editor3d);
|
||||
m_active3DEditors.emplace_back(editor3d);
|
||||
editor3d->updateUi();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user