#3706 Annotations. First commit. Not tested

This commit is contained in:
Bjørn Erik Jensen 2018-11-23 13:33:59 +01:00
parent 39a838b406
commit 35405ebafc
47 changed files with 2944 additions and 91 deletions

View File

@ -76,6 +76,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.h
)
@ -150,6 +151,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateTemporaryLgrFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewAnnotationFeature.cpp
)

View File

@ -0,0 +1,124 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewAnnotationFeature.h"
#include "RiaApplication.h"
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylineAnnotation.h"
#include "RimAnnotationCollection.h"
#include "RimProject.h"
#include "RimOilField.h"
#include "RiuMainWindow.h"
#include <cafSelectionManagerTools.h>
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewAnnotationFeature, "RicNewAnnotationFeature");
CAF_CMD_SOURCE_INIT(RicNewTextAnnotationFeature, "RicNewTextAnnotationFeature");
CAF_CMD_SOURCE_INIT(RicNewPolylineAnnotationFeature, "RicNewPolygonAnnotationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewAnnotationFeature::isCommandEnabled()
{
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
return selObjs.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewAnnotationFeature::onActionTriggered(bool isChecked)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("(Not valid)");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RicNewAnnotationFeature::annotationCollection() const
{
auto project = RiaApplication::instance()->project();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewTextAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimTextAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("New Text Annotation");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineAnnotationFeature::onActionTriggered(bool isChecked)
{
auto coll = annotationCollection();
if (coll)
{
auto newAnnotation = new RimPolylineAnnotation();
coll->addAnnotation(newAnnotation);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineAnnotationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/Plus.png"));
actionToSetup->setText("New Polyline Annotation");
}

View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPreferences.h"
#include "cafCmdFeature.h"
#include <QString>
class RimAnnotationCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewAnnotationFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
RimAnnotationCollection* annotationCollection() const;
};
//==================================================================================================
///
//==================================================================================================
class RicNewTextAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineAnnotationFeature : public RicNewAnnotationFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -46,6 +46,14 @@ ${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.h
${CMAKE_CURRENT_LIST_DIR}/RivMeshLinesSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivContourMapProjectionPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationsPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -90,6 +98,14 @@ ${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/RivMeshLinesSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivContourMapProjectionPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationsPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -27,6 +27,7 @@
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionPartMgr.h"
#include "RivPolylineGenerator.h"
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
#include "cafDisplayCoordTransform.h"
@ -483,7 +484,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createFaultMeshDraw
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPolylineDrawable()
{
return createLineAlongPolylineDrawable(m_flattenedOrOffsettedPolyLines);
return RivPolylineGenerator::createLineAlongPolylineDrawable(m_flattenedOrOffsettedPolyLines);
}
//--------------------------------------------------------------------------------------------------
@ -499,48 +500,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongExtr
displayCoords.push_back(transform->translateToDisplayCoord(pt));
}
return createLineAlongPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({ displayCoords }));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines)
{
std::vector<cvf::uint> lineIndices;
std::vector<cvf::Vec3f> vertices;
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
{
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];
if (polyLine.size() < 2) continue;
for (size_t i = 0; i < polyLine.size(); ++i)
{
vertices.push_back(cvf::Vec3f(polyLine[i]));
if (i < polyLine.size() - 1)
{
lineIndices.push_back(static_cast<cvf::uint>(i));
lineIndices.push_back(static_cast<cvf::uint>(i + 1));
}
}
}
if (vertices.size() == 0) return nullptr;
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray;
vx->assign(vertices);
cvf::ref<cvf::UIntArray> idxes = new cvf::UIntArray;
idxes->assign(lineIndices);
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
prim->setIndices(idxes.p());
cvf::ref<cvf::DrawableGeo> polylineGeo = new cvf::DrawableGeo;
polylineGeo->setVertexArray(vx.p());
polylineGeo->addPrimitiveSet(prim.p());
return polylineGeo;
return RivPolylineGenerator::createLineAlongPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({ displayCoords }));
}
//--------------------------------------------------------------------------------------------------
@ -548,7 +508,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPoly
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPolylineDrawable()
{
return createPointsFromPolylineDrawable(m_flattenedOrOffsettedPolyLines);
return RivPolylineGenerator::createPointsFromPolylineDrawable(m_flattenedOrOffsettedPolyLines);
}
//--------------------------------------------------------------------------------------------------
@ -564,39 +524,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromExt
displayCoords.push_back(transform->translateToDisplayCoord(pt));
}
return createPointsFromPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({displayCoords}));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines)
{
std::vector<cvf::Vec3f> vertices;
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
{
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];
for (size_t i = 0; i < polyLine.size(); ++i)
{
vertices.push_back(cvf::Vec3f(polyLine[i]));
}
}
if (vertices.size() == 0) return nullptr;
cvf::ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_POINTS);
primSet->setStartIndex(0);
primSet->setIndexCount(vertices.size());
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray(vertices);
geo->setVertexArray(vx.p());
geo->addPrimitiveSet(primSet.p());
return geo;
return RivPolylineGenerator::createPointsFromPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({displayCoords}));
}
//--------------------------------------------------------------------------------------------------

