Examples of CRSAuthorityFactory


Examples of org.opengis.referencing.crs.CRSAuthorityFactory

void createFromEPSGCode2() throws Exception {
    System.out.println("------------------------------------------");
    System.out.println("Creating a CRS from an authority factory:");
    // createFromEPSGCode2 start
    String code = "26910";
    CRSAuthorityFactory crsAuthorityFactory = ReferencingFactoryFinder.getCRSAuthorityFactory(
            "EPSG", null);
    CoordinateReferenceSystem crs = crsAuthorityFactory.createCoordinateReferenceSystem(code);
    // createFromEPSGCode2 end
    System.out.println("  CRS: " + crs.toWKT());
    System.out.println("Identified CRS object:");
    printIdentifierStuff(crs);
    System.out.println("------------------------------------------");
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

     */
    private void transform(final PrintWriter out, final String[] args) throws FactoryException {
        if (!(factory instanceof CRSAuthorityFactory)) {
            return;
        }
        final CRSAuthorityFactory factory = (CRSAuthorityFactory) this.factory;
        final CoordinateOperationFactory opFactory =
                ReferencingFactoryFinder.getCoordinateOperationFactory(HINTS);
        char[] separator = null;
        for (int i=0; i<args.length; i++) {
            final CoordinateReferenceSystem crs1 = factory.createCoordinateReferenceSystem(args[i]);
            for (int j=i+1; j<args.length; j++) {
                final CoordinateReferenceSystem crs2 = factory.createCoordinateReferenceSystem(args[j]);
                final CoordinateOperation op;
                try {
                    op = opFactory.createOperation(crs1, crs2);
                } catch (OperationNotFoundException exception) {
                    out.println(exception.getLocalizedMessage());
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

     * @since 2.3
     */
    public static synchronized CRSAuthorityFactory getAuthorityFactory(final boolean longitudeFirst)
            throws FactoryRegistryException
    {
        CRSAuthorityFactory factory = (longitudeFirst) ? xyFactory : defaultFactory;
        if (factory == null)
            try {
                // what matters is the value of the flag when the factories are created,. do updated
                updateForcedLonLat();
                factory = new DefaultAuthorityFactory(longitudeFirst);
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

    protected Set<String> filterCRSNames( String[] filter ) {
        crsCodeMap = new HashMap<String, String>();
        Set<String> descriptions = new TreeSet<String>();
       
        for( Object object : ReferencingFactoryFinder.getCRSAuthorityFactories(null) ) {
            CRSAuthorityFactory factory = (CRSAuthorityFactory) object;
            try {
                Set<String> codes = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
                for( Object codeObj : codes ) {
                    String code = (String) codeObj;
                    String description;
                    try {
                        description = factory.getDescriptionText(code).toString();
                    } catch (Exception e1) {
                        description = Messages.getString("CRSChooser_unnamed");
                    }
                    description += " (" + code + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                    crsCodeMap.put(code, description);
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

     */
    protected CoordinateReferenceSystem createCRS( String code ) {
        if (code == null)
            return null;
        for( Object object : ReferencingFactoryFinder.getCRSAuthorityFactories(null) ) {
            CRSAuthorityFactory factory = (CRSAuthorityFactory) object;
            try {
                return (CoordinateReferenceSystem) factory.createObject(code);
            } catch (FactoryException e2) {
                // then we have the wrong factory
                // is there a better way to do this?
            } catch (Exception e) {
                ExceptionMonitor.show(wktText.getShell(), e, "Error creating CRS object, trying more...");
View Full Code Here

Examples of org.opengis.referencing.crs.CRSAuthorityFactory

     * @param authority the authority name
     * @param showDefaults show GeoTools default reference systems
     */
    public CRSListModel(String authority) {
        try {
            CRSAuthorityFactory fac =
                    ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null);

            Set<String> codes = fac.getAuthorityCodes(CoordinateReferenceSystem.class);
           
            if (authority == null || authority.trim().length() == 0) {
                authority = JCRSChooser.DEFAULT_AUTHORITY;
            }
           
            for (String code : codes) {
                code = code.trim();
                String desc = fac.getDescriptionText(authority + ":" + code).toString();
                allItems.add(new Item(code, desc));
            }
            filterItems.addAll(allItems);
           
        } catch (Exception ex) {
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.