]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/threedee/Java3DWindow.java
Version 6, October 2008
[GpsPrune.git] / tim / prune / threedee / Java3DWindow.java
1 package tim.prune.threedee;
2
3 import java.awt.FlowLayout;
4 import java.awt.BorderLayout;
5 import java.awt.Font;
6 import java.awt.GraphicsConfiguration;
7 import java.awt.GraphicsEnvironment;
8 import java.awt.event.ActionEvent;
9 import java.awt.event.ActionListener;
10 import java.awt.event.WindowAdapter;
11 import java.awt.event.WindowEvent;
12 import java.awt.geom.GeneralPath;
13
14 import javax.media.j3d.AmbientLight;
15 import javax.media.j3d.Appearance;
16 import javax.media.j3d.BoundingSphere;
17 import javax.media.j3d.BranchGroup;
18 import javax.media.j3d.Canvas3D;
19 import javax.media.j3d.Font3D;
20 import javax.media.j3d.FontExtrusion;
21 import javax.media.j3d.GraphicsConfigTemplate3D;
22 import javax.media.j3d.Group;
23 import javax.media.j3d.Material;
24 import javax.media.j3d.PointLight;
25 import javax.media.j3d.Shape3D;
26 import javax.media.j3d.Text3D;
27 import javax.media.j3d.Transform3D;
28 import javax.media.j3d.TransformGroup;
29 import javax.swing.JButton;
30 import javax.swing.JFrame;
31 import javax.swing.JOptionPane;
32 import javax.swing.JPanel;
33 import javax.vecmath.Color3f;
34 import javax.vecmath.Matrix3d;
35 import javax.vecmath.Point3d;
36 import javax.vecmath.Point3f;
37 import javax.vecmath.Vector3d;
38
39 import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
40 import com.sun.j3d.utils.geometry.Box;
41 import com.sun.j3d.utils.geometry.Cylinder;
42 import com.sun.j3d.utils.geometry.Sphere;
43 import com.sun.j3d.utils.universe.SimpleUniverse;
44
45 import tim.prune.App;
46 import tim.prune.I18nManager;
47 import tim.prune.data.Altitude;
48 import tim.prune.data.Track;
49
50
51 /**
52  * Class to hold main window for java3d view of data
53  */
54 public class Java3DWindow implements ThreeDWindow
55 {
56         private App _app = null;
57         private Track _track = null;
58         private JFrame _parentFrame = null;
59         private JFrame _frame = null;
60         private ThreeDModel _model = null;
61         private OrbitBehavior _orbit = null;
62         private int _altitudeCap = ThreeDModel.MINIMUM_ALTITUDE_CAP;
63
64         /** only prompt about big track size once */
65         private static boolean TRACK_SIZE_WARNING_GIVEN = false;
66
67         // Constants
68         private static final double INITIAL_Y_ROTATION = -25.0;
69         private static final double INITIAL_X_ROTATION = 15.0;
70         private static final String CARDINALS_FONT = "Arial";
71         private static final int MAX_TRACK_SIZE = 2500; // threshold for warning
72
73
74         /**
75          * Constructor
76          * @param inApp App object to use for callbacks
77          * @param inFrame parent frame
78          */
79         public Java3DWindow(App inApp, JFrame inFrame)
80         {
81                 _app = inApp;
82                 _parentFrame = inFrame;
83         }
84
85
86         /**
87          * Set the track object
88          * @param inTrack Track object
89          */
90         public void setTrack(Track inTrack)
91         {
92                 _track = inTrack;
93         }
94
95
96         /**
97          * Show the window
98          */
99         public void show() throws ThreeDException
100         {
101                 // Get the altitude cap to use
102                 String altitudeUnits = getAltitudeUnitsLabel(_track);
103                 Object altCapString = JOptionPane.showInputDialog(_parentFrame,
104                         I18nManager.getText("dialog.3d.altitudecap") + " (" + altitudeUnits + ")",
105                         I18nManager.getText("dialog.3d.title"),
106                         JOptionPane.QUESTION_MESSAGE, null, null, "" + _altitudeCap);
107                 if (altCapString == null) return;
108                 try
109                 {
110                         _altitudeCap = Integer.parseInt(altCapString.toString());
111                 }
112                 catch (Exception e) {} // Ignore parse errors
113
114                 // Set up the graphics config
115                 GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
116                 if (config == null)
117                 {
118                         // Config shouldn't be null, but we can try to create a new one as a workaround
119                         GraphicsConfigTemplate3D gc = new GraphicsConfigTemplate3D();
120                         gc.setDepthSize(0);
121                         config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gc);
122                 }
123
124                 if (config == null)
125                 {
126                         // Second attempt also failed, going to have to give up here.
127                         throw new ThreeDException("Couldn't create graphics config");
128                 }
129
130                 // Check number of points in model isn't too big, and suggest compression
131                 Object[] buttonTexts = {I18nManager.getText("button.continue"), I18nManager.getText("button.cancel")};
132                 if (_track.getNumPoints() > MAX_TRACK_SIZE && !TRACK_SIZE_WARNING_GIVEN)
133                 {
134                         if (JOptionPane.showOptionDialog(_frame,
135                                         I18nManager.getText("dialog.exportpov.warningtracksize"),
136                                         I18nManager.getText("dialog.exportpov.title"), JOptionPane.OK_CANCEL_OPTION,
137                                         JOptionPane.WARNING_MESSAGE, null, buttonTexts, buttonTexts[1])
138                                 == JOptionPane.OK_OPTION)
139                         {
140                                 // opted to continue, don't show warning again
141                                 TRACK_SIZE_WARNING_GIVEN = true;
142                         }
143                         else
144                         {
145                                 // opted to cancel - show warning again next time
146                                 return;
147                         }
148                 }
149
150                 Canvas3D canvas = new Canvas3D(config);
151                 canvas.setSize(400, 300);
152
153                 // Create the scene and attach it to the virtual universe
154                 BranchGroup scene = createSceneGraph();
155                 SimpleUniverse u = new SimpleUniverse(canvas);
156
157                 // This will move the ViewPlatform back a bit so the
158                 // objects in the scene can be viewed.
159                 u.getViewingPlatform().setNominalViewingTransform();
160
161                 // Add behaviour to rotate using mouse
162                 _orbit = new OrbitBehavior(canvas, OrbitBehavior.REVERSE_ALL |
163                                                                   OrbitBehavior.STOP_ZOOM);
164                 BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
165                 _orbit.setSchedulingBounds(bounds);
166                 u.getViewingPlatform().setViewPlatformBehavior(_orbit);
167                 u.addBranchGraph(scene);
168
169                 // Don't reuse _frame object from last time, because data and/or scale might be different
170                 // Need to regenerate everything
171                 _frame = new JFrame(I18nManager.getText("dialog.3d.title"));
172                 _frame.getContentPane().setLayout(new BorderLayout());
173                 _frame.getContentPane().add(canvas, BorderLayout.CENTER);
174                 // Make panel for render, close buttons
175                 JPanel panel = new JPanel();
176                 panel.setLayout(new FlowLayout(FlowLayout.RIGHT));
177                 // Add callback button for render
178                 JButton renderButton = new JButton(I18nManager.getText("menu.file.exportpov"));
179                 renderButton.addActionListener(new ActionListener()
180                 {
181                         /** Render button pressed */
182                         public void actionPerformed(ActionEvent e)
183                         {
184                                 if (_orbit != null)
185                                 {
186                                         callbackRender();
187                                 }
188                         }});
189                 panel.add(renderButton);
190                 // Display coordinates of lat/long lines of 3d graph in separate dialog
191                 JButton showLinesButton = new JButton(I18nManager.getText("button.showlines"));
192                 showLinesButton.addActionListener(new ActionListener() {
193                         public void actionPerformed(ActionEvent e)
194                         {
195                                 double[] latLines = _model.getLatitudeLines();
196                                 double[] lonLines = _model.getLongitudeLines();
197                                 LineDialog dialog = new LineDialog(_frame, latLines, lonLines);
198                                 dialog.showDialog();
199                         }
200                 });
201                 panel.add(showLinesButton);
202                 // Close button
203                 JButton closeButton = new JButton(I18nManager.getText("button.close"));
204                 closeButton.addActionListener(new ActionListener()
205                 {
206                         /** Close button pressed - clean up */
207                         public void actionPerformed(ActionEvent e)
208                         {
209                                 _frame.dispose();
210                                 _frame = null;
211                                 _orbit = null;
212                         }
213                 });
214                 panel.add(closeButton);
215                 _frame.getContentPane().add(panel, BorderLayout.SOUTH);
216                 _frame.setSize(500, 350);
217                 _frame.pack();
218                 // Add a listener to clean up when window closed
219                 _frame.addWindowListener(new WindowAdapter() {
220                         public void windowClosing(WindowEvent e)
221                         {
222                                 dispose();
223                         }
224                 });
225
226                 // show frame
227                 _frame.show();
228                 if (_frame.getState() == JFrame.ICONIFIED)
229                 {
230                         _frame.setState(JFrame.NORMAL);
231                 }
232         }
233
234         /**
235          * Dispose of the frame and its resources
236          */
237         public void dispose()
238         {
239                 if (_frame != null) {
240                         _frame.dispose();
241                         _frame = null;
242                 }
243         }
244
245         /**
246          * Create the whole scenery from the given track
247          * @return all objects in the scene
248          */
249         private BranchGroup createSceneGraph()
250         {
251                 // Create the root of the branch graph
252                 BranchGroup objRoot = new BranchGroup();
253
254                 // Create the transform group node and initialize it.
255                 // Enable the TRANSFORM_WRITE capability so it can be spun by the mouse
256                 TransformGroup objTrans = new TransformGroup();
257                 objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
258
259                 // Create a translation
260                 Transform3D shiftz = new Transform3D();
261                 shiftz.setScale(0.055);
262                 TransformGroup shiftTrans = new TransformGroup(shiftz);
263
264                 objRoot.addChild(shiftTrans);
265                 Transform3D rotTrans = new Transform3D();
266                 rotTrans.rotY(Math.toRadians(INITIAL_Y_ROTATION));
267                 Transform3D rot2 = new Transform3D();
268                 rot2.rotX(Math.toRadians(INITIAL_X_ROTATION));
269                 TransformGroup tg2 = new TransformGroup(rot2);
270                 objTrans.setTransform(rotTrans);
271                 shiftTrans.addChild(tg2);
272                 tg2.addChild(objTrans);
273
274                 // Base plane
275                 Appearance planeAppearance = null;
276                 Box plane = null;
277                 planeAppearance = new Appearance();
278                 planeAppearance.setMaterial(new Material(new Color3f(0.1f, 0.2f, 0.2f),
279                  new Color3f(0.0f, 0.0f, 0.0f), new Color3f(0.3f, 0.4f, 0.4f),
280                  new Color3f(0.3f, 0.3f, 0.3f), 0.0f));
281                 plane = new Box(10f, 0.04f, 10f, planeAppearance);
282                 objTrans.addChild(plane);
283
284                 // N, S, E, W
285                 GeneralPath bevelPath = new GeneralPath();
286                 bevelPath.moveTo(0.0f, 0.0f);
287                 for (int i=0; i<91; i+= 5)
288                         bevelPath.lineTo((float) (0.1 - 0.1 * Math.cos(Math.toRadians(i))),
289                           (float) (0.1 * Math.sin(Math.toRadians(i))));
290                 for (int i=90; i>0; i-=5)
291                         bevelPath.lineTo((float) (0.3 + 0.1 * Math.cos(Math.toRadians(i))),
292                           (float) (0.1 * Math.sin(Math.toRadians(i))));
293                 Font3D compassFont = new Font3D(
294                         new Font(CARDINALS_FONT, Font.PLAIN, 1),
295                         new FontExtrusion(bevelPath));
296                 objTrans.addChild(createCompassPoint(I18nManager.getText("cardinal.n"), new Point3f(0f, 0f, -10f), compassFont));
297                 objTrans.addChild(createCompassPoint(I18nManager.getText("cardinal.s"), new Point3f(0f, 0f, 10f), compassFont));
298                 objTrans.addChild(createCompassPoint(I18nManager.getText("cardinal.w"), new Point3f(-11f, 0f, 0f), compassFont));
299                 objTrans.addChild(createCompassPoint(I18nManager.getText("cardinal.e"), new Point3f(10f, 0f, 0f), compassFont));
300
301                 // create and scale model
302                 _model = new ThreeDModel(_track);
303                 _model.setAltitudeCap(_altitudeCap);
304                 _model.scale();
305
306                 // Lat/Long lines
307                 objTrans.addChild(createLatLongs(_model));
308
309                 // Add points to model
310                 objTrans.addChild(createDataPoints(_model));
311
312                 // Create lights
313                 BoundingSphere bounds =
314                   new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
315                 AmbientLight aLgt = new AmbientLight(new Color3f(1.0f, 1.0f, 1.0f));
316                 aLgt.setInfluencingBounds(bounds);
317                 objTrans.addChild(aLgt);
318
319                 PointLight pLgt = new PointLight(new Color3f(1.0f, 1.0f, 1.0f),
320                  new Point3f(0f, 0f, 2f),
321                  new Point3f(0.25f, 0.05f, 0.0f) );
322                 pLgt.setInfluencingBounds(bounds);
323                 objTrans.addChild(pLgt);
324
325                 PointLight pl2 = new PointLight(new Color3f(0.8f, 0.9f, 0.4f),
326                  new Point3f(6f, 1f, 6f),
327                  new Point3f(0.2f, 0.1f, 0.05f) );
328                 pl2.setInfluencingBounds(bounds);
329                 objTrans.addChild(pl2);
330
331                 PointLight pl3 = new PointLight(new Color3f(0.7f, 0.7f, 0.7f),
332                  new Point3f(0.0f, 12f, -2f),
333                  new Point3f(0.1f, 0.1f, 0.0f) );
334                 pl3.setInfluencingBounds(bounds);
335                 objTrans.addChild(pl3);
336
337                 // Have Java 3D perform optimizations on this scene graph.
338                 objRoot.compile();
339
340                 return objRoot;
341         }
342
343
344         /**
345          * Create a text object for compass point, N S E or W
346          * @param text text to display
347          * @param locn position at which to display
348          * @param font 3d font to use
349          * @return Shape3D object
350          */
351         private Shape3D createCompassPoint(String inText, Point3f inLocn, Font3D inFont)
352         {
353                 Text3D txt = new Text3D(inFont, inText, inLocn, Text3D.ALIGN_FIRST, Text3D.PATH_RIGHT);
354                 Material mat = new Material(new Color3f(0.5f, 0.5f, 0.55f),
355                  new Color3f(0.05f, 0.05f, 0.1f), new Color3f(0.3f, 0.4f, 0.5f),
356                  new Color3f(0.4f, 0.5f, 0.7f), 70.0f);
357                 mat.setLightingEnable(true);
358                 Appearance app = new Appearance();
359                 app.setMaterial(mat);
360                 Shape3D shape = new Shape3D(txt, app);
361                 return shape;
362         }
363
364
365         /**
366          * Create all the latitude and longitude lines on the base plane
367          * @param inModel model containing data
368          * @return Group object containing cylinders for lat and long lines
369          */
370         private static Group createLatLongs(ThreeDModel inModel)
371         {
372                 Group group = new Group();
373                 int numlines = inModel.getLatitudeLines().length;
374                 for (int i=0; i<numlines; i++)
375                 {
376                         group.addChild(createLatLine(inModel.getScaledLatitudeLine(i), inModel.getModelSize()));
377                 }
378                 numlines = inModel.getLongitudeLines().length;
379                 for (int i=0; i<numlines; i++)
380                 {
381                         group.addChild(createLonLine(inModel.getScaledLongitudeLine(i), inModel.getModelSize()));
382                 }
383                 return group;
384         }
385
386
387         /**
388          * Make a single latitude line for the specified latitude
389          * @param inLatitude latitude in scaled units
390          * @param inSize size of model, for length of line
391          * @return Group object containing cylinder for latitude line
392          */
393         private static Group createLatLine(double inLatitude, double inSize)
394         {
395                 Cylinder latline = new Cylinder(0.1f, (float) (inSize*2));
396                 Transform3D horizShift = new Transform3D();
397                 horizShift.setTranslation(new Vector3d(0.0, 0.0, inLatitude));
398                 TransformGroup horizTrans = new TransformGroup(horizShift);
399                 Transform3D zRot = new Transform3D();
400                 zRot.rotZ(Math.toRadians(90.0));
401                 TransformGroup zTrans = new TransformGroup(zRot);
402                 horizTrans.addChild(zTrans);
403                 zTrans.addChild(latline);
404                 return horizTrans;
405         }
406
407
408         /**
409          * Make a single longitude line for the specified longitude
410          * @param inLongitude longitude in scaled units
411          * @param inSize size of model, for length of line
412          * @return Group object containing cylinder for longitude line
413          */
414         private static Group createLonLine(double inLongitude, double inSize)
415         {
416                 Cylinder lonline = new Cylinder(0.1f, (float) (inSize*2));
417                 Transform3D horizShift = new Transform3D();
418                 horizShift.setTranslation(new Vector3d(inLongitude, 0.0, 0.0));
419                 TransformGroup horizTrans = new TransformGroup(horizShift);
420                 Transform3D xRot = new Transform3D();
421                 xRot.rotX(Math.toRadians(90.0));
422                 TransformGroup xTrans = new TransformGroup(xRot);
423                 horizTrans.addChild(xTrans);
424                 xTrans.addChild(lonline);
425                 return horizTrans;
426         }
427
428
429         /**
430          * Make a Group of the data points to be added
431          * @param inModel model containing data
432          * @return Group object containing spheres, rods etc
433          */
434         private static Group createDataPoints(ThreeDModel inModel)
435         {
436                 // Add points to model
437                 Group group = new Group();
438                 int numPoints = inModel.getNumPoints();
439                 for (int i=0; i<numPoints; i++)
440                 {
441                         byte pointType = inModel.getPointType(i);
442                         if (pointType == ThreeDModel.POINT_TYPE_WAYPOINT)
443                         {
444                                 // Add waypoint
445                                 // Note that x, y and z are horiz, altitude, -vert
446                                 group.addChild(createWaypoint(new Point3d(
447                                         inModel.getScaledHorizValue(i), inModel.getScaledAltValue(i), -inModel.getScaledVertValue(i))));
448                         }
449                         else
450                         {
451                                 // Add colour-coded track point
452                                 // Note that x, y and z are horiz, altitude, -vert
453                                 group.addChild(createTrackpoint(new Point3d(
454                                         inModel.getScaledHorizValue(i), inModel.getScaledAltValue(i), -inModel.getScaledVertValue(i)),
455                                         inModel.getPointHeightCode(i)));
456                         }
457                 }
458                 return group;
459         }
460
461
462         /**
463          * Create a waypoint sphere
464          * @param inPointPos position of point
465          * @return Group object containing sphere
466          */
467         private static Group createWaypoint(Point3d inPointPos)
468         {
469                 Material mat = getWaypointMaterial();
470                 // TODO: sort symbol scaling
471                 Sphere dot = new Sphere(0.35f); // * symbolScaling / 100f);
472                 return createBall(inPointPos, dot, mat);
473         }
474
475
476         /**
477          * @return a new Material object to define waypoint colour / shine etc
478          */
479         private static Material getWaypointMaterial()
480         {
481                 return new Material(new Color3f(0.1f, 0.1f, 0.4f),
482                          new Color3f(0.0f, 0.0f, 0.0f), new Color3f(0.0f, 0.2f, 0.7f),
483                          new Color3f(1.0f, 0.6f, 0.6f), 40.0f);
484         }
485
486
487         private static Group createTrackpoint(Point3d inPointPos, byte inHeightCode)
488         {
489                 Material mat = getTrackpointMaterial(inHeightCode);
490                 // TODO: sort symbol scaling
491                 Sphere dot = new Sphere(0.2f); // * symbolScaling / 100f);
492                 return createBall(inPointPos, dot, mat);
493         }
494
495
496         private static Material getTrackpointMaterial(byte inHeightCode)
497         {
498                 // create default material
499                 Material mat = new Material(new Color3f(0.3f, 0.2f, 0.1f),
500                         new Color3f(0.0f, 0.0f, 0.0f), new Color3f(0.0f, 0.6f, 0.0f),
501                         new Color3f(1.0f, 0.6f, 0.6f), 70.0f);
502                 // change colour according to height code
503                 if (inHeightCode == 1) mat.setDiffuseColor(new Color3f(0.4f, 0.9f, 0.2f));
504                 if (inHeightCode == 2) mat.setDiffuseColor(new Color3f(0.7f, 0.8f, 0.2f));
505                 if (inHeightCode == 3) mat.setDiffuseColor(new Color3f(0.5f, 0.85f, 0.95f));
506                 if (inHeightCode == 4) mat.setDiffuseColor(new Color3f(0.1f, 0.9f, 0.9f));
507                 if (inHeightCode >= 5) mat.setDiffuseColor(new Color3f(1.0f, 1.0f, 1.0f));
508                 // return object
509                 return mat;
510         }
511
512
513         /**
514          * Create a ball at the given point
515          * @param inPosition scaled position of point
516          * @param inSphere sphere object
517          * @param inMaterial material object
518          * @return Group containing sphere
519          */
520         private static Group createBall(Point3d inPosition, Sphere inSphere, Material inMaterial)
521         {
522                 Group group = new Group();
523                 // Create ball and add to group
524                 Transform3D ballShift = new Transform3D();
525                 ballShift.setTranslation(new Vector3d(inPosition));
526                 TransformGroup ballShiftTrans = new TransformGroup(ballShift);
527                 inMaterial.setLightingEnable(true);
528                 Appearance ballApp = new Appearance();
529                 ballApp.setMaterial(inMaterial);
530                 inSphere.setAppearance(ballApp);
531                 ballShiftTrans.addChild(inSphere);
532                 group.addChild(ballShiftTrans);
533                 // Also create rod for ball to sit on
534                 Cylinder rod = new Cylinder(0.1f, (float) inPosition.y);
535                 Material rodMat = new Material(new Color3f(0.2f, 0.2f, 0.2f),
536                  new Color3f(0.0f, 0.0f, 0.0f), new Color3f(0.2f, 0.2f, 0.2f),
537                  new Color3f(0.05f, 0.05f, 0.05f), 0.4f);
538                 rodMat.setLightingEnable(true);
539                 Appearance rodApp = new Appearance();
540                 rodApp.setMaterial(rodMat);
541                 rod.setAppearance(rodApp);
542                 Transform3D rodShift = new Transform3D();
543                 rodShift.setTranslation(new Vector3d(inPosition.x,
544                  inPosition.y/2.0, inPosition.z));
545                 TransformGroup rodShiftTrans = new TransformGroup(rodShift);
546                 rodShiftTrans.addChild(rod);
547                 group.addChild(rodShiftTrans);
548                 // return the pair
549                 return group;
550         }
551
552
553         /**
554          * Calculate the angles and call them back to the app
555          */
556         private void callbackRender()
557         {
558                 Transform3D trans3d = new Transform3D();
559                 _orbit.getViewingPlatform().getViewPlatformTransform().getTransform(trans3d);
560                 Matrix3d matrix = new Matrix3d();
561                 trans3d.get(matrix);
562                 Point3d point = new Point3d(0.0, 0.0, 1.0);
563                 matrix.transform(point);
564                 // Set up initial rotations
565                 Transform3D firstTran = new Transform3D();
566                 firstTran.rotY(Math.toRadians(-INITIAL_Y_ROTATION));
567                 Transform3D secondTran = new Transform3D();
568                 secondTran.rotX(Math.toRadians(-INITIAL_X_ROTATION));
569                 // Apply inverse rotations in reverse order to test point
570                 Point3d result = new Point3d();
571                 secondTran.transform(point, result);
572                 firstTran.transform(result);
573                 // Callback settings to App
574                 _app.exportPov(result.x, result.y, result.z, _altitudeCap);
575         }
576
577
578         /**
579          * Get a units label for the altitudes in the given Track
580          * @param inTrack Track object
581          * @return units label for altitude used in Track
582          */
583         private static String getAltitudeUnitsLabel(Track inTrack)
584         {
585                 int altitudeFormat = inTrack.getAltitudeRange().getFormat();
586                 if (altitudeFormat == Altitude.FORMAT_METRES)
587                         return I18nManager.getText("units.metres.short");
588                 return I18nManager.getText("units.feet.short");
589         }
590
591 }