コード例 #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]);
         }
       }
     }
   }
 }
コード例 #2
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;
   }
 }