Examples of CRSAuthorityFactory


Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Tests the creation of an operation from EPSG:4230 to EPSG:4326. They are the same
     * CRS than the one tested in {@link DefaultDataSourceTest#testTransformations}.
     */
    public void testCreate() throws FactoryException {
        final CRSAuthorityFactory       crsFactory;
        final CoordinateOperationFactory opFactory;
              CoordinateReferenceSystem  sourceCRS;
              CoordinateReferenceSystem  targetCRS;
              CoordinateOperation        operation;

        crsFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
        opFactory  = ReferencingFactoryFinder.getCoordinateOperationFactory(null);
        sourceCRS  = crsFactory.createCoordinateReferenceSystem("4230");
        targetCRS  = crsFactory.createCoordinateReferenceSystem("4326");
        operation  = opFactory.createOperation(sourceCRS, targetCRS);

        assertSame(sourceCRS, operation.getSourceCRS());
        assertSame(targetCRS, operation.getTargetCRS());
        assertSame(operation, opFactory.createOperation(sourceCRS, targetCRS));
        assertTrue("Expected a buffered factory but got " + opFactory.getClass().getName(),
                opFactory instanceof BufferedCoordinateOperationFactory);
        assertTrue("EPSG authority factory not found.",
                ((BufferedCoordinateOperationFactory) opFactory).getImplementationHints().
                get(Hints.COORDINATE_OPERATION_FACTORY) instanceof AuthorityBackedFactory);
        assertEquals("1612", getIdentifier(operation)); // See comment in DefaultDataSourceTest.
        assertEquals(1.0, AbstractCoordinateOperation.getAccuracy(operation), 1E-6);
        assertTrue(operation instanceof Transformation);
        /*
         * Tests a transformation not backed directly by an authority factory.
         * However, the inverse transform may exist in the authority factory.
         */
        sourceCRS  = crsFactory.createCoordinateReferenceSystem("4326");
        targetCRS  = crsFactory.createCoordinateReferenceSystem("2995");
        operation  = opFactory.createOperation(sourceCRS, targetCRS);
        assertTrue("This test needs an operation not backed by the EPSG factory.",
                   operation.getIdentifiers().isEmpty());
        // Should contains exactly one transformations and an arbitrary number of conversions.
        assertTrue(operation instanceof ConcatenatedOperation);
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Tests the obtention of various codes.
     */
    public void testCodes() throws FactoryException {
        final CRSAuthorityFactory factory = CRS.getAuthorityFactory(false);
        final Collection codes = factory.getAuthorityCodes(ProjectedCRS.class);
        assertTrue (codes.contains("EPSG:3395"));    // Defined in EPSG database
        assertTrue (codes.contains("EPSG:54004"));   // Defined in ESRI database
        assertFalse(codes.contains("ESRI:54004"));
        assertTrue (codes.contains("EPSG:42304"));   // Defined in unnamed database
        assertTrue (codes.contains("EPSG:26742"));   // Defined in EPSG database
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Returns the ordered axis factory for the specified set of hints.
     */
    private static OrderedAxisAuthorityFactory getFactory(final Hints hints) {
        CRSAuthorityFactory factory;
        factory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);

        assertTrue(factory.getClass().toString(), factory instanceof LongitudeFirstFactory);
        final LongitudeFirstFactory asLongitudeFirst = (LongitudeFirstFactory) factory;
        final Map implementationHints = asLongitudeFirst.getImplementationHints();
        factory = (CRSAuthorityFactory) implementationHints.get(Hints.CRS_AUTHORITY_FACTORY);

        assertTrue(factory.getClass().toString(), factory instanceof OrderedAxisAuthorityFactory);
        final OrderedAxisAuthorityFactory asOrdered = (OrderedAxisAuthorityFactory) factory;
        assertFalse(asOrdered.isCodeMethodOverriden());

        return asOrdered;
    }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Tests the {@link IdentifiedObjectFinder#find} method with axis order forced.
     */
    public void testFind() throws FactoryException {
        final CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(
                "EPSG", new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));

        assertTrue(factory instanceof AbstractAuthorityFactory);
        AbstractAuthorityFactory findable = (AbstractAuthorityFactory) factory;
        final IdentifiedObjectFinder finder = findable.getIdentifiedObjectFinder(CoordinateReferenceSystem.class);
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Tests the creation of an operation from EPSG:4230 to EPSG:4326. They are the same
     * CRS than the one tested in {@link DefaultDataSourceTest#testTransformations}.
     */
    public void testCreate() throws FactoryException {
        final CRSAuthorityFactory       crsFactory;
        final CoordinateOperationFactory opFactory;
              CoordinateReferenceSystem  sourceCRS;
              CoordinateReferenceSystem  targetCRS;
              CoordinateOperation        operation;

        crsFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
        opFactory  = ReferencingFactoryFinder.getCoordinateOperationFactory(null);
        sourceCRS  = crsFactory.createCoordinateReferenceSystem("4230");
        targetCRS  = crsFactory.createCoordinateReferenceSystem("4326");
        operation  = opFactory.createOperation(sourceCRS, targetCRS);

        assertSame(sourceCRS, operation.getSourceCRS());
        assertSame(targetCRS, operation.getTargetCRS());
        assertSame(operation, opFactory.createOperation(sourceCRS, targetCRS));
        assertTrue("Expected a buffered factory but got " + opFactory.getClass().getName(),
                opFactory instanceof BufferedCoordinateOperationFactory);
        assertTrue("EPSG authority factory not found.",
                ((BufferedCoordinateOperationFactory) opFactory).getImplementationHints().
                get(Hints.COORDINATE_OPERATION_FACTORY) instanceof AuthorityBackedFactory);
        assertEquals("1612", getIdentifier(operation)); // See comment in DefaultDataSourceTest.
        assertEquals(1.0, AbstractCoordinateOperation.getAccuracy(operation), 1E-6);
        assertTrue(operation instanceof Transformation);
        /*
         * Tests a transformation not backed directly by an authority factory.
         * However, the inverse transform may exist in the authority factory.
         */
        sourceCRS  = crsFactory.createCoordinateReferenceSystem("4326");
        targetCRS  = crsFactory.createCoordinateReferenceSystem("2995");
        operation  = opFactory.createOperation(sourceCRS, targetCRS);
        assertTrue("This test needs an operation not backed by the EPSG factory.",
                   operation.getIdentifiers().isEmpty());
        // Should contains exactly one transformations and an arbitrary number of conversions.
        assertTrue(operation instanceof ConcatenatedOperation);
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * This CRS is defined in {@code esri.properties}.
     */
    public void test54004() throws FactoryException {
        final CRSAuthorityFactory factory = CRS.getAuthorityFactory(false);
        final String code = "EPSG:54004";
        final CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem(code);
        assertNotNull(crs);
        assertSame(crs, CRS.decode(code, true));
        assertEquals("World_Mercator", String.valueOf(factory.getDescriptionText(code)));

        // Equivalent standard ESPG
        final CoordinateReferenceSystem standard = factory.createCoordinateReferenceSystem("EPSG:3395");
        assertEquals("WGS 84 / World Mercator", String.valueOf(factory.getDescriptionText("EPSG:3395")));
        // TODO: enable if we implement more intelligent 'equalsIgnoreMetadata'
        //assertTrue(CRS.equalsIgnoreMetadata(crs, standard));
    }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * UDIG requires this to work.
     */
    public void test42102() throws FactoryException {
        final Hints hints = new Hints(Hints.CRS_AUTHORITY_FACTORY, UnnamedExtension.class);
        final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", hints, null);
        final CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:42102");
        assertNotNull(crs);
        assertNotNull(crs.getIdentifiers());
        assertFalse(crs.getIdentifiers().isEmpty());
        NamedIdentifier expected = new NamedIdentifier(Citations.EPSG, "42102");
        assertTrue(crs.getIdentifiers().contains(expected));
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

        // prepare the loaders
        final AtomicInteger ai = new AtomicInteger(NUMBER_OF_THREADS);
        final Runnable runnable = new Runnable() {
            public void run() {
                try {
                    final CRSAuthorityFactory authorityFactory = ReferencingFactoryFinder
                            .getCRSAuthorityFactory("EPSG", null);
                    authorityFactory.createCoordinateReferenceSystem("4326");
                } catch (Exception e) {
                    throw new RuntimeException(e);
                } finally {
                    ai.decrementAndGet();
                }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Makes sure that the authority factory has the proper name.
     */
    public void testAuthority() {
        CRSAuthorityFactory factory;
        Citation authority;

        // Tests the official factory.
        factory   = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
        authority = factory.getAuthority();
        assertNotNull(authority);
        assertEquals("European Petroleum Survey Group", authority.getTitle().toString(Locale.US));
        assertTrue(Citations.identifierMatches(authority, "EPSG"));

        // Tests the modified factory.
        factory   = new OrderedAxisAuthorityFactory("EPSG", null, null);
        authority = factory.getAuthority();
        assertNotNull(authority);
        assertTrue(Citations.identifierMatches(authority, "EPSG"));
    }
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

    /**
     * Tests the vendor name.
     */
    public void testVendor() {
        CRSAuthorityFactory factory;
        Citation vendor;

        factory = new OrderedAxisAuthorityFactory("EPSG", null, null);
        vendor  = factory.getVendor();
        assertNotNull(vendor);
        assertEquals("Geotools", vendor.getTitle().toString(Locale.US));
        assertFalse(Citations.identifierMatches(vendor, "EPSG"));
    }
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.