Debian Codegraph @

pyvista/plotting/opts.py

raw
1 """Module with enum options classes for plotting."""
2
3 from __future__ import annotations
4
5 from enum import Enum
6
7 from pyvista.core.utilities.misc import AnnotatedIntEnum
8
9
10 class ShaderType(str, Enum):
11 """Shader types for GLSL shader replacements.
12
13 .. versionadded:: 0.48
14
15 Attributes
16 ----------
17 VERTEX : str
18 Vertex shader.
19 FRAGMENT : str
20 Fragment shader.
21 GEOMETRY : str
22 Geometry shader.
23
24 """
25
26 VERTEX = 'vertex'
27 FRAGMENT = 'fragment'
28 GEOMETRY = 'geometry'
29
30
31 class PointSpriteShape(str, Enum):
32 """Point sprite shape options for fragment shader rendering.
33
34 .. versionadded:: 0.48
35
36 Attributes
37 ----------
38 CIRCLE : str
39 Circular disc.
40 TRIANGLE : str
41 Upward-pointing triangle.
42 HEXAGON : str
43 Regular hexagon.
44 DIAMOND : str
45 Diamond (rotated square).
46 ASTERISK : str
47 Five-pointed asterisk.
48 STAR : str
49 Five-pointed star.
50
51 """
52
53 CIRCLE = 'circle'
54 TRIANGLE = 'triangle'
55 HEXAGON = 'hexagon'
56 DIAMOND = 'diamond'
57 ASTERISK = 'asterisk'
58 STAR = 'star'
59
60
61 class InterpolationType(AnnotatedIntEnum):
62 """Lighting interpolation types.
63
64 Attributes
65 ----------
66 FLAT : (int, str)
67 Flat interpolation type.
68 GOURAUD : (int, str)
69 Gouraud interpolation type.
70 PHONG : (int, str)
71 Phong interpolation type.
72 PBR : (int, str)
73 Physically based rendering interpolation type.
74
75 """
76
77 FLAT = (0, 'Flat')
78 GOURAUD = (1, 'Gouraud')
79 PHONG = (2, 'PHONG')
80 PBR = (3, 'Physically based rendering')
81
82 @classmethod
83 def from_str(cls, input_str):
84 """Create from string.
85
86 Create an instance of InterpolationType from a string.
87
88 Parameters
89 ----------
90 input_str : str
91 The string representation of the interpolation type. Accepts
92 aliases such as ``'pbr'`` for ``'Physically based rendering'``.
93
94 Returns
95 -------
96 InterpolationType
97 Interpolation type as defined by the input string.
98
99 """
100 aliases = {
101 'pbr': 'Physically based rendering',
102 }
103 if input_str in aliases:
104 input_str = aliases[input_str]
105 return super().from_str(input_str)
106
107
108 class RepresentationType(AnnotatedIntEnum):
109 """Types of representations the models can have."""
110
111 POINTS = (0, 'Points')
112 WIREFRAME = (1, 'Wireframe')
113 SURFACE = (2, 'Surface')
114
115
116 class ElementType(AnnotatedIntEnum):
117 """Types of elemental geometries."""
118
119 MESH = (0, 'Mesh')
120 CELL = (1, 'Cell')
121 FACE = (2, 'Face')
122 EDGE = (3, 'Edge')
123 POINT = (4, 'Point')
124
125
126 class PickerType(AnnotatedIntEnum):
127 """Types of pickers."""
128
129 AREA = (0, 'Area')
130 CELL = (1, 'Cell')
131 HARDWARE = (2, 'Hardware')
132 POINT = (3, 'Point')
133 PROP = (4, 'Prop')
134 RENDERED = (5, 'Rendered')
135 RESLICE = (6, 'Reslice')
136 SCENE = (7, 'Scene')
137 VOLUME = (8, 'Volume')
138 WORLD = (9, 'World')
139
140
141 class StereoType(AnnotatedIntEnum):
142 """Types of stereo rendering."""
143
144 CRYSTAL_EYES = (1, 'Crystal Eyes')
145 RED_BLUE = (2, 'Red Blue')
146 INTERLACED = (3, 'Interlaced')
147 LEFT = (4, 'Left')
148 RIGHT = (5, 'Right')
149 DRESDEN = (6, 'Dresden')
150 ANAGLYPH = (7, 'Anaglyph')
151 CHECKERBOARD = (8, 'Checkerboard')
152 SPLITVIEWPORT_HORIZONTAL = (9, 'Split Viewport Horizontal')
153 FAKE = (10, 'Fake')
154 EMULATE = (11, 'Emulate')
155 ZSPACE_INSPIRE = (12, 'ZSpace Inspire')