mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3868 Annotations. Draw spheres on polylines + toggles conotrolling visibility
This commit is contained in:
parent
295da5658e
commit
8401e3d9f0
@ -27,6 +27,7 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
@ -63,6 +64,7 @@ void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isCh
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
newAnnotation->appearance()->setSphereColor(newColor);
|
||||
newAnnotation->enablePicking(true);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
|
@ -54,7 +54,8 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "RimWellPathValve.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
@ -127,7 +128,8 @@ bool isDeletable(caf::PdmUiItem* uiItem)
|
||||
if (dynamic_cast<RimDerivedEnsembleCaseCollection*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimWellPathValve*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimTextAnnotation*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimLineBasedAnnotation*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimReachCircleAnnotation*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimPolylinesAnnotation*>(uiItem)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RivPolylineAnnotationPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaBoundingBoxTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
@ -42,6 +43,9 @@
|
||||
#include "cvfPart.h"
|
||||
#include "cvfTransform.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cvfGeometryBuilderTriangles.h"
|
||||
#include "cvfGeometryUtils.h"
|
||||
#include "cvfDrawableVectors.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -79,23 +83,90 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
auto linesInDomain = getPolylinesPointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
auto linesInDisplay = transformPolylinesPointsToDisplay(linesInDomain, displayXf);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay, rimAnnotation->closePolyline());
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("RivPolylineAnnotationPartMgr");
|
||||
part->setDrawable(drawableGeo.p());
|
||||
// Line part
|
||||
if(rimAnnotation->showLines())
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay, rimAnnotation->closePolyline());
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("RivPolylineAnnotationPartMgr");
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
effgen.setLineWidth(lineThickness);
|
||||
if (isDashedLine) effgen.setLineStipple(true);
|
||||
cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
effgen.setLineWidth(lineThickness);
|
||||
if (isDashedLine) effgen.setLineStipple(true);
|
||||
cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_part = part;
|
||||
m_linePart = part;
|
||||
}
|
||||
|
||||
// Sphere part
|
||||
if(rimAnnotation->showSpheres())
|
||||
{
|
||||
auto sphereColor = rimAnnotation->appearance()->sphereColor();
|
||||
int sphereRadius = rimAnnotation->appearance()->sphereRadius();
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertices = new cvf::Vec3fArray;
|
||||
cvf::ref<cvf::Vec3fArray> vecRes = new cvf::Vec3fArray;
|
||||
cvf::ref<cvf::Color3fArray> colors = new cvf::Color3fArray;
|
||||
vertices->reserve(linesInDisplay.front().size());
|
||||
vecRes->reserve(linesInDisplay.front().size());
|
||||
colors->reserve(linesInDisplay.front().size());
|
||||
|
||||
for (const auto& v : linesInDisplay.front())
|
||||
{
|
||||
vertices->add(cvf::Vec3f(v));
|
||||
vecRes->add(cvf::Vec3f::X_AXIS);
|
||||
colors->add(sphereColor);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableVectors> vectorDrawable;
|
||||
if (RiaApplication::instance()->useShaders())
|
||||
{
|
||||
// NOTE: Drawable vectors must be rendered using shaders when the rest of the application is rendered using
|
||||
// shaders Drawing vectors using fixed function when rest of the application uses shaders causes visual artifacts
|
||||
vectorDrawable = new cvf::DrawableVectors("u_transformationMatrix", "u_color");
|
||||
}
|
||||
else
|
||||
{
|
||||
vectorDrawable = new cvf::DrawableVectors();
|
||||
}
|
||||
|
||||
vectorDrawable->setVectors(vertices.p(), vecRes.p());
|
||||
vectorDrawable->setColors(colors.p());
|
||||
|
||||
cvf::GeometryBuilderTriangles builder;
|
||||
cvf::GeometryUtils::createSphere(sphereRadius, 15, 15, &builder);
|
||||
vectorDrawable->setGlyph(builder.trianglesUShort().p(), builder.vertices().p());
|
||||
|
||||
|
||||
|
||||
//cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createPointsFromPolylineDrawable(linesInDisplay);
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("RivPolylineAnnotationPartMgr");
|
||||
//part->setDrawable(drawableGeo.p());
|
||||
part->setDrawable(vectorDrawable.p());
|
||||
|
||||
//caf::MeshEffectGenerator effgen(lineColor);
|
||||
//effgen.setLineWidth(lineThickness);
|
||||
//if (isDashedLine) effgen.setLineStipple(true);
|
||||
//cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
|
||||
|
||||
part->setEffect(new cvf::Effect());
|
||||
|
||||
//part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_spherePart = part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +239,8 @@ bool RivPolylineAnnotationPartMgr::isPolylinesInBoundingBox(const cvf::BoundingB
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPolylineAnnotationPartMgr::clearAllGeometry()
|
||||
{
|
||||
m_part = nullptr;
|
||||
m_linePart = nullptr;
|
||||
m_spherePart = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -198,9 +270,14 @@ void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelB
|
||||
|
||||
buildPolylineAnnotationParts(displayXf);
|
||||
|
||||
if ( m_part.notNull() )
|
||||
if ( m_linePart.notNull() )
|
||||
{
|
||||
model->addPart(m_part.p());
|
||||
model->addPart(m_linePart.p());
|
||||
}
|
||||
|
||||
if (m_spherePart.notNull())
|
||||
{
|
||||
model->addPart(m_spherePart.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,5 +70,6 @@ private:
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimPolylinesAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_part;
|
||||
cvf::ref<cvf::Part> m_linePart;
|
||||
cvf::ref<cvf::Part> m_spherePart;
|
||||
};
|
||||
|
@ -10,7 +10,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationTextAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.h
|
||||
@ -31,7 +30,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationTextAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.cpp
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
|
@ -40,10 +40,10 @@ CAF_PDM_SOURCE_INIT(RimAnnotationLineAppearance, "RimAnnotationLineAppearance");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationLineAppearance::RimAnnotationLineAppearance()
|
||||
{
|
||||
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
|
||||
CAF_PDM_InitObject("AnnotationLineAppearance", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3f::BLACK), "Color", "", "", "");
|
||||
CAF_PDM_InitField(&m_thickness, "Thickness", 2, "Thickness", "", "", "");
|
||||
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3f::BLACK), "Line Color", "", "", "");
|
||||
CAF_PDM_InitField(&m_thickness, "Thickness", 2, "Line Thickness", "", "", "");
|
||||
|
||||
// Stippling not yet supported. Needs new stuff in VizFwk
|
||||
CAF_PDM_InitField(&m_style, "Style", LineStyle(), "Style", "", "", "");
|
||||
@ -107,3 +107,71 @@ void RimAnnotationLineAppearance::fieldChangedByUi(const caf::PdmFieldHandle* ch
|
||||
this->firstAncestorOrThisOfTypeAsserted(annColl);
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylineAppearance, "RimPolylineAppearance");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineAppearance::RimPolylineAppearance()
|
||||
{
|
||||
CAF_PDM_InitObject("PolylineAppearance", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_sphereColor, "SphereColor", cvf::Color3f(cvf::Color3f::BLACK), "Sphere Color", "", "", "");
|
||||
CAF_PDM_InitField(&m_sphereRadius, "SphereRadius", 15, "Sphere Radius", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAppearance::setSphereColor(const cvf::Color3f& color)
|
||||
{
|
||||
m_sphereColor = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimPolylineAppearance::sphereColor() const
|
||||
{
|
||||
return m_sphereColor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAppearance::setSphereRadius(int radius)
|
||||
{
|
||||
m_sphereRadius = radius;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimPolylineAppearance::sphereRadius() const
|
||||
{
|
||||
return m_sphereRadius();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAppearance::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimAnnotationLineAppearance::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
|
||||
uiOrdering.add(&m_sphereColor);
|
||||
uiOrdering.add(&m_sphereRadius);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineAppearance::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
RimAnnotationLineAppearance::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
|
@ -60,3 +60,38 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimReachCircleLineAppearance : public RimAnnotationLineAppearance
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylineAppearance : public RimAnnotationLineAppearance
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylineAppearance();
|
||||
|
||||
void setSphereColor(const cvf::Color3f& color);
|
||||
cvf::Color3f sphereColor() const;
|
||||
void setSphereRadius(int radius);
|
||||
int sphereRadius() const;
|
||||
|
||||
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_sphereColor;
|
||||
caf::PdmField<int> m_sphereRadius;
|
||||
};
|
||||
|
@ -1,77 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
|
||||
|
||||
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);
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationLineAppearance* RimLineBasedAnnotation::appearance() const
|
||||
{
|
||||
return m_appearance;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimLineBasedAnnotation::isActive()
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimLineBasedAnnotation::isVisible()
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
return coll && coll->isActive() && m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimLineBasedAnnotation::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimGridView;
|
||||
class RimAnnotationLineAppearance;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimLineBasedAnnotation : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimLineBasedAnnotation();
|
||||
RimAnnotationLineAppearance* appearance() const;
|
||||
|
||||
bool isActive();
|
||||
bool isVisible();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimAnnotationLineAppearance*> m_appearance;
|
||||
};
|
@ -24,6 +24,8 @@
|
||||
#include "RimTools.h"
|
||||
#include "QFile"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "QFileInfo"
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT(RimPolylinesAnnotation, "RimPolylinesAnnotation");
|
||||
@ -35,7 +37,19 @@ RimPolylinesAnnotation::RimPolylinesAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_closePolyline, "ClosePolyline", false, "Close Polyline", "", "", "");
|
||||
CAF_PDM_InitField(&m_showLines, "ShowLines", true, "Show Lines", "", "", "");
|
||||
CAF_PDM_InitField(&m_showSpheres, "ShowSpheres", false, "Show Spheres", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_appearance, "Appearance", "Appearance", "", "", "");
|
||||
|
||||
m_appearance = new RimPolylineAppearance();
|
||||
m_appearance.uiCapability()->setUiTreeHidden(true);
|
||||
m_appearance.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -46,6 +60,25 @@ RimPolylinesAnnotation::~RimPolylinesAnnotation()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotation::isActive()
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotation::isVisible()
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
return coll && coll->isActive() && m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -54,3 +87,35 @@ bool RimPolylinesAnnotation::closePolyline() const
|
||||
return m_closePolyline;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotation::showLines() const
|
||||
{
|
||||
return m_showLines;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylinesAnnotation::showSpheres() const
|
||||
{
|
||||
return m_showSpheres;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineAppearance* RimPolylinesAnnotation::appearance() const
|
||||
{
|
||||
return m_appearance;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPolylinesAnnotation::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
|
@ -17,21 +17,22 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RigPolyLinesData;
|
||||
class RimPolylineAppearance;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylinesAnnotation : public RimLineBasedAnnotation
|
||||
class RimPolylinesAnnotation : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -42,8 +43,24 @@ public:
|
||||
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
||||
virtual bool isEmpty() = 0;
|
||||
|
||||
bool isActive();
|
||||
bool isVisible();
|
||||
|
||||
bool closePolyline() const;
|
||||
bool showLines() const;
|
||||
bool showSpheres() const;
|
||||
|
||||
RimPolylineAppearance* appearance() const;
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
caf::PdmField<bool> m_closePolyline;
|
||||
caf::PdmField<bool> m_showLines;
|
||||
caf::PdmField<bool> m_showSpheres;
|
||||
|
||||
caf::PdmChildField<RimPolylineAppearance*> m_appearance;
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
@ -34,9 +35,37 @@ RimReachCircleAnnotation::RimReachCircleAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("CircleAnnotation", ":/ReachCircle16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_centerPointXyd, "CenterPointXyd", Vec3d::ZERO, "Center Point", "", "", "");
|
||||
CAF_PDM_InitField(&m_radius, "Radius", 0.0, "Radius", "", "", "");
|
||||
CAF_PDM_InitField(&m_name, "Name", QString("Circle Annotation"), "Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_appearance, "Appearance", "Appearance", "", "", "");
|
||||
|
||||
m_appearance = new RimReachCircleLineAppearance();
|
||||
m_appearance.uiCapability()->setUiTreeHidden(true);
|
||||
m_appearance.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimReachCircleAnnotation::isActive()
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimReachCircleAnnotation::isVisible()
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
return coll && coll->isActive() && m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,6 +94,14 @@ QString RimReachCircleAnnotation::name() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReachCircleLineAppearance* RimReachCircleAnnotation::appearance() const
|
||||
{
|
||||
return m_appearance;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -74,7 +111,7 @@ void RimReachCircleAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&m_centerPointXyd);
|
||||
uiOrdering.add(&m_radius);
|
||||
|
||||
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||
auto appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
@ -101,3 +138,11 @@ caf::PdmFieldHandle* RimReachCircleAnnotation::userDescriptionField()
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimReachCircleAnnotation::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -32,6 +29,7 @@
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
@ -40,13 +38,13 @@
|
||||
|
||||
class QString;
|
||||
class RimGridView;
|
||||
|
||||
class RimReachCircleLineAppearance;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimReachCircleAnnotation : public RimLineBasedAnnotation
|
||||
class RimReachCircleAnnotation : public caf::PdmObject
|
||||
{
|
||||
friend class RimReachCircleAnnotationInView;
|
||||
|
||||
@ -58,17 +56,25 @@ public:
|
||||
RimReachCircleAnnotation();
|
||||
~RimReachCircleAnnotation() override {}
|
||||
|
||||
bool isActive();
|
||||
bool isVisible();
|
||||
|
||||
Vec3d centerPoint() const;
|
||||
double radius() const;
|
||||
QString name() const;
|
||||
RimReachCircleLineAppearance* appearance() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
caf::PdmField<Vec3d> m_centerPointXyd;
|
||||
caf::PdmField<double> m_radius;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmChildField<RimReachCircleLineAppearance*> m_appearance;
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
@ -230,7 +230,10 @@ void RimUserDefinedPolylinesAnnotation::defineUiOrdering(QString uiConfigName, c
|
||||
uiOrdering.add(&m_enablePicking);
|
||||
uiOrdering.add(&m_closePolyline);
|
||||
|
||||
auto appearanceGroup = uiOrdering.addNewGroup("Line Appearance");
|
||||
uiOrdering.add(&m_showLines);
|
||||
uiOrdering.add(&m_showSpheres);
|
||||
|
||||
auto appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||
appearance()->uiOrdering(uiConfigName, *appearanceGroup);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
|
Loading…
Reference in New Issue
Block a user