/**
   * Update the center point location
   *
   * @throws RemoteException Java RMI error
   * @throws VisADException VisAD error
   */
  protected void updateCenterPoint() throws VisADException, RemoteException {

    GriddedSet domainSet = (GriddedSet) GridUtil.getSpatialDomain(getGridDataInstance().getGrid());

    // Get location for label of control window
    Radar3DCoordinateSystem transform = (Radar3DCoordinateSystem) domainSet.getCoordinateSystem();
    //   get station location from the data coordinate transform
    float stationLat = (transform.getCenterPoint())[0];
    float stationLon = (transform.getCenterPoint())[1];
    float stationEl = (transform.getCenterPoint())[2];

    List choices = getDataChoices();
    String staname = ((DataChoice) choices.get(0)).getName();

    // If this isn't satisfactory, then please implement a Misc or
    // DisplayConventions method that will take an EarthLocation and
    // return a nicely formatted string.
    initLinePosition(stationLat, stationLon);
    setCSLineLength(defaultLen);
  }
  /** _more_ */
  public void initDone() {
    try {
      setRequestProperties();

      setVerticalAxisRange(new Range(0, 20000));

      loadDataFromLine();
      FieldImpl fieldImpl = (FieldImpl) (getGridDataInstance().getGrid()).getSample(0);
      GriddedSet domainSet = (GriddedSet) GridUtil.getSpatialDomain(fieldImpl);
      Unit xUnit = domainSet.getSetUnits()[0];
      String unitlabel = xUnit.toString();
      if (unitlabel.equalsIgnoreCase("1000.0 m")) {
        unitlabel = "km";
      }
      // xScale.setTitle("Distance along ground (" + unitlabel + ")");
      // Do we need this here or is it already done in setData?
      updateCenterPoint();
    } catch (Exception e) {
      logException("Initializing the csSelector", e);
    }
    csSelector.addPropertyChangeListener(this);
    updatePositionWidget();
  }
Exemplo n.º 3
0
  /**
   * Make a grid with a Linear3DSet for the volume rendering
   *
   * @param grid grid to transform
   * @param cs coordinate system to transform to XYZ
   * @return transformed grid
   * @throws RemoteException Java RMI Exception
   * @throws VisADException problem creating grid
   */
  private FieldImpl makeLinearGrid(FieldImpl grid, CoordinateSystem cs)
      throws VisADException, RemoteException {

    Trace.call1("VRC.makeLinearGrid");
    GriddedSet domainSet = (GriddedSet) GridUtil.getSpatialDomain(grid);
    SampledSet ss = null;
    boolean latLonOrder = GridUtil.isLatLonOrder(domainSet);
    // System.out.println("grid is latLonOrder " + latLonOrder);
    Trace.call1("VRC.convertDomain");
    if (latLonOrder) {
      ss = Util.convertDomain(domainSet, RealTupleType.LatitudeLongitudeAltitude, null);
    } else {
      ss = Util.convertDomain(domainSet, RealTupleType.SpatialEarth3DTuple, null);
    }
    Trace.call2("VRC.convertDomain");
    float[][] refVals = ss.getSamples(true);
    MapProjectionDisplay mpd = (MapProjectionDisplay) getNavigatedDisplay();
    MapProjection mp = mpd.getMapProjection();
    boolean mapLatLonOrder = mp.isLatLonOrder();
    // System.out.println("map is latLonOrder " + mapLatLonOrder);
    float[][] newVals =
        (latLonOrder) ? refVals : new float[][] {refVals[1], refVals[0], refVals[2]};
    Trace.call1("VRC.toRef");
    newVals = cs.toReference(newVals);
    Trace.call2("VRC.toRef");
    Trace.call1("VRC.scaleVerticalValues");
    newVals[2] = mpd.scaleVerticalValues(newVals[2]);
    Trace.call2("VRC.scaleVerticalValues");
    int[] lengths = domainSet.getLengths();
    // Misc.printArray("lengths",lengths);
    GriddedSet xyzSet =
        GriddedSet.create(
            RealTupleType.SpatialCartesian3DTuple,
            newVals,
            domainSet.getLengths(),
            (CoordinateSystem) null,
            (Unit[]) null,
            (ErrorEstimate[]) null,
            false,
            true);
    Trace.call1("VRC.setSpatialDomain");
    FieldImpl newGrid = GridUtil.setSpatialDomain(grid, xyzSet); // , true);
    Trace.call2("VRC.setSpatialDomain");
    float[] lows = xyzSet.getLow();
    float[] highs = xyzSet.getHi();
    // Misc.printArray("lows",lows);
    // Misc.printArray("highs",highs);
    Linear3DSet volumeXYZ =
        new Linear3DSet(
            RealTupleType.SpatialCartesian3DTuple,
            lows[0],
            highs[0],
            lengths[0],
            lows[1],
            highs[1],
            lengths[1],
            lows[2],
            highs[2],
            lengths[2]);
    // System.out.println(volumeXYZ);
    Trace.call1("VRC.resampleGrid");
    newGrid = GridUtil.resampleGrid(newGrid, volumeXYZ);
    Trace.call2("VRC.resampleGrid");
    Trace.call2("VRC.makeLinearGrid");
    return newGrid;
  }