Package org.geotools.factory

Examples of org.geotools.factory.Hints


    }

    @Test
    public void testDefaultFileDriver() {
        DefaultFileDriver driver = new DefaultFileDriver(TestDriver.TEST_DRIVER,
                TestDriver.TEST_DRIVER, TestDriver.TEST_DRIVER, new Hints(),
                Collections.singletonList(".EXT"), EnumSet.of(DriverCapabilities.CONNECT,
                        DriverCapabilities.CREATE, DriverCapabilities.DELETE));

        // Various checks on the DefaultFileDriver class
        assertFalse(driver.canProcess(DriverCapabilities.CONNECT, url, connectionParams));
View Full Code Here


        // //
        //
        // Setting several parameters
        //
        // //
        final Hints hints = new Hints(Hints.OVERVIEW_POLICY,OverviewPolicy.getDefaultPolicy());
        final JP2KReader reader = new JP2KReader(file,hints);
        final ParameterValue<GridGeometry2D> gg = JP2KFormat.READ_GRIDGEOMETRY2D.createValue();
        final ParameterValue<Boolean> useMT = JP2KFormat.USE_MULTITHREADING.createValue();
        final ParameterValue<Boolean> useJAI = JP2KFormat.USE_JAI_IMAGEREAD.createValue();
        final ParameterValue<String> tileSize= JP2KFormat.SUGGESTED_TILE_SIZE.createValue();
View Full Code Here

   *
   * @see org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter#execute()
   */
    @SuppressWarnings("unchecked")
  protected GridCoverage2D execute() {
    final Hints hints = getHints();

    // /////////////////////////////////////////////////////////////////////
    //
    // Get the sources and see what we got to do. Note that if we have more
    // than once source we'll use only the first one but we'll
View Full Code Here

    /**
     * Tests the registration of the various flavor of {@link OrderedAxisAuthorityFactoryTest}
     * for the EPSG authority factory.
     */
    public void testRegistration() {
        final Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
        OrderedAxisAuthorityFactory factory;
        factory = getFactory(hints);
        assertFalse(factory.forceStandardDirections);
        assertFalse(factory.forceStandardUnits);

        hints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS, Boolean.FALSE);
        assertSame(factory, getFactory(hints));
        assertFalse(factory.forceStandardDirections);
        assertFalse(factory.forceStandardUnits);

        hints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.FALSE);
        assertSame(factory, getFactory(hints));
        assertFalse(factory.forceStandardDirections);
        assertFalse(factory.forceStandardUnits);

        hints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.TRUE);
        assertNotSame(factory, factory = getFactory(hints));
        assertFalse  (factory.forceStandardDirections);
        assertTrue   (factory.forceStandardUnits);

        hints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS, Boolean.TRUE);
        assertNotSame(factory, factory = getFactory(hints));
        assertTrue   (factory.forceStandardDirections);
        assertTrue   (factory.forceStandardUnits);

        hints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.FALSE);
        assertNotSame(factory, factory = getFactory(hints));
        assertTrue   (factory.forceStandardDirections);
        assertFalse  (factory.forceStandardUnits);
    }
