/** * Constructs an authority factory using the specified connection. * * @param userHints The underlying factories used for objects creation. * @param dataSource The data source connecting to the underlying EPSG database */ public DirectEpsgFactory(final Hints userHints, final DataSource dataSource) { super(userHints, MAXIMUM_PRIORITY - 20); // The following hints have no effect on this class behaviour, // but tell to the user what this factory do about axis order. hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE); hints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS, Boolean.FALSE); hints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.FALSE); this.dataSource = dataSource; this.lonLatFactory = new OrderedAxisAuthorityFactory(buffered, userHints, null); ensureNonNull("dataSource", dataSource); }
/** Tests the amount of codes available. */ public void testCodes() throws FactoryException { final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", null, null); final Set codes = factory.getAuthorityCodes(CoordinateReferenceSystem.class); assertNotNull(codes); assertTrue(codes.size() >= 3000); }
/** * Tests the number of CRS that can be created. This test will be executed only if this test * suite is run with the {@code -verbose} option provided on the command line. */ public void testSuccess() throws FactoryException { if (!verbose) { return; } final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", null, null); Set codes = factory.getAuthorityCodes(CoordinateReferenceSystem.class); int total = codes.size(); int count = 0; for (Iterator i = codes.iterator(); i.hasNext(); ) { CoordinateReferenceSystem crs; String code = (String) i.next(); try { crs = factory.createCoordinateReferenceSystem(code); assertNotNull(crs); count++; } catch (FactoryException e) { // System.err.println("WARNING (CRS: " + code + " ):" + e.getMessage()); } } // System.out.println("Success: " + count + "/" + total + " (" + (count * 100) / total + // "%)"); }
/** UDIG requires this to work. */ public void test4326() throws FactoryException { final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", null, null); final CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4326"); assertNotNull(crs); assertSame(crs, factory.createObject("EPSG:4326")); }
/** A random CRS for fun. */ public void test26910() throws FactoryException { final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", null, null); final CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:26910"); assertNotNull(crs); assertSame(crs, factory.createObject("EPSG:26910")); }
/** UDIG requires this to work. */ public void test4269() throws FactoryException { final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory("EPSG", null, null); final CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4269"); assertNotNull(crs); assertSame(crs, factory.createObject("EPSG:4269")); }
throw new FactoryException(exception); return new OrderedAxisAuthorityFactory(factory, new Hints(hints), null);
throw new FactoryException(exception); return new OrderedAxisAuthorityFactory(factory, new Hints(hints), null);
/** 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")); }
/** 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")); }