Package org.geotools.factory

Examples of org.geotools.factory.Hints


    }

    public static class TestDriverNew extends DefaultFileDriver implements Driver {

        public TestDriverNew() {
            super(TestDriver.TEST_DRIVER, TestDriver.TEST_DRIVER, TestDriver.TEST_DRIVER, new Hints(), Collections
                    .singletonList(".EXT"), EnumSet.of(DriverCapabilities.CONNECT,
                            DriverCapabilities.CREATE, DriverCapabilities.DELETE));
        }
View Full Code Here


    //
    // managing hints
    //
    // //
    if (this.hints == null)
      this.hints = new Hints();
    if (uHints != null) {
      this.hints.add(uHints);
    }
    this.coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints);
View Full Code Here

   * @throws FactoryException
   * @throws NoSuchAuthorityCodeException
   */
  static AbstractGridFormat getFormat(URL testURL) throws NoSuchAuthorityCodeException, FactoryException {
 
    final Hints hints= new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, CRS.decode("EPSG:4326", true));
    // Get format
    final AbstractGridFormat format = (AbstractGridFormat) GridFormatFinder.findFormat(testURL,hints);
    Assert.assertNotNull(format);
    Assert.assertFalse("UknownFormat", format instanceof UnknownFormat);
    return format;
View Full Code Here

  protected void imageMosaic(String name, String configUrl,
      GeneralEnvelope envelope, int width, int heigth, Color bColor,Color transparentColor,
      CoordinateReferenceSystem crs) throws IOException {
    // Hints hints = new
    // Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM,CRS.parseWKT(M34_PRJ));
    Hints hints = null;

    if (crs != null) {
      hints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);
    }

    AbstractGridFormat format = (AbstractGridFormat) GridFormatFinder
        .findFormat(configUrl);
    ImageMosaicJDBCReader reader = (ImageMosaicJDBCReader) format
View Full Code Here

        // look for and indexer.properties file
        parent = new File(rootMosaicDir);
        indexerFile = new File(parent, Utils.INDEXER_XML);
        Indexer indexer = null;

        Hints hints = configuration.getHints();
        String ancillaryFile = null;
        if (Utils.checkFileReadable(indexerFile)) {
            try {
                indexer = (Indexer) Utils.unmarshal(indexerFile);
                if (indexer != null) {
View Full Code Here

            if (reader instanceof ImageMosaicReader) {
                if (getParentReader() == null) {
                    setParentReader((ImageMosaicReader) reader);
                }
                if (updateHints) {
                    Hints readerHints = getParentReader().getHints();
                    readerHints.add(hints);
                }
            }
        }
       
    }
View Full Code Here

            }

            if (hints != null) {
                hints.put(Utils.AUXILIARY_FILES_PATH, ancillaryFilePath);
            } else {
                hints = new Hints(Utils.AUXILIARY_FILES_PATH, ancillaryFilePath);
                configuration.setHints(hints);
            }
            if (!absolutePath) {
                hints.put(Utils.PARENT_DIR, rootMosaicDir);
            }
View Full Code Here

            configBuilder.setElevationAttribute(IndexerUtils.getAttribute(coverageName,
                    Utils.ELEVATION_DOMAIN, indexer));
            configBuilder.setAdditionalDomainAttributes(IndexerUtils.getAttribute(coverageName,
                    Utils.ADDITIONAL_DOMAIN, indexer));

            final Hints runHints = getRunConfiguration().getHints();
            if (runHints != null && runHints.containsKey(Utils.AUXILIARY_FILES_PATH)) {
                String auxiliaryFilePath = (String) runHints.get(Utils.AUXILIARY_FILES_PATH);
                if (auxiliaryFilePath != null && auxiliaryFilePath.trim().length() > 0) {
                    configBuilder.setAuxiliaryFilePath(auxiliaryFilePath);
                }
            }
View Full Code Here

        assertTrue(CRS.equalsIgnoreMetadata(coverage.getCoordinateReferenceSystem(), DefaultEngineeringCRS.GENERIC_2D));
       

        // hint for CRS
        crs = CRS.decode("EPSG:32632", true);
        final Hints hint = new Hints();
        hint.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);

        // getting a reader
        reader = new GeoTiffReader(noCrs, hint);

        // reading the coverage
View Full Code Here

          o = files[i].toURI().toURL();
        if (format.accepts(o)) {
          buffer.append("ACCEPTED").append("\n");
   
          // getting a reader
          GeoTiffReader reader = new GeoTiffReader(o, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
          if (reader != null) {
   
            // reading the coverage
                  final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
   
            // Crs and envelope
            if (TestData.isInteractiveTest()) {
              buffer.append("CRS: ").append(
                  coverage.getCoordinateReferenceSystem2D()
                      .toWKT()).append("\n");
              buffer.append("GG: ").append(
                  coverage.getGridGeometry().toString()).append("\n");
            }
            // display metadata
            if (org.geotools.TestData.isExtensiveTest()) {
              IIOMetadataDumper iIOMetadataDumper = new IIOMetadataDumper(
                  ((GeoTiffReader) reader).getMetadata()
                      .getRootNode());
              buffer.append("TIFF metadata: ").append(
                  iIOMetadataDumper.getMetadata()).append("\n");
            }
           
            // layout checks
            final ImageLayout layout = reader.getImageLayout();
            assertNotNull(layout);
            assertNotNull(layout.getColorModel(null));
            assertNotNull(layout.getSampleModel(null));
            assertEquals(0,layout.getMinX(null));
            assertEquals(0,layout.getMinY(null));
            assertTrue(layout.getWidth(null) > 0);
            assertTrue(layout.getHeight(null) > 0);
            assertEquals(0,layout.getTileGridXOffset(null));
            assertEquals(0,layout.getTileGridYOffset(null));
            assertTrue(layout.getTileHeight(null) > 0);
            assertTrue(layout.getTileWidth(null) > 0);
           
           
            // showing it
            if (TestData.isInteractiveTest()){
                coverage.show();
            }
            else {
                PlanarImage.wrapRenderedImage(coverage.getRenderedImage()).getTiles();
            }
           
            // write and read back
            final File destFile = File.createTempFile("test", ".tif",writeDirectory);       
            final GeoTiffWriter writer= new GeoTiffWriter(destFile);
            writer.write(coverage, null);
            writer.dispose();
           
            // read back
            assertTrue(format.accepts(destFile));
            reader = new GeoTiffReader(destFile, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
            final GridCoverage2D destCoverage = (GridCoverage2D) reader.read(null);
            reader.dispose();
           
            final double eps=XAffineTransform.getScaleX0((AffineTransform)coverage.getGridGeometry().getGridToCRS())*1E-2;
            assertTrue("CRS comparison failed:" +o.toString(),CRS.findMathTransform(coverage.getCoordinateReferenceSystem(), destCoverage.getCoordinateReferenceSystem(), true).isIdentity());
View Full Code Here

TOP

Related Classes of org.geotools.factory.Hints

Copyright © 2018 www.massapicom. 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.