View File

@ -83,9 +83,6 @@ public:
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointFlat);
private:
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
void calculateArrays();
void calculateSegementTransformPrLinePoint();
void calculateFlattenedOrOffsetedPolyline();

View File

@ -0,0 +1,155 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivAnnotationsPartMgr.h"
#include "RiaApplication.h"
#include "RigActiveCellInfo.h"
#include "RigCell.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylineAnnotation.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimProject.h"
#include "RimSimWellInViewCollection.h"
#include "RimSimWellInView.h"
#include "RivTextAnnotationPartMgr.h"
#include "RivReachCircleAnnotationPartMgr.h"
#include "RivPolylineAnnotationPartMgr.h"
#include "RivPipeGeometryGenerator.h"
#include "RivPartPriority.h"
#include "RivSimWellPipeSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivAnnotationsPartMgr::RivAnnotationsPartMgr(Rim3dView* view)
: m_rimView(view)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivAnnotationsPartMgr::~RivAnnotationsPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivAnnotationsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform)
{
createAnnotationPartManagers();
for (auto& partMgr : m_textAnnotationPartMgrs)
{
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform);
}
for (auto& partMgr : m_reachCircleAnnotationPartMgrs)
{
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform);
}
for (auto& partMgr : m_polylineAnnotationPartMgrs)
{
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivAnnotationsPartMgr::createAnnotationPartManagers()
{
RimProject* proj = RiaApplication::instance()->project();
auto textAnnotations = proj->textAnnotations();
auto reachCircleAnnotations = proj->reachCircleAnnotations();
auto polylineAnnotations = proj->polylineAnnotations();
if (m_textAnnotationPartMgrs.size() != textAnnotations.size())
{
clearGeometryCache();
for (auto annotation : textAnnotations)
{
auto* apm = new RivTextAnnotationPartMgr(annotation);
m_textAnnotationPartMgrs.push_back(apm);
//m_mapFromViewToIndex[wellPath] = wppm;
}
}
if (m_reachCircleAnnotationPartMgrs.size() != reachCircleAnnotations.size())
{
clearGeometryCache();
for (auto annotation : reachCircleAnnotations)
{
auto* apm = new RivReachCircleAnnotationPartMgr(annotation);
m_reachCircleAnnotationPartMgrs.push_back(apm);
// m_mapFromViewToIndex[wellPath] = wppm;
}
}
if (m_polylineAnnotationPartMgrs.size() != polylineAnnotations.size())
{
clearGeometryCache();
for (auto annotation : polylineAnnotations)
{
auto* apm = new RivPolylineAnnotationPartMgr(annotation);
m_polylineAnnotationPartMgrs.push_back(apm);
// m_mapFromViewToIndex[wellPath] = wppm;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivAnnotationsPartMgr::clearGeometryCache()
{
m_textAnnotationPartMgrs.clear();
m_reachCircleAnnotationPartMgrs.clear();
m_polylineAnnotationPartMgrs.clear();
}

View File

@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, 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 "cvfBase.h"
#include "cvfAssert.h"
#include "cvfCollection.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
namespace cvf
{
class BoundingBox;
class Part;
class ModelBasicList;
class Transform;
class Font;
}
namespace caf
{
class DisplayCoordTransform;
}
class Rim3dView;
class RimAnnotationInViewCollection;
class RivTextAnnotationPartMgr;
class RivReachCircleAnnotationPartMgr;
class RivPolylineAnnotationPartMgr;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RivAnnotationsPartMgr : public cvf::Object
{
public:
RivAnnotationsPartMgr( Rim3dView* view);
~RivAnnotationsPartMgr() override;
void appendGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform);
//void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
// size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf);
//void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
// size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf,
// double xOffset);
void clearGeometryCache();
private:
void createAnnotationPartManagers();
//void buildWellHeadParts(size_t frameIndex,
// const caf::DisplayCoordTransform * displayXf,
// bool doFlatten,
// double xOffset);
private:
caf::PdmPointer<Rim3dView> m_rimView;
cvf::Collection<RivTextAnnotationPartMgr> m_textAnnotationPartMgrs;
cvf::Collection<RivReachCircleAnnotationPartMgr> m_reachCircleAnnotationPartMgrs;
cvf::Collection<RivPolylineAnnotationPartMgr> m_polylineAnnotationPartMgrs;
};

View File

@ -0,0 +1,212 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivPolylineAnnotationPartMgr.h"
#include "RiaApplication.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 "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimSimWellInView.h"
#include "RivPipeGeometryGenerator.h"
#include "RivPolylineGenerator.h"
#include "RivPartPriority.h"
#include "RivPolylineAnnotationSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(RimPolylineAnnotation* annotation)
: m_rimAnnotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset)
{
clearAllGeometry();
cvf::ref<RivPolylineAnnotationSourceInfo> sourceInfo = new RivPolylineAnnotationSourceInfo(m_rimAnnotation);
const auto& points = m_rimAnnotation->points();
if (!points.empty())
{
// textPosition.z() += 1.2 * arrowLength;
cvf::Font* font = RiaApplication::instance()->customFont();
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(points);
//drawableGeo->
//drawableText->setCheckPosVisible(false);
//drawableText->setDrawBorder(false);
//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::Part> part = new cvf::Part;
//part->setName("RivAnnotationPartMgr: text " + cvfString);
part->setDrawable(drawableGeo.p());
caf::SurfaceEffectGenerator colorEffgen(cvf::Color3f::RED, caf::PO_NONE);
cvf::ref<cvf::Effect> eff = colorEffgen.generateUnCachedEffect();
part->setEffect(eff.p());
part->setPriority(RivPartPriority::PartType::MeshLines);
part->setSourceInfo(sourceInfo.p());
m_part = part;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivPolylineAnnotationPartMgr::clearAllGeometry()
{
m_part = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf)
{
if (m_rimAnnotation.isNull()) return;
if (!validateAnnotation(m_rimAnnotation)) return;
buildPolygonAnnotationParts(displayXf, false, 0.0);
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;
}

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, 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 "cvfBase.h"
#include "cvfAssert.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
namespace cvf
{
class Part;
class ModelBasicList;
class Transform;
class Font;
}
namespace caf
{
class DisplayCoordTransform;
}
class Rim3dView;
class RimPolylineAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RivPolylineAnnotationPartMgr : public cvf::Object
{
public:
RivPolylineAnnotationPartMgr( RimPolylineAnnotation* annotation);
~RivPolylineAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf);
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex,
const caf::DisplayCoordTransform * displayXf,
double xOffset);
private:
void buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf,
bool doFlatten,
double xOffset);
void clearAllGeometry();
Rim3dView* viewWithSettings();
RimAnnotationInViewCollection* annotatationInViewCollection();
bool validateAnnotation(const RimPolylineAnnotation* annotation) const;
caf::PdmPointer<RimPolylineAnnotation> m_rimAnnotation;
cvf::ref<cvf::Part> m_part;
};

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivPolylineAnnotationSourceInfo.h"
#include "RimEclipseView.h"
#include "RimAnnotationInViewCollection.h"
#include "RimPolylineAnnotation.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivPolylineAnnotationSourceInfo::RivPolylineAnnotationSourceInfo(RimPolylineAnnotation* annotation)
: m_annotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPolylineAnnotation* RivPolylineAnnotationSourceInfo::annotation() const
{
return m_annotation.p();
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
class RimPolylineAnnotation;
class RivPolylineAnnotationSourceInfo : public cvf::Object
{
public:
RivPolylineAnnotationSourceInfo(RimPolylineAnnotation* annotation);
RimPolylineAnnotation* annotation() const;
private:
caf::PdmPointer<RimPolylineAnnotation> m_annotation;
};

View File

@ -0,0 +1,116 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RivPolylineGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfPrimitiveSetDirect.h"
#include "cvfPrimitiveSetIndexedUInt.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine)
{
std::vector<std::vector<cvf::Vec3d>> polyLines;
polyLines.push_back(polyLine);
return createLineAlongPolylineDrawable(polyLines);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo>
RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines)
{
std::vector<cvf::uint> lineIndices;
std::vector<cvf::Vec3f> vertices;
for (const std::vector<cvf::Vec3d>& polyLine : polyLines)
{
if (polyLine.size() < 2) continue;
for (size_t i = 0; i < polyLine.size(); ++i)
{
vertices.emplace_back(polyLine[i]);
if (i < polyLine.size() - 1)
{
lineIndices.push_back(static_cast<cvf::uint>(i));
lineIndices.push_back(static_cast<cvf::uint>(i + 1));
}
}
}
if (vertices.empty()) return nullptr;
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray;
vx->assign(vertices);
cvf::ref<cvf::UIntArray> idxes = new cvf::UIntArray;
idxes->assign(lineIndices);
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
prim->setIndices(idxes.p());
cvf::ref<cvf::DrawableGeo> polylineGeo = new cvf::DrawableGeo;
polylineGeo->setVertexArray(vx.p());
polylineGeo->addPrimitiveSet(prim.p());
return polylineGeo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivPolylineGenerator::createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine)
{
std::vector<std::vector<cvf::Vec3d>> polyLines;
polyLines.push_back(polyLine);
return createPointsFromPolylineDrawable( polyLines );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo>
RivPolylineGenerator::createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines)
{
std::vector<cvf::Vec3f> vertices;
for (const std::vector<cvf::Vec3d>& polyLine : polyLines)
{
for (const auto& pl : polyLine)
{
vertices.emplace_back(pl);
}
}
if (vertices.empty()) return nullptr;
cvf::ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_POINTS);
primSet->setStartIndex(0);
primSet->setIndexCount(vertices.size());
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray(vertices);
geo->setVertexArray(vx.p());
geo->addPrimitiveSet(primSet.p());
return geo;
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include <cvfVector3.h>
#include <vector>
namespace cvf
{
class DrawableGeo;
}
//==================================================================================================
///
//==================================================================================================
class RivPolylineGenerator : public cvf::Object
{
public:
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
};

View File

@ -0,0 +1,166 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivReachCircleAnnotationPartMgr.h"
#include "RiaApplication.h"
#include "RigActiveCellInfo.h"
#include "RigCell.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
//#include "RimAnnotationInView.h"
#include "RimReachCircleAnnotation.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimSimWellInView.h"
#include "RivPipeGeometryGenerator.h"
#include "RivPolylineGenerator.h"
#include "RivPartPriority.h"
#include "RivReachCircleAnnotationSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(RimReachCircleAnnotation* annotation)
: m_rimAnnotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReachCircleAnnotationPartMgr::~RivReachCircleAnnotationPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReachCircleAnnotationPartMgr::clearAllGeometry()
{
m_part = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReachCircleAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf)
{
if (m_rimAnnotation.isNull()) return;
if (!validateAnnotation(m_rimAnnotation)) return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReachCircleAnnotationPartMgr::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* RivReachCircleAnnotationPartMgr::viewWithSettings()
{
Rim3dView* view = nullptr;
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(view);
return view;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RivReachCircleAnnotationPartMgr::annotatationInViewCollection()
{
RimAnnotationInViewCollection* coll = nullptr;
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivReachCircleAnnotationPartMgr::validateAnnotation(const RimReachCircleAnnotation* annotation) const
{
return false;
}

View File

@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, 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 "cvfBase.h"
#include "cvfAssert.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
namespace cvf
{
class Part;
class ModelBasicList;
class Transform;
class Font;
}
namespace caf
{
class DisplayCoordTransform;
}
class Rim3dView;
class RimReachCircleAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RivReachCircleAnnotationPartMgr : public cvf::Object
{
public:
RivReachCircleAnnotationPartMgr( RimReachCircleAnnotation* annotation);
~RivReachCircleAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf);
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex,
const caf::DisplayCoordTransform * displayXf,
double xOffset);
private:
void clearAllGeometry();
Rim3dView* viewWithSettings();
RimAnnotationInViewCollection* annotatationInViewCollection();
bool validateAnnotation(const RimReachCircleAnnotation* annotation) const;
caf::PdmPointer<RimReachCircleAnnotation> m_rimAnnotation;
cvf::ref< cvf::Part > m_part;
};

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivReachCircleAnnotationSourceInfo.h"
#include "RimEclipseView.h"
#include "RimAnnotationInViewCollection.h"
#include "RimReachCircleAnnotation.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReachCircleAnnotationSourceInfo::RivReachCircleAnnotationSourceInfo(RimReachCircleAnnotation* annotation)
: m_annotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimReachCircleAnnotation* RivReachCircleAnnotationSourceInfo::annotation() const
{
return m_annotation.p();
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
class RimReachCircleAnnotation;
class RivReachCircleAnnotationSourceInfo : public cvf::Object
{
public:
RivReachCircleAnnotationSourceInfo(RimReachCircleAnnotation* annotation);
RimReachCircleAnnotation* annotation() const;
private:
caf::PdmPointer<RimReachCircleAnnotation> m_annotation;
};

View File

@ -0,0 +1,218 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivTextAnnotationPartMgr.h"
#include "RiaApplication.h"
#include "RigActiveCellInfo.h"
#include "RigCell.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
//#include "RimAnnotationInView.h"
#include "RimTextAnnotation.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimSimWellInView.h"
#include "RivPipeGeometryGenerator.h"
#include "RivPolylineGenerator.h"
#include "RivPartPriority.h"
#include "RivTextAnnotationSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfArrowGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfGeometryBuilderFaceList.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
#include "RivSectionFlattner.h"
static RimSimWellInViewCollection* simWellInViewCollection() { return nullptr; }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(RimTextAnnotation* annotation)
: m_rimAnnotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivTextAnnotationPartMgr::~RivTextAnnotationPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextAnnotationPartMgr::buildTextAnnotationParts(const caf::DisplayCoordTransform * displayXf,
bool doFlatten,
double xOffset)
{
clearAllGeometry();
auto textAnnotation = dynamic_cast<RimTextAnnotation*>(m_rimAnnotation.p());
if(textAnnotation)
{
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(m_rimAnnotation);
cvf::Vec3d textPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->anchorPoint());
QString text = textAnnotation->text();
if (!text.isEmpty())
{
cvf::Font* font = RiaApplication::instance()->customFont();
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
drawableText->setFont(font);
drawableText->setCheckPosVisible(false);
drawableText->setDrawBorder(false);
drawableText->setDrawBackground(false);
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
drawableText->setTextColor(cvf::Color3f::BLACK);// simWellInViewCollection()->wellLabelColor());
cvf::String cvfString = cvfqt::Utils::toString(text);
cvf::Vec3f textCoord(textPosition);
drawableText->addText(cvfString, textCoord);
cvf::ref<cvf::Part> part = new cvf::Part;
part->setName("RivAnnotationPartMgr: text " + cvfString);
part->setDrawable(drawableText.p());
cvf::ref<cvf::Effect> eff = new cvf::Effect;
part->setEffect(eff.p());
part->setPriority(RivPartPriority::PartType::Text);
part->setSourceInfo(sourceInfo.p());
m_part = part;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextAnnotationPartMgr::clearAllGeometry()
{
m_part = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf)
{
if (m_rimAnnotation.isNull()) return;
if (!validateAnnotation(m_rimAnnotation)) return;
buildTextAnnotationParts(displayXf, false, 0.0);
model->addPart(m_part.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextAnnotationPartMgr::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* RivTextAnnotationPartMgr::viewWithSettings()
{
Rim3dView* view = nullptr;
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(view);
return view;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RivTextAnnotationPartMgr::annotatationInViewCollection()
{
RimAnnotationInViewCollection* coll = nullptr;
if (m_rimAnnotation) m_rimAnnotation->firstAncestorOrThisOfType(coll);
return coll;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivTextAnnotationPartMgr::validateAnnotation(const RimTextAnnotation* annotation) const
{
return m_rimAnnotation->anchorPoint() != cvf::Vec3d::ZERO && !m_rimAnnotation->text().isEmpty();
}

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, 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 "cvfBase.h"
#include "cvfAssert.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
namespace cvf
{
class Part;
class ModelBasicList;
class Transform;
class Font;
}
namespace caf
{
class DisplayCoordTransform;
}
class Rim3dView;
class RimTextAnnotation;
class RimAnnotationInViewCollection;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RivTextAnnotationPartMgr : public cvf::Object
{
public:
RivTextAnnotationPartMgr( RimTextAnnotation* annotation);
~RivTextAnnotationPartMgr() override;
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform * displayXf);
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
size_t frameIndex,
const caf::DisplayCoordTransform * displayXf,
double xOffset);
private:
void buildTextAnnotationParts(const caf::DisplayCoordTransform * displayXf,
bool doFlatten,
double xOffset);
void clearAllGeometry();
Rim3dView* viewWithSettings();
RimAnnotationInViewCollection* annotatationInViewCollection();
bool validateAnnotation(const RimTextAnnotation* annotation) const;
caf::PdmPointer<RimTextAnnotation> m_rimAnnotation;
cvf::ref< cvf::Part > m_part;
};

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivTextAnnotationSourceInfo.h"
#include "RimEclipseView.h"
#include "RimAnnotationInViewCollection.h"
#include "RimTextAnnotation.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivTextAnnotationSourceInfo::RivTextAnnotationSourceInfo(RimTextAnnotation* annotation)
: m_annotation(annotation)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTextAnnotation* RivTextAnnotationSourceInfo::annotation() const
{
return m_annotation.p();
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
//class RimAnnotationInView;
class RimTextAnnotation;
class RivTextAnnotationSourceInfo : public cvf::Object
{
public:
RivTextAnnotationSourceInfo(RimTextAnnotation* annotation);
RimTextAnnotation* annotation() const;
private:
caf::PdmPointer<RimTextAnnotation> m_annotation;
};

View File

@ -122,6 +122,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.h
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.h
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
)
@ -248,6 +254,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RimContourMapView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContourMapViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContourMapNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolylineAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -25,6 +25,7 @@
#include "RiaViewRedrawScheduler.h"
#include "Rim3dWellLogCurve.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimMainPlotCollection.h"
@ -34,6 +35,7 @@
#include "RimViewLinker.h"
#include "RimWellPathCollection.h"
#include "RivAnnotationsPartMgr.h"
#include "RivWellPathsPartMgr.h"
#include "RiuMainWindow.h"
@ -131,6 +133,7 @@ Rim3dView::Rim3dView(void)
m_wellPathPipeVizModel->setName("WellPathPipeModel");
m_wellPathsPartManager = new RivWellPathsPartMgr(this);
m_annotationsPartManager = new RivAnnotationsPartMgr(this);
this->setAs3DViewMdiWindow();
}
@ -313,6 +316,8 @@ void Rim3dView::setCurrentTimeStepAndUpdate(int frameIndex)
RimProject* project;
firstAncestorOrThisOfTypeAsserted(project);
project->mainPlotCollection()->updateCurrentTimeStepInPlots();
appendAnnotationsToModel();
}
//--------------------------------------------------------------------------------------------------
@ -665,6 +670,29 @@ void Rim3dView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBas
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicList)
{
if (!this->ownerCase()) return;
std::vector<RimAnnotationInViewCollection*> annotationCollections;
descendantsIncludingThisOfType(annotationCollections);
if (annotationCollections.empty() || !annotationCollections.front()->isActive())
{
m_annotationsPartManager->clearGeometryCache();
}
else
{
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_annotationsPartManager->appendGeometryPartsToModel(wellPathModelBasicList, transForm.p());
}
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -961,11 +989,23 @@ void Rim3dView::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::appendAnnotationsToModel()
{
if (!m_viewer) return;
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
cvf::String name = "Annotations";
this->removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> model = new cvf::ModelBasicList;
model->setName(name);
addAnnotationsToModel(model.p());
frameScene->addModel(model.p());
}
}

View File

@ -41,6 +41,7 @@ class RimCase;
class RimLegendConfig;
class RimWellPathCollection;
class RiuViewer;
class RivAnnotationsPartMgr;
class RivWellPathsPartMgr;
namespace cvf
@ -166,6 +167,8 @@ protected:
void addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::BoundingBox& wellPathClipBoundingBox);
void addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicList);
void createHighlightAndGridBoxDisplayModel();
// Implementation of RiuViewerToViewInterface
@ -201,6 +204,7 @@ protected:
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
cvf::ref<RivAnnotationsPartMgr> m_annotationsPartManager;
private:
// Overridden PdmObject methods:
@ -230,6 +234,7 @@ private:
caf::PdmObjectHandle* implementingPdmObject() override { return this; }
void handleMdiWindowClosed() override;
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) override;
void appendAnnotationsToModel();
private:
caf::PdmField<QString> m_name;

View File

@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimAnnotationCollection.h"
#include "RimTextAnnotation.h"
#include "RimReachCircleAnnotation.h"
#include "RimPolylineAnnotation.h"
#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");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection::RimAnnotationCollection()
{
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
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_reachCircleAnnotations.uiCapability()->setUiHidden(true);
m_polylineAnnotations.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection::~RimAnnotationCollection()
{
// wellPaths.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimTextAnnotation* annotation)
{
m_textAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation)
{
m_reachCircleAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationCollection::addAnnotation(RimPolylineAnnotation* annotation)
{
m_polylineAnnotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimTextAnnotation*> RimAnnotationCollection::textAnnotations() const
{
return m_textAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnotations() const
{
return m_reachCircleAnnotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineAnnotation*> RimAnnotationCollection::polylineAnnotations() const
{
return m_polylineAnnotations.childObjects();
}

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiaEclipseUnitTools.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.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 RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylineAnnotation;
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationCollection();
~RimAnnotationCollection() override;
void addAnnotation(RimTextAnnotation* annotation);
void addAnnotation(RimReachCircleAnnotation* annotation);
void addAnnotation(RimPolylineAnnotation* annotation);
std::vector<RimTextAnnotation*> textAnnotations() const;
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
private:
caf::PdmChildArrayField<RimTextAnnotation*> m_textAnnotations;
caf::PdmChildArrayField<RimReachCircleAnnotation*> m_reachCircleAnnotations;
caf::PdmChildArrayField<RimPolylineAnnotation*> m_polylineAnnotations;
};

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimAnnotationInView.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimAnnotationInView, "Annotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::RimAnnotationInView()
{
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInView::~RimAnnotationInView()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimAnnotationInView::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
}

View File

@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
#include "cvfObject.h"
#include "cvfVector3.h"
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationInView : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationInView();
~RimAnnotationInView() override;
caf::PdmFieldHandle* objectToggleField() override;
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
private:
caf::PdmField<bool> m_isActive;
};

View File

@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimAnnotationInViewCollection.h"
#include "RimGridView.h"
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection::RimAnnotationInViewCollection()
{
CAF_PDM_InitObject("Annotations", ":/Plus.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimAnnotationInViewCollection::isActive() const
{
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&m_isActive == changedField)
{
this->updateUiIconFromToggleField();
RimGridView* view;
firstAncestorOrThisOfType(view);
if (view)
{
//view->hasUserRequestedAnimation = true;
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimAnnotationInViewCollection::objectToggleField()
{
return &m_isActive;
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafTristate.h"
//==================================================================================================
///
///
//==================================================================================================
class RimAnnotationInViewCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimAnnotationInViewCollection();
~RimAnnotationInViewCollection() override;
bool isActive() const;
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
caf::PdmFieldHandle* objectToggleField() override;
private:
caf::PdmField<bool> m_isActive;
};

View File

@ -26,6 +26,7 @@
#include "Rim3dWellLogExtractionCurve.h"
#include "Rim3dWellLogFileCurve.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimAnnotationCollection.h"
#include "RimCalcScript.h"
#include "RimCaseCollection.h"
#include "RimCellRangeFilter.h"
@ -679,6 +680,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
menuBuilder << "RicConvertFractureTemplateUnitFeature";
}
else if (dynamic_cast<RimAnnotationCollection*>(uiItem))
{
menuBuilder << "RicNewTextAnnotationFeature";
menuBuilder << "RicNewPolygonAnnotationFeature";
}
if (dynamic_cast<Rim3dView*>(uiItem))
{

View File

@ -22,6 +22,7 @@
#include "RiuViewer.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimCellRangeFilterCollection.h"
#include "RimContourMapNameConfig.h"
@ -181,6 +182,7 @@ void RimContourMapView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder
cellResult()->uiCapability()->setUiReadOnly(m_contourMapProjection->isColumnResult());
uiTreeOrdering.add(wellCollection());
uiTreeOrdering.add(faultCollection());
uiTreeOrdering.add(annotationCollection());
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(nativePropertyFilterCollection());

View File

@ -38,6 +38,7 @@
#include "Rim2dIntersectionView.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
@ -141,6 +142,10 @@ RimEclipseView::RimEclipseView()
m_faultCollection = new RimFaultInViewCollection;
m_faultCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_annotationCollection, "AnnotationCollection", "Annotations", "", "", "");
m_annotationCollection = new RimAnnotationInViewCollection;
m_annotationCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "");
m_propertyFilterCollection = new RimEclipsePropertyFilterCollection();
m_propertyFilterCollection.uiCapability()->setUiHidden(true);
@ -176,6 +181,7 @@ RimEclipseView::~RimEclipseView()
delete m_propertyFilterCollection;
delete wellCollection();
delete faultCollection();
delete annotationCollection();
m_reservoirGridPartManager->clearGeometryCache();
@ -568,7 +574,7 @@ void RimEclipseView::updateCurrentTimeStep()
updateVisibleGeometriesAndCellColors();
appendWellsAndFracturesToModel();
m_overlayInfoConfig()->update3DInfo();
// Invisible Wells are marked as read only when "show wells intersecting visible cells" is enabled
@ -1521,6 +1527,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_virtualPerforationResult);
uiTreeOrdering.add(faultCollection());
uiTreeOrdering.add(annotationCollection());
uiTreeOrdering.add(crossSectionCollection());
uiTreeOrdering.add(m_rangeFilterCollection());

View File

@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCellRangeFilterCollection.h"
#include "RimGridCollection.h"
#include "RimIntersectionCollection.h"
@ -179,6 +180,14 @@ const RimCellRangeFilterCollection* RimGridView::rangeFilterCollection() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationInViewCollection* RimGridView::annotationCollection() const
{
return m_annotationCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include "cvfBase.h"
#include "cvfArray.h"
class RimAnnotationInViewCollection;
class RimContourMapProjection;
class Rim3dOverlayInfoConfig;
class RimIntersectionCollection;
@ -50,7 +51,9 @@ public:
void rangeFiltersUpdated();
RimCellRangeFilterCollection* rangeFilterCollection();
const RimCellRangeFilterCollection* rangeFilterCollection() const;
RimAnnotationInViewCollection* annotationCollection() const;
bool hasOverridenRangeFilterCollection();
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
void replaceRangeFilterCollectionWithOverride();
@ -78,6 +81,8 @@ protected: // Fields
caf::PdmChildField<RimCellRangeFilterCollection*> m_rangeFilterCollection;
caf::PdmChildField<RimCellRangeFilterCollection*> m_overrideRangeFilterCollection;
caf::PdmChildField<RimGridCollection*> m_gridCollection;
caf::PdmChildField<RimAnnotationInViewCollection*> m_annotationCollection;
protected:
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;

View File

@ -20,6 +20,7 @@
#include "RimOilField.h"
#include "RimAnnotationCollection.h"
#include "RimEclipseCaseCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimFractureTemplateCollection.h"
@ -49,12 +50,15 @@ RimOilField::RimOilField(void)
CAF_PDM_InitFieldNoDefault(&formationNamesCollection,"FormationNamesCollection","Formations","","","");
CAF_PDM_InitFieldNoDefault(&observedDataCollection, "ObservedDataCollection", "Observed Data", ":/Cases16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&annotationCollection, "AnnotationCollection", "Annotations", "", "", "");
fractureDefinitionCollection = new RimFractureTemplateCollection();
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseMainCollection = new RimSummaryCaseMainCollection();
observedDataCollection = new RimObservedDataCollection();
formationNamesCollection = new RimFormationNamesCollection();
annotationCollection = new RimAnnotationCollection();
}
//--------------------------------------------------------------------------------------------------
@ -70,6 +74,7 @@ RimOilField::~RimOilField(void)
if (summaryCaseMainCollection()) delete summaryCaseMainCollection();
if (formationNamesCollection()) delete formationNamesCollection();
if (observedDataCollection()) delete observedDataCollection();
if (annotationCollection()) delete annotationCollection();
}
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@ class RimObservedDataCollection;
class RimSummaryCase;
class RimSummaryCaseMainCollection;
class RimWellPathCollection;
class RimAnnotationCollection;
//==================================================================================================
///
@ -55,5 +56,5 @@ public:
caf::PdmChildField<RimSummaryCaseMainCollection*> summaryCaseMainCollection;
caf::PdmChildField<RimObservedDataCollection*> observedDataCollection;
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
caf::PdmChildField<RimAnnotationCollection*> annotationCollection;
};

View File

@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPolylineAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimPolylineAnnotation, "RimPolylineAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPolylineAnnotation::RimPolylineAnnotation()
{
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_points, "Points", {}, "", "", "", "");
}
RimPolylineAnnotation::~RimPolylineAnnotation()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::setPoints(const std::vector<Vec3d>& points)
{
m_points = points;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RimPolylineAnnotation::Vec3d>& RimPolylineAnnotation::points() const
{
return m_points();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_points);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolylineAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_points)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimPolylineAnnotation::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;
}

View File

@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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;
};

View File

@ -30,6 +30,7 @@
#include "RigEclipseCaseData.h"
#include "RigGridBase.h"
#include "RimAnnotationCollection.h"
#include "RimCalcScript.h"
#include "RimCase.h"
#include "RimCaseCollection.h"
@ -707,7 +708,7 @@ void RimProject::allVisibleViews(std::vector<Rim3dView*>& views)
void RimProject::allVisibleGridViews(std::vector<RimGridView*>& views)
{
std::vector<Rim3dView*> visibleViews;
this->allVisibleViews(visibleViews);
this->allVisibleViews(visibleViews);
for ( Rim3dView* view : visibleViews )
{
RimGridView* gridView = dynamic_cast<RimGridView*>(view);
@ -957,6 +958,57 @@ std::vector<RimWellPath*> RimProject::allWellPaths() const
return paths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimTextAnnotation*> RimProject::textAnnotations() const
{
std::vector<RimTextAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->textAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() const
{
std::vector<RimReachCircleAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->reachCircleAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylineAnnotation*> RimProject::polylineAnnotations() const
{
std::vector<RimPolylineAnnotation*> annotations;
for (const auto& oilField : oilFields())
{
auto annotationColl = oilField->annotationCollection();
for (const auto& annotation : annotationColl->polylineAnnotations())
{
annotations.push_back(annotation);
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1128,6 +1180,7 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
if (oilField->wellPathCollection()) uiTreeOrdering.add(oilField->wellPathCollection());
if (oilField->formationNamesCollection()) uiTreeOrdering.add(oilField->formationNamesCollection());
if (oilField->fractureDefinitionCollection()) uiTreeOrdering.add(oilField->fractureDefinitionCollection());
if (oilField->annotationCollection()) uiTreeOrdering.add(oilField->annotationCollection());
}
uiTreeOrdering.add(scriptCollection());

View File

@ -35,6 +35,9 @@ class RigGridManager;
class RigMainGrid;
class RigWellPath;
class RimTextAnnotation;
class RimReachCircleAnnotation;
class RimPolylineAnnotation;
class RimSummaryCalculationCollection;
class RimCase;
class RimCommandObject;
@ -142,6 +145,9 @@ public:
RimWellPath* wellPathFromSimWellName(const QString& simWellName, int branchIndex = -1);
RimWellPath* wellPathByName(const QString& wellPathName) const;
std::vector<RimWellPath*> allWellPaths() const;
std::vector<RimTextAnnotation*> textAnnotations() const;
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
std::vector<RimPolylineAnnotation*> polylineAnnotations() const;
std::vector<RimGeoMechCase*> geoMechCases() const;

View File

@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimReachCircleAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimReachCircleAnnotation, "RimReachCircleAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimReachCircleAnnotation::RimReachCircleAnnotation()
{
CAF_PDM_InitObject("CircleAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_centerPoint, "CenterPoint", Vec3d::ZERO, "Center Point", "", "", "");
CAF_PDM_InitField(&m_radius, "Radius", 0.0, "Radius", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::setRadius(double radius)
{
m_radius = radius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimReachCircleAnnotation::radius() const
{
return m_radius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_centerPoint);
uiOrdering.add(&m_radius);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimReachCircleAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_centerPoint || changedField == &m_radius)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimReachCircleAnnotation::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;
}

View File

@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RimReachCircleAnnotation : public caf::PdmObject
{
using Vec3d = cvf::Vec3d;
CAF_PDM_HEADER_INIT;
public:
RimReachCircleAnnotation();
void setRadius(double radius);
double radius() 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<Vec3d> m_centerPoint;
caf::PdmField<double> m_radius;
};

View File

@ -0,0 +1,160 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimTextAnnotation.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimAnnotationInViewCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimGridView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimPerforationCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
CAF_PDM_SOURCE_INIT(RimTextAnnotation, "RimTextAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTextAnnotation::RimTextAnnotation()
{
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
CAF_PDM_InitField(&m_anchorPoint, "AnchorPoint", Vec3d::ZERO, "Anchor Point", "", "", "");
CAF_PDM_InitField(&m_labelPoint, "LabelPoint", Vec3d::ZERO, "Label Point", "", "", "");
CAF_PDM_InitField(&m_text, "Text", QString(), "Text", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimTextAnnotation::anchorPoint() const
{
return m_anchorPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimTextAnnotation::labelPoint() const
{
return m_labelPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::setText(const QString& text)
{
m_text = text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimTextAnnotation::text() const
{
return m_text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_anchorPoint);
uiOrdering.add(&m_labelPoint);
uiOrdering.add(&m_text);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTextAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
auto views = gridViewsContainingAnnotations();
if (!views.empty())
{
if (changedField == &m_text)
{
for (auto& view : views)
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridView*> RimTextAnnotation::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;
}

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RimTextAnnotation : public caf::PdmObject
{
using Vec3d = cvf::Vec3d;
CAF_PDM_HEADER_INIT;
public:
RimTextAnnotation();
Vec3d anchorPoint() const;
Vec3d labelPoint() const;
void setText(const QString& text);
const QString& text() 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<Vec3d> m_anchorPoint;
caf::PdmField<Vec3d> m_labelPoint;
caf::PdmField<QString> m_text;
};

22
doc/annotations.plantuml Normal file
View File

@ -0,0 +1,22 @@
@startuml
left to right direction
package "Project" {
RimProject --> RimOilField
RimOilField --> RimAnnotationCollection
RimAnnotationCollection --> "n" RimAnnotation
RimAnnotation <|-- RimTextAnnotation
RimAnnotation <|-- RimCircleAnnotation
RimAnnotation <|-- RimPolygonAnnotation
}
package "View" {
Rim3dView --> RivAnnotationsPartMgr
Rim3dView <|-- RimGridView
RimGridView --> RimAnnotationInViewCollection
RivAnnotationsPartMgr --> "n" RivAnnotationPartMgr
RivAnnotationPartMgr "injected" --> RimAnnotation
}
@enduml