Examples of CoordinateSystem


Examples of org.opengis.referencing.cs.CoordinateSystem

     * Returns the coordinate system if it is of the given type, or {@code null} otherwise.
     * This method is invoked by subclasses that can accept more than one CS type.
     */
    @SuppressWarnings("unchecked")
    final <T extends CoordinateSystem> T getCoordinateSystem(final Class<T> type) {
        final CoordinateSystem cs = coordinateSystem;
        if (type.isInstance(cs)) {
            // Special case for AfficeCS: must ensure that the cs is not the CartesianCS subtype.
            if (type != AffineCS.class || !(cs instanceof CartesianCS)) {
                return (T) cs;
            }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

     * @return {@inheritDoc}
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        final String  keyword = super.formatTo(formatter);
        final CoordinateSystem cs = coordinateSystem;
        final boolean isWKT1  = formatter.getConvention().majorVersion() == 1;
        final Unit<?> unit    = ReferencingUtilities.getUnit(cs);
        final Unit<?> oldUnit = formatter.addContextualUnit(unit);
        formatter.newLine();
        formatter.append(toFormattable(getDatum()));
        formatter.newLine();
        if (isWKT1) { // WKT 1 writes unit before axes, while WKT 2 writes them after axes.
            formatter.append(unit);
            if (unit == null) {
                formatter.setInvalidWKT(this, null);
            }
        } else {
            formatter.append(toFormattable(cs)); // The concept of CoordinateSystem was not explicit in WKT 1.
            formatter.indent(+1);
        }
        final int dimension = cs.getDimension();
        for (int i=0; i<dimension; i++) {
            formatter.newLine();
            formatter.append(toFormattable(cs.getAxis(i)));
        }
        if (!isWKT1) { // WKT 2 writes unit after axes, while WKT 1 wrote them before axes.
            formatter.newLine();
            formatter.append(unit);
            formatter.indent(-1);
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

     *
     * @throws ConversionException Should not happen.
     */
    @Test
    public void testSwapAndScaleAxes2D() throws ConversionException {
        final CoordinateSystem λφ = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(λ,φ)"),
                HardCodedAxes.GEODETIC_LONGITUDE,
                HardCodedAxes.GEODETIC_LATITUDE);
        final CoordinateSystem φλ = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(φ,λ)"),
                HardCodedAxes.GEODETIC_LATITUDE,
                HardCodedAxes.GEODETIC_LONGITUDE);
        final Matrix expected = Matrices.create(3, 3, new double[] {
                0, 1, 0,
                1, 0, 0,
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

     */
    public static void ensureDimensionMatches(final String name, final int expected,
            final CoordinateReferenceSystem crs) throws MismatchedDimensionException
    {
        if (crs != null) {
            final CoordinateSystem cs = crs.getCoordinateSystem();
            if (cs != null) { // Should never be null, but let be safe.
                final int dimension = cs.getDimension();
                if (dimension != expected) {
                    throw new MismatchedDimensionException(Errors.format(
                            Errors.Keys.MismatchedDimension_3, name, expected, dimension));
                }
            }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

     * @throws ConversionException Should not happen.
     */
    @Test
    @DependsOnMethod("testSwapAndScaleAxes2D")
    public void testSwapAndScaleAxes3D() throws ConversionException {
        final CoordinateSystem λφh = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(λ,φ,h)"),
                HardCodedAxes.GEODETIC_LONGITUDE,
                HardCodedAxes.GEODETIC_LATITUDE,
                HardCodedAxes.ELLIPSOIDAL_HEIGHT);
        final CoordinateSystem φλh = new DefaultEllipsoidalCS(singletonMap(NAME_KEY, "(φ,λ,h)"),
                HardCodedAxes.GEODETIC_LATITUDE,
                HardCodedAxes.GEODETIC_LONGITUDE,
                HardCodedAxes.ELLIPSOIDAL_HEIGHT);
        final Matrix expected = Matrices.create(4, 4, new double[] {
                0, 1, 0, 0,
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

     * @throws ConversionException Should not happen.
     */
    @Test
    @DependsOnMethod("testSwapAndScaleAxes3D")
    public void testSwapAndScaleAxes() throws ConversionException {
        final CoordinateSystem hxy = new DefaultCartesianCS(singletonMap(NAME_KEY, "(h,x,y)"),
                HardCodedAxes.HEIGHT_cm,
                HardCodedAxes.EASTING,
                HardCodedAxes.NORTHING);
        final CoordinateSystem yxh = new DefaultCartesianCS(singletonMap(NAME_KEY, "(y,x,h)"),
                HardCodedAxes.SOUTHING,
                HardCodedAxes.EASTING,
                HardCodedAxes.DEPTH);
        assertTrue(swapAndScaleAxes(hxy, hxy).isIdentity());
        assertTrue(swapAndScaleAxes(yxh, yxh).isIdentity());
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

    private int indexOfX(CoordinateReferenceSystem crs) {
        return indexOf(crs, LEFTDirections);
    }

    private int indexOf(CoordinateReferenceSystem crs, Set<AxisDirection> direction) {
        CoordinateSystem cs = crs.getCoordinateSystem();
        for (int index = 0; index < cs.getDimension(); index++) {
            CoordinateSystemAxis axis = cs.getAxis(index);
            if (direction.contains(axis.getDirection()))
                return index;
        }
        return -1;
    }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

    /**
     * Returns a positive number if the specified coordinate system is right-handed,
     * or a negative number if it is left handed.
     */
    private static double getAngle(final CoordinateReferenceSystem crs) {
        final CoordinateSystem cs = crs.getCoordinateSystem();
        assertEquals(2, cs.getDimension());
        return DefaultCoordinateSystemAxis.getAngle(cs.getAxis(0).getDirection(),
                                                    cs.getAxis(1).getDirection());
    }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

        // CRS with "South along 180 deg" and "South along 90 deg East" axis
        sourceCRS = factory.createCoordinateReferenceSystem("EPSG:32661");
        targetCRS = factory.createCoordinateReferenceSystem("4326");
        operation = opf.createOperation(sourceCRS, targetCRS);
        final MathTransform    transform = operation.getMathTransform();
        final CoordinateSystem  sourceCS = sourceCRS.getCoordinateSystem();
        final CoordinateSystemAxis axis0 = sourceCS.getAxis(0);
        final CoordinateSystemAxis axis1 = sourceCS.getAxis(1);
        assertEquals("Northing",                axis0.getName().getCode());
        assertEquals("Easting",                 axis1.getName().getCode());
        assertEquals("South along 180 deg",     axis0.getDirection().name());
        assertEquals("South along 90 deg East", axis1.getDirection().name());
        assertFalse(transform.isIdentity());
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystem

                    //TODO: stop being lame and properly figure out the dimension and bounds, see
                    // oracle dialect for the proper way to do it
                    String bbox = null;
                    if (gd.getCoordinateReferenceSystem() != null) {
                        CoordinateReferenceSystem crs = gd.getCoordinateReferenceSystem();
                        CoordinateSystem cs = crs.getCoordinateSystem();
                        if (cs.getDimension() == 2) {
                            CoordinateSystemAxis a0 = cs.getAxis(0);
                            CoordinateSystemAxis a1 = cs.getAxis(1);
                            bbox = "(";
                            bbox += (Double.isInfinite(a0.getMinimumValue()) ?
                                DEFAULT_AXIS_MIN : a0.getMinimumValue()) + ", ";
                            bbox += (Double.isInfinite(a1.getMinimumValue()) ?
                                DEFAULT_AXIS_MIN : a1.getMinimumValue()) + ", ";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.