Search in sources :

Example 11 with CoordinateSystem

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

the class EpsgCoordinateSystems method getGeographicCoordinateSystems.

public static List<GeographicCoordinateSystem> getGeographicCoordinateSystems() {
    final List<GeographicCoordinateSystem> coordinateSystems = new ArrayList<>();
    for (final CoordinateSystem coordinateSystem : coordinateSystemsByName.values()) {
        if (coordinateSystem instanceof GeographicCoordinateSystem) {
            final GeographicCoordinateSystem geographicCoordinateSystem = (GeographicCoordinateSystem) coordinateSystem;
            coordinateSystems.add(geographicCoordinateSystem);
        }
    }
    return coordinateSystems;
}
Also used : ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeocentricCoordinateSystem(com.revolsys.geometry.cs.GeocentricCoordinateSystem) CompoundCoordinateSystem(com.revolsys.geometry.cs.CompoundCoordinateSystem) VerticalCoordinateSystem(com.revolsys.geometry.cs.VerticalCoordinateSystem) EngineeringCoordinateSystem(com.revolsys.geometry.cs.EngineeringCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) ArrayList(java.util.ArrayList) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem)

Example 12 with CoordinateSystem

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

the class EpsgCoordinateSystems method addCoordinateSystem.

private static void addCoordinateSystem(final CoordinateSystem coordinateSystem) {
    if (coordinateSystem != null) {
        final Integer id = coordinateSystem.getCoordinateSystemId();
        final String name = coordinateSystem.getCoordinateSystemName();
        COORDINATE_SYSTEM_BY_ID.put(id, coordinateSystem);
        coordinateSystemsById.put(id, coordinateSystem);
        final int hashCode = coordinateSystem.hashCode();
        List<CoordinateSystem> coordinateSystems = coordinateSystemsByCoordinateSystem.get(hashCode);
        if (coordinateSystems == null) {
            coordinateSystems = new ArrayList<>();
            coordinateSystemsByCoordinateSystem.put(hashCode, coordinateSystems);
        }
        coordinateSystems.add(coordinateSystem);
        coordinateSystemsByName.put(name, coordinateSystem);
    }
}
Also used : ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeocentricCoordinateSystem(com.revolsys.geometry.cs.GeocentricCoordinateSystem) CompoundCoordinateSystem(com.revolsys.geometry.cs.CompoundCoordinateSystem) VerticalCoordinateSystem(com.revolsys.geometry.cs.VerticalCoordinateSystem) EngineeringCoordinateSystem(com.revolsys.geometry.cs.EngineeringCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString)

Example 13 with CoordinateSystem

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

the class EpsgCoordinateSystems method getCodes.

@Override
public Map<Identifier, List<Object>> getCodes() {
    if (this.codes == null) {
        final Map<Identifier, List<Object>> codesById = new HashMap<>();
        for (final CoordinateSystem coordinateSystem : coordinateSystems) {
            final int coordinateSystemId = coordinateSystem.getCoordinateSystemId();
            final Identifier id = Identifier.newIdentifier(coordinateSystemId);
            final List<Object> code = Collections.singletonList(coordinateSystem);
            codesById.put(id, code);
        }
        this.codes = codesById;
    }
    return this.codes;
}
Also used : Identifier(com.revolsys.identifier.Identifier) IntHashMap(com.revolsys.collection.map.IntHashMap) HashMap(java.util.HashMap) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeocentricCoordinateSystem(com.revolsys.geometry.cs.GeocentricCoordinateSystem) CompoundCoordinateSystem(com.revolsys.geometry.cs.CompoundCoordinateSystem) VerticalCoordinateSystem(com.revolsys.geometry.cs.VerticalCoordinateSystem) EngineeringCoordinateSystem(com.revolsys.geometry.cs.EngineeringCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) List(java.util.List) ArrayList(java.util.ArrayList)

