ProductUtils { public static PixelPos[] createRectBoundary(Rectangle rect, int step) { final boolean usePixelCenter = true; return createRectBoundary(rect, step, usePixelCenter); }  static ImageInfo createImageInfo(RasterDataNode[] rasters, boolean assignMissingImageInfos,
                                            ProgressMonitor pm); static BufferedImage createRgbImage(final RasterDataNode[] rasters,
                                               final ImageInfo imageInfo,
                                               final ProgressMonitor pm); static BufferedImage createColorIndexedImage(final RasterDataNode rasterDataNode,
                                                        ProgressMonitor pm); static MapInfo createSuitableMapInfo(final Product product,
                                                final Rectangle rect,
                                                final MapProjection mapProjection); @Deprecated static MapInfo createSuitableMapInfo(final Product product,
                                                final MapProjection mapProjection,
                                                final double orientation,
                                                final double noDataValue); static Dimension getOutputRasterSize(final Product product,
                                                final Rectangle rect,
                                                final MapTransform mapTransform,
                                                final double pixelSizeX,
                                                final double pixelSizeY); static Point2D[] createMapEnvelope(final Product product,
                                              final Rectangle rect,
                                              final MapTransform mapTransform); static Point2D[] createMapEnvelope(Product product,
                                              Rectangle rect,
                                              int step,
                                              MapTransform mapTransform); static Point2D[] getMinMax(Point2D[] boundary); static Point2D[] createMapBoundary(Product product, Rectangle rect, int step, MapTransform mapTransform); static GeoPos[] createGeoBoundary(Product product, int step); static GeoPos[] createGeoBoundary(Product product, Rectangle region, int step); static GeoPos[] createGeoBoundary(Product product, Rectangle region, int step,
                                             final boolean usePixelCenter); static GeoPos[] createGeoBoundary(RasterDataNode raster, Rectangle region, int step); static GeneralPath[] createGeoBoundaryPaths(Product product); static GeneralPath[] createGeoBoundaryPaths(Product product, Rectangle region, int step); static GeneralPath[] createGeoBoundaryPaths(Product product, Rectangle region, int step,
                                                       final boolean usePixelCenter); static PixelPos[] createPixelBoundary(Product product, Rectangle rect, int step); static PixelPos[] createPixelBoundary(Product product, Rectangle rect, int step,
                                                 final boolean usePixelCenter); static PixelPos[] createPixelBoundary(RasterDataNode raster, Rectangle rect, int step); static PixelPos[] createRectBoundary(Rectangle rect, int step); static PixelPos[] createRectBoundary(final Rectangle rect, int step, final boolean usePixelCenter); static void copyFlagCodings(Product source, Product target); static FlagCoding copyFlagCoding(FlagCoding sourceFlagCoding, Product target); static void copyIndexCodings(Product source, Product target); static IndexCoding copyIndexCoding(IndexCoding sourceIndexCoding, Product target); static void copyMasks(Product sourceProduct, Product targetProduct); static void copyOverlayMasks(Product sourceProduct, Product targetProduct); @Deprecated static void copyRoiMasks(Product sourceProduct, Product targetProduct); static void copyFlagBands(Product sourceProduct, Product targetProduct, boolean copySourceImage); @Deprecated static void copyFlagBands(Product sourceProduct, Product targetProduct); static TiePointGrid copyTiePointGrid(String gridName, Product sourceProduct, Product targetProduct); static Band copyBand(String sourceBandName, Product sourceProduct, Product targetProduct,
                                boolean copySourceImage); static Band copyBand(String sourceBandName, Product sourceProduct,
                                String targetBandName, Product targetProduct, boolean copySourceImage); static void copyRasterDataNodeProperties(RasterDataNode sourceRaster, RasterDataNode targetRaster); @Deprecated static Band copyBand(String sourceBandName, Product sourceProduct, Product targetProduct); @Deprecated static Band copyBand(String sourceBandName, Product sourceProduct,
                                String targetBandName, Product targetProduct); static void copySpectralBandProperties(Band sourceBand, Band targetBand); static void copyProductNodes(final Product sourceProduct, final Product targetProduct); static void copyGeoCoding(final Product sourceProduct, final Product targetProduct); static void copyTiePointGrids(Product sourceProduct, Product targetProduct); static void copyVectorData(Product sourceProduct, Product targetProduct); static boolean canGetPixelPos(Product product); static boolean canGetPixelPos(final RasterDataNode raster); static BufferedImage createDensityPlotImage(final RasterDataNode raster1,
                                                       final float sampleMin1,
                                                       final float sampleMax1,
                                                       final RasterDataNode raster2,
                                                       final float sampleMin2,
                                                       final float sampleMax2,
                                                       final Mask roiMask,
                                                       final int width,
                                                       final int height,
                                                       final Color background,
                                                       BufferedImage image,
                                                       final ProgressMonitor pm); static BufferedImage overlayMasks(final RasterDataNode raster, final BufferedImage overlayBIm,
                                             ProgressMonitor pm); static GeoPos getCenterGeoPos(final Product product); static int normalizeGeoPolygon(GeoPos[] polygon); @Deprecated static int normalizeGeoPolygon_old(GeoPos[] polygon); static void denormalizeGeoPolygon(final GeoPos[] polygon); static void denormalizeGeoPos(GeoPos geoPos); @Deprecated static void denormalizeGeoPos_old(GeoPos geoPos); static int getRotationDirection(GeoPos[] polygon); static double getAngleSum(GeoPos[] polygon); static GeneralPath convertToPixelPath(GeneralPath geoPath, GeoCoding geoCoding); static GeneralPath convertToGeoPath(Shape shape, GeoCoding geoCoding); static void copyMetadata(Product source, Product target); static void copyMetadata(MetadataElement source, MetadataElement target); static void copyPreferredTileSize(Product sourceProduct, Product targetProduct); static GeoTIFFMetadata createGeoTIFFMetadata(final Product product); static GeoTIFFMetadata createGeoTIFFMetadata(GeoCoding geoCoding, int width, int height); static GeneralPath areaToPath(Area negativeArea, double deltaX); static void addElementToHistory(Product product, MetadataElement elem); static String[] removeInvalidExpressions(final Product product); static String findSuitableQuicklookBandName(final Product product); static PixelPos[] computeSourcePixelCoordinates(final GeoCoding sourceGeoCoding,
                                                           final int sourceWidth,
                                                           final int sourceHeight,
                                                           final GeoCoding destGeoCoding,
                                                           final Rectangle destArea); static float[] computeMinMaxY(PixelPos[] pixelPositions); static void copyBandsForGeomTransform(final Product sourceProduct,
                                                 final Product targetProduct,
                                                 final double defaultNoDataValue,
                                                 final Map<Band, RasterDataNode> addedRasterDataNodes); static void copyBandsForGeomTransform(final Product sourceProduct,
                                                 final Product targetProduct,
                                                 final boolean includeTiePointGrids,
                                                 final double defaultNoDataValue,
                                                 final Map<Band, RasterDataNode> targetToSourceMap); static ArrayList<GeneralPath> assemblePathList(GeoPos[] geoPoints); static ProductData.UTC getScanLineTime(Product product, double y); static double getGeophysicalSampleDouble(Band band, int pixelX, int pixelY, int level); static long getGeophysicalSampleLong(Band band, int pixelX, int pixelY, int level);  }
