use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method newCoordinateSystemGeocentric.
private static GeocentricCoordinateSystem newCoordinateSystemGeocentric(final int id, final String name, final Datum datum, final List<Axis> axis, final Area area, final boolean deprecated) {
final EpsgAuthority authority = new EpsgAuthority(id);
final LinearUnit linearUnit = (LinearUnit) axis.get(0).getUnit();
final GeodeticDatum geodeticDatum = (GeodeticDatum) datum;
return new GeocentricCoordinateSystem(id, name, geodeticDatum, linearUnit, axis, area, authority, deprecated);
}
use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadDatum.
private static void loadDatum() {
final IntHashMap<Ellipsoid> ellipsoids = loadEllipsoid();
try (ChannelReader reader = newChannelReader("datum")) {
while (true) {
final int id = reader.getInt();
final String name = reader.getStringUtf8ByteCount();
final int datumType = reader.getByte();
final Ellipsoid ellipsoid = readCode(reader, ellipsoids);
final PrimeMeridian primeMeridian = readCode(reader, PRIME_MERIDIAN_BY_ID);
final Area area = readCode(reader, AREA_BY_ID);
final boolean deprecated = readBoolean(reader);
final EpsgAuthority authority = new EpsgAuthority(id);
Datum datum;
if (datumType == 0) {
datum = new GeodeticDatum(authority, name, area, deprecated, ellipsoid, primeMeridian);
} else if (datumType == 1) {
datum = new VerticalDatum(authority, name, area, deprecated);
} else if (datumType == 2) {
datum = new EngineeringDatum(authority, name, area, deprecated);
} else {
throw new IllegalArgumentException("Unknown datumType=" + datumType);
}
DATUM_BY_ID.put(id, datum);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
}
use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.
the class EpsgCsWktWriter method write.
public static void write(final PrintWriter out, final GeographicCoordinateSystem coordinateSystem) {
if (coordinateSystem != null) {
out.print("GEOGCS[");
write(out, coordinateSystem.getCoordinateSystemName());
final GeodeticDatum geodeticDatum = coordinateSystem.getDatum();
write(out, geodeticDatum);
final PrimeMeridian primeMeridian = coordinateSystem.getPrimeMeridian();
write(out, primeMeridian);
final AngularUnit unit = coordinateSystem.getAngularUnit();
write(out, unit);
final Authority authority = coordinateSystem.getAuthority();
write(out, authority);
out.write(']');
}
}
use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.
the class EsriCsWktWriter method write.
public static void write(final Writer out, final GeographicCoordinateSystem coordinateSystem, final int indentLevel) throws IOException {
out.write("GEOGCS[");
write(out, coordinateSystem.getCoordinateSystemName(), incrementIndent(indentLevel));
final GeodeticDatum geodeticDatum = coordinateSystem.getDatum();
if (geodeticDatum != null) {
out.write(",");
indent(out, incrementIndent(indentLevel));
write(out, geodeticDatum, incrementIndent(indentLevel));
}
final PrimeMeridian primeMeridian = coordinateSystem.getPrimeMeridian();
if (primeMeridian != null) {
out.write(",");
indent(out, incrementIndent(indentLevel));
write(out, primeMeridian, incrementIndent(indentLevel));
}
final AngularUnit unit = coordinateSystem.getAngularUnit();
if (unit != null) {
write(out, unit, incrementIndent(indentLevel));
}
indent(out, indentLevel);
out.write(']');
}
use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.
the class WktCsParser method processGeographicCoordinateSystem.
private GeographicCoordinateSystem processGeographicCoordinateSystem(final List<Object> values) {
final String name = (String) values.get(0);
final GeodeticDatum geodeticDatum = (GeodeticDatum) values.get(1);
final PrimeMeridian primeMeridian = (PrimeMeridian) values.get(2);
final AngularUnit angularUnit = (AngularUnit) values.get(3);
int index = 4;
List<Axis> axis = null;
if (index < values.size() && values.get(index) instanceof Axis) {
axis = Arrays.asList((Axis) values.get(index++), (Axis) values.get(index++));
}
Authority authority = null;
if (index < values.size()) {
authority = (Authority) values.get(index);
}
final int coordinateSystemId = getCoordinateSystemId(authority);
return new GeographicCoordinateSystem(coordinateSystemId, name, geodeticDatum, primeMeridian, angularUnit, axis, authority);
}
Aggregations