1 // Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef PVIEW_OPTIONS_H
7 #define PVIEW_OPTIONS_H
8 
9 #include <string>
10 #include "ColorTable.h"
11 #include "SBoundingBox3d.h"
12 
13 class mathEvaluator;
14 
15 // The display options of a post-processing view.
16 class PViewOptions {
17 public:
18   enum PlotType { Plot3D = 1, Plot2DSpace = 2, Plot2DTime = 3, Plot2D = 4 };
19   enum IntervalsType { Iso = 1, Continuous = 2, Discrete = 3, Numeric = 4 };
20   enum VectorType {
21     Segment = 1,
22     Arrow = 2,
23     Pyramid = 3,
24     Arrow3D = 4,
25     Displacement = 5
26   };
27   enum TensorType {
28     VonMises = 1,
29     MaxEigenValue = 2,
30     MinEigenValue = 3,
31     EigenVectors = 4,
32     Ellipse = 5,
33     Ellipsoid = 6,
34     Frame = 7
35   };
36   enum GlyphLocation { COG = 1, Vertex = 2 };
37   enum RangeType { Default = 1, Custom = 2, PerTimeStep = 3 };
38   enum ScaleType { Linear = 1, Logarithmic = 2, DoubleLogarithmic = 3 };
39 
40   int type, autoPosition;
41   double position[2], size[2];
42   std::string format;
43   int axes, axesAutoPosition, axesMikado;
44   double axesTics[3];
45   std::string axesFormat[3], axesLabel[3];
46   double axesPosition[6];
47   double customMin, customMax, tmpMin, tmpMax, externalMin, externalMax;
48   double customAbscissaMin, customAbscissaMax;
49   SBoundingBox3d tmpBBox;
50   double offset[3], raise[3], transform[3][3], displacementFactor, normalRaise;
51   double explode;
52   double arrowSizeMin, arrowSizeMax;
53   double normals, tangents;
54   int visible, intervalsType, nbIso;
55   int light, lightTwoSide, lightLines, smoothNormals;
56   double angleSmoothNormals;
57   int saturateValues, fakeTransparency;
58   int showElement, showTime, showScale;
59   int scaleType, rangeType, abscissaRangeType;
60   int vectorType, tensorType, glyphLocation, centerGlyphs;
61   int timeStep;
62   double currentTime;
63   int drawStrings;
64   int drawPoints, drawLines, drawTriangles, drawQuadrangles, drawPolygons;
65   int drawTetrahedra, drawHexahedra, drawPrisms, drawPyramids, drawTrihedra,
66     drawPolyhedra;
67   int drawScalars, drawVectors, drawTensors;
68   int boundary, pointType, lineType, drawSkinOnly;
69   double pointSize, lineWidth;
70   GmshColorTable colorTable;
71   int useStipple, stipple[10][2];
72   std::string stippleString[10];
73   int externalViewIndex, viewIndexForGenRaise;
74   int useGenRaise;
75   double genRaiseFactor;
76   std::string genRaiseX, genRaiseY, genRaiseZ;
77   mathEvaluator *genRaiseEvaluator;
78   int adaptVisualizationGrid, maxRecursionLevel;
79   double targetError;
80   int clip; // status of clip planes (bit array)
81   int forceNumComponents, componentMap[9];
82   int sampling;
83   std::string attributes, doubleClickedCommand, group;
84   int closed;
85   struct {
86     unsigned int point, line, triangle, quadrangle;
87     unsigned int tetrahedron, hexahedron, prism, pyramid, trihedron;
88     unsigned int tangents, normals;
89     unsigned int text2d, text3d, axes, background2d;
90   } color;
91 
92 private:
93   // static reference that contains default values
94   static PViewOptions *_reference;
95 
96 public:
97   PViewOptions();
98   ~PViewOptions();
99   static PViewOptions *reference();
100   // return a floating point value in [min, max] corresponding to the
101   // integer iso in [0, numIso - 1]
102   double getScaleValue(int iso, int numIso, double min, double max);
103   // return an integer in [0, numIso - 1] corresponding to the
104   // floating point value val in [min, max]
105   int getScaleIndex(double val, int numIso, double min, double max,
106                     bool forceLinear = false);
107   // get color for val in [min, max] (only use numColors if > 0
108   // instead of all available colors)
109   unsigned int getColor(double val, double min, double max,
110                         bool forceLinear = false, int numColors = -1);
111   // get i-th color amongst nb (i in [0, nb - 1])
112   unsigned int getColor(int i, int nb);
113   // create math evaluator for general raise option
114   void createGeneralRaise();
115   // return true if one should not draw elements with type type
116   bool skipElement(int type);
117 };
118 
119 #endif
120