pytecplot 1.5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
  2. pytecplot-1.5.2.dist-info/METADATA +508 -0
  3. pytecplot-1.5.2.dist-info/RECORD +97 -0
  4. pytecplot-1.5.2.dist-info/WHEEL +5 -0
  5. pytecplot-1.5.2.dist-info/top_level.txt +1 -0
  6. tecplot/__init__.py +94 -0
  7. tecplot/annotation/__init__.py +7 -0
  8. tecplot/annotation/annotation.py +223 -0
  9. tecplot/annotation/geometry.py +369 -0
  10. tecplot/annotation/georeference.py +33 -0
  11. tecplot/annotation/image.py +185 -0
  12. tecplot/annotation/iter.py +105 -0
  13. tecplot/annotation/polyline.py +381 -0
  14. tecplot/annotation/text.py +744 -0
  15. tecplot/constant.py +401 -0
  16. tecplot/data/__init__.py +34 -0
  17. tecplot/data/array.py +645 -0
  18. tecplot/data/create.py +1 -0
  19. tecplot/data/dataset.py +1809 -0
  20. tecplot/data/extract.py +544 -0
  21. tecplot/data/face_neighbors.py +494 -0
  22. tecplot/data/facemap.py +814 -0
  23. tecplot/data/load.py +2075 -0
  24. tecplot/data/nodemap.py +577 -0
  25. tecplot/data/operate.py +928 -0
  26. tecplot/data/query.py +334 -0
  27. tecplot/data/save.py +343 -0
  28. tecplot/data/variable.py +280 -0
  29. tecplot/data/zone.py +841 -0
  30. tecplot/exception.py +201 -0
  31. tecplot/export/__init__.py +13 -0
  32. tecplot/export/animation.py +521 -0
  33. tecplot/export/export_setup.py +318 -0
  34. tecplot/export/image.py +577 -0
  35. tecplot/export/print_setup.py +218 -0
  36. tecplot/export/time_animation.py +607 -0
  37. tecplot/extension/__init__.py +14 -0
  38. tecplot/extension/ipython.py +68 -0
  39. tecplot/layout/__init__.py +20 -0
  40. tecplot/layout/frame.py +1285 -0
  41. tecplot/layout/layout.py +488 -0
  42. tecplot/layout/page.py +541 -0
  43. tecplot/legend/__init__.py +4 -0
  44. tecplot/legend/contour_legend.py +516 -0
  45. tecplot/legend/legend.py +141 -0
  46. tecplot/legend/line_legend.py +66 -0
  47. tecplot/legend/rgb_coloring_legend.py +291 -0
  48. tecplot/legend/scatter_legend.py +136 -0
  49. tecplot/macro.py +339 -0
  50. tecplot/plot/__init__.py +62 -0
  51. tecplot/plot/axes.py +881 -0
  52. tecplot/plot/axis.py +1350 -0
  53. tecplot/plot/blanking.py +584 -0
  54. tecplot/plot/contour.py +1302 -0
  55. tecplot/plot/effects.py +162 -0
  56. tecplot/plot/fieldmap.py +2159 -0
  57. tecplot/plot/grid.py +758 -0
  58. tecplot/plot/isosurface.py +1167 -0
  59. tecplot/plot/labels.py +338 -0
  60. tecplot/plot/linemap.py +1905 -0
  61. tecplot/plot/linking.py +489 -0
  62. tecplot/plot/plot.py +1791 -0
  63. tecplot/plot/rgb_coloring.py +281 -0
  64. tecplot/plot/scatter.py +396 -0
  65. tecplot/plot/slice.py +1544 -0
  66. tecplot/plot/streamtrace.py +1949 -0
  67. tecplot/plot/symbol.py +567 -0
  68. tecplot/plot/ticks.py +666 -0
  69. tecplot/plot/title.py +380 -0
  70. tecplot/plot/vector.py +679 -0
  71. tecplot/plot/view.py +868 -0
  72. tecplot/session/__init__.py +112 -0
  73. tecplot/session/aux_data.py +276 -0
  74. tecplot/session/config.py +92 -0
  75. tecplot/session/session.py +425 -0
  76. tecplot/session/state_changed.py +225 -0
  77. tecplot/session/style.py +504 -0
  78. tecplot/tecutil/__init__.py +16 -0
  79. tecplot/tecutil/arglist.py +230 -0
  80. tecplot/tecutil/captured_output.py +177 -0
  81. tecplot/tecutil/constant.py +1312 -0
  82. tecplot/tecutil/index_set.py +118 -0
  83. tecplot/tecutil/lock.py +36 -0
  84. tecplot/tecutil/message_pb2.py +39 -0
  85. tecplot/tecutil/preamble.py +54 -0
  86. tecplot/tecutil/stringlist.py +114 -0
  87. tecplot/tecutil/sv.py +1662 -0
  88. tecplot/tecutil/tecutil.py +12402 -0
  89. tecplot/tecutil/tecutil_client.py +627 -0
  90. tecplot/tecutil/tecutil_connector.py +937 -0
  91. tecplot/tecutil/tecutil_rpc.py +6845 -0
  92. tecplot/tecutil/util.py +332 -0
  93. tecplot/text/__init__.py +3 -0
  94. tecplot/text/font.py +224 -0
  95. tecplot/text/label_format.py +374 -0
  96. tecplot/text/textbox.py +106 -0
  97. tecplot/version.py +41 -0
