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

Annotation of /temp_trunk_copy/doc/examples/pyvisi/map.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1203 - (hide annotations)
Thu Jun 21 23:17:16 2007 UTC (11 years, 11 months ago) by jongui
Original Path: trunk/doc/examples/pyvisi/map.py
File MIME type: text/x-python
File size: 1817 byte(s)
Made some minor changes to the exampels.
1 jongui 1203 """
2     Author: John Ngui, john.ngui@uq.edu.au
3     """
4    
5 ksteube 1147 # Import the necessary modules.
6     from esys.pyvisi import Scene, DataCollector, Map, Camera
7     from esys.pyvisi.constant import *
8 jongui 1148 import os
9 ksteube 1147
10 jongui 1148 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
11     PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
12 ksteube 1147 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 jongui 1148 dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
28 ksteube 1147 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 jongui 1148 c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
37 ksteube 1147 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 jongui 1148 dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
43 ksteube 1147 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 jongui 1194 c2 = Camera(scene = s, viewport = Viewport.NORTH_EAST)
51 ksteube 1147
52     # Render the object.
53 jongui 1148 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))

  ViewVC Help
Powered by ViewVC 1.1.26