当前位置: 首页>>代码示例>>Java>>正文


Java RectIter类代码示例

本文整理汇总了Java中javax.media.jai.iterator.RectIter的典型用法代码示例。如果您正苦于以下问题:Java RectIter类的具体用法?Java RectIter怎么用?Java RectIter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RectIter类属于javax.media.jai.iterator包,在下文中一共展示了RectIter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkMatrixEqual

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
protected void checkMatrixEqual( RenderedImage image, double[][] matrix, double delta ) {
    RectIter rectIter = RectIterFactory.create(image, null);
    int y = 0;
    do {
        int x = 0;
        do {
            double value = rectIter.getSampleDouble();
            double expectedResult = matrix[y][x];
            if (isNovalue(value)) {
                assertTrue(x + " " + y, isNovalue(expectedResult));
            } else {
                assertEquals(x + " " + y, expectedResult, value, delta);
            }
            x++;
        } while( !rectIter.nextPixelDone() );
        rectIter.startPixels();
        y++;
    } while( !rectIter.nextLineDone() );
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:20,代码来源:HMTestCase.java

示例2: checkEqualsSinlgeValue

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
protected void checkEqualsSinlgeValue( RenderedImage image, double expectedResult, double delta ) {
    RectIter rectIter = RectIterFactory.create(image, null);
    int y = 0;
    do {
        int x = 0;
        do {
            double value = rectIter.getSampleDouble();
            if (isNovalue(value)) {
                assertTrue(x + " " + y, isNovalue(expectedResult));
            } else {
                assertEquals(x + " " + y, expectedResult, value, delta);
            }
            x++;
        } while( !rectIter.nextPixelDone() );
        rectIter.startPixels();
        y++;
    } while( !rectIter.nextLineDone() );
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:19,代码来源:HMTestCase.java

示例3: checkMatrixEqual

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
protected void checkMatrixEqual( RenderedImage image, double[][] matrix, double delta ) {
    RectIter rectIter = RectIterFactory.create(image, null);
    int y = 0;
    do {
        int x = 0;
        do {
            double value = rectIter.getSampleDouble();
            double expectedResult = matrix[y][x];
            if (isNovalue(value)) {
                boolean novalue = isNovalue(expectedResult);
                assertTrue("col:" + x + " row:" + y + "=" + expectedResult, novalue);
            } else {
                assertEquals("col:" + x + " row:" + y + "=" + value, expectedResult, value, delta);
            }
            x++;
        } while( !rectIter.nextPixelDone() );
        rectIter.startPixels();
        y++;
    } while( !rectIter.nextLineDone() );
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:HMTestCase.java

示例4: checkMatrixEqualLimit

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
protected void checkMatrixEqualLimit( RenderedImage image, double[][] matrix, double delta ) {
    RectIter rectIter = RectIterFactory.create(image, null);
    int y = 0;
    do {
        int x = 0;
        do {
            double value = rectIter.getSampleDouble();
            double expectedResult = matrix[y][x];
            if (isNovalue(value)) {
                assertTrue(x + " " + y, isNovalue(expectedResult));
            } else {
                assertEquals(x + " " + y, expectedResult, value, delta);
            }
            x++;
        } while( !rectIter.nextPixelDone() );
        rectIter.startPixels();
        y++;
        if (y > 10) {
            break;
        }
    } while( !rectIter.nextLineDone() );
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:23,代码来源:TestDePitter.java

示例5: printImage

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
protected void printImage( RenderedImage image ) {
    RectIter rectIter = RectIterFactory.create(image, null);
    do {
        do {
            double value = rectIter.getSampleDouble();
            System.out.print(value + " ");
        } while( !rectIter.nextPixelDone() );
        rectIter.startPixels();
        System.out.println();
    } while( !rectIter.nextLineDone() );
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:12,代码来源:HMTestCase.java

示例6: viewCoverage

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
@Execute
public void viewCoverage() throws Exception {
    StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
    // RasterSymbolizer sym = sf.getDefaultRasterSymbolizer();
    // Style rasterStyle = SLD.wrapSymbolizers(sym);

    StyleBuilder sB = new StyleBuilder(sf);
    RasterSymbolizer rasterSym = sf.createRasterSymbolizer();

    ColorMap colorMap = sf.createColorMap();

    RenderedImage renderedImage = raster.getRenderedImage();
    double max = Double.NEGATIVE_INFINITY;
    double min = Double.POSITIVE_INFINITY;
    RectIter iter = RectIterFactory.create(renderedImage, null);
    do {
        do {
            double value = iter.getSampleDouble();
            if (value > max) {
                max = value;
            }
            if (value < min) {
                min = value;
            }
        } while( !iter.nextPixelDone() );
        iter.startPixels();
    } while( !iter.nextLineDone() );

    // red to blue
    Color fromColor = Color.blue;
    Color toColor = Color.red;
    Expression fromColorExpr = sB.colorExpression(new java.awt.Color(fromColor.getRed(), fromColor.getGreen(), fromColor
            .getBlue(), 255));
    Expression toColorExpr = sB.colorExpression(new java.awt.Color(toColor.getRed(), toColor.getGreen(), toColor.getBlue(),
            255));
    Expression fromExpr = sB.literalExpression(min);
    Expression toExpr = sB.literalExpression(max);

    ColorMapEntry entry = sf.createColorMapEntry();
    entry.setQuantity(fromExpr);
    entry.setColor(fromColorExpr);
    colorMap.addColorMapEntry(entry);

    entry = sf.createColorMapEntry();
    entry.setQuantity(toExpr);
    entry.setColor(toColorExpr);
    colorMap.addColorMapEntry(entry);

    rasterSym.setColorMap(colorMap);

    Style rasterStyle = SLD.wrapSymbolizers(rasterSym);

    // Set up a MapContext with the two layers
    final MapContext map = new DefaultMapContext();
    map.setTitle("Coverage Viewer");
    map.addLayer(raster, rasterStyle);

    // Create a JMapFrame with a menu to choose the display style for the
    final JMapFrame frame = new JMapFrame(map);
    frame.setSize(800, 600);
    frame.enableStatusBar(true);
    frame.enableTool(JMapFrame.Tool.ZOOM, JMapFrame.Tool.PAN, JMapFrame.Tool.RESET);
    frame.enableToolBar(true);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter(){
        public void windowClosing( WindowEvent e ) {
            frame.setVisible(false);
        }
    });

    while( frame.isVisible() ) {
        Thread.sleep(300);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:75,代码来源:OmsCoverageViewer.java

示例7: addCoverages

import javax.media.jai.iterator.RectIter; //导入依赖的package包/类
private void addCoverages( final MapContent map ) throws Exception {
    if (inRasters == null) {
        return;
    }
    RasterSymbolizer rasterSym = sf.createRasterSymbolizer();
    ColorMap colorMap = sf.createColorMap();

    for( String rasterPath : inRasters ) {
        GridCoverage2D readRaster = OmsRasterReader.readRaster(rasterPath);
        RenderedImage renderedImage = readRaster.getRenderedImage();
        double max = Double.NEGATIVE_INFINITY;
        double min = Double.POSITIVE_INFINITY;
        RectIter iter = RectIterFactory.create(renderedImage, null);
        do {
            do {
                double value = iter.getSampleDouble();
                if (value > max) {
                    max = value;
                }
                if (value < min) {
                    min = value;
                }
            } while( !iter.nextPixelDone() );
            iter.startPixels();
        } while( !iter.nextLineDone() );

        // red to blue
        Color fromColor = Color.blue;
        Color midColor = Color.green;
        Color toColor = Color.red;
        Expression fromColorExpr = sb
                .colorExpression(new java.awt.Color(fromColor.getRed(), fromColor.getGreen(), fromColor.getBlue(), 255));
        Expression midColorExpr = sb
                .colorExpression(new java.awt.Color(midColor.getRed(), midColor.getGreen(), midColor.getBlue(), 255));
        Expression toColorExpr = sb
                .colorExpression(new java.awt.Color(toColor.getRed(), toColor.getGreen(), toColor.getBlue(), 255));
        Expression fromExpr = sb.literalExpression(min);
        Expression midExpr = sb.literalExpression(min + (max - min) / 2);
        Expression toExpr = sb.literalExpression(max);

        ColorMapEntry entry = sf.createColorMapEntry();
        entry.setQuantity(fromExpr);
        entry.setColor(fromColorExpr);
        colorMap.addColorMapEntry(entry);

        entry = sf.createColorMapEntry();
        entry.setQuantity(midExpr);
        entry.setColor(midColorExpr);
        colorMap.addColorMapEntry(entry);

        entry = sf.createColorMapEntry();
        entry.setQuantity(toExpr);
        entry.setColor(toColorExpr);
        colorMap.addColorMapEntry(entry);

        rasterSym.setColorMap(colorMap);

        Style rasterStyle = SLD.wrapSymbolizers(rasterSym);

        GridCoverageLayer layer = new GridCoverageLayer(readRaster, rasterStyle);

        map.addLayer(layer);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:65,代码来源:OmsMapsViewer.java


注:本文中的javax.media.jai.iterator.RectIter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。