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;
}
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();
}
}
}
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);
}
}
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);
}
}
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;
}
Aggregations