Пример #1
0
  public void createData(final RepositoryEntry entry, final Repository repository)
      throws IOException {
    final Product product = entry.getProduct();
    final PropertyMap propertyMap = repository.getPropertyMap();
    final String productName = entry.getProductFile().getName();

    if (product.getGeoCoding() != null) {
      final String boundaryPathString = createPathsString(product);
      propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, boundaryPathString);
      final GeoPos centerGeoPos = ProductUtils.getCenterGeoPos(product);
      propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, centerGeoPos.lat);
      propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, centerGeoPos.lon);
    } else {
      propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, "");
      propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, null);
      propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, null);
    }

    if (createWorldMapFile) {
      final File worldMapImageFile =
          getWorldMapImageFile(repository.getStorageDir(), entry.getProductFile().getName());
      final BufferedImage worldMapImage = createWorldMapImage(product);
      writeImage(worldMapImage, worldMapImageFile);
    }
  }
Пример #2
0
 @Override
 public boolean validatePage() {
   try {
     crsSelectionPanel.getCrs(
         ProductUtils.getCenterGeoPos(getContext().getAppContext().getSelectedProduct()));
   } catch (FactoryException ignored) {
     return false;
   }
   return true;
 }
Пример #3
0
 @Override
 public AbstractLayerSourceAssistantPage getNextPage() {
   final LayerSourcePageContext context = getContext();
   try {
     final Product product = context.getAppContext().getSelectedProduct();
     final GeoPos referencePos = ProductUtils.getCenterGeoPos(product);
     final CoordinateReferenceSystem crs = crsSelectionPanel.getCrs(referencePos);
     context.setPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION_CRS, crs);
     return new ShapefileAssistantPage3();
   } catch (FactoryException e) {
     e.printStackTrace();
     context.showErrorDialog("Could not create CRS:\n" + e.getMessage());
   }
   return null;
 }