Exemplo n.º 1
0
 void displayPosition(int projectionMode, double[] point) {
   if (showCoordinates < 0) {
     return;
   }
   if (point == null) {
     panel.setMessage(null, showCoordinates);
     return;
   }
   String text = ""; // $NON-NLS-1$
   switch (projectionMode) {
     case org.opensourcephysics.display3d.core.Camera.MODE_PLANAR_XY:
       if (formatX != null) {
         text = theFormatX.format(point[0]);
       }
       if (formatY != null) {
         text += ", " + theFormatY.format(point[1]); // $NON-NLS-1$
       }
       break;
     case org.opensourcephysics.display3d.core.Camera.MODE_PLANAR_XZ:
       if (formatX != null) {
         text = theFormatX.format(point[0]);
       }
       if (formatZ != null) {
         text += ", " + theFormatZ.format(point[2]); // $NON-NLS-1$
       }
       break;
     case org.opensourcephysics.display3d.core.Camera.MODE_PLANAR_YZ:
       if (formatY != null) {
         text = theFormatY.format(point[1]);
       }
       if (formatZ != null) {
         text += ", " + theFormatZ.format(point[2]); // $NON-NLS-1$
       }
       break;
     default:
       if (formatX != null) {
         text = theFormatX.format(point[0]);
       }
       if (formatY != null) {
         text += ", " + theFormatY.format(point[1]); // $NON-NLS-1$
       }
       if (formatZ != null) {
         text += ", " + theFormatZ.format(point[2]); // $NON-NLS-1$
       }
       break;
   }
   if (text.startsWith(", ")) { // $NON-NLS-1$
     text = text.substring(2);
   }
   panel.setMessage(text, showCoordinates);
 }