private Ellipsoid decodeSpheroid() { if (currentToken != CrsWktVariant.SPHEROID) { throw new WktDecodeException("Expected SPHEROID keyword, but received " + currentToken.toString()); } String ellipsoidName = decodeName(); matchesElementSeparator(); double semiMajorAxis = decodeNumber(); matchesElementSeparator(); double inverseFlattening = decodeNumber(); CrsId crsId = decodeOptionalAuthority(CrsId.UNDEFINED.getCode()); matchesCloseList(); return new Ellipsoid(crsId, ellipsoidName, semiMajorAxis, inverseFlattening); }
private PrimeMeridian decodePrimem() { if (currentToken != CrsWktVariant.PRIMEM) { throw new WktDecodeException("Expected PRIMEM keyword, received " + currentToken.toString()); } String name = decodeName(); matchesElementSeparator(); double longitude = decodeNumber(); CrsId crsId = decodeOptionalAuthority(CrsId.UNDEFINED.getCode()); matchesCloseList(); return new PrimeMeridian(crsId, name, longitude); }
private double[] decodeOptionalToWGS84() { matchesElementSeparator(); if (currentToken != CrsWktVariant.TOWGS84) { return new double[0]; } nextToken(); double[] toWGS = new double[7]; matchesOpenList(); for (int i = 0; i < 7; i++) { //TODO -- what with 3-parameter variants? toWGS[i] = decodeNumber(); matchesElementSeparator(); } matchesCloseList(); return toWGS; }
private CrsParameter decodeOptionalParameter() { matchesElementSeparator(); if (currentToken != CrsWktVariant.PARAMETER) { return null; } nextToken(); String name = decodeName(); matchesElementSeparator(); double value = decodeNumber(); matchesCloseList(); return new CrsParameter(name, value); }
private Unit decodeUnit(boolean isLinear) { if (currentToken != CrsWktVariant.UNIT) { throw new WktDecodeException("Expected UNIT keyword, found " + currentToken.toString()); } String name = decodeName(); matchesElementSeparator(); double cf = decodeNumber(); matchesElementSeparator(); CrsId crsId = decodeOptionalAuthority(CrsId.UNDEFINED.getCode()); matchesCloseList(); return isLinear ? new LinearUnit(crsId, name, cf) : new AngularUnit(crsId, name, cf); }