mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4255 Read default plot font sizes from preferences and apply
This commit is contained in:
parent
798e3ff19e
commit
9d06b59357
@ -1990,12 +1990,11 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
||||
|
||||
// The creation of a font is time consuming, so make sure you really need your own font
|
||||
// instead of using the application font
|
||||
RiaFontCache::FontSize sceneFontSize = m_preferences->defaultFontSizeInScene();
|
||||
m_defaultSceneFont = RiaFontCache::getFont(sceneFontSize);
|
||||
RiaFontCache::FontSize annotationFontSize = m_preferences->defaultAnnotationFontSize();
|
||||
m_defaultAnnotationFont = RiaFontCache::getFont(annotationFontSize);
|
||||
RiaFontCache::FontSize wellLabelFontSize = m_preferences->defaultWellLabelFontSize();
|
||||
m_defaultWellLabelFont = RiaFontCache::getFont(wellLabelFontSize);
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes = m_preferences->defaultFontSizes();
|
||||
|
||||
m_defaultSceneFont = RiaFontCache::getFont(fontSizes[RiaDefines::SCENE_FONT]);
|
||||
m_defaultAnnotationFont = RiaFontCache::getFont(fontSizes[RiaDefines::ANNOTATION_FONT]);
|
||||
m_defaultWellLabelFont = RiaFontCache::getFont(fontSizes[RiaDefines::WELL_LABEL_FONT]);
|
||||
|
||||
if (this->project())
|
||||
{
|
||||
@ -2004,8 +2003,8 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
||||
|
||||
RimWellPathCollection* wellPathCollection = this->project()->activeOilField()->wellPathCollection();
|
||||
|
||||
std::vector<Rim3dView*> visibleViews;
|
||||
this->project()->allVisibleViews(visibleViews);
|
||||
std::vector<RimViewWindow*> allViewWindows;
|
||||
project()->descendantsIncludingThisOfType(allViewWindows);
|
||||
|
||||
bool existingViewsWithDifferentMeshLines = false;
|
||||
bool existingViewsWithCustomColors = false;
|
||||
@ -2013,41 +2012,59 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
||||
bool existingObjectsWithCustomFonts = false;
|
||||
if (oldPreferences)
|
||||
{
|
||||
for (auto view : visibleViews)
|
||||
for (auto viewWindow : allViewWindows)
|
||||
{
|
||||
if (view->meshMode() != oldPreferences->defaultMeshModeType())
|
||||
auto rim3dView = dynamic_cast<Rim3dView*>(viewWindow);
|
||||
if (rim3dView)
|
||||
{
|
||||
existingViewsWithDifferentMeshLines = true;
|
||||
}
|
||||
if (view->backgroundColor() != oldPreferences->defaultViewerBackgroundColor())
|
||||
{
|
||||
existingViewsWithCustomColors = true;
|
||||
}
|
||||
if (view->scaleZ() != static_cast<double>(oldPreferences->defaultScaleFactorZ))
|
||||
{
|
||||
existingViewsWithCustomZScale = true;
|
||||
}
|
||||
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>(view);
|
||||
if (gridView)
|
||||
{
|
||||
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
|
||||
existingObjectsWithCustomFonts = gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
||||
}
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclipseView)
|
||||
{
|
||||
if (eclipseView->wellCollection()->wellLabelColor() != oldPreferences->defaultWellLabelColor())
|
||||
if (rim3dView->meshMode() != oldPreferences->defaultMeshModeType())
|
||||
{
|
||||
existingViewsWithDifferentMeshLines = true;
|
||||
}
|
||||
if (rim3dView->backgroundColor() != oldPreferences->defaultViewerBackgroundColor())
|
||||
{
|
||||
existingViewsWithCustomColors = true;
|
||||
}
|
||||
if (rim3dView->scaleZ() != static_cast<double>(oldPreferences->defaultScaleFactorZ))
|
||||
{
|
||||
existingViewsWithCustomZScale = true;
|
||||
}
|
||||
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>(rim3dView);
|
||||
if (gridView)
|
||||
{
|
||||
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
|
||||
existingObjectsWithCustomFonts = gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
||||
}
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(rim3dView);
|
||||
if (eclipseView)
|
||||
{
|
||||
if (eclipseView->wellCollection()->wellLabelColor() != oldPreferences->defaultWellLabelColor())
|
||||
{
|
||||
existingViewsWithCustomColors = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wellPathCollection->wellPathLabelColor() != oldPreferences->defaultWellLabelColor())
|
||||
|
||||
for (auto fontTypeSizePair : fontSizes)
|
||||
{
|
||||
existingViewsWithCustomColors = true;
|
||||
RiaFontCache::FontSize oldFontSizeEnum = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
|
||||
if (oldFontSizeEnum != fontTypeSizePair.second)
|
||||
{
|
||||
int oldFontSize = RiaFontCache::pointSizeFromFontSizeEnum(oldFontSizeEnum);
|
||||
if (viewWindow->hasCustomFontSizes(fontTypeSizePair.first, oldFontSize))
|
||||
{
|
||||
existingObjectsWithCustomFonts = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldPreferences->defaultWellLabelColor() != wellPathCollection->wellPathLabelColor())
|
||||
{
|
||||
existingViewsWithCustomColors = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool applySettingsToAllViews = false;
|
||||
if (existingViewsWithCustomColors || existingViewsWithCustomZScale ||
|
||||
@ -2076,76 +2093,60 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
||||
|
||||
std::set<caf::PdmUiItem*> uiEditorsToUpdate;
|
||||
|
||||
for (auto view : visibleViews)
|
||||
for (auto viewWindow : allViewWindows)
|
||||
{
|
||||
bool applyBackgroundOrFonts = false;
|
||||
|
||||
if (oldPreferences && (applySettingsToAllViews || view->meshMode() == oldPreferences->defaultMeshModeType()))
|
||||
for (auto fontTypeSizePair : fontSizes)
|
||||
{
|
||||
view->meshMode = m_preferences->defaultMeshModeType();
|
||||
}
|
||||
|
||||
if (oldPreferences && (applySettingsToAllViews || view->backgroundColor() == oldPreferences->defaultViewerBackgroundColor()))
|
||||
{
|
||||
view->setBackgroundColor(m_preferences->defaultViewerBackgroundColor());
|
||||
applyBackgroundOrFonts = true;
|
||||
uiEditorsToUpdate.insert(view);
|
||||
}
|
||||
|
||||
if (oldPreferences && (applySettingsToAllViews || view->scaleZ == static_cast<double>(oldPreferences->defaultScaleFactorZ())))
|
||||
{
|
||||
view->scaleZ = static_cast<double>(m_preferences->defaultScaleFactorZ());
|
||||
view->updateScaling();
|
||||
uiEditorsToUpdate.insert(view);
|
||||
if (view == activeViewWindow())
|
||||
RiaFontCache::FontSize oldFontSizeEnum = oldPreferences->defaultFontSizes()[fontTypeSizePair.first];
|
||||
if (oldFontSizeEnum != fontTypeSizePair.second)
|
||||
{
|
||||
RiuMainWindow::instance()->updateScaleValue();
|
||||
}
|
||||
}
|
||||
|
||||
if (oldPreferences && oldPreferences->defaultFontSizeInScene() != sceneFontSize)
|
||||
{
|
||||
applyBackgroundOrFonts = true;
|
||||
}
|
||||
|
||||
if (oldPreferences && oldPreferences->defaultAnnotationFontSize() != annotationFontSize)
|
||||
{
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>(view);
|
||||
if (gridView)
|
||||
{
|
||||
auto annotations = gridView->annotationCollection();
|
||||
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
|
||||
bool applyFontSizes = applySettingsToAllViews ||
|
||||
!annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
||||
|
||||
if (applyFontSizes)
|
||||
int oldFontSize = RiaFontCache::pointSizeFromFontSizeEnum(oldFontSizeEnum);
|
||||
int newFontSize = RiaFontCache::pointSizeFromFontSizeEnum(fontTypeSizePair.second);
|
||||
if (viewWindow->applyFontSize(fontTypeSizePair.first, oldFontSize, newFontSize, applySettingsToAllViews))
|
||||
{
|
||||
annotations->applyFontSizeToAllTextAnnotations(annotationFontSize);
|
||||
for (auto annotation : annotations->globalTextAnnotations())
|
||||
{
|
||||
uiEditorsToUpdate.insert(annotation);
|
||||
}
|
||||
for (auto annotation : annotations->textAnnotations())
|
||||
{
|
||||
uiEditorsToUpdate.insert(annotation);
|
||||
}
|
||||
uiEditorsToUpdate.insert(viewWindow);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclipseView)
|
||||
|
||||
auto rim3dView = dynamic_cast<Rim3dView*>(viewWindow);
|
||||
if (rim3dView)
|
||||
{
|
||||
if (oldPreferences && (applySettingsToAllViews || eclipseView->wellCollection()->wellLabelColor() == oldPreferences->defaultWellLabelColor()))
|
||||
if (oldPreferences && (applySettingsToAllViews || rim3dView->meshMode() == oldPreferences->defaultMeshModeType()))
|
||||
{
|
||||
eclipseView->wellCollection()->wellLabelColor = m_preferences->defaultWellLabelColor();
|
||||
uiEditorsToUpdate.insert(eclipseView->wellCollection());
|
||||
rim3dView->meshMode = m_preferences->defaultMeshModeType();
|
||||
}
|
||||
eclipseView->scheduleReservoirGridGeometryRegen();
|
||||
}
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
if (applyBackgroundOrFonts)
|
||||
{
|
||||
view->applyBackgroundColorAndFontChanges();
|
||||
|
||||
if (oldPreferences && (applySettingsToAllViews || rim3dView->backgroundColor() == oldPreferences->defaultViewerBackgroundColor()))
|
||||
{
|
||||
rim3dView->setBackgroundColor(m_preferences->defaultViewerBackgroundColor());
|
||||
rim3dView->applyBackgroundColorAndFontChanges();
|
||||
uiEditorsToUpdate.insert(rim3dView);
|
||||
}
|
||||
|
||||
if (oldPreferences && (applySettingsToAllViews || rim3dView->scaleZ == static_cast<double>(oldPreferences->defaultScaleFactorZ())))
|
||||
{
|
||||
rim3dView->scaleZ = static_cast<double>(m_preferences->defaultScaleFactorZ());
|
||||
rim3dView->updateScaling();
|
||||
uiEditorsToUpdate.insert(rim3dView);
|
||||
if (rim3dView == activeViewWindow())
|
||||
{
|
||||
RiuMainWindow::instance()->updateScaleValue();
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(rim3dView);
|
||||
if (eclipseView)
|
||||
{
|
||||
if (oldPreferences && (applySettingsToAllViews || eclipseView->wellCollection()->wellLabelColor() == oldPreferences->defaultWellLabelColor()))
|
||||
{
|
||||
eclipseView->wellCollection()->wellLabelColor = m_preferences->defaultWellLabelColor();
|
||||
uiEditorsToUpdate.insert(eclipseView->wellCollection());
|
||||
}
|
||||
eclipseView->scheduleReservoirGridGeometryRegen();
|
||||
}
|
||||
rim3dView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2159,8 +2160,6 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (caf::PdmUiItem* uiItem : uiEditorsToUpdate)
|
||||
{
|
||||
uiItem->updateConnectedEditors();
|
||||
|
@ -170,5 +170,13 @@ namespace RiaDefines
|
||||
ImportFileType obtainFileTypeFromFileName(const QString& fileName);
|
||||
QString defaultDirectoryLabel(ImportFileType fileTypes);
|
||||
|
||||
enum FontSettingType
|
||||
{
|
||||
SCENE_FONT,
|
||||
ANNOTATION_FONT,
|
||||
WELL_LABEL_FONT,
|
||||
PLOT_FONT
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
@ -85,7 +85,7 @@ cvf::ref<caf::FixedAtlasFont> RiaFontCache::getFont(FontSize size)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaFontCache::getPointSize(FontSize fontSize)
|
||||
int RiaFontCache::pointSizeFromFontSizeEnum(FontSize fontSize)
|
||||
{
|
||||
switch (fontSize)
|
||||
{
|
||||
@ -107,3 +107,25 @@ int RiaFontCache::getPointSize(FontSize fontSize)
|
||||
return 16;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize(int pointSize)
|
||||
{
|
||||
std::vector<FontSize> allValues =
|
||||
{ FONT_SIZE_8, FONT_SIZE_10, FONT_SIZE_12, FONT_SIZE_14, FONT_SIZE_16, FONT_SIZE_24, FONT_SIZE_32 };
|
||||
|
||||
FontSize closestEnumValue = FONT_SIZE_8;
|
||||
int closestDiff = std::numeric_limits<int>::max();
|
||||
for (FontSize enumValue : allValues)
|
||||
{
|
||||
int diff = std::abs(pointSizeFromFontSizeEnum(enumValue) - pointSize);
|
||||
if (diff < closestDiff)
|
||||
{
|
||||
closestEnumValue = enumValue;
|
||||
closestDiff = diff;
|
||||
}
|
||||
}
|
||||
return closestEnumValue;
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ public:
|
||||
typedef caf::AppEnum<FontSize> FontSizeType;
|
||||
|
||||
static cvf::ref<caf::FixedAtlasFont> getFont(FontSize fontSize);
|
||||
static int getPointSize(FontSize fontSize);
|
||||
static int pointSizeFromFontSizeEnum(FontSize fontSize);
|
||||
static FontSize fontSizeEnumFromPointSize(int pointSize);
|
||||
|
||||
private:
|
||||
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
|
||||
|
@ -75,10 +75,11 @@ RiaPreferences::RiaPreferences(void)
|
||||
|
||||
CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&defaultFontSizeInScene, "fontSizeInScene", "Viewer Font", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultSceneFontSize, "fontSizeInScene", "Viewer Font", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultAnnotationFontSize, "defaultAnnotationFontSize", "Annotation Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultWellLabelFontSize, "wellLabelFontSize", "Well Label Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultWellLabelFontSize, "wellLabelFontSize", "Well Label Font Size", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&defaultPlotFontSize, "defaultPlotFontSize", "Plot Font Size", "", "", "");
|
||||
defaultPlotFontSize = RiaFontCache::FONT_SIZE_10;
|
||||
|
||||
CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS Curve Without TVD Warning", "", "", "");
|
||||
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
@ -206,7 +207,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
colorGroup->add(&defaultWellLabelColor);
|
||||
|
||||
caf::PdmUiGroup* fontGroup = uiOrdering.addNewGroup("Default Font Sizes");
|
||||
fontGroup->add(&defaultFontSizeInScene);
|
||||
fontGroup->add(&defaultSceneFontSize);
|
||||
fontGroup->add(&defaultAnnotationFontSize, false);
|
||||
fontGroup->add(&defaultWellLabelFontSize);
|
||||
fontGroup->add(&defaultPlotFontSize, false);
|
||||
@ -368,3 +369,15 @@ QString RiaPreferences::holoLensExportFolder() const
|
||||
return m_holoLensExportFolder();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> RiaPreferences::defaultFontSizes() const
|
||||
{
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> fontSizes;
|
||||
fontSizes[RiaDefines::SCENE_FONT] = defaultSceneFontSize();
|
||||
fontSizes[RiaDefines::ANNOTATION_FONT] = defaultAnnotationFontSize();
|
||||
fontSizes[RiaDefines::WELL_LABEL_FONT] = defaultWellLabelFontSize();
|
||||
fontSizes[RiaDefines::PLOT_FONT] = defaultPlotFontSize();
|
||||
return fontSizes;
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class RifReaderSettings;
|
||||
|
||||
class RiaPreferences : public caf::PdmObject
|
||||
@ -61,6 +63,8 @@ public:
|
||||
bool showOctaveCommunicationWarning() const;
|
||||
QString holoLensExportFolder() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
@ -81,7 +85,7 @@ public: // Pdm Fields
|
||||
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
|
||||
caf::PdmField<bool> showLasCurveWithoutTvdWarning;
|
||||
|
||||
caf::PdmField<FontSizeType> defaultFontSizeInScene;
|
||||
caf::PdmField<FontSizeType> defaultSceneFontSize;
|
||||
caf::PdmField<FontSizeType> defaultWellLabelFontSize;
|
||||
caf::PdmField<FontSizeType> defaultAnnotationFontSize;
|
||||
caf::PdmField<FontSizeType> defaultPlotFontSize;
|
||||
|
@ -39,10 +39,14 @@ bool RicVec3dPickEventHandler::handle3dPickEvent(const Ric3dPickEvent& eventObje
|
||||
{
|
||||
const Rim3dView* rimView = eventObject.m_view;
|
||||
|
||||
double zPickOffset = 10.0;
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
|
||||
cvf::Vec3d pickedPositionInUTM = transForm->transformToDomainCoord(eventObject.m_pickItemInfos.front().globalPickedPoint());
|
||||
|
||||
pickedPositionInUTM.z() *= -1.0;
|
||||
pickedPositionInUTM.z() -= zPickOffset;
|
||||
|
||||
m_vectorField->setValueWithFieldChanged(pickedPositionInUTM);
|
||||
return true;
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
RicVec3dPickEventHandler(caf::PdmField<cvf::Vec3d>* vectorField);
|
||||
bool handle3dPickEvent(const Ric3dPickEvent& eventObject) override;
|
||||
|
||||
|
||||
void registerAsPickEventHandler() override;
|
||||
void notifyUnregistered() override;
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimAnnotationTextAppearance.h"
|
||||
@ -262,17 +260,31 @@ bool RimAnnotationInViewCollection::hasTextAnnotationsWithCustomFontSize(RiaFont
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize fontSize)
|
||||
bool RimAnnotationInViewCollection::applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize oldFontSize,
|
||||
RiaFontCache::FontSize fontSize,
|
||||
bool forceChange)
|
||||
{
|
||||
bool anyChange = false;
|
||||
for (auto annotation : textAnnotations())
|
||||
{
|
||||
annotation->appearance()->setFontSize(fontSize);
|
||||
if (forceChange || annotation->appearance()->fontSize() == oldFontSize)
|
||||
{
|
||||
annotation->appearance()->setFontSize(fontSize);
|
||||
annotation->updateConnectedEditors();
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto annotationInView : globalTextAnnotations())
|
||||
{
|
||||
annotationInView->sourceAnnotation()->appearance()->setFontSize(fontSize);
|
||||
if (forceChange || annotationInView->sourceAnnotation()->appearance()->fontSize() == oldFontSize)
|
||||
{
|
||||
annotationInView->sourceAnnotation()->appearance()->setFontSize(fontSize);
|
||||
annotationInView->updateConnectedEditors();
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
size_t annotationsCount() const;
|
||||
|
||||
bool hasTextAnnotationsWithCustomFontSize(RiaFontCache::FontSize defaultFontSize) const;
|
||||
void applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize fontSize);
|
||||
bool applyFontSizeToAllTextAnnotations(RiaFontCache::FontSize oldFontSize, RiaFontCache::FontSize fontSize, bool forceSizeChange = false);
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
@ -128,6 +128,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRiuQwtPlotOwnerInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
)
|
||||
@ -261,6 +262,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
|
||||
)
|
||||
|
@ -17,6 +17,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifEclipseDataTableFormatter.h"
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
@ -50,7 +54,9 @@ RimGridCrossPlot::RimGridCrossPlot()
|
||||
|
||||
CAF_PDM_InitField(&m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "");
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Show Legend", "", "", "");
|
||||
CAF_PDM_InitField(&m_legendFontSize, "LegendFontSize", 10, "Legend Font Size", "", "", "");
|
||||
CAF_PDM_InitField(&m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "");
|
||||
m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name Config", "", "", "");
|
||||
m_nameConfig.uiCapability()->setUiTreeHidden(true);
|
||||
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
@ -515,7 +521,7 @@ void RimGridCrossPlot::updatePlot()
|
||||
QwtLegend* legend = new QwtLegend(m_qwtPlot);
|
||||
|
||||
auto font = legend->font();
|
||||
font.setPixelSize(m_legendFontSize());
|
||||
font.setPointSize(m_legendFontSize());
|
||||
legend->setFont(font);
|
||||
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend);
|
||||
}
|
||||
@ -651,6 +657,61 @@ int RimGridCrossPlot::legendFontSize() const
|
||||
return m_legendFontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (legendFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/)
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
bool anyChange = false;
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (forceChange || plotAxis->titleFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setTitleFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
if (forceChange || plotAxis->valuesFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setValuesFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (forceChange || legendFontSize() == oldFontSize)
|
||||
{
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if (anyChange) loadDataAndUpdate();
|
||||
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -722,12 +783,16 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
|
||||
m_qwtPlot->enableAxis(qwtAxisId, true);
|
||||
|
||||
QwtText axisTitle(axisParameterString);
|
||||
QFont font = m_qwtPlot->axisFont(qwtAxisId);
|
||||
font.setBold(true);
|
||||
font.setPixelSize(axisProperties->titleFontSize);
|
||||
axisTitle.setFont(font);
|
||||
QFont titleFont = m_qwtPlot->axisTitle(qwtAxisId).font();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setPointSize(axisProperties->titleFontSize());
|
||||
axisTitle.setFont(titleFont);
|
||||
|
||||
switch (axisProperties->titlePositionEnum())
|
||||
QFont valuesFont = m_qwtPlot->axisFont(qwtAxisId);
|
||||
valuesFont.setPointSize(axisProperties->valuesFontSize());
|
||||
m_qwtPlot->setAxisFont(qwtAxisId, valuesFont);
|
||||
|
||||
switch (axisProperties->titlePosition())
|
||||
{
|
||||
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
|
||||
axisTitle.setRenderFlags(Qt::AlignCenter);
|
||||
@ -875,6 +940,14 @@ void RimGridCrossPlot::setShowInfoBox(bool enable)
|
||||
m_showInfoBox = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
|
||||
{
|
||||
return { m_xAxisProperties, m_yAxisProperties };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Name Configuration
|
||||
///
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <set>
|
||||
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
class RimGridCrossPlotDataSet;
|
||||
class RiuGridCrossQwtPlot;
|
||||
@ -79,6 +82,10 @@ public:
|
||||
bool isYAxisLogarithmic() const;
|
||||
void setYAxisInverted(bool inverted);
|
||||
int legendFontSize() const;
|
||||
|
||||
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
|
||||
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
|
||||
|
||||
public:
|
||||
// Rim2dPlotInterface overrides
|
||||
void updateAxisScaling() override;
|
||||
@ -114,6 +121,7 @@ protected:
|
||||
RimGridCrossPlotNameConfig* nameConfig();
|
||||
void setShowInfoBox(bool enable);
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
private:
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
|
@ -1011,6 +1011,27 @@ cvf::ref<caf::DisplayCoordTransform> Rim3dView::displayCoordTransform() const
|
||||
return coordTrans;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/)
|
||||
{
|
||||
if (fontSettingType == RiaDefines::SCENE_FONT)
|
||||
{
|
||||
applyBackgroundColorAndFontChanges();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -156,6 +156,10 @@ public:
|
||||
virtual RimCase* ownerCase() const = 0;
|
||||
virtual std::vector<RimLegendConfig*> legendConfigs() const = 0;
|
||||
|
||||
|
||||
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
|
||||
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
|
||||
|
||||
protected:
|
||||
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
|
||||
|
||||
|
@ -27,16 +27,19 @@
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimViewNameConfig.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfModel.h"
|
||||
#include "cvfScene.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimGridView, "GenericGridView"); // Do not use. Abstract class
|
||||
@ -284,6 +287,45 @@ bool RimGridView::isGridVisualizationMode() const
|
||||
return this->m_gridCollection->isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
|
||||
{
|
||||
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
|
||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||
{
|
||||
auto annotations = annotationCollection();
|
||||
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
||||
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize) || hasCustomFonts;
|
||||
}
|
||||
return hasCustomFonts;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false*/)
|
||||
{
|
||||
bool anyChange = Rim3dView::applyFontSize(fontSettingType, oldFontSize, fontSize, forceChange);
|
||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||
{
|
||||
auto annotations = annotationCollection();
|
||||
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
||||
RiaFontCache::FontSize newFontSize = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
|
||||
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
||||
|
||||
if (applyFontSizes)
|
||||
{
|
||||
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSize, newFontSize, forceChange) || anyChange;
|
||||
}
|
||||
}
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -64,6 +64,10 @@ public:
|
||||
|
||||
bool isGridVisualizationMode() const override;
|
||||
|
||||
|
||||
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
|
||||
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
|
||||
|
||||
protected:
|
||||
virtual void updateViewFollowingRangeFilterUpdates();
|
||||
void initAfterRead() override;
|
||||
|
@ -19,7 +19,10 @@
|
||||
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaFontCache.h"
|
||||
#include "RigStatisticsCalculator.h"
|
||||
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
@ -45,15 +48,6 @@ void caf::AppEnum<RimPlotAxisProperties::NumberFormatType>::setUp()
|
||||
|
||||
setDefault(RimPlotAxisProperties::NUMBER_FORMAT_AUTO);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum<RimPlotAxisProperties::AxisTitlePositionType>::setUp()
|
||||
{
|
||||
addItem(RimPlotAxisProperties::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
||||
addItem(RimPlotAxisProperties::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
||||
|
||||
setDefault(RimPlotAxisProperties::AXIS_TITLE_CENTER);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPlotAxisProperties, "SummaryYAxisProperties");
|
||||
@ -79,8 +73,6 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitField(&m_displayUnitText, "DisplayUnitText", true, " Units", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&titlePositionEnum, "TitlePosition", "Title Position", "", "", "");
|
||||
CAF_PDM_InitField(&titleFontSize, "FontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min", "", "", "");
|
||||
@ -88,7 +80,6 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format", "", "", "");
|
||||
CAF_PDM_InitField(&numberOfDecimals, "Decimals", 2, "Number of Decimals", "", "", "");
|
||||
CAF_PDM_InitField(&scaleFactor, "ScaleFactor", 1.0, "Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&valuesFontSize, "ValuesFontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
numberOfDecimals.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
|
||||
@ -96,6 +87,12 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
|
||||
CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position", "", "", "");
|
||||
CAF_PDM_InitField(&m_titleFontSize, "FontSize", 10, "Font Size", "", "", "");
|
||||
m_titleFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
|
||||
CAF_PDM_InitField(&m_valuesFontSize, "ValuesFontSize", 10, "Font Size", "", "", "");
|
||||
m_valuesFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "", "", "", "");
|
||||
|
||||
m_annotations.uiCapability()->setUiHidden(true);
|
||||
@ -130,7 +127,7 @@ QList<caf::PdmOptionItemInfo> RimPlotAxisProperties::calculateValueOptions(const
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
*useOptionsOnly = true;
|
||||
|
||||
if (&titleFontSize == fieldNeedingOptions || &valuesFontSize == fieldNeedingOptions)
|
||||
if (&m_titleFontSize == fieldNeedingOptions || &m_valuesFontSize == fieldNeedingOptions)
|
||||
{
|
||||
std::vector<int> fontSizes;
|
||||
fontSizes.push_back(8);
|
||||
@ -191,8 +188,8 @@ void RimPlotAxisProperties::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* titleGroup = uiOrdering.addNewGroup("Title Layout");
|
||||
titleGroup->add(&titlePositionEnum);
|
||||
titleGroup->add(&titleFontSize);
|
||||
titleGroup->add(&m_titlePositionEnum);
|
||||
titleGroup->add(&m_titleFontSize);
|
||||
}
|
||||
|
||||
caf::PdmUiGroup& scaleGroup = *(uiOrdering.addNewGroup("Axis Values"));
|
||||
@ -208,7 +205,7 @@ void RimPlotAxisProperties::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
|
||||
scaleGroup.add(&visibleRangeMin);
|
||||
scaleGroup.add(&visibleRangeMax);
|
||||
scaleGroup.add(&valuesFontSize);
|
||||
scaleGroup.add(&m_valuesFontSize);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
@ -225,6 +222,46 @@ void RimPlotAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axis ax
|
||||
if (axis == QwtPlot::xBottom) this->setUiIcon(QIcon(":/BottomAxis16x16.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisPropertiesInterface::AxisTitlePositionType RimPlotAxisProperties::titlePosition() const
|
||||
{
|
||||
return m_titlePositionEnum();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimPlotAxisProperties::titleFontSize() const
|
||||
{
|
||||
return m_titleFontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setTitleFontSize(int fontSize)
|
||||
{
|
||||
m_titleFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimPlotAxisProperties::valuesFontSize() const
|
||||
{
|
||||
return m_valuesFontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setValuesFontSize(int fontSize)
|
||||
{
|
||||
m_valuesFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@ -36,7 +37,7 @@ class RimPlotAxisAnnotation;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotAxisProperties : public caf::PdmObject
|
||||
class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -48,18 +49,17 @@ public:
|
||||
NUMBER_FORMAT_SCIENTIFIC
|
||||
};
|
||||
|
||||
enum AxisTitlePositionType
|
||||
{
|
||||
AXIS_TITLE_CENTER,
|
||||
AXIS_TITLE_END
|
||||
};
|
||||
|
||||
public:
|
||||
RimPlotAxisProperties();
|
||||
|
||||
void setEnableTitleTextSettings(bool enable);
|
||||
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
||||
|
||||
void setEnableTitleTextSettings(bool enable);
|
||||
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
||||
AxisTitlePositionType titlePosition() const override;
|
||||
int titleFontSize() const override;
|
||||
void setTitleFontSize(int fontSize) override;
|
||||
int valuesFontSize() const override;
|
||||
void setValuesFontSize(int fontSize) override;
|
||||
|
||||
QwtPlot::Axis qwtPlotAxisType() const;
|
||||
QString name() const;
|
||||
RiaDefines::PlotAxis plotAxisType() const;
|
||||
@ -76,8 +76,6 @@ public:
|
||||
void appendAnnotation(RimPlotAxisAnnotation* annotation);
|
||||
|
||||
caf::PdmField<QString> customTitle;
|
||||
caf::PdmField<int> titleFontSize;
|
||||
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> titlePositionEnum;
|
||||
|
||||
caf::PdmField<double> visibleRangeMin;
|
||||
caf::PdmField<double> visibleRangeMax;
|
||||
@ -86,7 +84,6 @@ public:
|
||||
caf::PdmField<int> numberOfDecimals;
|
||||
caf::PdmField<double> scaleFactor;
|
||||
caf::PdmField<bool> isLogarithmicScaleEnabled;
|
||||
caf::PdmField<int> valuesFontSize;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
@ -122,7 +119,10 @@ private:
|
||||
|
||||
bool m_enableTitleTextSettings;
|
||||
|
||||
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
||||
caf::PdmField<int> m_titleFontSize;
|
||||
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> m_titlePositionEnum;
|
||||
caf::PdmField<int> m_valuesFontSize;
|
||||
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
||||
};
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotAxisPropertiesInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
// clang-format off
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum<RimPlotAxisPropertiesInterface::AxisTitlePositionType>::setUp()
|
||||
{
|
||||
addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
||||
addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
||||
|
||||
setDefault(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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
|
||||
|
||||
class RimPlotAxisPropertiesInterface
|
||||
{
|
||||
public:
|
||||
enum AxisTitlePositionType
|
||||
{
|
||||
AXIS_TITLE_CENTER,
|
||||
AXIS_TITLE_END
|
||||
};
|
||||
|
||||
public:
|
||||
virtual AxisTitlePositionType titlePosition() const = 0;
|
||||
virtual int titleFontSize() const = 0;
|
||||
virtual void setTitleFontSize(int fontSize) = 0;
|
||||
virtual int valuesFontSize() const = 0;
|
||||
virtual void setValuesFontSize(int fontSize) = 0;
|
||||
|
||||
};
|
||||
|
@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
namespace caf
|
||||
@ -38,5 +39,4 @@ public:
|
||||
|
||||
virtual caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const = 0;
|
||||
|
||||
|
||||
};
|
@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@ -65,6 +67,10 @@ public:
|
||||
|
||||
void viewNavigationChanged();
|
||||
|
||||
|
||||
virtual bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const { return false;}
|
||||
virtual bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) { return false;}
|
||||
|
||||
protected:
|
||||
void removeMdiWindowFromMdiArea();
|
||||
|
||||
|
@ -127,12 +127,12 @@ void RimSummaryPlotYAxisFormatter::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
|
||||
|
||||
QFont axisTitleYFont = axisTitleY.font();
|
||||
axisTitleYFont.setBold(true);
|
||||
axisTitleYFont.setPixelSize(m_axisProperties->titleFontSize);
|
||||
axisTitleYFont.setPointSize(m_axisProperties->titleFontSize());
|
||||
axisTitleY.setFont(axisTitleYFont);
|
||||
|
||||
axisTitleY.setText(axisTitle);
|
||||
|
||||
switch (m_axisProperties->titlePositionEnum())
|
||||
switch (m_axisProperties->titlePosition())
|
||||
{
|
||||
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
|
||||
axisTitleY.setRenderFlags(Qt::AlignCenter);
|
||||
@ -148,7 +148,7 @@ void RimSummaryPlotYAxisFormatter::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
|
||||
{
|
||||
QFont yAxisFont = qwtPlot->axisFont(m_axisProperties->qwtPlotAxisType());
|
||||
yAxisFont.setBold(false);
|
||||
yAxisFont.setPixelSize(m_axisProperties->valuesFontSize);
|
||||
yAxisFont.setPointSize(m_axisProperties->valuesFontSize());
|
||||
qwtPlot->setAxisFont(m_axisProperties->qwtPlotAxisType(), yAxisFont);
|
||||
}
|
||||
|
||||
|
@ -539,6 +539,61 @@ size_t RimSummaryPlot::singleColorCurveCount() const
|
||||
return colorIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_legendFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/)
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
bool anyChange = false;
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (forceChange || plotAxis->titleFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setTitleFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
if (forceChange || plotAxis->valuesFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setValuesFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (forceChange || m_legendFontSize() == oldFontSize)
|
||||
{
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if (anyChange) loadDataAndUpdate();
|
||||
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -847,12 +902,12 @@ void RimSummaryPlot::updateTimeAxis()
|
||||
|
||||
QFont font = timeAxisTitle.font();
|
||||
font.setBold(true);
|
||||
font.setPixelSize(m_timeAxisProperties->titleFontSize);
|
||||
font.setPointSize(m_timeAxisProperties->titleFontSize());
|
||||
timeAxisTitle.setFont(font);
|
||||
|
||||
timeAxisTitle.setText(axisTitle);
|
||||
|
||||
switch ( m_timeAxisProperties->titlePositionEnum() )
|
||||
switch ( m_timeAxisProperties->titlePosition() )
|
||||
{
|
||||
case RimSummaryTimeAxisProperties::AXIS_TITLE_CENTER:
|
||||
timeAxisTitle.setRenderFlags(Qt::AlignCenter);
|
||||
@ -868,7 +923,7 @@ void RimSummaryPlot::updateTimeAxis()
|
||||
{
|
||||
QFont timeAxisFont = m_qwtPlot->axisFont(QwtPlot::xBottom);
|
||||
timeAxisFont.setBold(false);
|
||||
timeAxisFont.setPixelSize(m_timeAxisProperties->valuesFontSize);
|
||||
timeAxisFont.setPointSize(m_timeAxisProperties->valuesFontSize());
|
||||
m_qwtPlot->setAxisFont(QwtPlot::xBottom, timeAxisFont);
|
||||
}
|
||||
}
|
||||
@ -1337,6 +1392,14 @@ void RimSummaryPlot::updateAxisRangesFromQwt()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
|
||||
{
|
||||
return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1518,7 +1581,7 @@ void RimSummaryPlot::updateMdiWindowTitle()
|
||||
QwtLegend* legend = new QwtLegend(m_qwtPlot);
|
||||
|
||||
auto font = legend->font();
|
||||
font.setPixelSize(m_legendFontSize());
|
||||
font.setPointSize(m_legendFontSize());
|
||||
legend->setFont(font);
|
||||
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class RimEnsembleCurveSet;
|
||||
class RimEnsembleCurveSetCollection;
|
||||
class RimSummaryCurveFilter_OBSOLETE;
|
||||
class RimSummaryTimeAxisProperties;
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryPlotNameHelper;
|
||||
@ -132,6 +133,10 @@ public:
|
||||
|
||||
size_t singleColorCurveCount() const;
|
||||
|
||||
|
||||
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
|
||||
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
|
||||
|
||||
public:
|
||||
// Rim2dPlotInterface overrides
|
||||
void updateAxisScaling() override;
|
||||
@ -171,7 +176,7 @@ private:
|
||||
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
bool hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
|
||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const;
|
||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const;
|
||||
void updateAxis(RiaDefines::PlotAxis plotAxis);
|
||||
|
||||
void updateZoomForAxis(RiaDefines::PlotAxis plotAxis);
|
||||
@ -181,6 +186,8 @@ private:
|
||||
|
||||
void updateAxisRangesFromQwt();
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
@ -28,15 +32,6 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RimSummaryTimeAxisProperties::AxisTitlePositionType >::setUp()
|
||||
{
|
||||
addItem(RimSummaryTimeAxisProperties::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
||||
addItem(RimSummaryTimeAxisProperties::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
||||
|
||||
setDefault(RimSummaryTimeAxisProperties::AXIS_TITLE_CENTER);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RimSummaryTimeAxisProperties::TimeModeType >::setUp()
|
||||
{
|
||||
@ -77,10 +72,6 @@ RimSummaryTimeAxisProperties::RimSummaryTimeAxisProperties()
|
||||
|
||||
CAF_PDM_InitField(&showTitle, "ShowTitle", false, "Show Title", "", "", "");
|
||||
CAF_PDM_InitField(&title, "Title", QString("Time"), "Title", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&titlePositionEnum, "TitlePosition", "Title Position", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&titleFontSize, "FontSize", 11, "Font Size", "", "", "");
|
||||
CAF_PDM_InitField(&valuesFontSize, "ValuesFontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Set Range Automatically", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeMode, "TimeMode", "Time Mode", "", "", "");
|
||||
@ -98,6 +89,52 @@ RimSummaryTimeAxisProperties::RimSummaryTimeAxisProperties()
|
||||
CAF_PDM_InitFieldNoDefault(&m_visibleTimeRangeMin, "VisibleTimeModeRangeMin", "Min", "", "", "");
|
||||
m_visibleDateRangeMin.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position", "", "", "");
|
||||
CAF_PDM_InitField(&m_titleFontSize, "FontSize", 10, "Font Size", "", "", "");
|
||||
m_titleFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
|
||||
CAF_PDM_InitField(&m_valuesFontSize, "ValuesFontSize", 10, "Font Size", "", "", "");
|
||||
m_valuesFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisPropertiesInterface::AxisTitlePositionType RimSummaryTimeAxisProperties::titlePosition() const
|
||||
{
|
||||
return m_titlePositionEnum();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimSummaryTimeAxisProperties::titleFontSize() const
|
||||
{
|
||||
return m_titleFontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::setTitleFontSize(int fontSize)
|
||||
{
|
||||
m_titleFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimSummaryTimeAxisProperties::valuesFontSize() const
|
||||
{
|
||||
return m_valuesFontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::setValuesFontSize(int fontSize)
|
||||
{
|
||||
m_valuesFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -240,8 +277,8 @@ QList<caf::PdmOptionItemInfo> RimSummaryTimeAxisProperties::calculateValueOption
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
*useOptionsOnly = true;
|
||||
|
||||
if (&titleFontSize == fieldNeedingOptions ||
|
||||
&valuesFontSize == fieldNeedingOptions)
|
||||
if (&m_titleFontSize == fieldNeedingOptions ||
|
||||
&m_valuesFontSize == fieldNeedingOptions)
|
||||
{
|
||||
std::vector<int> fontSizes;
|
||||
fontSizes.push_back(8);
|
||||
@ -272,6 +309,22 @@ caf::PdmFieldHandle* RimSummaryTimeAxisProperties::objectToggleField()
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTimeAxisProperties::TimeModeType RimSummaryTimeAxisProperties::timeMode() const
|
||||
{
|
||||
return m_timeMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::setTimeMode(TimeModeType val)
|
||||
{
|
||||
m_timeMode = val;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -340,8 +393,8 @@ void RimSummaryTimeAxisProperties::defineUiOrdering(QString uiConfigName, caf::P
|
||||
caf::PdmUiGroup& titleGroup = *(uiOrdering.addNewGroup("Axis Title"));
|
||||
titleGroup.add(&showTitle);
|
||||
titleGroup.add(&title);
|
||||
titleGroup.add(&titlePositionEnum);
|
||||
titleGroup.add(&titleFontSize);
|
||||
titleGroup.add(&m_titlePositionEnum);
|
||||
titleGroup.add(&m_titleFontSize);
|
||||
|
||||
caf::PdmUiGroup* timeGroup = uiOrdering.addNewGroup("Time Values");
|
||||
timeGroup->add(&m_timeMode);
|
||||
@ -356,7 +409,7 @@ void RimSummaryTimeAxisProperties::defineUiOrdering(QString uiConfigName, caf::P
|
||||
timeGroup->add(&m_visibleTimeRangeMax);
|
||||
timeGroup->add(&m_visibleTimeRangeMin);
|
||||
}
|
||||
timeGroup->add(&valuesFontSize);
|
||||
timeGroup->add(&m_valuesFontSize);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@ -31,18 +33,11 @@
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryTimeAxisProperties : public caf::PdmObject
|
||||
class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
|
||||
enum AxisTitlePositionType
|
||||
{
|
||||
AXIS_TITLE_CENTER,
|
||||
AXIS_TITLE_END
|
||||
};
|
||||
|
||||
enum TimeModeType
|
||||
{
|
||||
DATE,
|
||||
@ -61,16 +56,19 @@ public:
|
||||
public:
|
||||
RimSummaryTimeAxisProperties();
|
||||
|
||||
caf::PdmField<int> titleFontSize;
|
||||
caf::PdmField<QString> title;
|
||||
caf::PdmField<bool> showTitle;
|
||||
caf::PdmField< caf::AppEnum< AxisTitlePositionType > > titlePositionEnum;
|
||||
caf::PdmField<int> valuesFontSize;
|
||||
|
||||
TimeModeType timeMode() const { return m_timeMode(); }
|
||||
void setTimeMode(TimeModeType val) { m_timeMode = val; }
|
||||
double fromTimeTToDisplayUnitScale();
|
||||
double fromDaysToDisplayUnitScale();
|
||||
|
||||
AxisTitlePositionType titlePosition() const override;
|
||||
int titleFontSize() const override;
|
||||
void setTitleFontSize(int fontSize) override;
|
||||
int valuesFontSize() const override;
|
||||
void setValuesFontSize(int fontSize) override;
|
||||
TimeModeType timeMode() const;
|
||||
void setTimeMode(TimeModeType val);
|
||||
double fromTimeTToDisplayUnitScale();
|
||||
double fromDaysToDisplayUnitScale();
|
||||
|
||||
double visibleRangeMin() const;
|
||||
double visibleRangeMax() const;
|
||||
@ -104,4 +102,9 @@ private:
|
||||
caf::PdmField<double> m_visibleTimeRangeMin;
|
||||
caf::PdmField<double> m_visibleTimeRangeMax;
|
||||
caf::PdmField<bool> m_isAutoZoom;
|
||||
|
||||
caf::PdmField<int> m_titleFontSize;
|
||||
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> m_titlePositionEnum;
|
||||
caf::PdmField<int> m_valuesFontSize;
|
||||
|
||||
};
|
||||
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuRimQwtPlotCurve.h"
|
||||
#include "RiuQwtCurvePointTracker.h"
|
||||
@ -28,6 +30,7 @@
|
||||
#include "RimRegularLegendConfig.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafFixedAtlasFont.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafTitledOverlayFrame.h"
|
||||
|
||||
@ -94,6 +97,7 @@ void RiuGridCrossQwtPlot::addOrUpdateDataSetLegend(RimGridCrossPlotDataSet* data
|
||||
if (overlayWidget)
|
||||
{
|
||||
caf::TitledOverlayFrame* overlayItem = dataSet->legendConfig()->titledOverlayFrame();
|
||||
applyFontSizeToOverlayItem(overlayItem);
|
||||
resizeOverlayItemToFitPlot(overlayItem);
|
||||
overlayWidget->updateFromOverlayItem(overlayItem);
|
||||
}
|
||||
@ -135,6 +139,7 @@ void RiuGridCrossQwtPlot::updateLegendSizesToMatchPlot()
|
||||
{
|
||||
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
|
||||
caf::TitledOverlayFrame* overlayItem = dataSet->legendConfig()->titledOverlayFrame();
|
||||
applyFontSizeToOverlayItem(overlayItem);
|
||||
if (resizeOverlayItemToFitPlot(overlayItem))
|
||||
{
|
||||
anyLegendResized = true;
|
||||
@ -208,6 +213,9 @@ void RiuGridCrossQwtPlot::updateInfoBoxLayout()
|
||||
if (!infoText.empty())
|
||||
{
|
||||
m_infoBox->label()->setText(infoText.join("\n"));
|
||||
QFont font = m_infoBox->font();
|
||||
font.setPointSize(crossPlot->legendFontSize());
|
||||
m_infoBox->setFont(font);
|
||||
m_infoBox->adjustSize();
|
||||
QRect infoRect = m_infoBox->frameGeometry();
|
||||
QRect canvasRect = canvas()->frameGeometry();
|
||||
@ -401,3 +409,14 @@ bool RiuGridCrossQwtPlot::curveText(const QwtPlotCurve* curve,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridCrossQwtPlot::applyFontSizeToOverlayItem(caf::TitledOverlayFrame* overlayItem)
|
||||
{
|
||||
RimGridCrossPlot* crossPlot = static_cast<RimGridCrossPlot*>(ownerViewWindow());
|
||||
int fontSize = crossPlot->legendFontSize();
|
||||
cvf::ref<cvf::Font> cafFont = RiaFontCache::getFont(RiaFontCache::fontSizeEnumFromPointSize(fontSize));
|
||||
overlayItem->setFont(cafFont.p());
|
||||
}
|
||||
|
@ -66,13 +66,14 @@ protected:
|
||||
void selectSample(QwtPlotCurve* curve, int sampleNumber) override;
|
||||
void clearSampleSelection() override;
|
||||
bool curveText(const QwtPlotCurve* curve, QString* curveTitle, QString* xParamName, QString* yParamName) const;
|
||||
void applyFontSizeToOverlayItem(caf::TitledOverlayFrame* overlayItem);
|
||||
private:
|
||||
typedef caf::PdmPointer<RimGridCrossPlotDataSet> DataSetPtr;
|
||||
typedef QPointer<RiuCvfOverlayItemWidget> LegendPtr;
|
||||
typedef QPointer<RiuDraggableOverlayFrame> InfoBoxPtr;
|
||||
|
||||
InfoBoxPtr m_infoBox;
|
||||
std::map<DataSetPtr, LegendPtr> m_legendWidgets;
|
||||
std::map<DataSetPtr, LegendPtr> m_legendWidgets;
|
||||
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
|
||||
QwtPlotMarker* m_selectedPointMarker;
|
||||
|
||||
|
@ -147,7 +147,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
// Axis number font
|
||||
{
|
||||
QFont axisFont = plot->axisFont(QwtPlot::xBottom);
|
||||
axisFont.setPixelSize(11);
|
||||
axisFont.setPointSize(10);
|
||||
plot->setAxisFont(QwtPlot::xBottom, axisFont);
|
||||
plot->setAxisFont(QwtPlot::yLeft, axisFont);
|
||||
}
|
||||
@ -156,7 +156,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
{
|
||||
QwtText axisTitle = plot->axisTitle(QwtPlot::xBottom);
|
||||
QFont axisTitleFont = axisTitle.font();
|
||||
axisTitleFont.setPixelSize(11);
|
||||
axisTitleFont.setPointSize(10);
|
||||
axisTitleFont.setBold(false);
|
||||
axisTitle.setFont(axisTitleFont);
|
||||
axisTitle.setRenderFlags(Qt::AlignRight);
|
||||
@ -168,7 +168,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
{
|
||||
QwtText plotTitle = plot->title();
|
||||
QFont titleFont = plotTitle.font();
|
||||
titleFont.setPixelSize(14);
|
||||
titleFont.setPointSize(14);
|
||||
plotTitle.setFont(titleFont);
|
||||
plot->setTitle(plotTitle);
|
||||
}
|
||||
@ -506,7 +506,7 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
m_titleLabel = new QLabel("", this);
|
||||
m_titleLabel->setAlignment(Qt::AlignHCenter);
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPixelSize(14);
|
||||
font.setPointSize(14);
|
||||
font.setBold(true);
|
||||
m_titleLabel->setFont(font);
|
||||
|
||||
|
@ -55,7 +55,7 @@ void RiuQwtPlotTools::setCommonPlotBehaviour(QwtPlot* plot)
|
||||
|
||||
// Axis number font
|
||||
QFont axisFont = plot->axisFont(QwtPlot::xBottom);
|
||||
axisFont.setPixelSize(11);
|
||||
axisFont.setPointSize(10);
|
||||
|
||||
plot->setAxisFont(QwtPlot::xBottom, axisFont);
|
||||
plot->setAxisFont(QwtPlot::xTop, axisFont);
|
||||
@ -69,7 +69,7 @@ void RiuQwtPlotTools::setCommonPlotBehaviour(QwtPlot* plot)
|
||||
{
|
||||
QwtText axisTitle = plot->axisTitle(axis);
|
||||
QFont axisTitleFont = axisTitle.font();
|
||||
axisTitleFont.setPixelSize(11);
|
||||
axisTitleFont.setPointSize(10);
|
||||
axisTitleFont.setBold(false);
|
||||
axisTitle.setFont(axisTitleFont);
|
||||
axisTitle.setRenderFlags(Qt::AlignRight);
|
||||
|
@ -159,7 +159,7 @@ void RiuRelativePermeabilityPlotPanel::setPlotDefaults(QwtPlot* plot)
|
||||
{
|
||||
QwtText plotTitle = plot->title();
|
||||
QFont titleFont = plotTitle.font();
|
||||
titleFont.setPixelSize(14);
|
||||
titleFont.setPointSize(14);
|
||||
plotTitle.setFont(titleFont);
|
||||
plot->setTitle(plotTitle);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ RiuTofAccumulatedPhaseFractionsPlot::RiuTofAccumulatedPhaseFractionsPlot(RimTofA
|
||||
setDefaults();
|
||||
QwtText title("Cumulative Saturation by Time of Flight");
|
||||
QFont titleFont = title.font();
|
||||
titleFont.setPixelSize(12);
|
||||
titleFont.setPointSize(12);
|
||||
title.setFont(titleFont);
|
||||
setTitle(title);
|
||||
|
||||
@ -249,7 +249,7 @@ void RiuTofAccumulatedPhaseFractionsPlot::setCommonPlotBehaviour(QwtPlot* plot)
|
||||
|
||||
// Axis number font
|
||||
QFont axisFont = plot->axisFont(QwtPlot::xBottom);
|
||||
axisFont.setPixelSize(11);
|
||||
axisFont.setPointSize(10);
|
||||
|
||||
plot->setAxisFont(QwtPlot::xBottom, axisFont);
|
||||
plot->setAxisFont(QwtPlot::xTop, axisFont);
|
||||
@ -259,7 +259,7 @@ void RiuTofAccumulatedPhaseFractionsPlot::setCommonPlotBehaviour(QwtPlot* plot)
|
||||
// Axis title font
|
||||
QwtText axisTitle = plot->axisTitle(QwtPlot::xBottom);
|
||||
QFont axisTitleFont = axisTitle.font();
|
||||
axisTitleFont.setPixelSize(11);
|
||||
axisTitleFont.setPointSize(10);
|
||||
axisTitleFont.setBold(false);
|
||||
axisTitle.setFont(axisTitleFont);
|
||||
axisTitle.setRenderFlags(Qt::AlignRight);
|
||||
|
@ -95,7 +95,7 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||
{
|
||||
cvf::Font* standardFont = RiaApplication::instance()->defaultSceneFont();
|
||||
QFont font = QApplication::font();
|
||||
font.setPointSize(RiaFontCache::getPointSize(RiaApplication::instance()->preferences()->defaultFontSizeInScene()));
|
||||
font.setPointSize(RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultSceneFontSize()));
|
||||
|
||||
m_axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
|
||||
m_axisCross->setAxisLabels("X", "Y", "Z");
|
||||
@ -1074,7 +1074,7 @@ void RiuViewer::updateFonts()
|
||||
m_showAxisCross = true;
|
||||
|
||||
QFont font = QApplication::font();
|
||||
font.setPointSize(RiaFontCache::getPointSize(RiaApplication::instance()->preferences()->defaultFontSizeInScene()));
|
||||
font.setPointSize(RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultSceneFontSize()));
|
||||
|
||||
m_zScaleLabel->setFont(font);
|
||||
m_infoLabel->setFont(font);
|
||||
|
Loading…
Reference in New Issue
Block a user