Пример #1
0
  private static BufferedImage createWorldMapImage(final Product product) {
    final GeneralPath[] geoBoundaryPaths = ProductUtils.createGeoBoundaryPaths(product);
    final Image wmImage = WorldMapImageLoader.getWorldMapImage(false);
    final WorldMapPainter worldMapPainter =
        new WorldMapPainter(
            wmImage.getScaledInstance(wmImage.getHeight(null) / 2, -1, Image.SCALE_SMOOTH));

    return worldMapPainter.createWorldMapImage(geoBoundaryPaths);
  }
Пример #2
0
 private static String createPathsString(final Product product) {
   final GeneralPath[] geoBoundaryPaths = ProductUtils.createGeoBoundaryPaths(product);
   final StringWriter pathWriter = new StringWriter();
   for (int i = 0; i < geoBoundaryPaths.length; i++) {
     final GeneralPath geoBoundaryPath = geoBoundaryPaths[i];
     if (i > 0) {
       pathWriter.write(",");
     }
     write(geoBoundaryPath, pathWriter);
   }
   return pathWriter.toString();
 }
Пример #3
0
 static Geometry computeProductGeometry(Product product) {
   final GeneralPath[] paths = ProductUtils.createGeoBoundaryPaths(product);
   final Polygon[] polygons = new Polygon[paths.length];
   final GeometryFactory factory = new GeometryFactory();
   for (int i = 0; i < paths.length; i++) {
     polygons[i] = convertAwtPathToJtsPolygon(paths[i], factory);
   }
   final DouglasPeuckerSimplifier peuckerSimplifier =
       new DouglasPeuckerSimplifier(
           polygons.length == 1 ? polygons[0] : factory.createMultiPolygon(polygons));
   return peuckerSimplifier.getResultGeometry();
 }