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


Java PixelOrientation类代码示例

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


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

示例1: doVectorize

import org.opengis.metadata.spatial.PixelOrientation; //导入依赖的package包/类
/**
 * Helper function to run the Vectorize operation with given parameters and
 * retrieve the vectors.
 * 
 * @param src the source {@link GridCoverage2D}.
 * @param args a {@code Map} of parameter names and values or <code>null</code>.
 * 
 * @return the generated vectors as JTS Polygons
 */
@SuppressWarnings("unchecked")
public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) {
    if (args == null) {
        args = new HashMap<String, Object>();
    }

    ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize");
    pb.setSource("source0", src.getRenderedImage());

    // Set any parameters that were passed in
    for( Entry<String, Object> e : args.entrySet() ) {
        pb.setParameter(e.getKey(), e.getValue());
    }

    // Get the desintation image: this is the unmodified source image data
    // plus a property for the generated vectors
    RenderedOp dest = JAI.create("Vectorize", pb);

    // Get the vectors
    Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME);

    RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src);
    double xRes = regionParams.getXres();
    double yRes = regionParams.getYres();
    final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER);
    final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(),
            mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0);
    for( Polygon polygon : polygons ) {
        polygon.apply(jtsTransformation);
    }
    return polygons;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:42,代码来源:FeatureUtilities.java

示例2: AreaOpImage

import org.opengis.metadata.spatial.PixelOrientation; //导入依赖的package包/类
public AreaOpImage(RenderedImage source, ImageLayout layout, Map configuration,
        ReferencedEnvelope env, double multiplier, Set<Integer> validValues, ROI roi) {
    super(source, layoutHelper(source, layout), configuration, true);

    this.multi = multiplier;
    this.validCheck = validValues != null && !validValues.isEmpty();
    this.validValues = validValues;
    this.envelope = env;

    // Creation of a GridGeometry in order to calculate the gridToWorld transform
    GridEnvelope gridRange = new GridEnvelope2D(getBounds());
    GridGeometry2D gg = new GridGeometry2D(gridRange, env);
    g2w = gg.getGridToCRS2D(PixelOrientation.UPPER_LEFT);

    CoordinateReferenceSystem sourceCRS = envelope.getCoordinateReferenceSystem();

    try {
        CoordinateReferenceSystem targetCRS = CRS.parseWKT(TARGET_CRS_WKT);
        transform = CRS.findMathTransform(sourceCRS, targetCRS);
    } catch (FactoryException e) {
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
        throw new IllegalArgumentException(e);
    }

    // Setting of the roi
    this.roiUsed = roi;
    if (roi != null) {
        // Setting a roi flag to true
        this.noROI = false;
        // check that the ROI contains the source image bounds
        final Rectangle sourceBounds = new Rectangle(source.getMinX(), source.getMinY(),
                source.getWidth(), source.getHeight());
        // Check if the ROI intersects the image bounds
        if (!roi.intersects(sourceBounds)) {
            throw new IllegalArgumentException(
                    "The bounds of the ROI must intersect the source image");
        }
        // massage roi
        roiUsed = roi.intersect(new ROIShape(sourceBounds));
    } else {
        this.noROI = true;
    }
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:44,代码来源:AreaOpImage.java


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