• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MathTransformFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: toMathTransform2D

import org.opengis.referencing.operation.MathTransformFactory; //导入依赖的package包/类
/**
 * Returns the math transform for the two specified dimensions of the specified transform.
 *
 * @param transform The transform.
 * @param mtFactory The factory to use for extracting the sub-transform.
 *
 * @return The {@link MathTransform2D} part of {@code transform}.
 *
 * @throws FactoryException If {@code transform} is not separable.
 */
private static MathTransform2D toMathTransform2D(final MathTransform transform,
                                                 final MathTransformFactory mtFactory) throws FactoryException {
    final DimensionFilter filter = new DimensionFilter(mtFactory);
    filter.addSourceDimension(DIMENSION_X_INDEX);
    filter.addSourceDimension(DIMENSION_Y_INDEX);
    MathTransform candidate = filter.separate(transform);
    if (candidate instanceof MathTransform2D) {
        return (MathTransform2D) candidate;
    }
    filter.addTargetDimension(DIMENSION_X_INDEX);
    filter.addTargetDimension(DIMENSION_Y_INDEX);
    candidate = filter.separate(transform);
    if (candidate instanceof MathTransform2D) {
        return (MathTransform2D) candidate;
    }
    throw new FactoryException(Errors.format(ErrorKeys.NO_TRANSFORM2D_AVAILABLE));
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:28,代码来源:Reproject.java


示例2: getCRS

import org.opengis.referencing.operation.MathTransformFactory; //导入依赖的package包/类
@Override
public CoordinateReferenceSystem getCRS(final GeoPos referencePos, ParameterValueGroup parameters,
                                        GeodeticDatum datum) throws FactoryException {
    final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    // in some cases, depending on the parameters set, the effective transformation can be different
    // from the transformation given by the OperationMethod.
    // So we create a new one
    final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
    final MathTransform transform = mtFactory.createParameterizedTransform(parameters);
    final DefaultOperationMethod operationMethod = new DefaultOperationMethod(transform);

    final Conversion conversion = new DefiningConversion(AbstractIdentifiedObject.getProperties(operationMethod),
                                                         operationMethod, transform);

    final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>();
    baseCrsProperties.put("name", datum.getName().getCode());
    GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties,
                                                           datum,
                                                           DefaultEllipsoidalCS.GEODETIC_2D);

    final HashMap<String, Object> projProperties = new HashMap<String, Object>();
    projProperties.put("name", conversion.getName().getCode() + " / " + datum.getName().getCode());
    return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:25,代码来源:OperationMethodCrsProvider.java


示例3: createCrsProviderSet

import org.opengis.referencing.operation.MathTransformFactory; //导入依赖的package包/类
public static Set<AbstractCrsProvider> createCrsProviderSet() {
    MathTransformFactory factory = ReferencingFactoryFinder.getMathTransformFactory(null);
    Set<OperationMethod> methods = factory.getAvailableMethods(Projection.class);

    TreeSet<AbstractCrsProvider> crsProviderSet = new TreeSet<>(new CrsProviderComparator());
    for (OperationMethod method : methods) {
        crsProviderSet.add(new OperationMethodCrsProvider(method));
    }

    return crsProviderSet;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:12,代码来源:CustomCrsPanel.java


示例4: createCRSByHand1

import org.opengis.referencing.operation.MathTransformFactory; //导入依赖的package包/类
/**
 * Creates a WGS 84/UTM Zone 10N CRS mostly (uses some premade objects) by hand. Uses the higher
 * level FactoryGroup instead of the lower level MathTransformFactory (commented out).
 * 
 * @throws Exception
 */
void createCRSByHand1() throws Exception {
    System.out.println("------------------------------------------");
    System.out.println("Creating a CRS by hand:");
    // createCRSByHand1 start
    MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
    CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
    
    GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
    CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
    
    ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
    parameters.parameter("central_meridian").setValue(-111.0);
    parameters.parameter("latitude_of_origin").setValue(0.0);
    parameters.parameter("scale_factor").setValue(0.9996);
    parameters.parameter("false_easting").setValue(500000.0);
    parameters.parameter("false_northing").setValue(0.0);
    Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
    
    Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
    ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);
    // createCRSByHand1 end
    
    // parameters.parameter("semi_major").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMajorAxis());
    // parameters.parameter("semi_minor").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMinorAxis());
    
    // MathTransform trans = mtFactory.createParameterizedTransform(parameters);
    // ProjectedCRS projCRS = crsFactory.createProjectedCRS(
    // Collections.singletonMap("name", "WGS 84 / UTM Zone 12N"),
    // new org.geotools.referencing.operation.OperationMethod(trans),
    // geoCRS, trans, cartCS);
    System.out.println("  Projected CRS: " + projCRS.toWKT());
    System.out.println("------------------------------------------");
    
    // save for later use in createMathTransformBetweenCRSs()
    this.utm10NCRS = projCRS;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:43,代码来源:ReferencingExamples.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CredentialsNotAvailableException类代码示例发布时间:2022-05-22
下一篇:
Java MutableInt类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap