Examples of DirectPosition


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, -364, 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, -364, upper   .getOrdinate(0), STRICT);
            assertEquals(label, +180, envelope.getMaximum (0), STRICT);
            assertEquals(label,    4, envelope.getMedian  (0), STRICT); // Note the alternance with the previous test methods.
            assertEquals(label,  NaN, envelope.getSpan    (0), STRICT); // testCrossingAntiMeridian() + 360°.
            if (envelope instanceof AbstractEnvelope) {
                final AbstractEnvelope ext = (AbstractEnvelope) envelope;
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, 372, -364, 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,  372, lower   .getOrdinate(0), STRICT);
            assertEquals(label, -180, envelope.getMinimum (0), STRICT);
            assertEquals(label, -364, upper   .getOrdinate(0), STRICT);
            assertEquals(label, +180, envelope.getMaximum (0), STRICT);
            assertEquals(label, -176, envelope.getMedian  (0), STRICT); // Note the alternance with the previous test methods.
            assertEquals(label,  NaN, envelope.getSpan    (0), STRICT); // testCrossingAntiMeridianTwice() + 360°.
            switch (type) {
                default: {
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        final Envelope2D intersect = (Envelope2D) create(RECTANGLE, -2, 16, 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, 0.0, -0.0, 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,  0.0, lower   .getOrdinate(0), STRICT);
            assertEquals(label, -180, envelope.getMinimum (0), STRICT);
            assertEquals(label, -0.0, upper   .getOrdinate(0), STRICT);
            assertEquals(label, +180, envelope.getMaximum (0), STRICT);
            assertEquals(label,  180, envelope.getMedian  (0), STRICT);
            assertEquals(label,  360, envelope.getSpan    (0), STRICT);
            switch (type) {
                default: {
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

            for (int gy = 0; gy < height; gy++) {
                for (int gx = 0; gx < width; gx++) {
                    coord.x = gx;
                    coord.y = gy;
                    // find coordinates for current raster cell in tile CRS
                    DirectPosition sourcePos = gg.gridToWorld(coord);
                    // convert coordinates in tile CRS to WGS84
                    tr.transform(sourcePos, sourcePos);
                    // axis order can vary
                    double lon = sourcePos.getOrdinate(0);
                    double lat = sourcePos.getOrdinate(1);
                    Sample s = ss.getSample(lon, lat);
                    if (s != null)
                        ns++;
                    ret[i] = s;
                    i++;
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

                    LOG.trace("raster line {} / {}", gy, height);
                for (int gx = 0; gx < width; gx++) {
                    coord.x = gx;
                    coord.y = gy;
                    // find coordinates for current raster cell in tile CRS
                    DirectPosition sourcePos = gg.gridToWorld(coord);
                    // convert coordinates in tile CRS to WGS84
                    //LOG.debug("world : {}", sourcePos);
                    tr.transform(sourcePos, sourcePos);
                    //LOG.debug("wgs84 : {}", sourcePos);
                    // axis order can vary
                    double lon = sourcePos.getOrdinate(0);
                    double lat = sourcePos.getOrdinate(1);
                    // TODO: axes are reversed in the default mathtransform
                    Sample s = graphService.getGraph(req.routerId).getSampleFactory().getSample(lon, lat);
                    samples[i++] = s;
                }
            }
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

            for (int col = 0; col < cols; col++) {
                coord.x = col;
                coord.y = row;
                try {
                    // find coordinates for current raster cell in raster CRS
                    DirectPosition sourcePos = gridGeometry.gridToWorld(coord);
                    // TODO: we are performing 2 transforms here, it would probably be more efficient to compose
                    // the grid-to-crs and crs-to-WGS84 transforms into grid-to-WGS84.
                    // cf. MathTransformFactory and CoordinateOperationFactory
                    // convert coordinates in raster CRS to WGS84
                    DirectPosition targetPos = tr.transform(sourcePos, null);
                    double lon = targetPos.getOrdinate(0);
                    double lat = targetPos.getOrdinate(1);
                    // evaluate using grid coordinates, which should be more efficient than using world coordinates
                    if (coverage != null)
                        coverage.evaluate(coord, val);
                    // add this grid cell to the population
                    String label = row + "_" + col;
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

                    CoordinateReferenceSystem crs2 = acquireCRS(code2);

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                        transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

        for( int t = 0; t < npoints; t++ ){
            double dx = scaleX * t;
            double dy = scaleY * t;
           
            GeneralDirectPosition left = new GeneralDirectPosition( xmin, ymin+dy);
            DirectPosition pt = transformTo3D( left, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
           
            GeneralDirectPosition top = new GeneralDirectPosition( xmin+dx, ymax);
            pt = transformTo3D( top, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

                double dz = scaleZ * u;
                double z = zmin+dz;

                GeneralDirectPosition left = new GeneralDirectPosition(xmin, ymin+dy, z );
               
                DirectPosition pt = transformTo2D( left, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
               
                GeneralDirectPosition top = new GeneralDirectPosition( xmin+dx, ymax, z );
                pt = transformTo2D( top, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
View Full Code Here

Examples of org.opengis.geometry.DirectPosition

     * @return Position in target CRS as calculated by transform2
     * @throws TransformException
     */
    private static DirectPosition transformTo3D(GeneralDirectPosition srcPosition, MathTransform transformToWGS84,
            MathTransform transformFromWGS84_3D) throws TransformException {
        DirectPosition world2D = transformToWGS84.transform(srcPosition, null );
       
        DirectPosition world3D = new GeneralDirectPosition( DefaultGeographicCRS.WGS84_3D);
        world3D.setOrdinate(0, world2D.getOrdinate(0));
        world3D.setOrdinate(1, world2D.getOrdinate(1));
        world3D.setOrdinate(2, 0.0 ); // 0 elliposial height is assumed
       
        DirectPosition targetPosition = transformFromWGS84_3D.transform(world3D, null );
        return targetPosition;
    }
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.