Beispiel #1
0
 /** Export allthe param infos to the plugin manager */
 public void exportToPlugin() {
   ParamDefaultsTable table = getCurrentTable();
   List list = table.getParamInfoList();
   if (list.size() == 0) {
     LogUtil.userMessage("No rows selected");
     return;
   }
   getIdv().getPluginManager().addObject(list);
 }
Beispiel #2
0
  /**
   * Call to help make this kind of Display Control; also calls code to made the Displayable (empty
   * of data thus far). This method is called from inside DisplayControlImpl.init(several args).
   *
   * @param dataChoice the DataChoice of the moment.
   * @return true if successful
   * @throws RemoteException Java RMI error
   * @throws VisADException VisAD Error
   */
  public boolean init(DataChoice dataChoice) throws VisADException, RemoteException {

    if (!isDisplay3D()) {
      LogUtil.userMessage(log_, "Can't render volume in 2D display");
      return false;
    }
    myDisplay = new VolumeDisplayable("volrend_" + dataChoice);
    myDisplay.setUseRGBTypeForSelect(true);
    myDisplay.addConstantMap(
        new ConstantMap(
            useTexture3D ? GraphicsModeControl.TEXTURE3D : GraphicsModeControl.STACK2D,
            Display.Texture3DMode));

    myDisplay.setPointSize(getPointSize());
    addDisplayable(myDisplay, getAttributeFlags());

    // Now, set the data. Return false if it fails.
    if (!setData(dataChoice)) {
      return false;
    }

    // Now set up the flags and add the displayable
    return true;
  }
Beispiel #3
0
 /**
  * Popup a unit selection gui. This will also save off persistently any new unit names typed in.
  *
  * @param unit The current unit
  * @param defaultUnit The default unit to return if the user chooses "Default"
  * @return The new unit or null on a cancel or an error
  */
 public Unit selectUnit(Unit unit, Unit defaultUnit) {
   JComboBox ufld = makeUnitBox(unit, defaultUnit);
   Component panel = GuiUtils.label(" New unit:  ", ufld);
   if (!GuiUtils.showOkCancelDialog(
       null, "Change unit", GuiUtils.inset(panel, 5), null, Misc.newList(ufld))) {
     return null;
   }
   Object selected = ufld.getSelectedItem();
   String unitName = TwoFacedObject.getIdString(selected);
   if (unitName == null) {
     return defaultUnit;
   }
   try {
     Unit newUnit = Util.parseUnit(unitName);
     if (!(selected instanceof TwoFacedObject)) {
       selected = new TwoFacedObject(selected.toString(), newUnit);
     }
     addToUnitList(selected);
     return newUnit;
   } catch (Exception exc) {
     LogUtil.userMessage("Error parsing unit:" + unitName + "\n" + exc);
   }
   return null;
 }