use of com.revolsys.spring.resource.NoSuchResourceException in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadCoordinateAxis.
private static IntHashMap<List<Axis>> loadCoordinateAxis() {
final IntHashMap<List<Axis>> axisesByCoordinateSystemId = new IntHashMap<>();
try (ChannelReader reader = newChannelReader("coordinateAxis")) {
while (true) {
final int coordinateSystemId = reader.getInt();
final AxisName axisName = readCode(reader, AXIS_NAMES);
final String orientation = reader.getStringUtf8ByteCount();
final Character abbreviation = (char) reader.getByte();
final UnitOfMeasure unitOfMeasure = readCode(reader, UNIT_BY_ID);
final Axis axis = new Axis(axisName, orientation, abbreviation.toString(), unitOfMeasure);
List<Axis> axises = axisesByCoordinateSystemId.get(coordinateSystemId);
if (axises == null) {
axises = new ArrayList<>();
axisesByCoordinateSystemId.put(coordinateSystemId, axises);
}
axises.add(axis);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
return axisesByCoordinateSystemId;
}
use of com.revolsys.spring.resource.NoSuchResourceException in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadCoordOperationMethod.
private static IntHashMap<CoordinateOperationMethod> loadCoordOperationMethod(final IntHashMap<List<ParameterName>> paramOrderByMethodId, final IntHashMap<List<Byte>> paramReversalByMethodId) {
final IntHashMap<CoordinateOperationMethod> methodById = new IntHashMap<>();
try (ChannelReader reader = newChannelReader("coordOperationMethod")) {
while (true) {
final int id = reader.getInt();
final String name = reader.getStringUtf8ByteCount();
final boolean reverse = readBoolean(reader);
final boolean deprecated = readBoolean(reader);
final List<ParameterName> parameterNames = paramOrderByMethodId.getOrDefault(id, Collections.emptyList());
final List<Byte> reversal = paramReversalByMethodId.getOrDefault(id, Collections.emptyList());
final CoordinateOperationMethod method = new CoordinateOperationMethod(id, name, reverse, deprecated, parameterNames);
methodById.put(id, method);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
return methodById;
}
use of com.revolsys.spring.resource.NoSuchResourceException 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.spring.resource.NoSuchResourceException in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadPrimeMeridians.
private static void loadPrimeMeridians() {
try (ChannelReader reader = newChannelReader("primeMeridian")) {
while (true) {
final int id = reader.getInt();
final String name = reader.getStringUtf8ByteCount();
final AngularUnit unit = (AngularUnit) readCode(reader, UNIT_BY_ID);
final double longitude = reader.getDouble();
final double longitudeDegrees = unit.toDegrees(longitude);
final EpsgAuthority authority = new EpsgAuthority(id);
final PrimeMeridian primeMeridian = new PrimeMeridian(name, longitudeDegrees, authority, false);
PRIME_MERIDIAN_BY_ID.put(id, primeMeridian);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
}
use of com.revolsys.spring.resource.NoSuchResourceException in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadArea.
private static void loadArea() {
try (ChannelReader reader = newChannelReader("area")) {
while (true) {
final int code = reader.getInt();
final String name = reader.getStringUtf8ByteCount();
final double minX = reader.getDouble();
final double minY = reader.getDouble();
final double maxX = reader.getDouble();
final double maxY = reader.getDouble();
final boolean deprecated = readBoolean(reader);
final Authority authority = new EpsgAuthority(code);
BoundingBox boundingBox;
if (Double.isFinite(minX) || Double.isFinite(minX) || Double.isFinite(minX) || Double.isFinite(minX)) {
boundingBox = new BoundingBoxDoubleXY(minX, minY, maxX, maxY);
} else {
boundingBox = BoundingBox.empty();
}
final Area area = new Area(name, boundingBox, authority, deprecated);
AREA_BY_ID.put(code, area);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
}
Aggregations