1 |
""" |
2 |
Author: John Ngui, john.ngui@uq.edu.au |
3 |
""" |
4 |
|
5 |
# Import the necessary modules. |
6 |
from esys.pyvisi import Scene, DataCollector, MapOnScalarClipWithRotation |
7 |
from esys.pyvisi import Camera |
8 |
from esys.pyvisi.constant import * |
9 |
import os |
10 |
|
11 |
PYVISI_EXAMPLE_MESHES_PATH = "data_meshes" |
12 |
PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images" |
13 |
X_SIZE = 800 |
14 |
Y_SIZE = 800 |
15 |
|
16 |
FILE_2D = "without_st.0700.xml" |
17 |
IMAGE_NAME = "maponscalarclipwithrotation.jpg" |
18 |
JPG_RENDERER = Renderer.ONLINE_JPG |
19 |
|
20 |
# Create a Scene. |
21 |
s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE, |
22 |
y_size = Y_SIZE) |
23 |
|
24 |
# Create a DataCollector reading from a XML file. |
25 |
dc1 = DataCollector(source = Source.XML) |
26 |
dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_2D)) |
27 |
|
28 |
# Create a MapOnScalarClipWithRotation. |
29 |
m1 = MapOnScalarClipWithRotation(scene = s, data_collector = dc1, |
30 |
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False) |
31 |
m1.setAngle(220) |
32 |
m1.setResolution(50) |
33 |
|
34 |
# Create a Camera. |
35 |
c2 = Camera(scene = s, viewport = Viewport.SOUTH_WEST) |
36 |
c2.isometricView() |
37 |
c2.elevation(-30) |
38 |
|
39 |
# Render the object. |
40 |
s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME)) |