Search in sources :

Example 6 with ProjectedCoordinateSystem

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

the class EpsgCoordinateSystems method getProjectedCoordinateSystems.

public static List<ProjectedCoordinateSystem> getProjectedCoordinateSystems() {
    final List<ProjectedCoordinateSystem> coordinateSystems = new ArrayList<>();
    for (final CoordinateSystem coordinateSystem : coordinateSystemsByName.values()) {
        if (coordinateSystem instanceof ProjectedCoordinateSystem) {
            final ProjectedCoordinateSystem projectedCoordinateSystem = (ProjectedCoordinateSystem) coordinateSystem;
            coordinateSystems.add(projectedCoordinateSystem);
        }
    }
    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) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) ArrayList(java.util.ArrayList)

Example 7 with ProjectedCoordinateSystem

use of com.revolsys.geometry.cs.ProjectedCoordinateSystem 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();
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) IntHashMap(com.revolsys.collection.map.IntHashMap) CoordinateOperationMethod(com.revolsys.geometry.cs.CoordinateOperationMethod) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) IntHashMap(com.revolsys.collection.map.IntHashMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 8 with ProjectedCoordinateSystem

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

the class EpsgCsWktWriter method write.

public static void write(final PrintWriter out, final CoordinateSystem coordinateSystem) {
    if (coordinateSystem instanceof ProjectedCoordinateSystem) {
        final ProjectedCoordinateSystem projCs = (ProjectedCoordinateSystem) coordinateSystem;
        write(out, projCs);
    } else if (coordinateSystem instanceof GeographicCoordinateSystem) {
        final GeographicCoordinateSystem geoCs = (GeographicCoordinateSystem) coordinateSystem;
        write(out, geoCs);
    }
}
Also used : ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem)

Example 9 with ProjectedCoordinateSystem

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

the class EsriCsWktWriter method write.

public static void write(final Writer out, final CoordinateSystem coordinateSystem, final int indentLevel) {
    try {
        if (coordinateSystem instanceof ProjectedCoordinateSystem) {
            final ProjectedCoordinateSystem projCs = (ProjectedCoordinateSystem) coordinateSystem;
            write(out, projCs, indentLevel);
        } else if (coordinateSystem instanceof GeographicCoordinateSystem) {
            final GeographicCoordinateSystem geoCs = (GeographicCoordinateSystem) coordinateSystem;
            write(out, geoCs, indentLevel);
        } else if (coordinateSystem instanceof VerticalCoordinateSystem) {
            final VerticalCoordinateSystem verticalCs = (VerticalCoordinateSystem) coordinateSystem;
            write(out, verticalCs, indentLevel);
        }
    } catch (final IOException e) {
        throw Exceptions.wrap(e);
    }
}
Also used : VerticalCoordinateSystem(com.revolsys.geometry.cs.VerticalCoordinateSystem) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) IOException(java.io.IOException)

Example 10 with ProjectedCoordinateSystem

use of com.revolsys.geometry.cs.ProjectedCoordinateSystem 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

ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)25 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)18 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)15 CoordinateOperationMethod (com.revolsys.geometry.cs.CoordinateOperationMethod)7 LinearUnit (com.revolsys.geometry.cs.unit.LinearUnit)7 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 Map (java.util.Map)7 BoundingBox (com.revolsys.geometry.model.BoundingBox)4 Point (com.revolsys.geometry.model.Point)4 Record (com.revolsys.record.Record)4 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 IntHashMap (com.revolsys.collection.map.IntHashMap)3 ParameterName (com.revolsys.geometry.cs.ParameterName)3 ParameterValue (com.revolsys.geometry.cs.ParameterValue)3 VerticalCoordinateSystem (com.revolsys.geometry.cs.VerticalCoordinateSystem)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 TreeMap (java.util.TreeMap)3