mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Renamed from polyline to polylines. Split into PolylinesFromFile and UserDefinedPolylines Add import of polylines from file
This commit is contained in:
parent
bb95daee97
commit
9297c5888c
@ -103,6 +103,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
|
|
||||||
Commands/CMakeLists_files.cmake
|
Commands/CMakeLists_files.cmake
|
||||||
Commands/ApplicationCommands/CMakeLists_files.cmake
|
Commands/ApplicationCommands/CMakeLists_files.cmake
|
||||||
|
Commands/AnnotationCommands/CMakeLists_files.cmake
|
||||||
Commands/CompletionCommands/CMakeLists_files.cmake
|
Commands/CompletionCommands/CMakeLists_files.cmake
|
||||||
Commands/CompletionExportCommands/CMakeLists_files.cmake
|
Commands/CompletionExportCommands/CMakeLists_files.cmake
|
||||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.h
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.cpp
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_SOURCE_FILES
|
||||||
|
${SOURCE_GROUP_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
set (QT_MOC_HEADERS
|
||||||
|
${QT_MOC_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
source_group( "CommandFeature\\AnnotationCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,93 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicImportPolylinesAnnotationFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimAnnotationCollection.h"
|
||||||
|
#include "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
|
#include "Riu3DMainWindowTools.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnnotationFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicImportPolylinesAnnotationFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||||
|
QStringList fileNames = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(),
|
||||||
|
"Import Poly Lines Annotation",
|
||||||
|
defaultDir,
|
||||||
|
"Text File (*.txt);Polylines (*.dat);All Files (*.*)");
|
||||||
|
|
||||||
|
if (fileNames.isEmpty()) return;
|
||||||
|
|
||||||
|
// Remember the path to next time
|
||||||
|
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
|
||||||
|
|
||||||
|
// Find or create the AnnotationsCollection
|
||||||
|
|
||||||
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection();
|
||||||
|
|
||||||
|
if (!annotColl)
|
||||||
|
{
|
||||||
|
annotColl = new RimAnnotationCollection;
|
||||||
|
proj->activeOilField()->annotationCollection = annotColl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For each file,
|
||||||
|
|
||||||
|
RimPolyLinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile(fileNames);
|
||||||
|
|
||||||
|
proj->updateConnectedEditors();
|
||||||
|
|
||||||
|
if (lastCreatedOrUpdated)
|
||||||
|
{
|
||||||
|
Riu3DMainWindowTools::selectAsCurrentItem(lastCreatedOrUpdated);
|
||||||
|
}
|
||||||
|
|
||||||
|
annotColl->scheduleRedrawOfRelevantViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setIcon(QIcon(":/FormationCollection16x16.png"));
|
||||||
|
actionToSetup->setText("Import Poly Lines Annotation");
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 RicImportPolylinesAnnotationFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "RimTextAnnotation.h"
|
#include "RimTextAnnotation.h"
|
||||||
#include "RimReachCircleAnnotation.h"
|
#include "RimReachCircleAnnotation.h"
|
||||||
#include "RimPolylineAnnotation.h"
|
#include "RimPolylinesAnnotation.h"
|
||||||
#include "RimAnnotationCollection.h"
|
#include "RimAnnotationCollection.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
@ -132,7 +132,7 @@ void RicNewPolylineAnnotationFeature::onActionTriggered(bool isChecked)
|
|||||||
auto coll = annotationCollection();
|
auto coll = annotationCollection();
|
||||||
if (coll)
|
if (coll)
|
||||||
{
|
{
|
||||||
auto newAnnotation = new RimPolylineAnnotation();
|
auto newAnnotation = new RimUserDefinedPolyLinesAnnotation();
|
||||||
coll->addAnnotation(newAnnotation);
|
coll->addAnnotation(newAnnotation);
|
||||||
coll->updateConnectedEditors();
|
coll->updateConnectedEditors();
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||||
|
@ -52,7 +52,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.h
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.h
|
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.h
|
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationSourceInfo.h
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.h
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.h
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationSourceInfo.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "RimTextAnnotation.h"
|
#include "RimTextAnnotation.h"
|
||||||
#include "RimReachCircleAnnotation.h"
|
#include "RimReachCircleAnnotation.h"
|
||||||
#include "RimPolylineAnnotation.h"
|
#include "RimPolylinesAnnotation.h"
|
||||||
#include "RimAnnotationInViewCollection.h"
|
#include "RimAnnotationInViewCollection.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
@ -138,6 +138,7 @@ void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
|||||||
// m_mapFromViewToIndex[wellPath] = wppm;
|
// m_mapFromViewToIndex[wellPath] = wppm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2011- Statoil ASA
|
// Copyright (C) 2018- equinor ASA
|
||||||
// Copyright (C) 2013- Ceetron Solutions AS
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -18,51 +16,29 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "RivPolylineAnnotationPartMgr.h"
|
#include "RivPolylineAnnotationPartMgr.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
#include "RigActiveCellInfo.h"
|
|
||||||
#include "RigCell.h"
|
|
||||||
#include "RigEclipseCaseData.h"
|
|
||||||
#include "RigMainGrid.h"
|
|
||||||
#include "RigSimWellData.h"
|
|
||||||
|
|
||||||
//#include "RimAnnotationInView.h"
|
|
||||||
#include "RimPolylineAnnotation.h"
|
|
||||||
#include "RimAnnotationInViewCollection.h"
|
#include "RimAnnotationInViewCollection.h"
|
||||||
#include "RimEclipseCase.h"
|
|
||||||
#include "RimEclipseView.h"
|
|
||||||
#include "RimSimWellInViewCollection.h"
|
|
||||||
#include "RimSimWellInView.h"
|
|
||||||
|
|
||||||
#include "RivPipeGeometryGenerator.h"
|
|
||||||
#include "RivPolylineGenerator.h"
|
#include "RivPolylineGenerator.h"
|
||||||
#include "RivPartPriority.h"
|
#include "RivPartPriority.h"
|
||||||
#include "RivPolylineAnnotationSourceInfo.h"
|
#include "RivPolylinesAnnotationSourceInfo.h"
|
||||||
|
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
#include "cvfArrowGenerator.h"
|
|
||||||
#include "cvfDrawableGeo.h"
|
#include "cvfDrawableGeo.h"
|
||||||
#include "cvfDrawableText.h"
|
#include "cvfDrawableText.h"
|
||||||
#include "cvfGeometryBuilderFaceList.h"
|
|
||||||
#include "cvfModelBasicList.h"
|
#include "cvfModelBasicList.h"
|
||||||
#include "cvfPart.h"
|
#include "cvfPart.h"
|
||||||
#include "cvfTransform.h"
|
#include "cvfTransform.h"
|
||||||
#include "cvfqtUtils.h"
|
|
||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
#include "RivSectionFlattner.h"
|
|
||||||
|
|
||||||
|
|
||||||
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
|
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(RimPolylineAnnotation* annotation)
|
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(RimPolylinesAnnotation* annotation)
|
||||||
: m_rimAnnotation(annotation)
|
: m_rimAnnotation(annotation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -78,41 +54,36 @@ RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset)
|
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf)
|
||||||
{
|
{
|
||||||
clearAllGeometry();
|
clearAllGeometry();
|
||||||
|
|
||||||
cvf::ref<RivPolylineAnnotationSourceInfo> sourceInfo = new RivPolylineAnnotationSourceInfo(m_rimAnnotation);
|
if (!m_rimAnnotation->isEmpty())
|
||||||
|
|
||||||
const auto& points = m_rimAnnotation->points();
|
|
||||||
|
|
||||||
if (!points.empty())
|
|
||||||
{
|
{
|
||||||
// textPosition.z() += 1.2 * arrowLength;
|
const auto& points = m_rimAnnotation->polyLinesData();
|
||||||
|
|
||||||
cvf::Font* font = RiaApplication::instance()->customFont();
|
auto linesInDisplayCoords = points->polyLines();
|
||||||
|
|
||||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(points);
|
for (auto& line : linesInDisplayCoords)
|
||||||
|
{
|
||||||
//drawableGeo->
|
for ( cvf::Vec3d& point : line)
|
||||||
//drawableText->setCheckPosVisible(false);
|
{
|
||||||
//drawableText->setDrawBorder(false);
|
point = displayXf->transformToDisplayCoord(point);
|
||||||
//drawableText->setDrawBackground(false);
|
}
|
||||||
//drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
|
}
|
||||||
//drawableText->setTextColor(cvf::Color3f::BLACK); // simWellInViewCollection()->wellLabelColor());
|
|
||||||
|
|
||||||
//cvf::Vec3f textCoord(textPosition);
|
|
||||||
//drawableText->addText(cvfString, textCoord);
|
|
||||||
|
|
||||||
|
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplayCoords);
|
||||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||||
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
||||||
part->setDrawable(drawableGeo.p());
|
part->setDrawable(drawableGeo.p());
|
||||||
|
|
||||||
caf::SurfaceEffectGenerator colorEffgen(cvf::Color3f::RED, caf::PO_NONE);
|
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
|
||||||
cvf::ref<cvf::Effect> eff = colorEffgen.generateUnCachedEffect();
|
cvf::ref<cvf::Effect> eff = colorEffgen.generateCachedEffect();
|
||||||
|
|
||||||
part->setEffect(eff.p());
|
part->setEffect(eff.p());
|
||||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||||
|
|
||||||
|
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(m_rimAnnotation);
|
||||||
part->setSourceInfo(sourceInfo.p());
|
part->setSourceInfo(sourceInfo.p());
|
||||||
|
|
||||||
m_part = part;
|
m_part = part;
|
||||||
@ -134,79 +105,9 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
|
|||||||
const caf::DisplayCoordTransform * displayXf)
|
const caf::DisplayCoordTransform * displayXf)
|
||||||
{
|
{
|
||||||
if (m_rimAnnotation.isNull()) return;
|
if (m_rimAnnotation.isNull()) return;
|
||||||
if (!validateAnnotation(m_rimAnnotation)) return;
|
if (m_rimAnnotation->isEmpty()) return;
|
||||||
|
|
||||||
buildPolygonAnnotationParts(displayXf, false, 0.0);
|
buildPolygonAnnotationParts(displayXf);
|
||||||
model->addPart(m_part.p());
|
model->addPart(m_part.p());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RivPolylineAnnotationPartMgr::appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
|
||||||
size_t frameIndex,
|
|
||||||
const caf::DisplayCoordTransform * displayXf,
|
|
||||||
double xOffset)
|
|
||||||
{
|
|
||||||
///////////////////////////////////////////
|
|
||||||
caf::PdmPointer<RimSimWellInView> m_rimWell;
|
|
||||||
cvf::ref<cvf::Part> m_wellHeadPipeSurfacePart;
|
|
||||||
cvf::ref<cvf::Part> m_wellHeadPipeCenterPart;
|
|
||||||
cvf::ref<cvf::Part> m_wellHeadArrowPart;
|
|
||||||
cvf::ref<cvf::Part> m_wellHeadLabelPart;
|
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
if (m_rimWell.isNull()) return;
|
|
||||||
if (!viewWithSettings()) return;
|
|
||||||
|
|
||||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
|
||||||
|
|
||||||
//buildParts(displayXf, true, xOffset);
|
|
||||||
|
|
||||||
// Always add pipe part of well head
|
|
||||||
if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());
|
|
||||||
if (m_wellHeadPipeSurfacePart.notNull()) model->addPart(m_wellHeadPipeSurfacePart.p());
|
|
||||||
|
|
||||||
if (m_rimWell->showWellLabel() &&
|
|
||||||
m_wellHeadLabelPart.notNull())
|
|
||||||
{
|
|
||||||
model->addPart(m_wellHeadLabelPart.p());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_rimWell->showWellHead() &&
|
|
||||||
m_wellHeadArrowPart.notNull())
|
|
||||||
{
|
|
||||||
model->addPart(m_wellHeadArrowPart.p());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
Rim3dView* RivPolylineAnnotationPartMgr::viewWithSettings()
|
|
||||||
{
|
|
||||||
Rim3dView* view = nullptr;
|
|
||||||
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(view);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimAnnotationInViewCollection* RivPolylineAnnotationPartMgr::annotatationInViewCollection()
|
|
||||||
{
|
|
||||||
RimAnnotationInViewCollection* coll = nullptr;
|
|
||||||
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(coll);
|
|
||||||
|
|
||||||
return coll;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RivPolylineAnnotationPartMgr::validateAnnotation(const RimPolylineAnnotation* annotation) const
|
|
||||||
{
|
|
||||||
return m_rimAnnotation->points().size() > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace caf
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Rim3dView;
|
class Rim3dView;
|
||||||
class RimPolylineAnnotation;
|
class RimPolylinesAnnotation;
|
||||||
class RimAnnotationInViewCollection;
|
class RimAnnotationInViewCollection;
|
||||||
class RimSimWellInView;
|
class RimSimWellInView;
|
||||||
class RimSimWellInViewCollection;
|
class RimSimWellInViewCollection;
|
||||||
@ -44,29 +44,17 @@ class RimSimWellInViewCollection;
|
|||||||
class RivPolylineAnnotationPartMgr : public cvf::Object
|
class RivPolylineAnnotationPartMgr : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RivPolylineAnnotationPartMgr( RimPolylineAnnotation* annotation);
|
RivPolylineAnnotationPartMgr( RimPolylinesAnnotation* annotation);
|
||||||
~RivPolylineAnnotationPartMgr() override;
|
~RivPolylineAnnotationPartMgr() override;
|
||||||
|
|
||||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||||
const caf::DisplayCoordTransform * displayXf);
|
const caf::DisplayCoordTransform * displayXf);
|
||||||
|
|
||||||
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
|
||||||
size_t frameIndex,
|
|
||||||
const caf::DisplayCoordTransform * displayXf,
|
|
||||||
double xOffset);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf,
|
void buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf);
|
||||||
bool doFlatten,
|
|
||||||
double xOffset);
|
|
||||||
|
|
||||||
void clearAllGeometry();
|
void clearAllGeometry();
|
||||||
Rim3dView* viewWithSettings();
|
|
||||||
RimAnnotationInViewCollection* annotatationInViewCollection();
|
|
||||||
bool validateAnnotation(const RimPolylineAnnotation* annotation) const;
|
|
||||||
|
|
||||||
caf::PdmPointer<RimPolylineAnnotation> m_rimAnnotation;
|
caf::PdmPointer<RimPolylinesAnnotation> m_rimAnnotation;
|
||||||
cvf::ref<cvf::Part> m_part;
|
cvf::ref<cvf::Part> m_part;
|
||||||
};
|
};
|
||||||
|
@ -17,16 +17,16 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RivPolylineAnnotationSourceInfo.h"
|
#include "RivPolylinesAnnotationSourceInfo.h"
|
||||||
|
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimAnnotationInViewCollection.h"
|
#include "RimAnnotationInViewCollection.h"
|
||||||
#include "RimPolylineAnnotation.h"
|
#include "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RivPolylineAnnotationSourceInfo::RivPolylineAnnotationSourceInfo(RimPolylineAnnotation* annotation)
|
RivPolylinesAnnotationSourceInfo::RivPolylinesAnnotationSourceInfo(RimPolylinesAnnotation* annotation)
|
||||||
: m_annotation(annotation)
|
: m_annotation(annotation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ RivPolylineAnnotationSourceInfo::RivPolylineAnnotationSourceInfo(RimPolylineAnno
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimPolylineAnnotation* RivPolylineAnnotationSourceInfo::annotation() const
|
RimPolylinesAnnotation* RivPolylinesAnnotationSourceInfo::annotation() const
|
||||||
{
|
{
|
||||||
return m_annotation.p();
|
return m_annotation.p();
|
||||||
}
|
}
|
@ -23,15 +23,15 @@
|
|||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
class RimPolylineAnnotation;
|
class RimPolylinesAnnotation;
|
||||||
|
|
||||||
class RivPolylineAnnotationSourceInfo : public cvf::Object
|
class RivPolylinesAnnotationSourceInfo : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RivPolylineAnnotationSourceInfo(RimPolylineAnnotation* annotation);
|
RivPolylinesAnnotationSourceInfo(RimPolylinesAnnotation* annotation);
|
||||||
|
|
||||||
RimPolylineAnnotation* annotation() const;
|
RimPolylinesAnnotation* annotation() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimPolylineAnnotation> m_annotation;
|
caf::PdmPointer<RimPolylinesAnnotation> m_annotation;
|
||||||
};
|
};
|
@ -123,7 +123,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.h
|
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.h
|
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.h
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.h
|
||||||
@ -255,7 +255,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.cpp
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2011- Statoil ASA
|
// Copyright (C) 2018- equinor ASA
|
||||||
// Copyright (C) 2013- Ceetron Solutions AS
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -22,22 +20,16 @@
|
|||||||
|
|
||||||
#include "RimTextAnnotation.h"
|
#include "RimTextAnnotation.h"
|
||||||
#include "RimReachCircleAnnotation.h"
|
#include "RimReachCircleAnnotation.h"
|
||||||
#include "RimPolylineAnnotation.h"
|
#include "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
|
#include "RimAnnotationInViewCollection.h"
|
||||||
|
|
||||||
|
#include "QMessageBox"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
|
||||||
{
|
|
||||||
// template<>
|
|
||||||
// void RimWellPathCollection::WellVisibilityEnum::setUp()
|
|
||||||
// {
|
|
||||||
// addItem(RimWellPathCollection::FORCE_ALL_OFF, "FORCE_ALL_OFF", "Off");
|
|
||||||
// addItem(RimWellPathCollection::ALL_ON, "ALL_ON", "Individual");
|
|
||||||
// addItem(RimWellPathCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
|
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
|
||||||
|
|
||||||
@ -49,11 +41,14 @@ RimAnnotationCollection::RimAnnotationCollection()
|
|||||||
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_polylineAnnotations, "PolylineAnnotations", "Polyline Annotations", "", "", "");
|
|
||||||
m_textAnnotations.uiCapability()->setUiHidden(true);
|
m_textAnnotations.uiCapability()->setUiHidden(true);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
|
||||||
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
|
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_polylineAnnotations, "PolylineAnnotations", "Polyline Annotations", "", "", "");
|
||||||
m_polylineAnnotations.uiCapability()->setUiHidden(true);
|
m_polylineAnnotations.uiCapability()->setUiHidden(true);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File", "", "", "");
|
||||||
|
m_polylineFromFileAnnotations.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +79,7 @@ void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimAnnotationCollection::addAnnotation(RimPolylineAnnotation* annotation)
|
void RimAnnotationCollection::addAnnotation(RimPolylinesAnnotation* annotation)
|
||||||
{
|
{
|
||||||
m_polylineAnnotations.push_back(annotation);
|
m_polylineAnnotations.push_back(annotation);
|
||||||
}
|
}
|
||||||
@ -108,7 +103,120 @@ std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnot
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimPolylineAnnotation*> RimAnnotationCollection::polylineAnnotations() const
|
std::vector<RimPolylinesAnnotation*> RimAnnotationCollection::polylineAnnotations() const
|
||||||
{
|
{
|
||||||
return m_polylineAnnotations.childObjects();
|
return m_polylineAnnotations.childObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimPolyLinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||||
|
{
|
||||||
|
return m_polylineFromFileAnnotations.childObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPolyLinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylinesFromFile(const QStringList& fileNames)
|
||||||
|
{
|
||||||
|
QStringList newFileNames;
|
||||||
|
std::vector<RimPolyLinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||||
|
size_t formationListBeforeImportCount = m_polylineFromFileAnnotations.size();
|
||||||
|
|
||||||
|
for(const QString& newFileName : fileNames)
|
||||||
|
{
|
||||||
|
bool isFound = false;
|
||||||
|
for(RimPolyLinesFromFileAnnotation* polyLinesAnnot: m_polylineFromFileAnnotations)
|
||||||
|
{
|
||||||
|
if(polyLinesAnnot->fileName() == newFileName)
|
||||||
|
{
|
||||||
|
polyLinesObjsToReload.push_back(polyLinesAnnot);
|
||||||
|
isFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isFound)
|
||||||
|
{
|
||||||
|
newFileNames.push_back(newFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const QString& newFileName : newFileNames)
|
||||||
|
{
|
||||||
|
RimPolyLinesFromFileAnnotation* newPolyLinesAnnot = new RimPolyLinesFromFileAnnotation;
|
||||||
|
newPolyLinesAnnot->setFileName(newFileName);
|
||||||
|
m_polylineFromFileAnnotations.push_back(newPolyLinesAnnot);
|
||||||
|
polyLinesObjsToReload.push_back(newPolyLinesAnnot);
|
||||||
|
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString totalErrorMessage;
|
||||||
|
|
||||||
|
for (RimPolyLinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload)
|
||||||
|
{
|
||||||
|
QString errormessage;
|
||||||
|
|
||||||
|
polyLinesAnnot->readPolyLinesFile(&errormessage);
|
||||||
|
if (!errormessage.isEmpty())
|
||||||
|
{
|
||||||
|
totalErrorMessage += "\nError in: " + polyLinesAnnot->fileName()
|
||||||
|
+ "\n\t" + errormessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!totalErrorMessage.isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox::warning(nullptr, "Import Formation Names", totalErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_polylineFromFileAnnotations.size() > formationListBeforeImportCount)
|
||||||
|
{
|
||||||
|
return m_polylineFromFileAnnotations[m_polylineFromFileAnnotations.size() - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAnnotationCollection::scheduleRedrawOfRelevantViews()
|
||||||
|
{
|
||||||
|
// Todo: Do a Bounding Box check to see if this annotation actually is relevant for the view
|
||||||
|
|
||||||
|
auto views = gridViewsContainingAnnotations();
|
||||||
|
if ( !views.empty() )
|
||||||
|
{
|
||||||
|
for ( auto& view : views )
|
||||||
|
{
|
||||||
|
view->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimGridView*> RimAnnotationCollection::gridViewsContainingAnnotations() const
|
||||||
|
{
|
||||||
|
std::vector<RimGridView*> views;
|
||||||
|
RimProject* project = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(project);
|
||||||
|
|
||||||
|
if (!project) return views;
|
||||||
|
|
||||||
|
std::vector<RimGridView*> visibleGridViews;
|
||||||
|
project->allVisibleGridViews(visibleGridViews);
|
||||||
|
|
||||||
|
for (auto& gridView : visibleGridViews)
|
||||||
|
{
|
||||||
|
if (gridView->annotationCollection()->isActive()) views.push_back(gridView);
|
||||||
|
}
|
||||||
|
return views;
|
||||||
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2011- Statoil ASA
|
// Copyright (C) 2018- equinor ASA
|
||||||
// Copyright (C) 2013- Ceetron Solutions AS
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -26,19 +24,13 @@
|
|||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
#include "cafAppEnum.h"
|
|
||||||
|
|
||||||
// Include to make Pdm work for cvf::Color
|
|
||||||
#include "cafPdmFieldCvfColor.h"
|
|
||||||
#include "cafPdmChildField.h"
|
|
||||||
|
|
||||||
#include "cvfObject.h"
|
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
class RimTextAnnotation;
|
class RimTextAnnotation;
|
||||||
class RimReachCircleAnnotation;
|
class RimReachCircleAnnotation;
|
||||||
class RimPolylineAnnotation;
|
class RimPolylinesAnnotation;
|
||||||
|
class RimPolyLinesFromFileAnnotation;
|
||||||
|
class RimGridView;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -53,14 +45,20 @@ public:
|
|||||||
|
|
||||||
void addAnnotation(RimTextAnnotation* annotation);
|
void addAnnotation(RimTextAnnotation* annotation);
|
||||||
void addAnnotation(RimReachCircleAnnotation* annotation);
|
void addAnnotation(RimReachCircleAnnotation* annotation);
|
||||||
void addAnnotation(RimPolylineAnnotation* annotation);
|
void addAnnotation(RimPolylinesAnnotation* annotation);
|
||||||
|
|
||||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||||
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
|
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
||||||
|
std::vector<RimPolyLinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||||
|
|
||||||
|
RimPolyLinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
|
||||||
|
void scheduleRedrawOfRelevantViews();
|
||||||
|
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
|
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
|
||||||
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
|
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
|
||||||
caf::PdmChildArrayField<RimPolylineAnnotation*> m_polylineAnnotations;
|
caf::PdmChildArrayField<RimPolylinesAnnotation*> m_polylineAnnotations;
|
||||||
|
caf::PdmChildArrayField<RimPolyLinesFromFileAnnotation*> m_polylineFromFileAnnotations;
|
||||||
};
|
};
|
||||||
|
@ -682,6 +682,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
}
|
}
|
||||||
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
|
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
|
||||||
{
|
{
|
||||||
|
menuBuilder << "RicImportPolylinesAnnotationFeature";
|
||||||
menuBuilder << "RicNewTextAnnotationFeature";
|
menuBuilder << "RicNewTextAnnotationFeature";
|
||||||
menuBuilder << "RicNewReachCircleAnnotationFeature";
|
menuBuilder << "RicNewReachCircleAnnotationFeature";
|
||||||
menuBuilder << "RicNewPolygonAnnotationFeature";
|
menuBuilder << "RicNewPolygonAnnotationFeature";
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (C) 2011- Statoil ASA
|
|
||||||
// Copyright (C) 2013- Ceetron Solutions AS
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
|
||||||
// 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 "cafPdmChildArrayField.h"
|
|
||||||
#include "cafPdmField.h"
|
|
||||||
#include "cafPdmObject.h"
|
|
||||||
#include "cafPdmPointer.h"
|
|
||||||
#include "cafAppEnum.h"
|
|
||||||
#include "cafPdmUiOrdering.h"
|
|
||||||
|
|
||||||
// Include to make Pdm work for cvf::Color
|
|
||||||
#include "cafPdmFieldCvfColor.h"
|
|
||||||
#include "cafPdmChildField.h"
|
|
||||||
#include "cafPdmFieldCvfVec3d.h"
|
|
||||||
|
|
||||||
#include "cvfObject.h"
|
|
||||||
#include "cvfVector3.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class QString;
|
|
||||||
class RimGridView;
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
|
||||||
///
|
|
||||||
///
|
|
||||||
//==================================================================================================
|
|
||||||
class RimPolylineAnnotation : public caf::PdmObject
|
|
||||||
{
|
|
||||||
using Vec3d = cvf::Vec3d;
|
|
||||||
|
|
||||||
CAF_PDM_HEADER_INIT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
RimPolylineAnnotation();
|
|
||||||
~RimPolylineAnnotation();
|
|
||||||
|
|
||||||
void setPoints(const std::vector<Vec3d>& points);
|
|
||||||
const std::vector<Vec3d>& points() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
|
||||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
caf::PdmField<std::vector<Vec3d>> m_points;
|
|
||||||
};
|
|
278
ApplicationCode/ProjectDataModel/RimPolylinesAnnotation.cpp
Normal file
278
ApplicationCode/ProjectDataModel/RimPolylinesAnnotation.cpp
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
|
#include "RimAnnotationInViewCollection.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimTools.h"
|
||||||
|
#include "QFile"
|
||||||
|
#include "RimAnnotationCollection.h"
|
||||||
|
#include "QFileInfo"
|
||||||
|
|
||||||
|
CAF_PDM_ABSTRACT_SOURCE_INIT(RimPolylinesAnnotation, "RimPolylinesAnnotation");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPolylinesAnnotation::RimPolylinesAnnotation()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||||
|
m_isActive.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPolylinesAnnotation::~RimPolylinesAnnotation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimPolylinesAnnotation::objectToggleField()
|
||||||
|
{
|
||||||
|
return &m_isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimUserDefinedPolyLinesAnnotation, "UserDefinedPolyLinesAnnotation");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimUserDefinedPolyLinesAnnotation::RimUserDefinedPolyLinesAnnotation()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("PolyLines Annotation", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_points, "Points", {}, "", "", "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimUserDefinedPolyLinesAnnotation::~RimUserDefinedPolyLinesAnnotation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::ref<RigPolyLinesData> RimUserDefinedPolyLinesAnnotation::polyLinesData()
|
||||||
|
{
|
||||||
|
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||||
|
std::vector<std::vector<cvf::Vec3d> > lines;
|
||||||
|
lines.push_back(m_points());
|
||||||
|
pld->setPolyLines(lines);
|
||||||
|
|
||||||
|
return pld;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimUserDefinedPolyLinesAnnotation::isEmpty()
|
||||||
|
{
|
||||||
|
return m_points().empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimUserDefinedPolyLinesAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
uiOrdering.add(&m_points);
|
||||||
|
|
||||||
|
uiOrdering.skipRemainingFields(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimUserDefinedPolyLinesAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue)
|
||||||
|
{
|
||||||
|
RimAnnotationCollection* annColl = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(annColl);
|
||||||
|
if (annColl)
|
||||||
|
{
|
||||||
|
annColl->scheduleRedrawOfRelevantViews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "cafPdmUiFilePathEditor.h"
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimPolyLinesFromFileAnnotation, "PolyLinesFromFileAnnotation");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPolyLinesFromFileAnnotation::RimPolyLinesFromFileAnnotation()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("PolyLines Annotation", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_polyLinesFileName, "PolyLineFilePath", QString(""), "File Path", "", "", "");
|
||||||
|
m_polyLinesFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||||
|
CAF_PDM_InitField(&m_userDescription, "PolyLineDescription", QString(""), "Name", "", "", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPolyLinesFromFileAnnotation::~RimPolyLinesFromFileAnnotation()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolyLinesFromFileAnnotation::setFileName(const QString& fileName)
|
||||||
|
{
|
||||||
|
m_polyLinesFileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const QString& RimPolyLinesFromFileAnnotation::fileName()
|
||||||
|
{
|
||||||
|
return m_polyLinesFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolyLinesFromFileAnnotation::readPolyLinesFile(QString * errorMessage)
|
||||||
|
{
|
||||||
|
QFile dataFile(m_polyLinesFileName());
|
||||||
|
|
||||||
|
if (!dataFile.open(QFile::ReadOnly))
|
||||||
|
{
|
||||||
|
if (errorMessage) (*errorMessage) += "Could not open the File: " + (m_polyLinesFileName()) + "\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_polyLinesData = new RigPolyLinesData;
|
||||||
|
|
||||||
|
std::vector< std::vector< cvf::Vec3d > > polylines(1);
|
||||||
|
|
||||||
|
QTextStream stream(&dataFile);
|
||||||
|
int lineNumber = 1;
|
||||||
|
while (!stream.atEnd())
|
||||||
|
{
|
||||||
|
QString line = stream.readLine();
|
||||||
|
QStringList commentLineSegs = line.split("#", QString::KeepEmptyParts);
|
||||||
|
if(commentLineSegs.size() == 0) continue; // Empty line
|
||||||
|
|
||||||
|
|
||||||
|
QStringList lineSegs = commentLineSegs[0].split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
if(lineSegs.size() == 0) continue; // No data
|
||||||
|
if(lineSegs.size() != 3)
|
||||||
|
{
|
||||||
|
if (errorMessage) (*errorMessage) += "Unexpected number of words on line: " + QString::number(lineNumber) + "\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lineSegs.size() == 3) // Normal case
|
||||||
|
{
|
||||||
|
bool isNumberParsingOk = true;
|
||||||
|
bool isOk = true;
|
||||||
|
double x = lineSegs[0].toDouble(&isOk); isNumberParsingOk &= isOk;
|
||||||
|
double y = lineSegs[1].toDouble(&isOk); isNumberParsingOk &= isOk;
|
||||||
|
double z = lineSegs[2].toDouble(&isOk); isNumberParsingOk &= isOk;
|
||||||
|
|
||||||
|
if (!isNumberParsingOk)
|
||||||
|
{
|
||||||
|
if (errorMessage) (*errorMessage) += "Could not read the point at line: " + QString::number(lineNumber) + "\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x == 999.0 && y == 999.0 && z == 999.0) // New PolyLine
|
||||||
|
{
|
||||||
|
polylines.push_back(std::vector<cvf::Vec3d>());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cvf::Vec3d point(x, y, -z);
|
||||||
|
polylines.back().push_back(point);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
++lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( polylines.back().empty() )
|
||||||
|
{
|
||||||
|
polylines.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_polyLinesData->setPolyLines(polylines);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPolyLinesFromFileAnnotation::isEmpty()
|
||||||
|
{
|
||||||
|
bool isThisEmpty = true;
|
||||||
|
for (const std::vector<cvf::Vec3d> & line :m_polyLinesData->polyLines())
|
||||||
|
{
|
||||||
|
if (!line.empty()) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolyLinesFromFileAnnotation::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||||
|
{
|
||||||
|
m_polyLinesFileName = RimTools::relocateFile(m_polyLinesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolyLinesFromFileAnnotation::setDescriptionFromFileName()
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(m_polyLinesFileName());
|
||||||
|
m_userDescription = fileInfo.fileName();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimPolyLinesFromFileAnnotation::userDescriptionField()
|
||||||
|
{
|
||||||
|
return &m_userDescription;
|
||||||
|
}
|
139
ApplicationCode/ProjectDataModel/RimPolylinesAnnotation.h
Normal file
139
ApplicationCode/ProjectDataModel/RimPolylinesAnnotation.h
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
#include "cafPdmUiOrdering.h"
|
||||||
|
|
||||||
|
// Include to make Pdm work for cvf::Color
|
||||||
|
#include "cafPdmFieldCvfColor.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
#include "cafPdmFieldCvfVec3d.h"
|
||||||
|
|
||||||
|
#include "cvfObject.h"
|
||||||
|
#include "cvfVector3.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
class RimGridView;
|
||||||
|
class RigPolyLinesData;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimPolylinesAnnotation : public caf::PdmObject
|
||||||
|
{
|
||||||
|
using Vec3d = cvf::Vec3d;
|
||||||
|
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimPolylinesAnnotation();
|
||||||
|
~RimPolylinesAnnotation();
|
||||||
|
|
||||||
|
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
||||||
|
virtual bool isEmpty() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<std::vector<Vec3d>> m_points;
|
||||||
|
caf::PdmField<bool> m_isActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
class RimUserDefinedPolyLinesAnnotation : public RimPolylinesAnnotation
|
||||||
|
{
|
||||||
|
using Vec3d = cvf::Vec3d;
|
||||||
|
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimUserDefinedPolyLinesAnnotation();
|
||||||
|
~RimUserDefinedPolyLinesAnnotation();
|
||||||
|
|
||||||
|
cvf::ref<RigPolyLinesData> polyLinesData() override;
|
||||||
|
virtual bool isEmpty() override;
|
||||||
|
|
||||||
|
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_points;
|
||||||
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class RimPolyLinesFromFileAnnotation : public RimPolylinesAnnotation
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimPolyLinesFromFileAnnotation();
|
||||||
|
~RimPolyLinesFromFileAnnotation();
|
||||||
|
|
||||||
|
void setFileName(const QString& fileName);
|
||||||
|
const QString& fileName();
|
||||||
|
void readPolyLinesFile(QString * errorMessage);
|
||||||
|
|
||||||
|
|
||||||
|
cvf::ref<RigPolyLinesData> polyLinesData() override { return m_polyLinesData;}
|
||||||
|
virtual bool isEmpty() override;
|
||||||
|
|
||||||
|
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||||
|
void setDescriptionFromFileName();
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
|
caf::PdmField<QString> m_userDescription;
|
||||||
|
caf::PdmField<QString> m_polyLinesFileName;
|
||||||
|
cvf::ref<RigPolyLinesData> m_polyLinesData;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RigPolyLinesData : public cvf::Object
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RigPolyLinesData() {}
|
||||||
|
|
||||||
|
const std::vector<std::vector<cvf::Vec3d> >& polyLines() const { return m_polylines;}
|
||||||
|
void setPolyLines(const std::vector<std::vector<cvf::Vec3d> >& polyLines) { m_polylines = polyLines;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::vector<cvf::Vec3d> > m_polylines;
|
||||||
|
};
|
@ -31,6 +31,8 @@
|
|||||||
#include "RigGridBase.h"
|
#include "RigGridBase.h"
|
||||||
|
|
||||||
#include "RimAnnotationCollection.h"
|
#include "RimAnnotationCollection.h"
|
||||||
|
#include "RimPolylinesAnnotation.h"
|
||||||
|
|
||||||
#include "RimCalcScript.h"
|
#include "RimCalcScript.h"
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimCaseCollection.h"
|
#include "RimCaseCollection.h"
|
||||||
@ -995,9 +997,9 @@ std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() cons
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimPolylineAnnotation*> RimProject::polylineAnnotations() const
|
std::vector<RimPolylinesAnnotation*> RimProject::polylineAnnotations() const
|
||||||
{
|
{
|
||||||
std::vector<RimPolylineAnnotation*> annotations;
|
std::vector<RimPolylinesAnnotation*> annotations;
|
||||||
for (const auto& oilField : oilFields())
|
for (const auto& oilField : oilFields())
|
||||||
{
|
{
|
||||||
auto annotationColl = oilField->annotationCollection();
|
auto annotationColl = oilField->annotationCollection();
|
||||||
@ -1005,6 +1007,12 @@ std::vector<RimPolylineAnnotation*> RimProject::polylineAnnotations() const
|
|||||||
{
|
{
|
||||||
annotations.push_back(annotation);
|
annotations.push_back(annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto& annotation : annotationColl->polylinesFromFileAnnotations())
|
||||||
|
{
|
||||||
|
annotations.push_back(annotation);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return annotations;
|
return annotations;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class RigWellPath;
|
|||||||
|
|
||||||
class RimTextAnnotation;
|
class RimTextAnnotation;
|
||||||
class RimReachCircleAnnotation;
|
class RimReachCircleAnnotation;
|
||||||
class RimPolylineAnnotation;
|
class RimPolylinesAnnotation;
|
||||||
class RimSummaryCalculationCollection;
|
class RimSummaryCalculationCollection;
|
||||||
class RimCase;
|
class RimCase;
|
||||||
class RimCommandObject;
|
class RimCommandObject;
|
||||||
@ -147,7 +147,7 @@ public:
|
|||||||
std::vector<RimWellPath*> allWellPaths() const;
|
std::vector<RimWellPath*> allWellPaths() const;
|
||||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||||
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
|
std::vector<RimPolylinesAnnotation*> polylineAnnotations() const;
|
||||||
|
|
||||||
std::vector<RimGeoMechCase*> geoMechCases() const;
|
std::vector<RimGeoMechCase*> geoMechCases() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user