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


Java ImageLayout.getMinX方法代码示例

本文整理汇总了Java中javax.media.jai.ImageLayout.getMinX方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLayout.getMinX方法的具体用法?Java ImageLayout.getMinX怎么用?Java ImageLayout.getMinX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.jai.ImageLayout的用法示例。


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

示例1: createProjectedImage

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
private MultiLevelImage createProjectedImage(final GeoCoding sourceGeoCoding, final MultiLevelImage sourceImage,
                                             MultiLevelModel sourceModel, final Band targetBand, final Interpolation resampling,
                                             MultiLevelModel targetModel, Reproject reprojection) {
    final CoordinateReferenceSystem sourceModelCrs = Product.findModelCRS(sourceGeoCoding);
    final CoordinateReferenceSystem targetModelCrs = Product.findModelCRS(targetBand.getGeoCoding());
    final AffineTransform sourceImageToMapTransform = Product.findImageToModelTransform(sourceGeoCoding);
    final AffineTransform targetImageToMapTransform = Product.findImageToModelTransform(targetBand.getGeoCoding());

    return new DefaultMultiLevelImage(new AbstractMultiLevelSource(targetModel) {

        @Override
        public RenderedImage createImage(int targetLevel) {
            final double targetScale = targetModel.getScale(targetLevel);
            final int sourceLevel = sourceImage.getModel().getLevel(targetScale);
            RenderedImage leveledSourceImage = sourceImage.getImage(sourceLevel);

            final Rectangle sourceBounds = new Rectangle(leveledSourceImage.getMinX(),
                    leveledSourceImage.getMinY(),
                    leveledSourceImage.getWidth(),
                    leveledSourceImage.getHeight());

            // the following transformation maps the source level image to level zero and then to the model,
            // which either is a map or an image CRS
            final AffineTransform i2mSource = sourceModel.getImageToModelTransform(sourceLevel);
            i2mSource.concatenate(sourceModel.getModelToImageTransform(0));
            i2mSource.concatenate(sourceImageToMapTransform);
            ImageGeometry sourceGeometry = new ImageGeometry(sourceBounds,
                    sourceModelCrs,
                    i2mSource);

            ImageLayout imageLayout = ImageManager.createSingleBandedImageLayout(
                    ImageManager.getDataBufferType(targetBand.getDataType()),
                    targetBand.getRasterWidth(),
                    targetBand.getRasterHeight(),
                    targetProduct.getPreferredTileSize(),
                    ResolutionLevel.create(getModel(), targetLevel));
            Rectangle targetBounds = new Rectangle(imageLayout.getMinX(null), imageLayout.getMinY(null),
                    imageLayout.getWidth(null), imageLayout.getHeight(null));

            // the following transformation maps the target level image to level zero and then to the model,
            // which always is a map
            final AffineTransform i2mTarget = getModel().getImageToModelTransform(targetLevel);
            i2mTarget.concatenate(getModel().getModelToImageTransform(0));
            i2mTarget.concatenate(targetImageToMapTransform);

            ImageGeometry targetGeometry = new ImageGeometry(targetBounds,
                    targetModelCrs,
                    i2mTarget);
            Hints hints = new Hints(JAI.KEY_IMAGE_LAYOUT, imageLayout);
            hints.put(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE);

            Dimension tileSize = ImageManager.getPreferredTileSize(targetProduct);
            try {
                return reprojection.reproject(leveledSourceImage, sourceGeometry, targetGeometry,
                        targetBand.getNoDataValue(), resampling, hints, targetLevel,
                        tileSize);
            } catch (FactoryException | TransformException e) {
                Debug.trace(e);
                throw new RuntimeException(e);
            }
        }
    });
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:64,代码来源:S2tbxReprojectionOp.java

示例2: WarpSourceCoordinatesOpImage

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
private WarpSourceCoordinatesOpImage(Warp warp, ImageLayout layout, Map configuration) {
    super(layout, configuration, layout.getSampleModel(null), layout.getMinX(null), layout.getMinY(null),
            layout.getWidth(null), layout.getHeight(null));
    this.warp = warp;
    int compatibleTag = RasterAccessor.findCompatibleTag(null, layout.getSampleModel(null));
    rasterFormatTag = new RasterFormatTag(layout.getSampleModel(null), compatibleTag);
    OperatorContext.setTileCache(this);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:9,代码来源:WarpSourceCoordinatesOpImage.java

示例3: create

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Creates a new instance of PatternOpImage in the rendered layer.
 * This method satisfies the implementation of RIF.
 */
public RenderedImage create(ParameterBlock paramBlock,
                            RenderingHints renderHints) {
    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
    
    int minX = 0;
    int minY = 0;

    if (layout != null) {
        if (layout.isValid(ImageLayout.MIN_X_MASK)) {
            minX = layout.getMinX(null);
        }
        if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
            minY = layout.getMinY(null);
        }
    }

    RenderedImage source = (RenderedImage)paramBlock.getSource(0);
    Raster pattern = source.getData();
    ColorModel colorModel = source.getColorModel();
 
    // Get image width and height from the parameter block
    int width = paramBlock.getIntParameter(0);
    int height = paramBlock.getIntParameter(1);

    return new PatternOpImage(pattern, colorModel,
                              minX, minY, width, height);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:33,代码来源:PatternRIF.java

示例4: AWTImageOpImage

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
   * Constructs an AWTImageOpImage.
   *
   * @param layout  Image layout.
   * @param image   The AWT image.
   */
  public AWTImageOpImage(Map config,
                         ImageLayout layout,
                         Image image) {
      // We don't know the width, height, and sample model yet
      super(layout = layoutHelper(layout, image), config,
            layout.getSampleModel(null),
            layout.getMinX(null), layout.getMinY(null),
            layout.getWidth(null), layout.getHeight(null));

      // Set the format tag if and only if we will use the RasterAccessor.
      if(getTileWidth() != getWidth() || getTileHeight() != getHeight()) {
          rasterFormatTag =
              new RasterFormatTag(getSampleModel(),
                                  RasterAccessor.TAG_BYTE_UNCOPIED);
      }

      // Grab the entire image
      this.pixels = new int[width * height];
      PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height,
                                              pixels, 0, width);
      try {
          if (!grabber.grabPixels()) {
              if ((grabber.getStatus() & ImageObserver.ABORT) != 0) {
                  throw new RuntimeException(JaiI18N.getString("AWTImageOpImage2"));
} else {
                  throw new RuntimeException(grabber.getStatus() + JaiI18N.getString("AWTImageOpImage3"));
              }
          }
      } catch (InterruptedException e) {
          e.printStackTrace();
          throw new RuntimeException(JaiI18N.getString("AWTImageOpImage4"));
      }
  }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:40,代码来源:AWTImageOpImage.java

示例5: create

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Creates a new instance of <code>ConstantOpImage</code>
 * in the rendered layer. This method satisfies the
 * implementation of RIF.
 */
public RenderedImage create(ParameterBlock paramBlock,
                            RenderingHints renderHints) {
    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);

    // Get width, height, bandValues from the parameter block
    int width = Math.round(paramBlock.getFloatParameter(0));
    int height = Math.round(paramBlock.getFloatParameter(1));
    Number[] bandValues = (Number[])paramBlock.getObjectParameter(2);

    int minX = 0;
    int minY = 0;
    int tileWidth = Math.min(width, DEFAULT_TILE_SIZE);
    int tileHeight = Math.min(height, DEFAULT_TILE_SIZE);

    // Attempt to get minX, minY, tileWidth, tileHeight
    // from the ImageLayout hint
    if (layout != null) {
        if (layout.isValid(ImageLayout.MIN_X_MASK)) {
            minX = layout.getMinX(null);
        }
        if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
            minY = layout.getMinY(null);
        }
        if (layout.isValid(ImageLayout.TILE_WIDTH_MASK)) {
            tileWidth = layout.getTileWidth(null);
        }
        if (layout.isValid(ImageLayout.TILE_HEIGHT_MASK)) {
            tileHeight = layout.getTileHeight(null);
        }
    }
    
    return new ConstantOpImage(minX, minY, width, height,
                               tileWidth, tileHeight,
                               bandValues);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:42,代码来源:ConstantCRIF.java

