/[escript]/trunk/doc/examples/pyvisi/map.py
ViewVC logotype

Contents of /trunk/doc/examples/pyvisi/map.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1203 - (show annotations)
Thu Jun 21 23:17:16 2007 UTC (11 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1817 byte(s)
Made some minor changes to the exampels.
1 """
2 Author: John Ngui, john.ngui@uq.edu.au
3 """
4
5 # Import the necessary modules.
6 from esys.pyvisi import Scene, DataCollector, Map, Camera
7 from esys.pyvisi.constant import *
8 import os
9
10 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
11 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
12 X_SIZE = 800
13 Y_SIZE = 800
14
15 SCALAR_FIELD_POINT_DATA = "temperature"
16 SCALAR_FIELD_CELL_DATA = "temperature_cell"
17 FILE_3D = "interior_3D.xml"
18 IMAGE_NAME = "map.jpg"
19 JPG_RENDERER = Renderer.ONLINE_JPG
20
21 # Create a Scene with four viewports.
22 s = Scene(renderer = JPG_RENDERER, num_viewport = 4, x_size = X_SIZE,
23 y_size = Y_SIZE)
24
25 # Create a DataCollector reading from a XML file.
26 dc1 = DataCollector(source = Source.XML)
27 dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
28 dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
29
30 # Create a Map for the first viewport.
31 m1 = Map(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST,
32 lut = Lut.COLOR, cell_to_point = False, outline = True)
33 m1.setRepresentationToWireframe()
34
35 # Create a Camera for the first viewport
36 c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
37 c1.isometricView()
38
39 # Create a second DataCollector reading from the same XML file but specifying
40 # a different scalar field.
41 dc2 = DataCollector(source = Source.XML)
42 dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
43 dc2.setActiveScalar(scalar = SCALAR_FIELD_CELL_DATA)
44
45 # Create a Map for the third viewport.
46 m2 = Map(scene = s, data_collector = dc2, viewport = Viewport.NORTH_EAST,
47 lut = Lut.COLOR, cell_to_point = True, outline = True)
48
49 # Create a Camera for the third viewport
50 c2 = Camera(scene = s, viewport = Viewport.NORTH_EAST)
51
52 # Render the object.
53 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))

  ViewVC Help
Powered by ViewVC 1.1.26