use of com.revolsys.collection.map.IntHashMap 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.collection.map.IntHashMap 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.collection.map.IntHashMap in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method initialize.
public static synchronized void initialize() {
if (!initialized) {
initialized = true;
final long startTime = System.currentTimeMillis();
try {
loadUnitOfMeasure();
loadCoordinateAxisNames();
final IntHashMap<List<Axis>> axisMap = loadCoordinateAxis();
loadArea();
loadPrimeMeridians();
loadDatum();
loadCoordOperationParam();
final IntHashMap<List<ParameterName>> paramOrderByMethodId = new IntHashMap<>();
final IntHashMap<List<Byte>> paramReversalByMethodId = new IntHashMap<>();
loadCoordOperationParamUsage(paramOrderByMethodId, paramReversalByMethodId);
final IntHashMap<CoordinateOperationMethod> methodById = loadCoordOperationMethod(paramOrderByMethodId, paramReversalByMethodId);
final IntHashMap<Map<ParameterName, ParameterValue>> operationParameters = new IntHashMap<>();
loadCoordOperationParamValue(methodById, operationParameters, paramReversalByMethodId);
loadCoordOperation(methodById, operationParameters, paramReversalByMethodId);
loadCoordinateSystem();
loadCoordinateReferenceSystem(axisMap);
final ProjectedCoordinateSystem worldMercator = (ProjectedCoordinateSystem) coordinateSystemsById.get(3857);
coordinateSystemsById.put(900913, worldMercator);
coordinateSystems = Collections.unmodifiableSet(new LinkedHashSet<>(coordinateSystemsById.values()));
Dates.debugEllapsedTime(EpsgCoordinateSystems.class, "initialize", startTime);
} catch (final Throwable t) {
t.printStackTrace();
}
}
}
use of com.revolsys.collection.map.IntHashMap in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadEllipsoid.
private static IntHashMap<Ellipsoid> loadEllipsoid() {
final IntHashMap<Ellipsoid> ellipsoids = new IntHashMap<>();
try (ChannelReader reader = newChannelReader("ellipsoid")) {
while (true) {
final int id = reader.getInt();
final String name = reader.getStringUtf8ByteCount();
final int unitId = reader.getInt();
final LinearUnit unit = (LinearUnit) UNIT_BY_ID.get(unitId);
final double semiMinorAxis = unit.toBase(reader.getDouble());
final double semiMajorAxis = unit.toBase(reader.getDouble());
final double inverseFlattening = unit.toBase(reader.getDouble());
final int ellipsoidShape = reader.getByte();
final boolean deprecated = readBoolean(reader);
final EpsgAuthority authority = new EpsgAuthority(id);
final Ellipsoid ellipsoid = new Ellipsoid(name, semiMajorAxis, semiMinorAxis, inverseFlattening, authority, deprecated);
ellipsoids.put(id, ellipsoid);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
return ellipsoids;
}
Aggregations