示例6: create

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Creates a new instance of ImageFunctionOpImage in the rendered layer.
 * This method satisfies the implementation of RIF.
 *
 * @param paramBlock  The source image, the X and Y scale factor,
 *                    and the interpolation method for resampling.
 */
public RenderedImage create(ParameterBlock paramBlock,
                            RenderingHints renderHints) {
    // Get ImageLayout from renderHints if any.
    ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
    

    ImageFunction function =
        (ImageFunction)paramBlock.getObjectParameter(0);

    // Ascertain that a supplied SampleModel has the requisite
    // number of bands vis-a-vis the ImageFunction.
    int numBandsRequired = function.isComplex() ?
        function.getNumElements() * 2 : function.getNumElements();
    if(layout != null &&
       layout.isValid(ImageLayout.SAMPLE_MODEL_MASK) &&
       layout.getSampleModel(null).getNumBands() != numBandsRequired ) {
        throw new RuntimeException(JaiI18N.getString("ImageFunctionRIF0"));
    }

    int minX = 0;
    int minY = 0;
    if (layout != null) {
        if (layout.isValid(ImageLayout.MIN_X_MASK)) {
            minX = layout.getMinX(null);
        }
        if (layout.isValid(ImageLayout.MIN_Y_MASK)) {
            minY = layout.getMinX(null);
        }
    }

    int width = paramBlock.getIntParameter(1);
    int height = paramBlock.getIntParameter(2);
    float xScale = paramBlock.getFloatParameter(3);
    float yScale = paramBlock.getFloatParameter(4);
    float xTrans = paramBlock.getFloatParameter(5);
    float yTrans = paramBlock.getFloatParameter(6);

    return new ImageFunctionOpImage(function,
                                    minX, minY,
                                    width, height,
                                    xScale, yScale,
                                    xTrans, yTrans,
                                    renderHints, layout);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:52,代码来源:ImageFunctionRIF.java


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