View Full Code Here

         *    - EPSG factories must be provided for both "official" and "modified" axis order.
         *    - The "official" axis order must have precedence over the modified one.
         *    - The hints are correctly understood by FactoryFinder.
         */
        final AbstractAuthorityFactory factory0, factory1;
        final Hints hints = new Hints(Hints.CRS_AUTHORITY_FACTORY, AbstractAuthorityFactory.class);
        factory0 = (AbstractAuthorityFactory) ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);
        assertFalse(factory0 instanceof OrderedAxisAuthorityFactory);
        assertFalse(factory0 instanceof LongitudeFirstFactory);
        hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
        hints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS,   Boolean.TRUE);
        hints.put(Hints.FORCE_STANDARD_AXIS_UNITS,        Boolean.TRUE);
        factory1 = (AbstractAuthorityFactory) ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);
        assertTrue(factory1 instanceof LongitudeFirstFactory);
        /*
         * The local variables to be used for all remaining tests
         * (usefull to setup in the debugger).
View Full Code Here

    /**
     * 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

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        if( factory == null ){
            DataSource datasource = HsqlEpsgDatabase.createDataSource();
            Hints hints = new Hints( Hints.CACHE_POLICY, "default" );
            factory = new HsqlDialectEpsgMediator(80, hints, datasource);
        }
        if( finder == null ){
            finder = factory.getIdentifiedObjectFinder(CoordinateReferenceSystem.class);
        }
View Full Code Here

      // /////////////////////////////////////////////////////////////////////
      final Iterator<CoverageProcessingNode> it = sources.iterator();
      RenderedImage op = null;
      GridGeometry2D gridGeometry = null;
      ImageLayout layout = null;
      final Hints hints = getHints();
      final List<GridCoverage2D> sourceGridCoverages= new ArrayList<GridCoverage2D>();
      do {
        // //
        //
        // Get the source image and do the merge
        //
        // //
        final CoverageProcessingNode currentSourceNode = (CoverageProcessingNode) it.next();
        final GridCoverage2D currentSourceCoverage = (GridCoverage2D) currentSourceNode.getOutput();
        sourceGridCoverages.add(currentSourceCoverage);
        final GridGeometry2D gg = (GridGeometry2D) currentSourceCoverage.getGridGeometry();
        if (gridGeometry == null) {
          // get the envelope for the first source.
          gridGeometry = gg;

          // color model
          final ComponentColorModel cm = new ComponentColorModel(
              ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB),
              false, false, Transparency.OPAQUE,
              currentSourceCoverage.getRenderedImage()
                  .getSampleModel().getDataType());
          layout = new ImageLayout();
          layout.setColorModel(cm);
        } else if (!gg.equals(gridGeometry))
          throw new IllegalArgumentException(Errors.format(
              ErrorKeys.MUST_SHARE_GRIDGEOMETRY_$1, "BandMerge"));

        // //
        //
        // Merge the current source with the results of the others
        // merges
        //
        // //
        if (op == null)
          op = currentSourceCoverage.getRenderedImage();
        else {
          op = BandMergeDescriptor.create(op, currentSourceCoverage.getRenderedImage(), hints);
          // //
          //
          // Save the intermediate image
          //
          // //
          intermediateOps.add(op);
        }

      } while (it.hasNext());

      // /////////////////////////////////////////////////////////////////////
      //
      // let's now create the output coverage and
      //
      // /////////////////////////////////////////////////////////////////////
      if (layout != null)
        hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
      op = FormatDescriptor.create(op, Integer.valueOf(op.getSampleModel().getDataType()), hints);
      final GridSampleDimension [] sd= new GridSampleDimension[op.getSampleModel().getNumBands()];
      for(int i=0;i<sd.length;i++)
          sd[i]= new GridSampleDimension(TypeMap.getColorInterpretation(op.getColorModel(), i).name());
                   
View Full Code Here

        return sb.toString();
    }

    GeometryFactory getGeometryFactory(Query query) {
        Hints hints = query.getHints();
        GeometryFactory gf = null;
        if (hints != null) {
            gf = (GeometryFactory) hints.get(Hints.JTS_GEOMETRY_FACTORY);
            if (gf == null) {
                // look for a coordinate sequence factory
                CoordinateSequenceFactory csFactory = (CoordinateSequenceFactory) hints
                        .get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY);

                if (csFactory != null) {
                    gf = new GeometryFactory(csFactory);
                }
View Full Code Here

          // //
          //
          // Save the output
          //
          // //
          final Hints hints = new Hints(getHints());
          final ImageLayout layout = new ImageLayout();
          final RenderedImage sourceRaster = source
              .getRenderedImage();
          final SampleModel oldSM = sourceRaster.getSampleModel();
          final ColorModel cm = new ComponentColorModel(ColorSpace
              .getInstance(ColorSpace.CS_GRAY), false, false,
              Transparency.OPAQUE, oldSM.getDataType());
          layout.setColorModel(cm);
          layout.setSampleModel(cm.createCompatibleSampleModel(oldSM
              .getWidth(), oldSM.getHeight()));
          hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
          output = (GridCoverage2D) new SelectSampleDimension()
              .doOperation(parameters, hints);
        }

        // postcondition
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.