Ejemplo n.º 1
0
 /**
  * _more_
  *
  * @param value _more_
  */
 public void setPointSize(float value) {
   super.setPointSize(value);
   if (myDisplay != null) {
     try {
       myDisplay.setPointSize(getPointSize());
     } catch (Exception e) {
       logException("Setting point size", e);
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Set the useTexture3D property
  *
  * @param use the useTexture3D property
  */
 public void setUseTexture3D(boolean use) {
   useTexture3D = use;
   if (myDisplay != null) {
     try {
       myDisplay.addConstantMap(
           new ConstantMap(
               useTexture3D ? GraphicsModeControl.TEXTURE3D : GraphicsModeControl.STACK2D,
               Display.Texture3DMode));
     } catch (Exception e) {
       logException("setUseTexture3D", e);
     }
   }
 }
Ejemplo n.º 3
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;
  }
Ejemplo n.º 4
0
  /**
   * Load the volume data to the display
   *
   * @throws RemoteException problem loading remote data
   * @throws VisADException problem loading the data
   */
  private void loadVolumeData() throws VisADException, RemoteException {
    Trace.call1("VRC.loadVolumeData");
    FieldImpl grid = getGridDataInstance().getGrid();
    FieldImpl newGrid = grid;

    if (getSkipValue() > 0) {
      grid = GridUtil.subset(grid, getSkipValue() + 1);
      newGrid = grid;
    }

    if (!usePoints) {
      // make sure the projection is correct before we start
      // transforming the data
      setProjectionInView(true, true);

      CoordinateSystem cs = getNavigatedDisplay().getDisplayCoordinateSystem();
      if ((cs != null) && (getNavigatedDisplay() instanceof MapProjectionDisplay)) {
        try {
          if (GridUtil.isConstantSpatialDomain(grid)) {
            newGrid = makeLinearGrid(grid, cs);
          } else {
            Set timeSet = GridUtil.getTimeSet(grid);
            for (int i = 0; i < timeSet.getLength(); i++) {
              FieldImpl timeField = makeLinearGrid((FieldImpl) grid.getSample(i, false), cs);
              if (i == 0) {
                FunctionType ft =
                    new FunctionType(
                        ((SetType) timeSet.getType()).getDomain(), timeField.getType());
                newGrid = new FieldImpl(ft, timeSet);
              }
              newGrid.setSample(i, timeField, false);
            }
          }
        } catch (VisADException ve) {
          ve.printStackTrace();
          userErrorMessage(
              "Can't render volume for "
                  + paramName
                  + " in this projection. Try using the data projection");
          newGrid = grid;
        }
      }
    }
    Trace.call1("VRC.loadVolumeData.loadData");
    myDisplay.loadData(newGrid);
    Trace.call2("VRC.loadVolumeData.loadData");
    Trace.call2("loadVolumeData");
  }