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


Java ImageLayout.getHeight方法代码示例

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


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

示例4: layoutHelper

import javax.media.jai.ImageLayout; //导入方法依赖的package包/类
/**
 * Override the dimension specification for the destination such that it
 * has width and height which are equal to non-negative powers of 2.
 */
private static ImageLayout layoutHelper(ImageLayout layout,
                                        RenderedImage source) {
    // Create an ImageLayout or clone the one passed in.
    ImageLayout il = layout == null ?
        new ImageLayout() : (ImageLayout)layout.clone();

    // Force the origin to coincide with that of the source.
    il.setMinX(source.getMinX());
    il.setMinY(source.getMinY());

    // Recalculate the non-unity dimensions to be a positive power of 2.
    // XXX This calculation should not be effected if an implementation
    // of the FCT which supports arbitrary dimensions is used.
    boolean createNewSampleModel = false;
    int w = il.getWidth(source);
    if(w > 1) {
        int newWidth = MathJAI.nextPositivePowerOf2(w);
        if(newWidth != w) {
            il.setWidth(w = newWidth);
            createNewSampleModel = true;
        }
    }
    int h = il.getHeight(source);
    if(h > 1) {
        int newHeight = MathJAI.nextPositivePowerOf2(h);
        if(newHeight != h) {
            il.setHeight(h = newHeight);
            createNewSampleModel = true;
        }
    }

    // Force the image to contain floating point data.
    SampleModel sm = il.getSampleModel(source);
    int dataType = sm.getTransferType();
    if(dataType != DataBuffer.TYPE_FLOAT &&
       dataType != DataBuffer.TYPE_DOUBLE) {
        dataType = DataBuffer.TYPE_FLOAT;
        createNewSampleModel = true;
    }

    // Create a new SampleModel for the destination.
    if(createNewSampleModel) {
        sm = RasterFactory.createComponentSampleModel(sm, dataType, w, h,
                                                      sm.getNumBands());
        il.setSampleModel(sm);

        // Clear the ColorModel mask if needed.
        ColorModel cm = il.getColorModel(null);
        if(cm != null &&
           !JDKWorkarounds.areCompatibleDataModels(sm, cm)) {
            // Clear the mask bit if incompatible.
            il.unsetValid(ImageLayout.COLOR_MODEL_MASK);
        }
    }

    return il;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:DCTOpImage.java


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