Пример #1
0
  public boolean mustCreateData(final RepositoryEntry entry, final Repository repository) {
    final PropertyMap propertyMap = repository.getPropertyMap();
    final String productName = entry.getProductFile().getName();

    final String boundaryPathString =
        propertyMap.getPropertyString(productName + KEY_BOUNDARY_PATH, null);

    if (boundaryPathString == null) {
      return true;
    }

    final String latString =
        propertyMap.getPropertyString(productName + KEY_PRODUCT_CENTER_LAT, null);

    if (latString == null) {
      return true;
    }

    final String lonString =
        propertyMap.getPropertyString(productName + KEY_PRODUCT_CENTER_LON, null);

    if (lonString == null) {
      return true;
    }

    if (createWorldMapFile) {
      final File worldMapImageFile =
          getWorldMapImageFile(repository.getStorageDir(), entry.getProductFile().getName());
      if (worldMapImageFile == null || !worldMapImageFile.exists()) {
        return true;
      }
    }

    return false;
  }
Пример #2
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);
    }
  }
Пример #3
0
  public void cleanUp(final RepositoryEntry entry, final Repository repository) {
    final String productName = entry.getProductFile().getName();
    final PropertyMap propertyMap = repository.getPropertyMap();
    propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, null);
    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());
      if (worldMapImageFile != null && worldMapImageFile.exists()) {
        worldMapImageFile.delete();
      }
    }
  }
Пример #4
0
  public Object getData(final RepositoryEntry entry, final Repository repository)
      throws IOException {
    final String productName = entry.getProductFile().getName();
    final PropertyMap propertyMap = repository.getPropertyMap();

    final String boundaryPathString =
        propertyMap.getPropertyString(productName + KEY_BOUNDARY_PATH, null);
    final Double latValue =
        propertyMap.getPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, null);
    final Double lonValue =
        propertyMap.getPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, null);

    final PropertyMap dataMap = new PropertyMap();
    dataMap.setPropertyString(KEY_BOUNDARY_PATH, boundaryPathString);
    dataMap.setPropertyDouble(KEY_PRODUCT_CENTER_LAT, latValue);
    dataMap.setPropertyDouble(KEY_PRODUCT_CENTER_LON, lonValue);

    return dataMap;
  }