/[escript]/trunk/pyvisi/py_src/position.py
ViewVC logotype

Contents of /trunk/pyvisi/py_src/position.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1189 - (show annotations)
Thu Jun 7 05:31:25 2007 UTC (13 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1529 byte(s)
A Scalar Bar can now be displayed by creating an instance of a 'Legend'. The Scalar Bar can either show the scalar data range or vector data range. Corresponding examples and tests have also been added.
1 """
2 @author: John NGUI
3 """
4
5 class LocalPosition:
6 """
7 Class that defines the local positioning coordiante system (2D).
8 """
9
10 def __init__(self, x_coor, y_coor):
11 """
12 Initialise the local position.
13
14 @type x_coor: Number
15 @param x_coor: x coordinate
16 @type y_coor: Number
17 @param y_coor: y coordinate
18 """
19
20 self.__x_coor = x_coor
21 self.__y_coor = y_coor
22 self.__position = [x_coor, y_coor]
23
24 def _getXCoor(self):
25 """
26 Return the X coordinate.
27
28 @rtype: Number
29 @return: X coordinate
30 """
31
32 return self.__x_coor
33
34 def _getYCoor(self):
35 """
36 Return the Y coordinate.
37
38 @rtype: Number
39 @return: Y coordinate
40 """
41
42 return self.__y_coor
43
44 def _getLocalPosition(self):
45 """
46 Return the local position.
47
48 @rtype: Two column tuple containing numbers
49 @return: Tuple with the x and y coordinates
50 """
51
52 return self.__position
53
54
55 ###############################################################################
56
57
58 class GlobalPosition:
59 """
60 Class that defines the global positioning coordinate system (3D)
61 """
62
63 def __init__(self, x_coor, y_coor, z_coor):
64 """
65 Initialise the global position.
66
67 @type x_coor: Number
68 @param x_coor: x coordinate
69 @type y_coor: Number
70 @param y_coor: y coordinate
71 @type z_coor: Number
72 @param z_coor: z coordinate
73 """
74
75 self.__position = [x_coor, y_coor, z_coor]
76
77 def _getGlobalPosition(self):
78 """
79 Return the global position.
80
81 @rtype: Three column tuple containing numbers
82 @return: Tuple with the x, y and z coordinates
83 """
84
85 return self.__position

  ViewVC Help
Powered by ViewVC 1.1.26