Exemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmd.equals("del")) {
     try {
       UnionSet set = (UnionSet) ref.getData();
       SampledSet[] sets = set.getSets();
       SampledSet[] new_sets = new SampledSet[sets.length - 1];
       System.arraycopy(sets, 0, new_sets, 0, sets.length - 1);
       ref.setData(new UnionSet(set.getType(), new_sets));
     } catch (VisADException ex) {
     } catch (RemoteException ex) {
     }
   } else if (cmd.equals("fill")) {
     UnionSet set = null;
     try {
       set = (UnionSet) ref.getData();
       System.out.println("area = " + DelaunayCustom.computeArea(set));
     } catch (VisADException ex) {
       System.out.println(ex.getMessage());
     }
     try {
       // Irregular2DSet new_set = DelaunayCustom.fill(set);
       Irregular2DSet new_set = DelaunayCustom.fillCheck(set, false);
       if (new_ref == null) {
         new_ref = new DataReferenceImpl("fill");
         ConstantMap[] cmaps =
             new ConstantMap[] {
               new ConstantMap(1.0, Display.Blue),
               new ConstantMap(1.0, Display.Red),
               new ConstantMap(0.0, Display.Green)
             };
         DataRenderer renderer =
             (display instanceof DisplayImplJ3D)
                 ? (DataRenderer) new DefaultRendererJ3D()
                 : (DataRenderer) new DefaultRendererJ2D();
         renderer.suppressExceptions(true);
         display.addReferences(renderer, new_ref, cmaps);
       }
       new_ref.setData(new_set);
     } catch (VisADException ex) {
       System.out.println(ex.getMessage());
     } catch (RemoteException ex) {
       System.out.println(ex.getMessage());
     }
   } else if (cmd.equals("lines")) {
     try {
       lines = !lines;
       GraphicsModeControl mode = display.getGraphicsModeControl();
       if (lines) {
         mode.setPolygonMode(DisplayImplJ3D.POLYGON_LINE);
       } else {
         mode.setPolygonMode(DisplayImplJ3D.POLYGON_FILL);
       }
     } catch (VisADException ex) {
       System.out.println(ex.getMessage());
     } catch (RemoteException ex) {
       System.out.println(ex.getMessage());
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Override the base class method to catch any events.
  *
  * @param e The action event.
  */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   try {
     if (cmd.equals(CMD_BARBSIZE)) {
       setFlowScale(GuiUtils.getBoxValue((JComboBox) e.getSource()));
     } else if (cmd.equals(CMD_INTERVAL)) {
       setVerticalInterval(GuiUtils.getBoxValue((JComboBox) e.getSource()));
     } else {
       super.actionPerformed(e);
     }
   } catch (NumberFormatException nfe) {
     userErrorMessage("Incorrect number format");
   }
 }
Exemplo n.º 3
0
 /**
  * Handle the CLOSEANCEL, OK, HELP, events.
  *
  * @param event The event
  */
 public void actionPerformed(ActionEvent event) {
   String cmd = event.getActionCommand();
   if (cmd.equals(GuiUtils.CMD_CLOSE)) {
     doClose();
   } else if (cmd.equals(GuiUtils.CMD_NEW)) {
     if (myTables.size() > 0) {
       ((ParamDefaultsTable) myTables.get(0)).addNewRow();
     }
   } else if (cmd.equals(GuiUtils.CMD_OK)) {
     saveData();
     doClose();
   } else if (cmd.equals(GuiUtils.CMD_HELP)) {
     showHelp();
   } else if (cmd.equals(GuiUtils.CMD_SAVEAS)) {
     doSaveAs(getCurrentTable().getParamInfoList());
   } else if (cmd.equals(GuiUtils.CMD_OPEN)) {
     doOpen();
   } else if (cmd.equals(GuiUtils.CMD_IMPORT)) {
     doImport();
   }
 }
Exemplo n.º 4
0
 /**
  * Public by implementing ActionListener.
  *
  * @param e ActionEvent to check
  */
 public void actionPerformed(ActionEvent e) {
   actionPerformed(e.getActionCommand());
 }