mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
Implement pdf rendering (#5250)
* First PDF creation support * Reimplement info box * Set title and make overlay frame margins more unified * Remove a style sheet that was never meant to be applied to Project Tree * Update RiuDraggableOverlayFrame when changing content * Default page layout in Preferences * undo removal of elision * Remove friend class assignment in cafCategoryMapper * the required methods have been made public * Fix up after review * Remove spurious const on by-value return * Fix compile errors on Linux * Fix size adjustment of legends with plot resizing
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "cafInternalLegendRenderTools.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace cvf;
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ public:
|
||||
void majorTickValues(std::vector<double>* domainValues) const override;
|
||||
double normalizedValue(double domainValue) const override;
|
||||
double domainValue(double normalizedValue) const override;
|
||||
size_t categoryCount() const;
|
||||
|
||||
const cvf::String textForCategoryIndex(size_t index) const;
|
||||
int categoryIndexForCategory(double domainValue) const;
|
||||
|
||||
private:
|
||||
friend class CategoryLegend;
|
||||
size_t categoryCount() const;
|
||||
const cvf::String textForCategoryIndex(size_t index) const;
|
||||
|
||||
int categoryIndexForCategory(double domainValue) const;
|
||||
void recomputeMaxTexCoord();
|
||||
|
||||
private:
|
||||
|
||||
@@ -682,7 +682,7 @@ cvf::Vec2ui OverlayScalarMapperLegend::preferredSize()
|
||||
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
|
||||
layoutInfo(&layout);
|
||||
|
||||
float prefferredYSize = 2 * layout.margins.y()
|
||||
float preferredYSize = 2 * layout.margins.y()
|
||||
+ layout.lineSpacing * this->titleStrings().size()
|
||||
+ 1.5f * layout.lineSpacing * m_tickValues.size();
|
||||
|
||||
@@ -706,18 +706,17 @@ cvf::Vec2ui OverlayScalarMapperLegend::preferredSize()
|
||||
maxTickTextWidth = maxTickTextWidth < textWidth ? textWidth : maxTickTextWidth;
|
||||
}
|
||||
|
||||
float prefferredXSize = layout.tickEndX + layout.margins.x() + layout.tickTextLeadSpace + maxTickTextWidth;
|
||||
float preferredXSize = layout.tickEndX + layout.margins.x() + layout.tickTextLeadSpace + maxTickTextWidth;
|
||||
|
||||
for (const cvf::String& titleLine : titleStrings())
|
||||
{
|
||||
float titleWidth = this->font()->textExtent(titleLine).x() + 2*layout.margins.x();
|
||||
prefferredXSize = prefferredXSize < titleWidth ? titleWidth : prefferredXSize;
|
||||
preferredXSize = preferredXSize < titleWidth ? titleWidth : preferredXSize;
|
||||
}
|
||||
|
||||
prefferredXSize = std::min(prefferredXSize, 400.0f);
|
||||
|
||||
return { (unsigned int)(std::ceil(prefferredXSize)), (unsigned int)(std::ceil(prefferredYSize)) };
|
||||
preferredXSize = std::min(preferredXSize, 400.0f);
|
||||
|
||||
return { (unsigned int)(std::ceil(preferredXSize)), (unsigned int)(std::ceil(preferredYSize)) };
|
||||
}
|
||||
|
||||
} // namespace cvf
|
||||
|
||||
@@ -218,4 +218,4 @@ namespace caf {
|
||||
{
|
||||
return m_font.p();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user