Exemplo n.º 1
0
 /** Updates the contour data my directly copying values. */
 void updateDirect(GridData griddata) {
   if (griddata == null) {
     return;
   }
   if (autoscaleZ) {
     double[] minmax = griddata.getZRange(ampIndex);
     zmax = minmax[1];
     zmin = minmax[0];
     if (zMap != null) {
       zMap.setMinMax(zmin, zmax);
     }
     colorMap.setScale(zmin, zmax);
   }
   if (griddata instanceof ArrayData) {
     double[][] arrayData = griddata.getData()[ampIndex];
     for (int i = 0; i < nx; i++) { // copy the rows
       System.arraycopy(arrayData[i], 0, internalData[i], 0, ny);
       if (zMap != null) {
         for (int j = 0; j < ny; j++) {
           internalData[i][j] = zMap.evaluate(internalData[i][j]);
         }
       }
     }
   } else if (griddata instanceof GridPointData) {
     double[][][] ptdata = griddata.getData();
     for (int i = 0, nx = ptdata.length; i < nx; i++) {
       for (int j = 0, ny = ptdata[0].length; j < ny; j++) {
         internalData[i][j] = ptdata[i][j][2 + ampIndex];
         if (zMap != null) {
           internalData[i][j] = zMap.evaluate(internalData[i][j]);
         }
       }
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Expands the z scale so as to enhance values close to zero.
  *
  * @param expanded boolean
  * @param expansionFactor double
  */
 public void setExpandedZ(boolean expanded, double expansionFactor) {
   if (expanded && (expansionFactor > 0)) {
     zMap = new ZExpansion(expansionFactor);
     zMap.setMinMax(zmin, zmax);
   } else {
     zMap = null;
   }
 }
Exemplo n.º 3
0
 /**
  * Sets the autoscale flag and the floor and ceiling values.
  *
  * <p>If autoscaling is true, then the min and max values of z are set using the data. If
  * autoscaling is false, then floor and ceiling values become the max and min. Values below min
  * map to the first color; values above max map to the last color.
  *
  * @param isAutoscale
  * @param floor
  * @param ceil
  */
 public void setAutoscaleZ(boolean isAutoscale, double floor, double ceil) {
   autoscaleZ = isAutoscale;
   if (autoscaleZ) {
     update();
   } else {
     zmax = ceil;
     zmin = floor;
     if (zMap != null) {
       zMap.setMinMax(zmin, zmax);
     }
     colorMap.setScale(zmin, zmax);
   }
 }
Exemplo n.º 4
0
 /** Updates the internal data by interpolating large grids onto a smaller array. */
 void updateInterpolated(GridData griddata) {
   if (autoscaleZ) {
     double[] minmax = griddata.getZRange(ampIndex);
     zmax = minmax[1];
     zmin = minmax[0];
     if (zMap != null) {
       zMap.setMinMax(zmin, zmax);
     }
     colorMap.setScale(zmin, zmax);
   }
   double x = griddata.getLeft(), dx = (griddata.getRight() - griddata.getLeft()) / (nx - 1);
   double y = griddata.getTop(), dy = -(griddata.getTop() - griddata.getBottom()) / (ny - 1);
   for (int i = 0; i < nx; i++) {
     y = griddata.getTop();
     for (int j = 0; j < ny; j++) {
       internalData[i][j] = griddata.interpolate(x, y, ampIndex);
       if (zMap != null) {
         internalData[i][j] = zMap.evaluate(internalData[i][j]);
       }
       y += dy;
     }
     x += dx;
   }
 }