mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#780 Cleanup and alignment
This commit is contained in:
parent
10d5da6ef5
commit
1e9e6d8541
@ -58,6 +58,22 @@ RimCurveLookCalculator::RimCurveLookCalculator(const std::set<std::pair<RimSumma
|
||||
{ int idx = 0; for(auto& pair : m_regToAppearanceIdxMap) pair.second = idx++; }
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCurveLookCalculator::assignDimensions( CurveAppearanceType caseAppearance,
|
||||
CurveAppearanceType variAppearance,
|
||||
CurveAppearanceType wellAppearance,
|
||||
CurveAppearanceType gropAppearance,
|
||||
CurveAppearanceType regiAppearance)
|
||||
{
|
||||
m_caseAppearanceType = caseAppearance;
|
||||
m_varAppearanceType = variAppearance;
|
||||
m_wellAppearanceType = wellAppearance;
|
||||
m_groupAppearanceType = gropAppearance;
|
||||
m_regionAppearanceType = regiAppearance;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -72,15 +88,42 @@ void RimCurveLookCalculator::setupCurveLook(RimSummaryCurve* curve)
|
||||
int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddress().wellGroupName()];
|
||||
int regAppearanceIdx = m_regToAppearanceIdxMap[curve->summaryAddress().regionNumber()];
|
||||
|
||||
setOneCurveAppearance(m_caseAppearanceType, m_caseCount, caseAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_varAppearanceType, m_variableCount, varAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_wellAppearanceType, m_wellCount, welAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_groupAppearanceType, m_groupCount, grpAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_regionAppearanceType, m_regionCount, regAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_caseAppearanceType, m_caseCount, caseAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_varAppearanceType, m_variableCount, varAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_wellAppearanceType, m_wellCount, welAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_groupAppearanceType, m_groupCount, grpAppearanceIdx, curve);
|
||||
setOneCurveAppearance(m_regionAppearanceType, m_regionCount, regAppearanceIdx, curve);
|
||||
|
||||
curve->setColor(gradeColor(m_currentCurveBaseColor, m_currentCurveGradient));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCurveLookCalculator::setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve)
|
||||
{
|
||||
switch(appeaType)
|
||||
{
|
||||
case NONE:
|
||||
break;
|
||||
case COLOR:
|
||||
m_currentCurveBaseColor = cycledPaletteColor(appeaIdx);
|
||||
break;
|
||||
case GRADIENT:
|
||||
m_currentCurveGradient = gradient(totalCount, appeaIdx);
|
||||
break;
|
||||
case LINE_STYLE:
|
||||
curve->setLineStyle(cycledLineStyle(appeaIdx));
|
||||
break;
|
||||
case SYMBOL:
|
||||
curve->setSymbol(cycledSymbol(appeaIdx));
|
||||
break;
|
||||
case LINE_THICKNESS:
|
||||
curve->setLineThickness(cycledLineThickness(appeaIdx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -150,32 +193,6 @@ float RimCurveLookCalculator::gradient(size_t totalCount, int index)
|
||||
return darkLimit + (index * step);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCurveLookCalculator::setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve)
|
||||
{
|
||||
switch(appeaType)
|
||||
{
|
||||
case NONE:
|
||||
break;
|
||||
case COLOR:
|
||||
m_currentCurveBaseColor = cycledPaletteColor(appeaIdx);
|
||||
break;
|
||||
case GRADIENT:
|
||||
m_currentCurveGradient = gradient(totalCount, appeaIdx);
|
||||
break;
|
||||
case LINE_STYLE:
|
||||
curve->setLineStyle(cycledLineStyle(appeaIdx));
|
||||
break;
|
||||
case SYMBOL:
|
||||
curve->setSymbol(cycledSymbol(appeaIdx));
|
||||
break;
|
||||
case LINE_THICKNESS:
|
||||
curve->setLineThickness(cycledLineThickness(appeaIdx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -27,127 +27,59 @@ class RimSummaryCase;
|
||||
class RimCurveLookCalculator
|
||||
{
|
||||
public:
|
||||
#if 0
|
||||
RimCurveLookCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions)
|
||||
{
|
||||
|
||||
std::set<RimSummaryCase*> casSet;
|
||||
std::set<std::string> varSet;
|
||||
std::set<std::string> welSet;
|
||||
std::set<std::string> grpSet;
|
||||
std::set<int> regSet;
|
||||
|
||||
for (const std::pair<RimSummaryCase*, RifEclipseSummaryAddress>& curveDef : curveDefinitions)
|
||||
{
|
||||
if (curveDef.first) casSet.insert(curveDef.first);
|
||||
if (!curveDef.second.quantityName().empty()) varSet.insert(curveDef.second.quantityName());
|
||||
if (!curveDef.second.wellName().empty()) welSet.insert(curveDef.second.wellName());
|
||||
if (!curveDef.second.wellGroupName().empty()) grpSet.insert(curveDef.second.wellGroupName());
|
||||
if (!(curveDef.second.regionNumber() == -1)) regSet.insert(curveDef.second.regionNumber());
|
||||
}
|
||||
|
||||
m_caseCount = casSet.size();
|
||||
m_variableCount = varSet.size();
|
||||
m_wellCount = welSet.size();
|
||||
m_groupCount = grpSet.size();
|
||||
m_regionCount = regSet.size();
|
||||
|
||||
prevCase = nullptr;
|
||||
colorIndex = 0;
|
||||
lineStyleIdx = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
RimCurveLookCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions);
|
||||
|
||||
#if 0
|
||||
void setupCurveLook2(RimSummaryCurve* curve)
|
||||
{
|
||||
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
|
||||
|
||||
if(curve->summaryCase() != prevCase)
|
||||
{
|
||||
prevCase = curve->summaryCase();
|
||||
lineStyleIdx++;
|
||||
}
|
||||
|
||||
lineStyle = caf::AppEnum<RimPlotCurve::LineStyleEnum>::fromIndex(lineStyleIdx%caf::AppEnum<RimPlotCurve::LineStyleEnum>::size());
|
||||
if(lineStyle == RimPlotCurve::STYLE_NONE)
|
||||
{
|
||||
lineStyle = RimPlotCurve::STYLE_SOLID;
|
||||
lineStyleIdx++;
|
||||
}
|
||||
|
||||
cvf::Color3f curveColor = cycledPaletteColor(colorIndex);
|
||||
colorIndex++;
|
||||
|
||||
curve->setColor(curveColor);
|
||||
curve->setLineStyle(lineStyle);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setupCurveLook(RimSummaryCurve* curve);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Pick default curve color from an index based palette
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f cycledPaletteColor(int colorIndex);
|
||||
|
||||
RimPlotCurve::LineStyleEnum cycledLineStyle(int index);
|
||||
|
||||
RimPlotCurve::PointSymbolEnum cycledSymbol(int index);
|
||||
|
||||
int cycledLineThickness(int index);
|
||||
|
||||
float gradient(size_t totalCount, int index);
|
||||
|
||||
private:
|
||||
int colorIndex;
|
||||
RimSummaryCase* prevCase;
|
||||
int lineStyleIdx;
|
||||
|
||||
enum CurveAppearanceType
|
||||
{
|
||||
NONE,
|
||||
COLOR,
|
||||
COLOR,
|
||||
GRADIENT,
|
||||
LINE_STYLE,
|
||||
SYMBOL,
|
||||
LINE_THICKNESS
|
||||
};
|
||||
|
||||
void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve);
|
||||
void assignDimensions(CurveAppearanceType caseAppearance,
|
||||
CurveAppearanceType variAppearance,
|
||||
CurveAppearanceType wellAppearance,
|
||||
CurveAppearanceType gropAppearance,
|
||||
CurveAppearanceType regiAppearance);
|
||||
|
||||
void setupCurveLook(RimSummaryCurve* curve);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve);
|
||||
|
||||
cvf::Color3f cycledPaletteColor(int colorIndex);
|
||||
RimPlotCurve::LineStyleEnum cycledLineStyle(int index);
|
||||
RimPlotCurve::PointSymbolEnum cycledSymbol(int index);
|
||||
int cycledLineThickness(int index);
|
||||
float gradient(size_t totalCount, int index);
|
||||
|
||||
cvf::Color3f gradeColor(const cvf::Color3f& color , float factor);
|
||||
cvf::Color3f gradeColor(const cvf::Color3f& color , float factor);
|
||||
|
||||
cvf::Color3f m_currentCurveBaseColor;
|
||||
float m_currentCurveGradient;
|
||||
cvf::Color3f m_currentCurveBaseColor;
|
||||
float m_currentCurveGradient;
|
||||
|
||||
size_t m_caseCount;
|
||||
size_t m_variableCount;
|
||||
size_t m_wellCount;
|
||||
size_t m_groupCount;
|
||||
size_t m_regionCount;
|
||||
size_t m_caseCount;
|
||||
size_t m_variableCount;
|
||||
size_t m_wellCount;
|
||||
size_t m_groupCount;
|
||||
size_t m_regionCount;
|
||||
|
||||
CurveAppearanceType m_caseAppearanceType;
|
||||
CurveAppearanceType m_varAppearanceType;
|
||||
CurveAppearanceType m_wellAppearanceType;
|
||||
CurveAppearanceType m_groupAppearanceType;
|
||||
CurveAppearanceType m_regionAppearanceType;
|
||||
CurveAppearanceType m_caseAppearanceType;
|
||||
CurveAppearanceType m_varAppearanceType;
|
||||
CurveAppearanceType m_wellAppearanceType;
|
||||
CurveAppearanceType m_groupAppearanceType;
|
||||
CurveAppearanceType m_regionAppearanceType;
|
||||
|
||||
std::map<RimSummaryCase*, int> m_caseToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_varToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_welToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_grpToAppearanceIdxMap;
|
||||
std::map<int , int> m_regToAppearanceIdxMap;
|
||||
std::map<RimSummaryCase*, int> m_caseToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_varToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_welToAppearanceIdxMap;
|
||||
std::map<std::string , int> m_grpToAppearanceIdxMap;
|
||||
std::map<int , int> m_regToAppearanceIdxMap;
|
||||
|
||||
#if 0
|
||||
std::vector<cvf::Color3f> m_colorsPrCurveDimension;
|
||||
std::vector<float> m_gradientPrCurveDimension;
|
||||
std::vector<RimPlotCurve::LineStyleEnum> m_lineStylePrCurveDimension;
|
||||
std::vector<RimPlotCurve::PointSymbolEnum> m_symbolPrCurveDimension;
|
||||
std::vector<int> m_lineThicknessPrCurveDimension;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user