/** Creates the coordinate reference system from datum and coordinate system computed in previous steps. */ @Override void createCRS(CRSFactory factory, Map<String,?> properties) throws FactoryException { referenceSystem = factory.createGeocentricCRS(properties, datum, coordinateSystem); } };
createProperties(name, epsg, area, scope, remarks); if (cs instanceof CartesianCS) { crs = factory.createGeocentricCRS(properties, datum, (CartesianCS) cs); } else if (cs instanceof SphericalCS) { crs = factory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } else { result.close();
generateProperties(name, epsg, area, scope, remarks); if (cs instanceof CartesianCS) { crs = factory.createGeocentricCRS(properties, datum, (CartesianCS) cs); } else if (cs instanceof SphericalCS) { crs = factory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } else { result.close();
/** * Makes sure that the specified geocentric CRS uses standard axis, prime meridian and the * specified datum. If {@code crs} already meets all those conditions, then it is returned * unchanged. Otherwise, a new normalized geocentric CRS is created and returned. * * @param crs The geocentric coordinate reference system to normalize. * @param datum The expected datum. * @return The normalized coordinate reference system. * @throws FactoryException if the construction of a new CRS was needed but failed. */ private GeocentricCRS normalize(final GeocentricCRS crs, final GeodeticDatum datum) throws FactoryException { final CartesianCS STANDARD = DefaultCartesianCS.GEOCENTRIC; final GeodeticDatum candidate = crs.getDatum(); if (equalsIgnorePrimeMeridian(candidate, datum)) { if (getGreenwichLongitude(candidate.getPrimeMeridian()) == getGreenwichLongitude(datum.getPrimeMeridian())) { if (hasStandardAxis(crs.getCoordinateSystem(), STANDARD)) { return crs; } } } final CRSFactory crsFactory = getFactoryContainer().getCRSFactory(); return crsFactory.createGeocentricCRS(getTemporaryName(crs), datum, STANDARD); }
return crsFactory.createGeocentricCRS( properties, datum,
final GeodeticDatum gd = (GeodeticDatum) datum; if (cs instanceof CartesianCS) { modified = crsFactory.createGeocentricCRS(properties, gd, (CartesianCS) cs); } else { modified = crsFactory.createGeocentricCRS(properties, gd, (SphericalCS) cs);
/** * Invoked when a {@code createFoo(…)} method is given a combined URI containing a datum and a coordinate system. * If the given information are not sufficient or not applicable, then this method returns {@code null}. * * @param datum the datum, or {@code null} if missing. * @param cs the coordinate system (never null). * @return the combined CRS, or {@code null} if the given information are not sufficient. * @throws FactoryException if an error occurred while creating the combined CRS. */ private static GeodeticCRS combine(final GeodeticDatum datum, final CoordinateSystem cs) throws FactoryException { final Map<String,?> properties = IdentifiedObjects.getProperties(datum, Datum.IDENTIFIERS_KEY); final CRSFactory factory = DefaultFactories.forBuildin(CRSFactory.class); if (datum instanceof GeodeticDatum) { if (cs instanceof EllipsoidalCS) { return factory.createGeographicCRS(properties, datum, (EllipsoidalCS) cs); } else if (cs instanceof SphericalCS) { return factory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } } return null; }
/** * Invoked when a {@code createFoo(…)} method is given a combined URI containing a datum and a coordinate system. * If the given information are not sufficient or not applicable, then this method returns {@code null}. * * @param datum the datum, or {@code null} if missing. * @param cs the coordinate system (never null). * @return the combined CRS, or {@code null} if the given information are not sufficient. * @throws FactoryException if an error occurred while creating the combined CRS. */ private static GeodeticCRS combine(final GeodeticDatum datum, final CoordinateSystem cs) throws FactoryException { final Map<String,?> properties = IdentifiedObjects.getProperties(datum, Datum.IDENTIFIERS_KEY); final CRSFactory factory = DefaultFactories.forBuildin(CRSFactory.class); if (datum instanceof GeodeticDatum) { if (cs instanceof EllipsoidalCS) { return factory.createGeographicCRS(properties, datum, (EllipsoidalCS) cs); } else if (cs instanceof SphericalCS) { return factory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } } return null; }
if (getGreenwichLongitude(targetPM) == 0) { stepCRS = crsFactory.createGeocentricCRS( getTemporaryName(targetCRS), targetDatum, STANDARD); } else { stepCRS = crsFactory.createGeocentricCRS( getTemporaryName(sourceCRS), sourceDatum, STANDARD);
/** * Creates a geocentric CRS for the given properties and verify its properties after construction. * * @param crsCode the GIGS code of the CRS to create. * @param crsName the GIGS name of the CRS to create. * @param csCode the EPSG code of the coordinate system. * @throws FactoryException if an error occurred while creating the CRS instance. */ @SuppressWarnings("null") private void createAndVerifyGeocentricCRS(final int crsCode, final String crsName, final int csCode) throws FactoryException { if (crsFactory != null) { final GeocentricCRS crs = crsFactory.createGeocentricCRS(properties(crsCode, crsName), getIdentifiedObject(), epsgFactory.createCartesianCS(String.valueOf(csCode))); assertNotNull("CRSFactory.createGeocentricCRS(…) shall not return null.", crs); validators.validate(crs); verifyIdentification(crs, crsName, String.valueOf(crsCode)); verifyCoordinateSystem(crs.getCoordinateSystem(), CartesianCS.class, GIGS2004.GEOCENTRIC, units.metre()); } }
cs = replaceLinearUnit(cs, linearUnit); final GeocentricCRS crs = getCRSFactory().createGeocentricCRS(properties(getOrDefault(names, GCRS)), datum, cs); lastName = crs.getName(); return crs;
return crsFactory.createGeocentricCRS(name, createDatum(pj, parser), csFactory.createCartesianCS(csName, axes[0], axes[1], axes[2]));
return crsFactory.createGeocentricCRS(name, createDatum(pj, parser), csFactory.createCartesianCS(csName, axes[0], axes[1], axes[2]));
return crsFactory.createGeocentricCRS(properties, datum, referencing.upgradeGeocentricCS((CartesianCS) cs)); return crsFactory.createGeocentricCRS(properties, datum, (SphericalCS) cs);
return crsFactory.createGeocentricCRS(properties, datum, referencing.upgradeGeocentricCS((CartesianCS) cs)); return crsFactory.createGeocentricCRS(properties, datum, (SphericalCS) cs);
csFactory.createCartesianCS(name("Rendered Cartesian CS"), x_axis, z_axis, y_axis); final GeocentricCRS output_crs = crsFactory.createGeocentricCRS(name("Output Cartesian CRS"), wgs84, world_cs);
name, epsg, area, scope, remarks, deprecated); if (cs instanceof CartesianCS) { crs = crsFactory.createGeocentricCRS(properties, datum, (CartesianCS) cs); } else if (cs instanceof SphericalCS) { crs = crsFactory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } else { throw new FactoryDataException(error().getString(
name, epsg, area, scope, remarks, deprecated); if (cs instanceof CartesianCS) { crs = crsFactory.createGeocentricCRS(properties, datum, (CartesianCS) cs); } else if (cs instanceof SphericalCS) { crs = crsFactory.createGeocentricCRS(properties, datum, (SphericalCS) cs); } else { throw new FactoryDataException(error().getString(
/** * Tests the creation of a geocentric CRS. * * @throws FactoryException if a factory fails to create a referencing object. */ @Test public void testGeocentric() throws FactoryException { final CoordinateSystemAxis X, Y, Z; final CartesianCS cs; final GeocentricCRS crs; // The final product of this method. final GeodeticDatum datum; final PrimeMeridian greenwich; final Ellipsoid ellipsoid; final Unit<Length> metre = units.metre(); final Unit<Angle> degree = units.degree(); assumeNotNull(datumFactory); validators.validate(greenwich = datumFactory.createPrimeMeridian (name("Greenwich Meridian"), 0, degree)); validators.validate(ellipsoid = datumFactory.createFlattenedSphere(name("WGS84 Ellipsoid"), 6378137, 298.257223563, metre)); validators.validate(datum = datumFactory.createGeodeticDatum (name("WGS84 Datum"), ellipsoid, greenwich)); assumeNotNull(csFactory); validators.validate(X = csFactory.createCoordinateSystemAxis(name("Geocentric X"), "X", GEOCENTRIC_X, metre)); validators.validate(Y = csFactory.createCoordinateSystemAxis(name("Geocentric Y"), "Y", GEOCENTRIC_Y, metre)); validators.validate(Z = csFactory.createCoordinateSystemAxis(name("Geocentric Z"), "Z", GEOCENTRIC_Z, metre)); validators.validate(cs = csFactory.createCartesianCS(name("Geocentric CS"), X, Z, Y)); assumeNotNull(crsFactory); validators.validate(crs = crsFactory.createGeocentricCRS(name("Geocentric CRS"), datum, cs)); assertAxisDirectionsEqual("GeocentricCRS", crs.getCoordinateSystem(), GEOCENTRIC_X, GEOCENTRIC_Z, GEOCENTRIC_Y); }