@Test public void testCreateRectBoundary_usePixelCenter_false() { final boolean usePixelCenter = false; final PixelPos[] rectBoundary = ProductUtils.createRectBoundary(new Rectangle(2, 3, 15, 20), 7, usePixelCenter); assertEquals(12, rectBoundary.length); assertEquals(new PixelPos(2, 3), rectBoundary[0]); assertEquals(new PixelPos(9, 3), rectBoundary[1]); assertEquals(new PixelPos(16, 3), rectBoundary[2]); assertEquals(new PixelPos(17, 3), rectBoundary[3]); assertEquals(new PixelPos(17, 10), rectBoundary[4]); assertEquals(new PixelPos(17, 17), rectBoundary[5]); assertEquals(new PixelPos(17, 23), rectBoundary[6]); assertEquals(new PixelPos(16, 23), rectBoundary[7]); assertEquals(new PixelPos(9, 23), rectBoundary[8]); assertEquals(new PixelPos(2, 23), rectBoundary[9]); assertEquals(new PixelPos(2, 17), rectBoundary[10]); assertEquals(new PixelPos(2, 10), rectBoundary[11]); }
@Test public void testCreateRectBoundary_usePixelCenter_true() { final boolean usePixelCenter = true; final PixelPos[] rectBoundary = ProductUtils.createRectBoundary(new Rectangle(2, 3, 15, 20), 7, usePixelCenter); assertEquals(10, rectBoundary.length); assertEquals(new PixelPos(2.5f, 3.5f), rectBoundary[0]); assertEquals(new PixelPos(9.5f, 3.5f), rectBoundary[1]); assertEquals(new PixelPos(16.5f, 3.5f), rectBoundary[2]); assertEquals(new PixelPos(16.5f, 10.5f), rectBoundary[3]); assertEquals(new PixelPos(16.5f, 17.5f), rectBoundary[4]); assertEquals(new PixelPos(16.5f, 22.5f), rectBoundary[5]); assertEquals(new PixelPos(9.5f, 22.5f), rectBoundary[6]); assertEquals(new PixelPos(2.5f, 22.5f), rectBoundary[7]); assertEquals(new PixelPos(2.5f, 17.5f), rectBoundary[8]); assertEquals(new PixelPos(2.5f, 10.5f), rectBoundary[9]); }
@Test public void testCreateRectBoundary_without_usePixelCenter_Parameter() { final PixelPos[] rectBoundary = ProductUtils.createRectBoundary(new Rectangle(2, 3, 15, 20), 7); assertEquals(10, rectBoundary.length); assertEquals(new PixelPos(2.5f, 3.5f), rectBoundary[0]); assertEquals(new PixelPos(9.5f, 3.5f), rectBoundary[1]); assertEquals(new PixelPos(16.5f, 3.5f), rectBoundary[2]); assertEquals(new PixelPos(16.5f, 10.5f), rectBoundary[3]); assertEquals(new PixelPos(16.5f, 17.5f), rectBoundary[4]); assertEquals(new PixelPos(16.5f, 22.5f), rectBoundary[5]); assertEquals(new PixelPos(9.5f, 22.5f), rectBoundary[6]); assertEquals(new PixelPos(2.5f, 22.5f), rectBoundary[7]); assertEquals(new PixelPos(2.5f, 17.5f), rectBoundary[8]); assertEquals(new PixelPos(2.5f, 10.5f), rectBoundary[9]); }