#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

@@ -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;
};