mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1498 Fishbones : Assign individual colors to fishbones
This commit is contained in:
parent
2898884c0b
commit
62209935a8
@ -47,7 +47,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
|
|||||||
CVF_ASSERT(wellPath);
|
CVF_ASSERT(wellPath);
|
||||||
|
|
||||||
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
||||||
wellPath->fishbonesCollection()->fishbonesSubs.push_back(obj);
|
wellPath->fishbonesCollection()->appendFishbonesSubs(obj);
|
||||||
|
|
||||||
obj->setName(QString("Fishbones Subs (%1)").arg(wellPath->fishbonesCollection()->fishbonesSubs.size()));
|
obj->setName(QString("Fishbones Subs (%1)").arg(wellPath->fishbonesCollection()->fishbonesSubs.size()));
|
||||||
int integerValue = wellPathSelItem->m_measuredDepth;
|
int integerValue = wellPathSelItem->m_measuredDepth;
|
||||||
|
@ -46,7 +46,7 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
||||||
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
|
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
|
||||||
fishbonesCollection->fishbonesSubs.push_back(obj);
|
fishbonesCollection->appendFishbonesSubs(obj);
|
||||||
|
|
||||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
|
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ void RivFishbonesSubsPartMgr::buildParts(caf::DisplayCoordTransform* displayCoor
|
|||||||
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(domainCoord));
|
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(domainCoord));
|
||||||
}
|
}
|
||||||
|
|
||||||
geoGenerator.cylinderWithCenterLineParts(&m_parts, displayCoords, wellPath->wellPathColor(), wellPath->combinedScaleFactor() * characteristicCellSize * 0.5);
|
geoGenerator.cylinderWithCenterLineParts(&m_parts, displayCoords, m_rimFishbonesSubs->fishbonesColor(), wellPath->combinedScaleFactor() * characteristicCellSize * 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include "RimFishboneWellPathCollection.h"
|
#include "RimFishboneWellPathCollection.h"
|
||||||
#include "RimFishbonesMultipleSubs.h"
|
#include "RimFishbonesMultipleSubs.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimFishbonesCollection, "FishbonesCollection");
|
CAF_PDM_SOURCE_INIT(RimFishbonesCollection, "FishbonesCollection");
|
||||||
@ -68,3 +71,45 @@ void RimFishbonesCollection::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
|||||||
proj->createDisplayModelAndRedrawAllViews();
|
proj->createDisplayModelAndRedrawAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFishbonesCollection::appendFishbonesSubs(RimFishbonesMultipleSubs* subs)
|
||||||
|
{
|
||||||
|
subs->fishbonesColor = nextFishbonesColor();
|
||||||
|
fishbonesSubs.push_back(subs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RimFishbonesCollection::nextFishbonesColor() const
|
||||||
|
{
|
||||||
|
RimWellPath* wellPath;
|
||||||
|
firstAncestorOrThisOfType(wellPath);
|
||||||
|
cvf::Color3ub wellPathColor(wellPath->wellPathColor());
|
||||||
|
QColor qWellPathColor = QColor(wellPathColor.r(), wellPathColor.g(), wellPathColor.b());
|
||||||
|
|
||||||
|
if (qWellPathColor.value() == 0)
|
||||||
|
{
|
||||||
|
// If the color is black, using `lighter` or `darker` will not have any effect, since they multiply `value` by a percentage.
|
||||||
|
// In this case, `value` is set specifically to make `lighter`/`darker` possible.
|
||||||
|
qWellPathColor.setHsl(qWellPathColor.hue(), qWellPathColor.saturation(), 25);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor qFishbonesColor;
|
||||||
|
|
||||||
|
int newIndex = static_cast<int>(fishbonesSubs.size());
|
||||||
|
|
||||||
|
if (qWellPathColor.lightnessF() < 0.5)
|
||||||
|
{
|
||||||
|
qFishbonesColor = qWellPathColor.lighter(150 + 50 * newIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qFishbonesColor = qWellPathColor.darker(150 + 50 * newIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cvf::Color3f::fromByteColor(qFishbonesColor.red(), qFishbonesColor.green(), qFishbonesColor.blue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
|
#include "cafPdmFieldCvfColor.h"
|
||||||
|
|
||||||
|
#include "cvfColor3.h"
|
||||||
|
|
||||||
class RimFishbonesMultipleSubs;
|
class RimFishbonesMultipleSubs;
|
||||||
class RimFishboneWellPathCollection;
|
class RimFishboneWellPathCollection;
|
||||||
@ -39,6 +42,7 @@ public:
|
|||||||
RimFishbonesCollection();
|
RimFishbonesCollection();
|
||||||
|
|
||||||
RimFishboneWellPathCollection* wellPathCollection() const;
|
RimFishboneWellPathCollection* wellPathCollection() const;
|
||||||
|
void appendFishbonesSubs(RimFishbonesMultipleSubs* subs);
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimFishbonesMultipleSubs*> fishbonesSubs;
|
caf::PdmChildArrayField<RimFishbonesMultipleSubs*> fishbonesSubs;
|
||||||
|
|
||||||
@ -46,5 +50,7 @@ protected:
|
|||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
cvf::Color3f nextFishbonesColor() const;
|
||||||
|
|
||||||
caf::PdmChildField<RimFishboneWellPathCollection*> m_wellPathCollection;
|
caf::PdmChildField<RimFishboneWellPathCollection*> m_wellPathCollection;
|
||||||
};
|
};
|
||||||
|
@ -59,6 +59,8 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("FishbonesMultipleSubs", ":/Default.png", "", "");
|
CAF_PDM_InitObject("FishbonesMultipleSubs", ":/Default.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&fishbonesColor, "FishbonesColor", cvf::Color3f(0.999f, 0.333f, 0.999f), "Fishbones Color", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_lateralCountPerSub, "LateralCountPerSub", size_t(3), "Laterals Per Sub", "", "", "");
|
CAF_PDM_InitField(&m_lateralCountPerSub, "LateralCountPerSub", size_t(3), "Laterals Per Sub", "", "", "");
|
||||||
CAF_PDM_InitField(&m_lateralLength, "LateralLength", QString("12.0"), "Length(s) [m]", "", "Specify multiple length values if the sub lengths differ", "");
|
CAF_PDM_InitField(&m_lateralLength, "LateralLength", QString("12.0"), "Length(s) [m]", "", "Specify multiple length values if the sub lengths differ", "");
|
||||||
|
|
||||||
@ -323,6 +325,12 @@ void RimFishbonesMultipleSubs::computeRangesAndLocations()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimFishbonesMultipleSubs::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimFishbonesMultipleSubs::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Appearance");
|
||||||
|
|
||||||
|
group->add(&fishbonesColor);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Location");
|
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Location");
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfVector3.h"
|
#include "cvfVector3.h"
|
||||||
|
#include "cvfColor3.h"
|
||||||
|
|
||||||
|
// Include to make Pdm work for cvf::Color
|
||||||
|
#include "cafPdmFieldCvfColor.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -76,6 +80,9 @@ public:
|
|||||||
// Override from Rim3dPropertiesInterface
|
// Override from Rim3dPropertiesInterface
|
||||||
virtual cvf::BoundingBox boundingBoxInDomainCoords() override;
|
virtual cvf::BoundingBox boundingBoxInDomainCoords() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
caf::PdmField<cvf::Color3f> fishbonesColor;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user