mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Renamed from polyline to polylines. Split into PolylinesFromFile and UserDefinedPolylines Add import of polylines from file
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
// Copyright (C) 2018- equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -18,51 +16,29 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#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 "RimPolylinesAnnotation.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 "RivPolylinesAnnotationSourceInfo.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)
|
||||
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(RimPolylinesAnnotation* annotation)
|
||||
: m_rimAnnotation(annotation)
|
||||
{
|
||||
}
|
||||
@@ -78,41 +54,36 @@ RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset)
|
||||
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivPolylineAnnotationSourceInfo> sourceInfo = new RivPolylineAnnotationSourceInfo(m_rimAnnotation);
|
||||
|
||||
const auto& points = m_rimAnnotation->points();
|
||||
|
||||
if (!points.empty())
|
||||
if (!m_rimAnnotation->isEmpty())
|
||||
{
|
||||
// textPosition.z() += 1.2 * arrowLength;
|
||||
const auto& points = m_rimAnnotation->polyLinesData();
|
||||
|
||||
cvf::Font* font = RiaApplication::instance()->customFont();
|
||||
auto linesInDisplayCoords = points->polyLines();
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(points);
|
||||
|
||||
//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);
|
||||
for (auto& line : linesInDisplayCoords)
|
||||
{
|
||||
for ( cvf::Vec3d& point : line)
|
||||
{
|
||||
point = displayXf->transformToDisplayCoord(point);
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplayCoords);
|
||||
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();
|
||||
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
|
||||
cvf::ref<cvf::Effect> eff = colorEffgen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(m_rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_part = part;
|
||||
@@ -134,79 +105,9 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
|
||||
const caf::DisplayCoordTransform * displayXf)
|
||||
{
|
||||
if (m_rimAnnotation.isNull()) return;
|
||||
if (!validateAnnotation(m_rimAnnotation)) return;
|
||||
if (m_rimAnnotation->isEmpty()) return;
|
||||
|
||||
buildPolygonAnnotationParts(displayXf, false, 0.0);
|
||||
buildPolygonAnnotationParts(displayXf);
|
||||
model->addPart(m_part.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user