Search in sources :

Example 1 with AxisName

use of com.revolsys.geometry.cs.AxisName 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;
}
Also used : WrappedException(com.revolsys.util.WrappedException) UnitOfMeasure(com.revolsys.geometry.cs.unit.UnitOfMeasure) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString) NoSuchResourceException(com.revolsys.spring.resource.NoSuchResourceException) IntHashMap(com.revolsys.collection.map.IntHashMap) AxisName(com.revolsys.geometry.cs.AxisName) ChannelReader(com.revolsys.io.channels.ChannelReader) EOFException(java.io.EOFException) List(java.util.List) ArrayList(java.util.ArrayList) Axis(com.revolsys.geometry.cs.Axis)

Example 2 with AxisName

use of com.revolsys.geometry.cs.AxisName in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method loadCoordinateAxisNames.

private static void loadCoordinateAxisNames() {
    try (ChannelReader reader = newChannelReader("coordinateAxisName")) {
        while (true) {
            final int code = reader.getInt();
            final String name = reader.getStringUtf8ByteCount();
            final AxisName axisName = new AxisName(code, name);
            AXIS_NAMES.putInt(code, axisName);
            AXIS_NAME_BY_NAME.put(name.toLowerCase(), axisName);
        }
    } catch (final NoSuchResourceException e) {
    } catch (final WrappedException e) {
        if (Exceptions.isException(e, EOFException.class)) {
        } else {
            throw e;
        }
    }
}
Also used : NoSuchResourceException(com.revolsys.spring.resource.NoSuchResourceException) AxisName(com.revolsys.geometry.cs.AxisName) WrappedException(com.revolsys.util.WrappedException) ChannelReader(com.revolsys.io.channels.ChannelReader) EOFException(java.io.EOFException) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString)

Aggregations

AxisName (com.revolsys.geometry.cs.AxisName)2 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)2 ChannelReader (com.revolsys.io.channels.ChannelReader)2 NoSuchResourceException (com.revolsys.spring.resource.NoSuchResourceException)2 WrappedException (com.revolsys.util.WrappedException)2 EOFException (java.io.EOFException)2 IntHashMap (com.revolsys.collection.map.IntHashMap)1 Axis (com.revolsys.geometry.cs.Axis)1 UnitOfMeasure (com.revolsys.geometry.cs.unit.UnitOfMeasure)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1