@@ -0,0 +1,369 @@
1
+ from ..tecutil import _tecutil
2
+ from .. import constant, tecutil
3
+ from . import annotation
4
+
5
+
6
+ class Geometry(annotation.Annotation):
7
+ """Base class for all geometric shape annotations."""
8
+ @property
9
+ def color(self):
10
+ """`Color`: Line `Color`.
11
+
12
+ This example shows how to change the edge or line `Color` to red::
13
+
14
+ >>> from tecplot.constant import Color, CoordSys
15
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
16
+ >>> geom.color = Color.Red
17
+ """
18
+ return constant.Color(_tecutil.GeomGetColor(self.uid))
19
+
20
+ @color.setter
21
+ @tecutil.lock()
22
+ def color(self, value):
23
+ with self.frame.activated():
24
+ _tecutil.GeomSetColor(self.uid, constant.Color(value).value)
25
+
26
+ @property
27
+ def fill_color(self):
28
+ """`constant.Color`: Background fill color.
29
+
30
+ This example shows how to change the area fill `Color` to red. To turn
31
+ off filling the geometry, set this attribute to `None`::
32
+
33
+ >>> from tecplot.constant import Color, CoordSys
34
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
35
+ >>> geom.fill_color = Color.Red
36
+ """
37
+ with self.frame.activated():
38
+ is_filled = _tecutil.GeomGetIsFilled(self.uid)
39
+ if is_filled:
40
+ return constant.Color(_tecutil.GeomGetFillColor(self.uid))
41
+
42
+ @fill_color.setter
43
+ @tecutil.lock()
44
+ def fill_color(self, value):
45
+ with self.frame.activated():
46
+ if value is None:
47
+ _tecutil.GeomSetIsFilled(self.uid, False)
48
+ else:
49
+ _tecutil.GeomSetIsFilled(self.uid, True)
50
+ _tecutil.GeomSetFillColor(self.uid, constant.Color(value).value)
51
+
52
+ @property
53
+ def line_pattern(self):
54
+ """`LinePattern`: Pattern used for drawing lines or edges.
55
+
56
+ This example shows how to change the line pattern::
57
+
58
+ >>> from tecplot.constant import CoordSys, LinePattern
59
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
60
+ >>> geom.line_pattern = LinePattern.DashDot
61
+ """
62
+ with self.frame.activated():
63
+ return constant.LinePattern(_tecutil.GeomGetLinePattern(self.uid))
64
+
65
+ @line_pattern.setter
66
+ @tecutil.lock()
67
+ def line_pattern(self, value):
68
+ with self.frame.activated():
69
+ line_pattern = constant.LinePattern(value)
70
+ _tecutil.GeomSetLinePattern(self.uid, line_pattern.value)
71
+
72
+ @property
73
+ def line_thickness(self):
74
+ """`float`: Thickness of lines or edges.
75
+
76
+ This example shows how to change the line thickness::
77
+
78
+ >>> from tecplot.constant import CoordSys
79
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
80
+ >>> geom.line_thickness = 4.0
81
+ """
82
+ with self.frame.activated():
83
+ return _tecutil.GeomGetLineThickness(self.uid)
84
+
85
+ @line_thickness.setter
86
+ @tecutil.lock()
87
+ def line_thickness(self, value):
88
+ with self.frame.activated():
89
+ _tecutil.GeomSetLineThickness(self.uid, float(value))
90
+
91
+ @property
92
+ def pattern_length(self):
93
+ """`float`: Length of the line pattern.
94
+
95
+ This example shows how to change the pattern length::
96
+
97
+ >>> from tecplot.constant import CoordSys
98
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
99
+ >>> geom.pattern_length = 1.2
100
+ """
101
+ with self.frame.activated():
102
+ return _tecutil.GeomGetPatternLength(self.uid)
103
+
104
+ @pattern_length.setter
105
+ @tecutil.lock()
106
+ def pattern_length(self, value):
107
+ with self.frame.activated():
108
+ _tecutil.GeomSetPatternLength(self.uid, float(value))
109
+
110
+
111
+ class Geometry2D(Geometry, annotation.MovableAnnotation):
112
+ @property
113
+ def clipping(self):
114
+ """`Clipping`: Clip geometry to the axes or frame for 2D plots.
115
+
116
+ Clipping refers to displaying only that portion of an object that falls
117
+ within a specified clipping region of the plot. If you have specified
118
+ the position in the Frame coordinate system, the `Annotation` will be
119
+ clipped to the frame. Default: `Clipping.ClipToViewport`.
120
+
121
+ If you have specified the Grid coordinate system, you can choose to
122
+ clip your `Annotation` to the frame or the viewport. The size of the
123
+ viewport depends on the plot type as follows:
124
+
125
+ * 3D Cartesian - The viewport is the same as the frame, so viewport
126
+ clipping is the same as frame clipping.
127
+ * 2D Cartesian/XY Line - The viewport is defined by the extents of
128
+ the X and Y axes.
129
+ * Polar Line/Sketch - By default, the viewport is the same as the
130
+ frame.
131
+
132
+ .. warning::
133
+
134
+ For 3D and line plots the viewport is the same as the frame and so
135
+ clipping to the viewport or the frame will have no apparent affect.
136
+ In cartesian 2D plots, clipping to the axes
137
+ (`Clipping.ClipToViewport`) is only available when the position
138
+ coordinate system is `CoordSys.Grid`.
139
+
140
+ Example of clipping a circle to the frame::
141
+
142
+ >>> from tecplot.constant import Clipping, CoordSys
143
+ >>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
144
+ >>> geom.clipping = Clipping.ClipToFrame
145
+ """
146
+ with self.frame.activated():
147
+ return constant.Clipping(_tecutil.GeomGetClipping(self.uid))
148
+
149
+ @clipping.setter
150
+ @tecutil.lock()
151
+ def clipping(self, value):
152
+ with self.frame.activated():
153
+ _tecutil.GeomSetClipping(self.uid, constant.Clipping(value).value)
154
+
155
+
156
+ class CurvedGeometry(Geometry2D):
157
+ @property
158
+ def num_points(self):
159
+ """`int`: Number of points to use when creating the curved shape.
160
+
161
+ This is the number of segments along the edge plus one. Example usage::
162
+
163
+ >>> from tecplot.constant import CoordSys
164
+ >>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
165
+ >>> geom.num_points = 300
166
+ """
167
+ with self.frame.activated():
168
+ return _tecutil.GeomEllipseGetNumPoints(self.uid)
169
+
170
+ @num_points.setter
171
+ @tecutil.lock()
172
+ def num_points(self, value):
173
+ _tecutil.GeomEllipseSetNumPoints(self.uid, int(value))
174
+
175
+
176
+ class Circle(CurvedGeometry):
177
+ """A circle annotation attached to a `Frame <layout.Frame>`.
178
+
179
+ .. seealso:: `Frame.add_circle()`
180
+
181
+ .. code-block:: python
182
+
183
+ import tecplot as tp
184
+ from tecplot.constant import *
185
+
186
+ frame = tp.active_frame()
187
+
188
+ circle0 = frame.add_circle((40, 50), 12, CoordSys.Frame)
189
+ circle1 = frame.add_circle((50, 50), 12, CoordSys.Frame)
190
+ circle2 = frame.add_circle((60, 50), 12, CoordSys.Frame)
191
+
192
+ circle0.fill_color = Color.Magenta
193
+ circle1.fill_color = Color.Yellow
194
+ circle2.fill_color = Color.Cyan
195
+
196
+ tp.export.save_png('circle.png', 600)
197
+
198
+ .. figure:: /_static/images/circle.png
199
+ :width: 300px
200
+ :figwidth: 300px
201
+ """
202
+ @property
203
+ def radius(self):
204
+ """`float`: Length of the radius.
205
+
206
+ This will be in the coordinate system specified by
207
+ `Circle.position_coordinate_system`. This example creates a circle of
208
+ radius 5 and then doubles it to 10 later::
209
+
210
+ >>> from tecplot.constant import CoordSys
211
+ >>> geom = frame.add_circle((20, 30), 5, CoordSys.Frame)
212
+ >>> geom.radius = 10
213
+ """
214
+ with self.frame.activated():
215
+ return _tecutil.GeomCircleGetRadius(self.uid)
216
+
217
+ @radius.setter
218
+ @tecutil.lock()
219
+ def radius(self, value):
220
+ with self.frame.activated():
221
+ _tecutil.GeomCircleSetRadius(self.uid, float(value))
222
+
223
+
224
+ class Ellipse(CurvedGeometry):
225
+ """An ellipse annotation attached to a `Frame <layout.Frame>`.
226
+
227
+ .. seealso:: `Frame.add_ellipse()`
228
+
229
+ .. code-block:: python
230
+
231
+ import tecplot as tp
232
+ from tecplot.constant import *
233
+
234
+ frame = tp.active_frame()
235
+
236
+ ellipse0 = frame.add_ellipse((40, 45), (10, 12), CoordSys.Frame)
237
+ ellipse1 = frame.add_ellipse((50, 50), (10, 16), CoordSys.Frame)
238
+ ellipse2 = frame.add_ellipse((60, 55), (10, 20), CoordSys.Frame)
239
+
240
+ ellipse0.fill_color = Color.Magenta
241
+ ellipse1.fill_color = Color.Yellow
242
+ ellipse2.fill_color = Color.Cyan
243
+
244
+ tp.export.save_png('ellipse.png', 600)
245
+
246
+ .. figure:: /_static/images/ellipse.png
247
+ :width: 300px
248
+ :figwidth: 300px
249
+ """
250
+ @property
251
+ def size(self):
252
+ """`tuple`: Size :math:`(h_{axis}, v_{axis})` of the ellipse.
253
+
254
+ This is the horizontal and vertical axis lengths of the ellipse and
255
+ will be in the coordinate system specified by
256
+ `Ellipse.position_coordinate_system`. This example creates an ellipse
257
+ with :math:`(h_{axis}, v_{axis})` of :math:`(5, 10)` and changes it to
258
+ :math:`(10, 20)` later::
259
+
260
+ >>> from tecplot.constant import CoordSys
261
+ >>> geom = frame.add_ellipse((50, 50), (5, 10), CoordSys.Frame)
262
+ >>> geom.size = (10, 20)
263
+ """
264
+ with self.frame.activated():
265
+ return _tecutil.GeomEllipseGetSize(self.uid)
266
+
267
+ @size.setter
268
+ @tecutil.lock()
269
+ def size(self, values):
270
+ haxis, vaxis = (float(v) for v in values)
271
+ _tecutil.GeomEllipseSetSize(self.uid, haxis, vaxis)
272
+
273
+
274
+ class Rectangle(Geometry2D):
275
+ """A rectangle annotation attached to a `Frame <layout.Frame>`.
276
+
277
+ .. seealso:: `Frame.add_rectangle()`
278
+
279
+ .. code-block:: python
280
+
281
+ import tecplot as tp
282
+ from tecplot.constant import *
283
+
284
+ frame = tp.active_frame()
285
+
286
+ rectangle0 = frame.add_rectangle((40, 45), (20, 12), CoordSys.Frame)
287
+ rectangle1 = frame.add_rectangle((50, 50), (20, 16), CoordSys.Frame)
288
+ rectangle2 = frame.add_rectangle((60, 55), (20, 20), CoordSys.Frame)
289
+
290
+ rectangle0.fill_color = Color.Magenta
291
+ rectangle1.fill_color = Color.Yellow
292
+ rectangle2.fill_color = Color.Cyan
293
+
294
+ tp.export.save_png('rectangle.png', 600)
295
+
296
+ .. figure:: /_static/images/rectangle.png
297
+ :width: 300px
298
+ :figwidth: 300px
299
+ """
300
+ @property
301
+ def size(self):
302
+ """`tuple`: Size :math:`(width, height)` of the rectangle.
303
+
304
+ This is the width and height of the rectangle and will be in the
305
+ coordinate system specified by `Rectangle.position_coordinate_system`.
306
+ This example creates a rectangle with :math:`(width, height)` of
307
+ :math:`(5, 10)` and changes it to :math:`(10, 20)` later::
308
+
309
+ >>> from tecplot.constant import CoordSys
310
+ >>> geom = frame.add_rectangle((50, 50), (5, 10), CoordSys.Frame)
311
+ >>> geom.size = (10, 20)
312
+ """
313
+ with self.frame.activated():
314
+ return _tecutil.GeomRectangleGetSize(self.uid)
315
+
316
+ @size.setter
317
+ @tecutil.lock()
318
+ def size(self, values):
319
+ width, height = (float(v) for v in values)
320
+ with self.frame.activated():
321
+ _tecutil.GeomRectangleSetSize(self.uid, width, height)
322
+
323
+
324
+ class Square(Geometry2D):
325
+ """A square annotation attached to a `Frame <layout.Frame>`.
326
+
327
+ .. seealso:: `Frame.add_square()`
328
+
329
+ .. code-block:: python
330
+
331
+ import tecplot as tp
332
+ from tecplot.constant import *
333
+
334
+ frame = tp.active_frame()
335
+
336
+ square0 = frame.add_square((40, 40), 15, CoordSys.Frame)
337
+ square1 = frame.add_square((50, 50), 15, CoordSys.Frame)
338
+ square2 = frame.add_square((60, 60), 15, CoordSys.Frame)
339
+
340
+ square0.fill_color = Color.Magenta
341
+ square1.fill_color = Color.Yellow
342
+ square2.fill_color = Color.Cyan
343
+
344
+ tp.export.save_png('square.png', 600)
345
+
346
+ .. figure:: /_static/images/square.png
347
+ :width: 300px
348
+ :figwidth: 300px
349
+ """
350
+ @property
351
+ def size(self):
352
+ """`float`: Length of one side of the square.
353
+
354
+ This will be in the coordinate system specified by
355
+ `Square.position_coordinate_system`. This example creates a square of
356
+ side-length 5 and then doubles it to 10 later::
357
+
358
+ >>> from tecplot.constant import CoordSys
359
+ >>> geom = frame.add_square((50, 50), 5, CoordSys.Frame)
360
+ >>> geom.radius = 10
361
+ """
362
+ with self.frame.activated():
363
+ return _tecutil.GeomSquareGetSize(self.uid)
364
+
365
+ @size.setter
366
+ @tecutil.lock()
367
+ def size(self, value):
368
+ with self.frame.activated():
369
+ _tecutil.GeomSquareSetSize(self.uid, float(value))
@@ -0,0 +1,33 @@
1
+ from ..tecutil import _tecutil
2
+ from ..exception import *
3
+ from .. import tecutil
4
+ from . import annotation
5
+
6
+
7
+ class GeoreferencedImage(annotation.Annotation):
8
+ """A Geographic reference image.
9
+
10
+ A georeferenced can be added to a plot with a call to
11
+ `Frame.add_georeferenced_image()`. Placement of the image is controlled by
12
+ the :math:`(x, y)` variables of the `Frame <layout.Frame>` and the `GeoreferencedImage`
13
+ object's :math:`z` parameter.
14
+ """
15
+ @property
16
+ def z(self):
17
+ """`float`: :math:`z`-position of the georeferenced image.
18
+
19
+ This is the :math:`z` position (typically elevation) of the
20
+ georeferenced image with respect to the :math:`(x, y, z)` variables set
21
+ in the `Frame <layout.Frame>`. Example usage::
22
+
23
+ >>> georefimg.z = 100
24
+ """
25
+ with self.frame.activated():
26
+ pos = _tecutil.GeomGetAnchorPos(self.uid)
27
+ return tecutil.XYZ(*pos).z
28
+
29
+ @z.setter
30
+ @tecutil.lock()
31
+ def z(self, value):
32
+ with self.frame.activated():
33
+ _tecutil.GeomSetAnchorPos(self.uid, 0, 0, float(value))
@@ -0,0 +1,185 @@
1
+ from ..tecutil import _tecutil
2
+ from ..exception import *
3
+ from .. import constant, tecutil
4
+
5
+ from .annotation import MovableAnnotation
6
+
7
+
8
+ class Image(MovableAnnotation):
9
+ """Image annotation.
10
+
11
+ This example shows creating an image from a 2D plot and overlaying it on
12
+ the 3D plot of the same data.
13
+
14
+ .. code-block:: python
15
+ :emphasize-lines: 22
16
+
17
+ import os
18
+
19
+ import tecplot as tp
20
+ from tecplot.constant import PlotType
21
+
22
+ examples_dir = tp.session.tecplot_examples_directory()
23
+ datafile = os.path.join(examples_dir, 'SimpleData', 'F18.plt')
24
+ dataset = tp.data.load_tecplot(datafile)
25
+
26
+ frame = tp.active_frame()
27
+
28
+ plot2d = frame.plot(PlotType.Cartesian2D)
29
+ plot2d.activate()
30
+ plot2d.show_contour = True
31
+ plot2d.contour(0).colormap_name = 'Sequential - Blue'
32
+ plot2d.contour(0).variable = dataset.variable('S')
33
+ tp.export.save_png('embedded_image.png')
34
+
35
+ plot3d = frame.plot(PlotType.Cartesian3D)
36
+ plot3d.activate()
37
+ plot3d.show_contour = True
38
+ frame.add_image('embedded_image.png', (5, 55), 40)
39
+
40
+ tp.export.save_png('image.png')
41
+
42
+ .. figure:: /_static/images/image.png
43
+ :width: 300px
44
+ :figwidth: 300px
45
+ """
46
+ @property
47
+ def filename(self):
48
+ """`str`: Source file (read-only).
49
+
50
+ Example usage::
51
+
52
+ >>> image = frame.add_imge('my_image.png', (20, 20), 40)
53
+ >>> print(image.filename)
54
+ my_image.png
55
+ """
56
+ with self.frame.activated():
57
+ return _tecutil.GeomImageGetFileName(self.uid)
58
+
59
+ @property
60
+ def height(self):
61
+ """`float`: Displayed image height in the coordinate system specified.
62
+
63
+ The units for height are determined by the `position_coordinate_system`
64
+ of the image. This example sets the height to 40% of the `Frame <layout.Frame>`::
65
+
66
+ >>> from tecplot.constant import CoordSys
67
+ >>> image.position_coordinate_system = CoordSys.Frame
68
+ >>> image.height = 40
69
+ """
70
+ return self.size[1]
71
+
72
+ @height.setter
73
+ @tecutil.lock()
74
+ def height(self, value):
75
+ value = float(value)
76
+ if value <= 0.0:
77
+ msg = 'Annotation image height must be greater than 0'
78
+ raise TecplotValueError(msg)
79
+ with self.frame.activated():
80
+ _tecutil.GeomImageSetHeight(self.uid, value)
81
+
82
+ @property
83
+ def maintain_aspect_ratio(self):
84
+ """`bool`: Keep aspect ratio on width or height change.
85
+
86
+ Example usage::
87
+
88
+ >>> image.maintain_aspect_ratio = True
89
+ """
90
+ with self.frame.activated():
91
+ return _tecutil.GeomImageGetUseRatio(self.uid)
92
+
93
+ @maintain_aspect_ratio.setter
94
+ @tecutil.lock()
95
+ def maintain_aspect_ratio(self, value):
96
+ with self.frame.activated():
97
+ _tecutil.GeomImageSetUseRatio(self.uid, bool(value))
98
+
99
+ @property
100
+ def raw_size(self):
101
+ """:math:`(width, height)`: Original image size in pixels (read-only).
102
+
103
+ Example usage::
104
+
105
+ >>> print(image.raw_size)
106
+ (600, 400)
107
+ """
108
+ return _tecutil.GeomImageGetRawSize(self.uid)
109
+
110
+ @tecutil.lock()
111
+ def reset_aspect_ratio(self):
112
+ """Restore the aspect ratio to that of the original image.
113
+
114
+ Example usage::
115
+
116
+ >>> image.reset_aspect_ratio()
117
+ """
118
+ _tecutil.GeomImageResetAspectRatio(self.uid)
119
+
120
+ @property
121
+ def resize_filter(self):
122
+ """`ImageResizeFilter`: Smoothing filter.
123
+
124
+ Possible values are `ImageResizeFilter.Texture`,
125
+ `ImageResizeFilter.Box`, `ImageResizeFilter.Lanczos2`,
126
+ `ImageResizeFilter.Lanczos3`, `ImageResizeFilter.Triangle`,
127
+ `ImageResizeFilter.Bell`, `ImageResizeFilter.BSpline`,
128
+ `ImageResizeFilter.Cubic`, `ImageResizeFilter.Mitchell`,
129
+ `ImageResizeFilter.Gaussian`. Example usage::
130
+
131
+ >>> from tecplot.constant import ImageResizeFilter
132
+ >>> image.resize_filter = ImageResizeFilter.BSpline
133
+ """
134
+ imgrf = _tecutil.GeomImageGetResizeFilter(self.uid)
135
+ with self.frame.activated():
136
+ return constant.ImageResizeFilter(imgrf)
137
+
138
+ @resize_filter.setter
139
+ @tecutil.lock()
140
+ def resize_filter(self, value):
141
+ imgrf = constant.ImageResizeFilter(value)
142
+ with self.frame.activated():
143
+ _tecutil.GeomImageSetResizeFilter(self.uid, imgrf.value)
144
+
145
+ @property
146
+ def size(self):
147
+ """:math:`(width, height)`: Displayed image size.
148
+
149
+ This will be in the coordinates specified by
150
+ `Image.position_coordinate_system`. Example usage::
151
+
152
+ >>> image.size = (40, 20)
153
+ """
154
+ with self.frame.activated():
155
+ return _tecutil.GeomImageGetSize(self.uid)
156
+
157
+ @size.setter
158
+ def size(self, values):
159
+ width, height = (float(v) for v in values)
160
+ _maintain_aspect = self.maintain_aspect_ratio
161
+ if _maintain_aspect:
162
+ self.maintain_aspect_ratio = False
163
+ self.width = width
164
+ self.height = height
165
+ if _maintain_aspect:
166
+ self.maintain_aspect_ratio = _maintain_aspect
167
+
168
+ @property
169
+ def width(self):
170
+ """`float`: Displayed image width in the coordinate system specified.
171
+
172
+ The units for width are determined by the `position_coordinate_system`
173
+ of the image. This example sets the width to 40% of the `Frame <layout.Frame>`::
174
+
175
+ >>> from tecplot.constant import CoordSys
176
+ >>> image.position_coordinate_system = CoordSys.Frame
177
+ >>> image.width = 0.4
178
+ """
179
+ return self.size[0]
180
+
181
+ @width.setter
182
+ @tecutil.lock()
183
+ def width(self, value):
184
+ with self.frame.activated():
185
+ _tecutil.GeomImageSetWidth(self.uid, float(value))
@@ -0,0 +1,105 @@
1
+ from ..tecutil import _tecutil
2
+ from .. import constant
3
+ from .annotation import Annotation, MovableAnnotation
4
+ from .geometry import Circle, Ellipse, Rectangle, Square
5
+ from .georeference import GeoreferencedImage
6
+ from .image import Image
7
+ from .polyline import MultiPolyline2D, MultiPolyline3D, Polyline2D, Polyline3D
8
+ from .text import Text
9
+
10
+ class GeometryIterator(object):
11
+ """
12
+ type_filter is a function that takes a Geometry object and returns one
13
+ of the concrete geometry objects: Circle, Square, Polyline3D,
14
+ MultiPolyline2D, Image, etc. or None if the object is to be filtered
15
+ out. For convenience, this class provides static methods for geometric
16
+ shape and image filtering.
17
+ """
18
+ def __init__(self, type_filter, frame):
19
+ self.type_filter = type_filter
20
+ self.frame = frame
21
+
22
+ def __iter__(self):
23
+ self.current_item = None
24
+ return self
25
+
26
+ @staticmethod
27
+ def ShapeFilter(anno):
28
+ geom_type = anno.type
29
+ if geom_type == constant.GeomType.LineSegs:
30
+ anno = MovableAnnotation(anno.uid, anno.frame)
31
+ if anno.position_coordinate_system == constant.CoordSys.Grid3D:
32
+ mpolyline = MultiPolyline3D(anno.uid, anno.frame)
33
+ if len(mpolyline) == 1:
34
+ return Polyline3D(0, mpolyline)
35
+ else:
36
+ return mpolyline
37
+ else:
38
+ mpolyline = MultiPolyline2D(anno.uid, anno.frame)
39
+ if len(mpolyline) == 1:
40
+ return Polyline2D(0, mpolyline)
41
+ else:
42
+ return mpolyline
43
+ else:
44
+ try:
45
+ ShapeTypes = {
46
+ constant.GeomType.Circle: Circle,
47
+ constant.GeomType.Ellipse: Ellipse,
48
+ constant.GeomType.Rectangle: Rectangle,
49
+ constant.GeomType.Square: Square,
50
+ }
51
+ return ShapeTypes[geom_type](anno.uid, anno.frame)
52
+ except KeyError:
53
+ return
54
+
55
+ @staticmethod
56
+ def ImageFilter(anno):
57
+ if anno.type == constant.GeomType.Image:
58
+ anno = MovableAnnotation(anno.uid, anno.frame)
59
+ if anno.position_coordinate_system == constant.CoordSys.Grid3D:
60
+ return GeoreferencedImage(anno.uid, anno.frame)
61
+ else:
62
+ return Image(anno.uid, anno.frame)
63
+
64
+ def __next__(self):
65
+ with self.frame.activated():
66
+ while True:
67
+ if getattr(self, 'current_item', None) is None:
68
+ uid = _tecutil.GeomGetBase()
69
+ else:
70
+ uid = _tecutil.GeomGetNext(self.current_item.uid)
71
+ if not uid:
72
+ break
73
+ self.current_item = Annotation(uid, self.frame)
74
+ obj = self.type_filter(self.current_item)
75
+ if obj is None:
76
+ continue
77
+ self.current_item = obj
78
+ return self.current_item
79
+ raise StopIteration
80
+
81
+ def next(self):
82
+ return self.__next__()
83
+
84
+
85
+ class TextIterator(object):
86
+ def __init__(self, frame):
87
+ self.frame = frame
88
+
89
+ def __iter__(self):
90
+ self.current_item = None
91
+ return self
92
+
93
+ def __next__(self):
94
+ with self.frame.activated():
95
+ if getattr(self, 'current_item', None) is None:
96
+ uid = _tecutil.TextGetBase()
97
+ else:
98
+ uid = _tecutil.TextGetNext(self.current_item.uid)
99
+ if not uid:
100
+ raise StopIteration
101
+ self.current_item = Text(uid, self.frame)
102
+ return self.current_item
103
+
104
+ def next(self):
105
+ return self.__next__()