Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystemAxis


    public void testCorrectAxisOrder() throws NoSuchAuthorityCodeException, FactoryException {
        final CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
        final CoordinateSystem cs = crs.getCoordinateSystem();
        assertEquals(2, cs.getDimension());

        CoordinateSystemAxis axis0 = cs.getAxis(0);
        assertEquals("Lat", axis0.getAbbreviation());

        CoordinateSystemAxis axis1 = cs.getAxis(1);
        assertEquals("Long", axis1.getAbbreviation());
    }
View Full Code Here


    public void testForcedAxisOrder() throws NoSuchAuthorityCodeException, FactoryException {
        final CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", true);
        final CoordinateSystem cs = crs.getCoordinateSystem();
        assertEquals(2, cs.getDimension());

        CoordinateSystemAxis axis0 = cs.getAxis(0);
        assertEquals("Long", axis0.getAbbreviation());

        CoordinateSystemAxis axis1 = cs.getAxis(1);
        assertEquals("Lat", axis1.getAbbreviation());

        final CoordinateReferenceSystem standard = CRS.decode("EPSG:4326");
        assertFalse("Should not be (long,lat) axis order.", CRS.equalsIgnoreMetadata(crs, standard));

        final CoordinateReferenceSystem def;
View Full Code Here

                default:        object=Double.valueOf(value); break;
                case LONGITUDE: object=new Longitude (value); break;
                case LATITUDE:  object=new Latitude  (value); break;
                case ANGLE:     object=new Angle     (value); break;
                case DATE: {
                    final CoordinateSystemAxis axis = cs.getAxis(i);
                    long offset = Math.round(toMillis[fi].convert(value));
                    if (AxisDirection.PAST.equals(axis.getDirection())) {
                        offset = -offset;
                    }
                    object = new Date(epochs[fi] + offset);
                    break;
                }
View Full Code Here

    {
        int candidate = -1;
        final int dimension = cs.getDimension();
        final AxisDirection direction = axis.getDirection().absolute();
        for (int i=0; i<dimension; i++) {
            final CoordinateSystemAxis xi = cs.getAxis(i);
            if (direction.equals(xi.getDirection().absolute())) {
                candidate = i;
                if (axis.equals(xi)) {
                    break;
                }
            }
View Full Code Here

        // see section 7.6.2 of the WCS 1.1.1 spec)
        List<Double> lower = bbox.getLowerCorner();
        List<Double> upper = bbox.getUpperCorner();
        for (int i = 0; i < lower.size(); i++) {
            if (lower.get(i) > upper.get(i)) {
                final CoordinateSystemAxis axis = bboxCRs.getCoordinateSystem().getAxis(i);
                // see if the coordinates can be fixed
                if (bboxCRs instanceof GeographicCRS && axis.getDirection() == AxisDirection.EAST) {

                    if (gridEnvelopeBboxCRS != null) {
                        // try to guess which one needs to be fixed
                        final double envMax = gridEnvelopeBboxCRS.getMaximum(i);
                        if (envMax >= lower.get(i))
                            upper.set(i, upper.get(i) + (axis.getMaximumValue() - axis.getMinimumValue()));
                        else
                            lower.set(i, lower.get(i) - (axis.getMaximumValue() - axis.getMinimumValue()));
                           
                    } else {
                        // just fix the upper and hope...
                        upper.set(i, upper.get(i) + (axis.getMaximumValue() - axis.getMinimumValue()));
                    }
                }

                // if even after the fix we're in the wrong situation, complain
                if (lower.get(i) > upper.get(i)) {
View Full Code Here

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

        // initialize the longitude dimension, if we have a longitude, that is
        CoordinateSystem cs = crs.getCoordinateSystem();
        this.dimensions = cs.getDimension();
        this.ordinates = new double[dimensions * 2];
        for (int i = 0; i < dimensions; i++) {
            CoordinateSystemAxis axis = cs.getAxis(i);
            if (CRS.equalsIgnoreMetadata(axis, DefaultCoordinateSystemAxis.LONGITUDE)) {
                longitudeDimension = i;
                break;
            }
        }
View Full Code Here

        final int dimension=cs.getDimension();
        // loop through dimensions
        final ArrayList<String> retValue=new ArrayList<String>();
        if (!axesSwitch) {
            for (int i = 0; i < dimension; i++) {
                CoordinateSystemAxis axis = cs.getAxis(i);
                retValue.add(getAxisLabel(axis)); // use axis abbreviation
            }
        } else {
            int northing=-1, easting=-1;
            for (int i = 0; i < dimension; i++) {
                final CoordinateSystemAxis axis = cs.getAxis(i);
                if (Math.abs(DefaultCoordinateSystemAxis.getAngle(axis.getDirection(), DefaultCoordinateSystemAxis.LONGITUDE.getDirection()))<1E-6) {
                    easting = i;
                } else if (Math.abs(DefaultCoordinateSystemAxis.getAngle(axis.getDirection(), DefaultCoordinateSystemAxis.LATITUDE.getDirection()))<1E-6){
                    northing = i;
                }
                retValue.add(getAxisLabel(axis)); // use axis abbreviation
            }      
           
View Full Code Here

            final String axisAbbreviation=axesAbbreviations.get(i);
            int pos=-1;
            // search for this dimension in cs axes
            for(int j=0;j<crsDimension;j++){
                // check exact abbreviation
                CoordinateSystemAxis axis = cs.getAxis(j);
                if(getAxisLabel(axis).equals(axisAbbreviation)){
                    pos=j; // FOUND!!!
                    break;
                }
            }
View Full Code Here

        // see section 7.6.2 of the WCS 1.1.1 spec)
        List<Double> lower = bbox.getLowerCorner();
        List<Double> upper = bbox.getUpperCorner();
        for (int i = 0; i < lower.size(); i++) {
            if (lower.get(i) > upper.get(i)) {
                final CoordinateSystemAxis axis = bboxCRs.getCoordinateSystem().getAxis(i);
                // see if the coordinates can be fixed
                if (bboxCRs instanceof GeographicCRS && axis.getDirection() == AxisDirection.EAST) {

                    if (gridEnvelopeBboxCRS != null) {
                        // try to guess which one needs to be fixed
                        final double envMax = gridEnvelopeBboxCRS.getMaximum(i);
                        if (envMax >= lower.get(i))
                            upper.set(i,
                                    upper.get(i)
                                            + (axis.getMaximumValue() - axis.getMinimumValue()));
                        else
                            lower.set(i,
                                    lower.get(i)
                                            - (axis.getMaximumValue() - axis.getMinimumValue()));

                    } else {
                        // just fix the upper and hope...
                        upper.set(i,
                                upper.get(i) + (axis.getMaximumValue() - axis.getMinimumValue()));
                    }
                }

                // if even after the fix we're in the wrong situation, complain
                if (lower.get(i) > upper.get(i)) {
View Full Code Here

TOP

Related Classes of org.opengis.referencing.cs.CoordinateSystemAxis

Copyright © 2018 www.massapicom. 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.