Package org.geotools.factory

Examples of org.geotools.factory.Hints


       
        final AbstractGridFormat format = new GeoTiffFormat();
        File file = TestData.file(GeoTiffReaderTest.class,"002025_0100_010722_l7_01_utm2.tiff");       
        if (format.accepts(file)) {
            // getting a reader
            GeoTiffReader reader = new GeoTiffReader(file, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
            if (reader != null) {
                // reading the coverage
                GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
                assertNotNull(coverage);
                assertTrue(coverage.getRenderedImage().getSampleModel().getNumBands() == 1);
                final ParameterValue<Color> colorPV = AbstractGridFormat.INPUT_TRANSPARENT_COLOR.createValue();
                colorPV.setValue(Color.BLACK);
                coverage = (GridCoverage2D) reader.read(new GeneralParameterValue[] { colorPV });
                assertNotNull(coverage);
                assertTrue(coverage.getRenderedImage().getSampleModel().getNumBands() == 2);

                // showing it
                if (TestData.isInteractiveTest())
                    coverage.show();
                else
                    PlanarImage.wrapRenderedImage(coverage.getRenderedImage()).getTiles();

            }

        } else
            assertFalse(true); // we should not get here

       
        file = TestData.file(GeoTiffReaderTest.class,"gaarc_subset.tiff");       
        if (format.accepts(file)) {
            // getting a reader
            GeoTiffReader reader = new GeoTiffReader(file, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
            if (reader != null) {
                // reading the coverage
                GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
                assertNotNull(coverage);
                assertTrue(coverage.getRenderedImage().getSampleModel().getNumBands() == 3);
                final ParameterValue<Color> colorPV = AbstractGridFormat.INPUT_TRANSPARENT_COLOR.createValue();
                colorPV.setValue(new Color(34,53,87));
                coverage = (GridCoverage2D) reader.read(new GeneralParameterValue[] { colorPV });
                assertNotNull(coverage);
                assertTrue(coverage.getRenderedImage().getSampleModel().getNumBands() == 4);

                // showing it
                if (TestData.isInteractiveTest())
                    coverage.show();
                else
                    PlanarImage.wrapRenderedImage(coverage.getRenderedImage()).getTiles();

            }

        } else
            assertFalse(true); // we should not get here
       
        // now we test that we cannot do colormasking on a non-rendered output
        file = TestData.file(GeoTiffReaderTest.class,"wind.tiff");       
        if (format.accepts(file)) {
            // getting a reader
            GeoTiffReader reader = new GeoTiffReader(file, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
            if (reader != null) {
                // reading the coverage
                GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
                assertNotNull(coverage);
                assertTrue(coverage.getRenderedImage().getSampleModel().getNumBands() == 2);
View Full Code Here


        if (selectedProperties != null && !selectedProperties.isEmpty()) {
            selectedProperties = new ArrayList<PropertyName>(selectedProperties);
            selectedProperties.add(filterFac.property(this.nestedTargetXPath.toString()));
        }

        final Hints hints = new Hints();
        hints.put(Query.INCLUDE_MANDATORY_PROPS, includeMandatory);
       
        if (resolveDepth > 0 ) {
            hints.put(Hints.RESOLVE, ResolveValueType.ALL);
            hints.put(Hints.ASSOCIATION_TRAVERSAL_DEPTH, resolveDepth);
            hints.put(Hints.RESOLVE_TIMEOUT, resolveTimeOut);
        } else {
            hints.put(Hints.RESOLVE, ResolveValueType.NONE);
        }
       
        query.setHints(hints);

        query.setProperties(selectedProperties);
View Full Code Here

    // managing hints
    //
    // //
    if (hints != null) {
      if (this.hints == null) {
        this.hints = new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE);
      }
      this.hints.add(hints);
    }
  }
View Full Code Here

     * @param priority
     * @param datasource
     */
    public HsqlDialectEpsgMediator(int priority, DataSource datasource) {
        this( priority,
             new Hints(Hints.AUTHORITY_MAX_ACTIVE,
                 Integer.valueOf(1),
                 new Object[] {
                     Hints.AUTHORITY_MIN_EVICT_IDLETIME, Integer.valueOf(20 * 60 * 1000),
                     Hints.CACHE_POLICY, "none"
                 }
View Full Code Here

                    dq.setCoordinateSystem(featureType.getCoordinateReferenceSystem());
                    if (query != null) {
                        dq.setHints(query.getHints());
                        dq.setHandle(query.getHandle());
                    } else {
                        dq.setHints(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY,new LiteCoordinateSequenceFactory()));
                    }
                    try{
                        sourceFeatureReader = ((DataStore) fs.getDataStore()).getFeatureReader(dq,Transaction.AUTO_COMMIT);
                    }catch (Exception ex){
                        //nothing to get
View Full Code Here

        return evaluate(object, Hints.class);
    }

    @SuppressWarnings("unchecked")
    public <T> T evaluate(Object object, Class<T> context) {
        return (T) new Hints(ComplexFeatureConstants.STRING_KEY, parameters.get(0).evaluate(object,
                String.class));
    }
View Full Code Here

        Map map = new HashMap();
        //map.put( Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, true );
        //map.put( Hints.FORCE_STANDARD_AXIS_DIRECTIONS, true );
        //map.put( Hints.FORCE_STANDARD_AXIS_UNITS, true );

        Hints global = new Hints(map);
        GeoTools.init( global );

       // ReferencedEnvelope[-0.24291497975705742 : 0.24291497975711265, -0.5056179775280899 : -0.0]
        CoordinateReferenceSystem EPSG4326 = CRS.decode("EPSG:4326");
        ReferencedEnvelope pixelBounds = new ReferencedEnvelope( -0.24291497975705742, 0.24291497975711265, -0.5056179775280899, 0.0, EPSG4326 );
View Full Code Here

        try {
            prepareEmptyMosaic(sourceDir, targetDir);

            // now make sure we can actually rebuild the mosaic
            final AbstractGridFormat format = new ImagePyramidFormat();
            final Hints hints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, DefaultGeographicCRS.WGS84);
            assertTrue(((ImagePyramidFormat)format).accepts(targetDir, hints));
            final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(targetDir, hints);
            assertNotNull(reader);
        } finally {
            // cleanup
View Full Code Here

            FileUtils.copyDirectory(zeroDir, targetDir);
            FileUtils.deleteDirectory(zeroDir);

            // now make sure we can actually rebuild the mosaic
            final AbstractGridFormat format = new ImagePyramidFormat();
            final Hints hints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, DefaultGeographicCRS.WGS84);
            assertTrue(((ImagePyramidFormat)format).accepts(targetDir, hints));
            final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(targetDir, hints);
            assertNotNull(reader);
        } finally {
            // cleanup
View Full Code Here

    //
    // Null argument
    //
    ImagePyramidReader reader = null;
    try {
      reader = new ImagePyramidReader(null, new Hints(
          Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
    } catch (DataSourceException e) {

    }
    assertNull(reader);

    //
    // Illegal arguments
    //
    try {
      reader = new ImagePyramidReader(new FileInputStream(testFile),
          new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER,
              Boolean.FALSE));
    } catch (DataSourceException e) {

    }
    assertNull(reader);
    try {
      reader = new ImagePyramidReader(ImageIO
          .createImageInputStream(testFile), new Hints(
          Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
    } catch (DataSourceException e) {

    }
    assertNull(reader);

    //
    // Unsopported operation
    reader = new ImagePyramidReader(testFile, new Hints(
        Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));

    try {
      reader.getCurrentSubname();
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.