mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3758 Annotations. Add appearance settings to line based annotations
This commit is contained in:
parent
8873cdb1f7
commit
d8142e3c75
@ -52,13 +52,16 @@ RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf)
|
void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf)
|
||||||
{
|
{
|
||||||
clearAllGeometry();
|
clearAllGeometry();
|
||||||
|
|
||||||
if (!m_rimAnnotation->isEmpty())
|
if (!m_rimAnnotation->isEmpty())
|
||||||
{
|
{
|
||||||
const auto& points = m_rimAnnotation->polyLinesData();
|
const auto& points = m_rimAnnotation->polyLinesData();
|
||||||
|
auto lineColor = m_rimAnnotation->appearance()->color();
|
||||||
|
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
|
||||||
|
auto lineThickness = m_rimAnnotation->appearance()->thickness();
|
||||||
|
|
||||||
auto linesInDisplayCoords = points->polyLines();
|
auto linesInDisplayCoords = points->polyLines();
|
||||||
|
|
||||||
@ -75,8 +78,10 @@ void RivPolylineAnnotationPartMgr::buildPolygonAnnotationParts(const caf::Displa
|
|||||||
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
||||||
part->setDrawable(drawableGeo.p());
|
part->setDrawable(drawableGeo.p());
|
||||||
|
|
||||||
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
|
caf::MeshEffectGenerator effgen(lineColor);
|
||||||
cvf::ref<cvf::Effect> eff = colorEffgen.generateCachedEffect();
|
effgen.setLineWidth(lineThickness);
|
||||||
|
if (isDashedLine) effgen.setLineStipple(true);
|
||||||
|
cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
|
||||||
|
|
||||||
part->setEffect(eff.p());
|
part->setEffect(eff.p());
|
||||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||||
@ -105,7 +110,7 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
|
|||||||
if (m_rimAnnotation.isNull()) return;
|
if (m_rimAnnotation.isNull()) return;
|
||||||
if (m_rimAnnotation->isEmpty()) return;
|
if (m_rimAnnotation->isEmpty()) return;
|
||||||
|
|
||||||
buildPolygonAnnotationParts(displayXf);
|
buildPolylineAnnotationParts(displayXf);
|
||||||
model->addPart(m_part.p());
|
model->addPart(m_part.p());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
const caf::DisplayCoordTransform * displayXf);
|
const caf::DisplayCoordTransform * displayXf);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buildPolygonAnnotationParts(const caf::DisplayCoordTransform* displayXf);
|
void buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf);
|
||||||
|
|
||||||
void clearAllGeometry();
|
void clearAllGeometry();
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
|
|||||||
|
|
||||||
Vec3d centerPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->centerPoint());
|
Vec3d centerPosition = displayXf->transformToDisplayCoord(m_rimAnnotation->centerPoint());
|
||||||
double radius = m_rimAnnotation->radius();
|
double radius = m_rimAnnotation->radius();
|
||||||
|
auto lineColor = m_rimAnnotation->appearance()->color();
|
||||||
|
auto isDashedLine = m_rimAnnotation->appearance()->isDashed();
|
||||||
|
auto lineThickness = m_rimAnnotation->appearance()->thickness();
|
||||||
|
|
||||||
// Circle part
|
// Circle part
|
||||||
{
|
{
|
||||||
@ -82,8 +85,10 @@ void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransfor
|
|||||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||||
part->setDrawable(drawableGeo.p());
|
part->setDrawable(drawableGeo.p());
|
||||||
|
|
||||||
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::RED);
|
caf::MeshEffectGenerator effgen(lineColor);
|
||||||
cvf::ref<cvf::Effect> eff = colorEffgen.generateUnCachedEffect();
|
effgen.setLineWidth(lineThickness);
|
||||||
|
if (isDashedLine) effgen.setLineStipple(true);
|
||||||
|
cvf::ref<cvf::Effect> eff = effgen.generateUnCachedEffect();
|
||||||
|
|
||||||
part->setEffect(eff.p());
|
part->setEffect(eff.p());
|
||||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||||
|
@ -5,6 +5,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -13,6 +15,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -0,0 +1,170 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimAnnotationLineAppearance.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"
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
void RimAnnotationLineAppearance::LineStyle::setUp()
|
||||||
|
{
|
||||||
|
addItem(RimAnnotationLineAppearance::STYLE_SOLID, "STYLE_SOLID", "Solid");
|
||||||
|
addItem(RimAnnotationLineAppearance::STYLE_DASH, "STYLE_DASH", "Dashes");
|
||||||
|
|
||||||
|
setDefault(RimAnnotationLineAppearance::STYLE_SOLID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimAnnotationLineAppearance, "RimAnnotationLineAppearance");
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimAnnotationLineAppearance::RimAnnotationLineAppearance()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3f::BLACK), "Color", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_style, "Style", LineStyle(), "Style", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_thickness, "Thickness", 1, "Thickness", "", "", "");
|
||||||
|
|
||||||
|
m_fieldChangedByUiCallback = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RimAnnotationLineAppearance::color() const
|
||||||
|
{
|
||||||
|
return m_color();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimAnnotationLineAppearance::isDashed() const
|
||||||
|
{
|
||||||
|
return m_style() == STYLE_DASH;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimAnnotationLineAppearance::thickness() const
|
||||||
|
{
|
||||||
|
return m_thickness();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const caf::PdmFieldHandle* RimAnnotationLineAppearance::colorField() const
|
||||||
|
{
|
||||||
|
return &m_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const caf::PdmFieldHandle* RimAnnotationLineAppearance::styleField() const
|
||||||
|
{
|
||||||
|
return &m_style;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const caf::PdmFieldHandle* RimAnnotationLineAppearance::thicknessField() const
|
||||||
|
{
|
||||||
|
return &m_thickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAnnotationLineAppearance::registerFieldChangedByUiCallback(FieldChangedByUiDelegate func)
|
||||||
|
{
|
||||||
|
m_fieldChangedByUiCallback = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAnnotationLineAppearance::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
uiOrdering.add(&m_color);
|
||||||
|
uiOrdering.add(&m_style);
|
||||||
|
uiOrdering.add(&m_thickness);
|
||||||
|
|
||||||
|
uiOrdering.skipRemainingFields(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAnnotationLineAppearance::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (m_fieldChangedByUiCallback)
|
||||||
|
{
|
||||||
|
m_fieldChangedByUiCallback(changedField, oldValue, newValue);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 RimAnnotationLineAppearance : public caf::PdmObject
|
||||||
|
{
|
||||||
|
// Friends
|
||||||
|
friend class RimReachCircleAnnotation;
|
||||||
|
friend class RimUserDefinedPolylinesAnnotation;
|
||||||
|
friend class RimPolylinesFromFileAnnotation;
|
||||||
|
|
||||||
|
using Vec3d = cvf::Vec3d;
|
||||||
|
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using FieldChangedByUiDelegate = std::function<void(const caf::PdmFieldHandle*, const QVariant&, const QVariant&)>;
|
||||||
|
|
||||||
|
enum LineStyleEnum
|
||||||
|
{
|
||||||
|
STYLE_SOLID,
|
||||||
|
STYLE_DASH
|
||||||
|
};
|
||||||
|
typedef caf::AppEnum<LineStyleEnum> LineStyle;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimAnnotationLineAppearance();
|
||||||
|
|
||||||
|
cvf::Color3f color() const;
|
||||||
|
bool isDashed() const;
|
||||||
|
int thickness() const;
|
||||||
|
|
||||||
|
const caf::PdmFieldHandle* colorField() const;
|
||||||
|
const caf::PdmFieldHandle* styleField() const;
|
||||||
|
const caf::PdmFieldHandle* thicknessField() const;
|
||||||
|
|
||||||
|
void registerFieldChangedByUiCallback(FieldChangedByUiDelegate func);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<cvf::Color3f> m_color;
|
||||||
|
caf::PdmField<LineStyle> m_style;
|
||||||
|
caf::PdmField<int> m_thickness;
|
||||||
|
|
||||||
|
FieldChangedByUiDelegate m_fieldChangedByUiCallback;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,88 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimLineBasedAnnotation.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 "RimFileWellPath.h"
|
||||||
|
#include "RimModeledWellPath.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 <functional>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimLineBasedAnnotation, "RimLineBasedAnnotation");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimLineBasedAnnotation::RimLineBasedAnnotation()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_appearance, "LineAppearance", "Line Appearance", "", "", "");
|
||||||
|
|
||||||
|
m_appearance = new RimAnnotationLineAppearance();
|
||||||
|
m_appearance.uiCapability()->setUiTreeHidden(true);
|
||||||
|
m_appearance.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
|
||||||
|
m_appearance->registerFieldChangedByUiCallback(
|
||||||
|
[this](const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) {
|
||||||
|
this->fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimAnnotationLineAppearance* RimLineBasedAnnotation::appearance() const
|
||||||
|
{
|
||||||
|
return m_appearance;
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimAnnotationLineAppearance.h"
|
||||||
|
|
||||||
|
#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 RimLineBasedAnnotation : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimLineBasedAnnotation();
|
||||||
|
RimAnnotationLineAppearance* appearance() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override {};
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmChildField<RimAnnotationLineAppearance*> m_appearance;
|
||||||
|
};
|
@ -105,6 +105,9 @@ void RimUserDefinedPolylinesAnnotation::defineUiOrdering(QString uiConfigName, c
|
|||||||
{
|
{
|
||||||
uiOrdering.add(&m_points);
|
uiOrdering.add(&m_points);
|
||||||
|
|
||||||
|
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||||
|
appearance()->defineUiOrdering(uiConfigName, *appearanceGroup);
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,6 +272,32 @@ void RimPolylinesFromFileAnnotation::setDescriptionFromFileName()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolylinesFromFileAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||||
|
appearance()->defineUiOrdering(uiConfigName, *appearanceGroup);
|
||||||
|
|
||||||
|
uiOrdering.skipRemainingFields(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolylinesFromFileAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue)
|
||||||
|
{
|
||||||
|
RimAnnotationCollection* annColl = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(annColl);
|
||||||
|
if (annColl)
|
||||||
|
{
|
||||||
|
annColl->scheduleRedrawOfRelevantViews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "RimLineBasedAnnotation.h"
|
||||||
|
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
@ -43,7 +44,7 @@ class RigPolyLinesData;
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimPolylinesAnnotation : public caf::PdmObject
|
class RimPolylinesAnnotation : public RimLineBasedAnnotation// caf::PdmObject
|
||||||
{
|
{
|
||||||
using Vec3d = cvf::Vec3d;
|
using Vec3d = cvf::Vec3d;
|
||||||
|
|
||||||
@ -113,6 +114,10 @@ public:
|
|||||||
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||||
void setDescriptionFromFileName();
|
void setDescriptionFromFileName();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "RimWellLogFile.h"
|
#include "RimWellLogFile.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
#include "RimPerforationCollection.h"
|
#include "RimPerforationCollection.h"
|
||||||
|
#include "RimFileWellPath.h"
|
||||||
|
#include "RimModeledWellPath.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
|
|
||||||
@ -55,8 +57,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "RimFileWellPath.h"
|
#include <functional>
|
||||||
#include "RimModeledWellPath.h"
|
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimReachCircleAnnotation, "RimReachCircleAnnotation");
|
CAF_PDM_SOURCE_INIT(RimReachCircleAnnotation, "RimReachCircleAnnotation");
|
||||||
@ -97,6 +98,9 @@ void RimReachCircleAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
|||||||
uiOrdering.add(&m_centerPoint);
|
uiOrdering.add(&m_centerPoint);
|
||||||
uiOrdering.add(&m_radius);
|
uiOrdering.add(&m_radius);
|
||||||
|
|
||||||
|
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||||
|
appearance()->defineUiOrdering(uiConfigName, *appearanceGroup);
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +114,11 @@ void RimReachCircleAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
auto views = gridViewsContainingAnnotations();
|
auto views = gridViewsContainingAnnotations();
|
||||||
if (!views.empty())
|
if (!views.empty())
|
||||||
{
|
{
|
||||||
if (changedField == &m_centerPoint || changedField == &m_radius)
|
if (changedField == &m_centerPoint ||
|
||||||
|
changedField == &m_radius ||
|
||||||
|
changedField == appearance()->colorField() ||
|
||||||
|
changedField == appearance()->styleField() ||
|
||||||
|
changedField == appearance()->thicknessField())
|
||||||
{
|
{
|
||||||
for (auto& view : views)
|
for (auto& view : views)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RimAnnotationLineAppearance.h"
|
||||||
|
#include "RimLineBasedAnnotation.h"
|
||||||
|
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
@ -45,7 +48,7 @@ class RimGridView;
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimReachCircleAnnotation : public caf::PdmObject
|
class RimReachCircleAnnotation : public RimLineBasedAnnotation
|
||||||
{
|
{
|
||||||
using Vec3d = cvf::Vec3d;
|
using Vec3d = cvf::Vec3d;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user