Example 14 with CoordinateSystem

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

the class EpsgCoordinateSystems method getIdentifiers.

@Override
public List<Identifier> getIdentifiers() {
    if (this.identifiers == null) {
        final List<Identifier> identifiers = new ArrayList<>();
        for (final CoordinateSystem coordinateSystem : coordinateSystems) {
            final int coordinateSystemId = coordinateSystem.getCoordinateSystemId();
            final Identifier id = Identifier.newIdentifier(coordinateSystemId);
            identifiers.add(id);
        }
        this.identifiers = Collections.unmodifiableList(identifiers);
    }
    return this.identifiers;
}
Also used : Identifier(com.revolsys.identifier.Identifier) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeocentricCoordinateSystem(com.revolsys.geometry.cs.GeocentricCoordinateSystem) CompoundCoordinateSystem(com.revolsys.geometry.cs.CompoundCoordinateSystem) VerticalCoordinateSystem(com.revolsys.geometry.cs.VerticalCoordinateSystem) EngineeringCoordinateSystem(com.revolsys.geometry.cs.EngineeringCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) ArrayList(java.util.ArrayList)

Example 15 with CoordinateSystem

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

the class LineString method getLength.

@Override
default double getLength(final Unit<Length> unit) {
    double length = 0;
    final CoordinateSystem coordinateSystem = getCoordinateSystem();
    if (coordinateSystem instanceof GeographicCoordinateSystem) {
        final int vertexCount = getVertexCount();
        if (vertexCount > 1) {
            double lon0 = getX(0);
            double lat0 = getY(0);
            for (int i = 1; i < vertexCount; i++) {
                final double lon1 = getX(i);
                final double lat1 = getY(i);
                length += GeographicCoordinateSystem.distanceMetres(lon0, lat0, lon1, lat1);
                lon0 = lon1;
                lat0 = lat1;
            }
        }
        final Quantity<Length> lengthMeasure = Quantities.getQuantity(length, Units.METRE);
        length = QuantityType.doubleValue(lengthMeasure, unit);
    } else if (coordinateSystem instanceof ProjectedCoordinateSystem) {
        final ProjectedCoordinateSystem projectedCoordinateSystem = (ProjectedCoordinateSystem) coordinateSystem;
        final Unit<Length> lengthUnit = projectedCoordinateSystem.getLengthUnit();
        length = getLength();
        final Quantity<Length> lengthMeasure = Quantities.getQuantity(length, lengthUnit);
        length = QuantityType.doubleValue(lengthMeasure, unit);
    } else {
        length = getLength();
    }
    return length;
}
Also used : Length(javax.measure.quantity.Length) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) Quantity(javax.measure.Quantity) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) Unit(javax.measure.Unit)

Aggregations

CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)51 ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)28 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)25 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)14 BoundingBox (com.revolsys.geometry.model.BoundingBox)11 Point (com.revolsys.geometry.model.Point)8 CompoundCoordinateSystem (com.revolsys.geometry.cs.CompoundCoordinateSystem)7 EngineeringCoordinateSystem (com.revolsys.geometry.cs.EngineeringCoordinateSystem)7 GeocentricCoordinateSystem (com.revolsys.geometry.cs.GeocentricCoordinateSystem)7 VerticalCoordinateSystem (com.revolsys.geometry.cs.VerticalCoordinateSystem)7 ArrayList (java.util.ArrayList)6 CoordinateOperationMethod (com.revolsys.geometry.cs.CoordinateOperationMethod)5 Map (java.util.Map)5 DataType (com.revolsys.datatype.DataType)4 LinearUnit (com.revolsys.geometry.cs.unit.LinearUnit)4 Record (com.revolsys.record.Record)4 FieldDefinition (com.revolsys.record.schema.FieldDefinition)4 PrintWriter (java.io.PrintWriter)4 IntHashMap (com.revolsys.collection.map.IntHashMap)3 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)3