File: plotColorbar.h

package info (click to toggle)
groops 0%2Bgit20250907%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 11,140 kB
  • sloc: cpp: 135,607; fortran: 1,603; makefile: 20
file content (95 lines) | stat: -rw-r--r-- 2,909 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/***********************************************/
/**
* @file plotColorbar.h
*
* @brief Colorbar.
*
* @author Andreas Kvas
* @author Torsten Mayer-Guerr
* @date 2020-05-03
*
*/
/***********************************************/

#ifndef __GROOPS_PLOTCOLORBAR__
#define __GROOPS_PLOTCOLORBAR__

// Latex documentation
#ifdef DOCSTRING_PlotColorbar
static const char *docstringPlotColorbar = R"(
\section{PlotColorbar}\label{plotColorbarType}
A colorbar as used in \program{PlotMap}, \program{PlotMatrix}, \program{PlotSphericalHarmonicsTriangle}.
)";
#endif

/***********************************************/

#include "base/import.h"
#include "config/config.h"

/** @addtogroup plotGroup */
/// @{

/***** TYPES ***********************************/

class PlotColorbar;
typedef std::shared_ptr<PlotColorbar> PlotColorbarPtr;

/***** CLASS ***********************************/

/** @brief A Colorbar for GMT plots.
* An Instance of this class can be created by @ref readConfig. */
class PlotColorbar
{
  Double      vMin, vMax;
  std::string colorTable;
  Double      annotation;
  std::string label, unit;
  Bool        isLog;
  Bool        triangleLeft, triangleRight;
  Bool        illuminate;
  Bool        vertical;
  Double      margin;
  Double      length;
  Bool        isPlot;

public:
  /** @brief Constructor. */
  PlotColorbar(Config &config, const std::string &name);

  void setAutoInterval(Double minAuto, Double maxAuto);

  /** @brief Get minimum value for this axis. */
  Double getMin() const {return vMin;}

  /** @brief Get maximum value for this axis. */
  Double getMax() const {return vMax;}

  Bool isLogarithmic() const {return isLog;}

  std::string scriptColorTable() const;
  std::string scriptEntry(Double width, Double height, Double marginX, Double marginY) const;

  /** @brief creates an derived instance of this class. */
  static PlotColorbarPtr create(Config &config, const std::string &name) {return PlotColorbarPtr(new PlotColorbar(config, name));}
};

/***** FUNCTIONS *******************************/

/** @brief Creates a class PlotColorbar.
* Search for a node with @a name in the Config node.
* if @a name is not found the function returns FALSE and @a plotColorbar is untouched.
* @param config The config node which includes the node with the options for this class
* @param name Tag name in the config.
* @param[out] plotColorbar Created class.
* @param mustSet If is MUSTSET and @a name is not found, this function throws an exception instead of returning with FALSE.
* @param defaultValue Ignored at the moment.
* @param annotation Description of the function of this class.
* @relates PlotColorbar */
template<> Bool readConfig(Config &config, const std::string &name, PlotColorbarPtr &plotColorbar, Config::Appearance mustSet, const std::string &defaultValue, const std::string &annotation);

/// @}

/***********************************************/

#endif