Exemplo n.º 1
0
  private void updateDataSource() {
    if (!isInitialized) {
      return;
    }

    profileData = null;
    if (getRaster() != null) {
      try {
        if (dataSourceConfig.useCorrelativeData && dataSourceConfig.pointDataSource != null) {
          profileData =
              new TransectProfileDataBuilder()
                  .raster(getRaster())
                  .pointData(dataSourceConfig.pointDataSource)
                  .boxSize(dataSourceConfig.boxSize)
                  .connectVertices(dataSourceConfig.computeInBetweenPoints)
                  .useRoiMask(dataSourceConfig.useRoiMask)
                  .roiMask(dataSourceConfig.roiMask)
                  .build();
        } else {
          Shape shape = StatisticsUtils.TransectProfile.getTransectShape(getRaster().getProduct());
          if (shape != null) {
            profileData =
                new TransectProfileDataBuilder()
                    .raster(getRaster())
                    .path(shape)
                    .boxSize(dataSourceConfig.boxSize)
                    .connectVertices(dataSourceConfig.computeInBetweenPoints)
                    .useRoiMask(dataSourceConfig.useRoiMask)
                    .roiMask(dataSourceConfig.roiMask)
                    .build();
          }
        }
      } catch (IOException e) {
        JOptionPane.showMessageDialog(
            getParent(),
            "Failed to compute profile plot.\n" + "An I/O error occurred:" + e.getMessage(),
            "I/O error",
            JOptionPane.ERROR_MESSAGE); /*I18N*/
      }
    }
  }