Пример #1
0
  Datum parseDatum(final Element parent, final Object meridian) throws ParseException {
    Element element = parent.pullElement("DATUM");
    String name = element.pullString("name");
    Ellipsoid ellipsoid = parseSpheroid(element);

    double[] toWGS84 = parseToWGS84(element); // Optional; may be
    // null.
    Map<String, Object> properties = parseAuthority(element, name);
    if (true /*ALLOW_ORACLE_SYNTAX*/ && (toWGS84 == null) && (element.peek() instanceof Number)) {
      toWGS84 = new double[7];
      toWGS84[0] = element.pullDouble("dx");
      toWGS84[1] = element.pullDouble("dy");
      toWGS84[2] = element.pullDouble("dz");
      toWGS84[3] = element.pullDouble("ex");
      toWGS84[4] = element.pullDouble("ey");
      toWGS84[5] = element.pullDouble("ez");
      toWGS84[6] = element.pullDouble("ppm");
    }
    element.close();

    return new Datum(name, toWGS84, ellipsoid, name);
  }
Пример #2
0
  double[] parseToWGS84(final Element parent) throws ParseException {
    final Element element = parent.pullOptionalElement("TOWGS84");
    if (element == null) {
      return null;
    }

    double dx = element.pullDouble("dx");
    double dy = element.pullDouble("dy");
    double dz = element.pullDouble("dz");

    try {
      if (element.peek() != null) {
        double ex = element.pullDouble("ex");
        double ey = element.pullDouble("ey");
        double ez = element.pullDouble("ez");
        double ppm = element.pullDouble("ppm");
        return new double[] {dx, dy, dz, ex, ey, ez, ppm};
      } else {
        return new double[] {dx, dy, dz};
      }
    } finally {
      element.close();
    }
  }