Examples of DirectPosition


Examples of org.opengis.geometry.DirectPosition

            xmax = +180;
        } else {
            xmin = xLower;
            xmax = xUpper;
        }
        final DirectPosition lower = test.getLowerCorner();
        final DirectPosition upper = test.getUpperCorner();
        assertEquals("lower", xLower, lower.getOrdinate(0), STRICT);
        assertEquals("upper", xUpper, upper.getOrdinate(0), STRICT);
        assertEquals("xmin",  xmin,   test .getMinimum (0), STRICT);
        assertEquals("xmax",  xmax,   test .getMaximum (0), STRICT);
        assertEquals("ymin",  ymin,   test .getMinimum (1), STRICT);
        assertEquals("ymax",  ymax,   test .getMaximum (1), STRICT);
        assertEquals("ymin",  ymin,   lower.getOrdinate(1), STRICT);
        assertEquals("ymax",  ymax,   upper.getOrdinate(1), STRICT);
        if (test instanceof Envelope2D) {
            final Envelope2D ri = (Envelope2D) test;
            assertEquals("xmin", xmin, ri.getMinX(), STRICT);
            assertEquals("xmax", xmax, ri.getMaxX(), STRICT);
            assertEquals("ymin", ymin, ri.getMinY(), STRICT);
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

    public boolean equals(final Object object) {
        if (object == this) {
            return true;
        }
        if (object instanceof DirectPosition) {
            final DirectPosition that = (DirectPosition) object;
            final int dimension = getDimension();
            if (dimension == that.getDimension()) {
                for (int i=0; i<dimension; i++) {
                    if (doubleToLongBits(getOrdinate(i)) != doubleToLongBits(that.getOrdinate(i))) {
                        return false;
                    }
                }
                if (Objects.equals(this.getCoordinateReferenceSystem(),
                                   that.getCoordinateReferenceSystem()))
                {
                    assert hashCode() == that.hashCode() : this;
                    return true;
                }
            }
        }
        return false;
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        final Envelope2D disjoint   = (Envelope2D) create(RECTANGLE, -2, 10, 35, 40);
        final Envelope2D spanning   = (Envelope2D) create(RECTANGLE, 16, -8, 35, 40);
        for (int type=0; type<LAST; type++) {
            final String label = "Type " + type;
            final Envelope envelope = create(type, 12, -4, 30, 50);
            final DirectPosition lower = envelope.getLowerCorner();
            final DirectPosition upper = envelope.getUpperCorner();
            assertEquals(label,   30, envelope.getMinimum (1), STRICT);
            assertEquals(label,   50, envelope.getMaximum (1), STRICT);
            assertEquals(label,   40, envelope.getMedian  (1), STRICT);
            assertEquals(label,   20, envelope.getSpan    (1), STRICT);
            assertEquals(label,   12, lower   .getOrdinate(0), STRICT);
            assertEquals(label, -180, envelope.getMinimum (0), STRICT);
            assertEquals(label,   -4, upper   .getOrdinate(0), STRICT);
            assertEquals(label, +180, envelope.getMaximum (0), STRICT);
            assertEquals(label, -176, envelope.getMedian  (0), STRICT);
            assertEquals(label,  344, envelope.getSpan    (0), STRICT); // 360° - testSimpleEnvelope()
            switch (type) {
                default: {
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

    public void setEnvelope(final Envelope envelope) throws MismatchedDimensionException {
        ensureNonNull("envelope", envelope);
        final int beginIndex = beginIndex();
        final int dimension = endIndex() - beginIndex;
        ensureDimensionMatches("envelope", dimension, envelope);
        final DirectPosition lower = envelope.getLowerCorner();
        final DirectPosition upper = envelope.getUpperCorner();
        final int d = ordinates.length >>> 1;
        for (int i=0; i<dimension; i++) {
            final int iLower = beginIndex + i;
            final int iUpper = iLower + d;
            ordinates[iLower] = lower.getOrdinate(i);
            ordinates[iUpper] = upper.getOrdinate(i);
        }
        final CoordinateReferenceSystem envelopeCRS = envelope.getCoordinateReferenceSystem();
        if (envelopeCRS != null) {
            crs = envelopeCRS;
            assert crs.getCoordinateSystem().getDimension() == getDimension() : crs;
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        ensureNonNull("envelope", envelope);
        final int beginIndex = beginIndex();
        final int dimension = endIndex() - beginIndex;
        ensureDimensionMatches("envelope", dimension, envelope);
        assert equalsIgnoreMetadata(crs, envelope.getCoordinateReferenceSystem(), true) : envelope;
        final DirectPosition lower = envelope.getLowerCorner();
        final DirectPosition upper = envelope.getUpperCorner();
        final int d = ordinates.length >>> 1;
        for (int i=0; i<dimension; i++) {
            final int iLower = beginIndex + i;
            final int iUpper = iLower + d;
            final double min0 = ordinates[iLower];
            final double max0 = ordinates[iUpper];
            final double min1 = lower.getOrdinate(i);
            final double max1 = upper.getOrdinate(i);
            final boolean sp0 = isNegative(max0 - min0);
            final boolean sp1 = isNegative(max1 - min1);
            if (sp0 == sp1) {
                /*
                 * Standard case (for rows in the above pictures), or case where both envelopes
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        ensureNonNull("envelope", envelope);
        final int beginIndex = beginIndex();
        final int dimension = endIndex() - beginIndex;
        ensureDimensionMatches("envelope", dimension, envelope);
        assert equalsIgnoreMetadata(crs, envelope.getCoordinateReferenceSystem(), true) : envelope;
        final DirectPosition lower = envelope.getLowerCorner();
        final DirectPosition upper = envelope.getUpperCorner();
        final int d = ordinates.length >>> 1;
        for (int i=beginIndex; i<dimension; i++) {
            final int iLower = beginIndex + i;
            final int iUpper = iLower + d;
            final double min0  = ordinates[iLower];
            final double max0  = ordinates[iUpper];
            final double min1  = lower.getOrdinate(i);
            final double max1  = upper.getOrdinate(i);
            final double span0 = max0 - min0;
            final double span1 = max1 - min1;
            if (isSameSign(span0, span1)) { // Always 'false' if any value is NaN.
                /*
                 * First, verify that the two envelopes intersect.
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        /*
         * If the other object implements the DirectPosition interface, performs
         * the comparison as specified in DirectPosition.equals(Object) contract.
         */
        if (object instanceof DirectPosition) {
            final DirectPosition other = (DirectPosition) object;
            if (other.getDimension() == 2 &&
                doubleToLongBits(other.getOrdinate(0)) == doubleToLongBits(x) &&
                doubleToLongBits(other.getOrdinate(1)) == doubleToLongBits(y) &&
                Objects.equals(other.getCoordinateReferenceSystem(), crs))
            {
                assert hashCode() == other.hashCode() : this;
                return true;
            }
            return false;
        }
        /*
 
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

    public ArrayEnvelope(final Envelope envelope) {
        ensureNonNull("envelope", envelope);
        crs = envelope.getCoordinateReferenceSystem();
        final int dimension = envelope.getDimension();
        ordinates = new double[dimension * 2];
        final DirectPosition lowerCorner = envelope.getLowerCorner();
        final DirectPosition upperCorner = envelope.getUpperCorner();
        for (int i=0; i<dimension; i++) {
            ordinates[i]           = lowerCorner.getOrdinate(i);
            ordinates[i+dimension] = upperCorner.getOrdinate(i);
        }
        verifyRanges(crs, ordinates);
    }
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

    public boolean equals(final Object object) {
        if (object == this) {
            return true;
        }
        if (object instanceof DirectPosition) {
            final DirectPosition that = (DirectPosition) object;
            final int dimension = getDimension();
            if (dimension == that.getDimension()) {
                for (int i=0; i<dimension; i++) {
                    if (doubleToLongBits(getOrdinate(i)) != doubleToLongBits(that.getOrdinate(i))) {
                        return false;
                    }
                }
                if (Objects.equals(this.getCoordinateReferenceSystem(),
                                   that.getCoordinateReferenceSystem()))
                {
                    assert hashCode() == that.hashCode() : this;
                    return true;
                }
            }
        }
        return false;
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        ensureNonNull("envelope", envelope);
        final int dimension = getDimension();
        ensureDimensionMatches("envelope", dimension, envelope);
        assert equalsIgnoreMetadata(getCoordinateReferenceSystem(),
                envelope.getCoordinateReferenceSystem(), true) : envelope;
        final DirectPosition lowerCorner = envelope.getLowerCorner();
        final DirectPosition upperCorner = envelope.getUpperCorner();
        for (int i=0; i<dimension; i++) {
            final double lower0 = getLower(i);
            final double upper0 = getUpper(i);
            final double lower1 = lowerCorner.getOrdinate(i);
            final double upper1 = upperCorner.getOrdinate(i);
            final boolean lowerCondition, upperCondition;
            if (edgesInclusive) {
                lowerCondition = (lower1 >= lower0);
                upperCondition = (upper1 <= upper0);
            } else {
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.