gpt4 book ai didi

org.apache.sis.io.wkt.WKTFormat.parseObject()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 20:21:05 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.sis.io.wkt.WKTFormat.parseObject()方法的一些代码示例,展示了WKTFormat.parseObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WKTFormat.parseObject()方法的具体详情如下:
包路径:org.apache.sis.io.wkt.WKTFormat
类名称:WKTFormat
方法名:parseObject

WKTFormat.parseObject介绍

暂无

代码示例

代码示例来源:origin: apache/sis

/**
 * Returns the CRS for the given Well Known Text.
 */
private static CoordinateReferenceSystem parse(final String wkt) throws ParseException {
  return (CoordinateReferenceSystem) parser.parseObject(wkt);
}

代码示例来源:origin: apache/sis

/**
 * Returns the CRS for the given Well Known Text.
 */
private static CoordinateReferenceSystem parse(final String wkt) throws ParseException {
  return (CoordinateReferenceSystem) parser.parseObject(wkt);
}

代码示例来源:origin: apache/sis

/**
 * Returns the CRS for the given Well Known Text.
 */
private static CoordinateReferenceSystem parse(final String wkt) throws ParseException {
  return (CoordinateReferenceSystem) parser.parseObject(wkt);
}

代码示例来源:origin: apache/sis

/**
 * Implementation of {@link #testConsistency()} for a single WKT.
 *
 * @throws ParseException if the parsing failed.
 */
private void testConsistency(final String wkt) throws ParseException {
  final Object expected = parser.parseObject(wkt);
  final String reformat = format.format(expected);
  final Object reparsed = format.parseObject(reformat);
  assertEqualsIgnoreMetadata(expected, reparsed);
}

代码示例来源:origin: apache/sis

/**
 * Tests integration in {@link WKTFormat#parse(CharSequence, ParsePosition)}.
 * This method tests only a simple WKT because it is not the purpose of this
 * method to test the parser itself. We only want to tests its integration in
 * the {@link WKTFormat} class.
 *
 * @throws ParseException if the parsing failed.
 */
@Test
public void testParse() throws ParseException {
  format = new WKTFormat(null, null);
  final VerticalCRS crs = (VerticalCRS) format.parseObject(
      "VERT_CS[“Gravity-related height”,\n" +
      "  VERT_DATUM[“Mean Sea Level”, 2005],\n" +
      "  UNIT[“metre”, 1],\n" +
      "  AXIS[“Gravity-related height”, UP]]");
  GeodeticObjectParserTest.assertNameAndIdentifierEqual("Gravity-related height", 0, crs);
  GeodeticObjectParserTest.assertNameAndIdentifierEqual("Mean Sea Level", 0, crs.getDatum());
}

代码示例来源:origin: apache/sis

/**
 * Parses the given Well Known Text (version 1) into a math transform.
 */
@Override
public synchronized MathTransform createFromWKT(final String wkt) throws FactoryException {
  ArgumentChecks.ensureNonEmpty("wkt", wkt);
  if (parser == null) {
    parser = new WKTFormat(null, null);
    parser.setFactory(CRSAuthorityFactory.class, this);
    parser.setFactory(MathTransformFactory.class, this);
    parser.setFactory(CoordinateOperationFactory.class, this);
  }
  try {
    return (MathTransform) parser.parseObject(wkt);
  } catch (ParseException | ClassCastException e) {
    throw new FactoryException(e);
  }
}

代码示例来源:origin: Geomatys/geotoolkit

@Test
  public void testFromWKT() throws ParseException, TransformException {
    final WKTFormat parser = new WKTFormat(null, null);
    final MathTransform mt = (MathTransform) parser.parseObject("Param_MT[\"Ellipsoid_To_Geoid\"]");
    DirectPosition pos = new GeneralDirectPosition(new double[] {45, 45, 1000});
    pos = mt.transform(pos, pos);
    assertEquals(  45.000, pos.getOrdinate(0), 0.001);
    assertEquals(  45.000, pos.getOrdinate(1), 0.001);
    assertEquals(1001.515, pos.getOrdinate(2), 0.001);
  }
}

代码示例来源:origin: apache/sis

parsed = (CoordinateReferenceSystem) f.parseObject(wkt);
} catch (ParseException e) {
  print(code, "ERROR", "Can not parse the WKT below.");

代码示例来源:origin: apache/sis

/**
   * Tests the usage of {@code WKTFormat} with WKT fragments.
   *
   * @throws ParseException if the parsing failed.
   */
  @Test
  public void testFragments() throws ParseException {
    format = new WKTFormat(null, null);
    format.addFragment("deg",    "UNIT[“degree”, 0.0174532925199433]");
    format.addFragment("Bessel", "SPHEROID[“Bessel 1841”, 6377397.155, 299.1528128, AUTHORITY[“EPSG”,“7004”]]");
    format.addFragment("Tokyo",  "DATUM[“Tokyo”, $Bessel]");
    format.addFragment("Lat",    "AXIS[“Lat”, NORTH, $deg]");
    format.addFragment("Lon",    "AXIS[“Long”, EAST, $deg]");
    final Object crs = format.parseObject("GEOGCS[“Tokyo”, $Tokyo, $Lat, $Lon]");
    final String wkt = format.format(crs);
    assertMultilinesEquals(
        "GEODCRS[\"Tokyo\",\n" +
        "  DATUM[\"Tokyo\",\n" +
        "    ELLIPSOID[\"Bessel 1841\", 6377397.155, 299.1528128, LENGTHUNIT[\"metre\", 1]]],\n" +
        "    PRIMEM[\"Greenwich\", 0.0, ANGLEUNIT[\"degree\", 0.017453292519943295]],\n" +
        "  CS[ellipsoidal, 2],\n" +
        "    AXIS[\"Latitude (B)\", north, ORDER[1]],\n" +
        "    AXIS[\"Longitude (L)\", east, ORDER[2]],\n" +
        "    ANGLEUNIT[\"degree\", 0.017453292519943295]]", wkt);
  }
}

代码示例来源:origin: apache/sis

pm = (DefaultPrimeMeridian) format.parseObject(wkt);
assertEquals("Invalid \"$name\" here", pm.getName().getCode());

代码示例来源:origin: apache/sis

parser = format = new WKTFormat(null, null);
format.setSymbols(symbols);
final DefaultProjectedCRS crs = (DefaultProjectedCRS) parser.parseObject(
  "PROJCS[“OSGB 1936 / British National Grid”,\n" +
  "  GEOGCS[“OSGB 1936”,\n" +

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com