Examples of ParameterValue


Examples of org.opengis.parameter.ParameterValue

         * and returns it.
         */
        for (final GeneralParameterDescriptor descriptor : getDescriptor().descriptors()) {
            if (descriptor instanceof ParameterDescriptor) {
                if (AbstractIdentifiedObject.nameMatches(descriptor, name)) {
                    final ParameterValue value = ((ParameterDescriptor) descriptor).createValue();
                    values.add(value);
                    return value;
                }
            }
        }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

            ReferencedEnvelope requestedEnvelope = null;
            Rectangle dim = null;

            if (parameters != null) {
                for (int i = 0; i < parameters.length; i++) {
                    final ParameterValue param = (ParameterValue) parameters[i];
                    final ReferenceIdentifier name = param.getDescriptor().getName();
                    if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName())) {
                        final GridGeometry2D gg = (GridGeometry2D) param.getValue();
                        try {                       
                            requestedEnvelope = ReferencedEnvelope.create(gg.getEnvelope(), gg.getCoordinateReferenceSystem()).transform(crs, true);;
                        } catch (Exception e) {
                            requestedEnvelope = null;
                        }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

      // Checking params
      //
      // /////////////////////////////////////////////////////////////////////
      if (params != null) {
        for (int i = 0; i < params.length; i++) {
          final ParameterValue param = (ParameterValue) params[i];
          final String name = param.getDescriptor().getName().getCode();
          if (name.equals(
              AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
                  .toString())) {
            final GridGeometry2D gg = (GridGeometry2D) param
                .getValue();
            requestedEnvelope = new GeneralEnvelope((Envelope) gg
                .getEnvelope2D());
            dim = gg.getGridRange2D().getBounds();
            continue;
          }
          if (name.equals(AbstractGridFormat.OVERVIEW_POLICY
              .getName().toString())) {
            overviewPolicy=(OverviewPolicy) param.getValue();
            continue;
          }         
        }
      }
    }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

     *
     * @return A copy of the parameter values for this math transform.
     */
    @Override
    public ParameterValueGroup getParameterValues() {
        final ParameterValue lat_diff_file = new Parameter(Provider.LAT_DIFF_FILE);
        lat_diff_file.setValue(latGridName);

        final ParameterValue long_diff_file = new Parameter(Provider.LONG_DIFF_FILE);
        long_diff_file.setValue(longGridName);

        return new ParameterGroup(getParameterDescriptors(),
            new GeneralParameterValue[] { lat_diff_file, long_diff_file }
        );
    }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

        ReferencedEnvelope requestedEnvelope = null;
        Rectangle dim = null;
       
        if (parameters != null) {
            for (int i = 0; i < parameters.length; i++) {
                final ParameterValue param = (ParameterValue) parameters[i];
                final ReferenceIdentifier name = param.getDescriptor().getName();
                if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName())) {
                    final GridGeometry2D gg = (GridGeometry2D) param.getValue();
                    try {                       
                        requestedEnvelope = ReferencedEnvelope.create(gg.getEnvelope(), gg.getCoordinateReferenceSystem()).transform(SPHERICAL_MERCATOR, true);;
                    } catch (Exception e) {
                        requestedEnvelope = null;
                    }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

        /*
         * Tests parameter values.
         */
        final ImagingParameters values = (ImagingParameters) parameters.createValue();
        for (int i=0; i<20; i++) {
            final ParameterValue before = values.parameter("constants");
            if ((i % 5)==0) {
                values.parameters.setParameter("constants", new double[]{i});
            } else {
                values.parameter("constants").setValue(new double[]{i});
            }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

                new ImagingParameterDescriptors(operation, replacingDescriptors);

        // Sets the parameter we want to override
        final ParameterValueGroup rip = ripd.createValue();
        assertSame(ripd, rip.getDescriptor());
        final ParameterValue p = rip.parameter("xPeriod");
        assertSame(SPATIAL_SUBSAMPLING_X, p.getDescriptor());

        // Note that we are supposed to use spatial coordinates for this value we are seeting here.
        p.setValue(Double.valueOf(2.3));
        assertTrue(p.toString().startsWith("xPeriod = 2.3"));

        // Tests direct access to the parameter list.
        final ParameterList pl = ((ImagingParameters) rip).parameters;
        assertSame(pl, pl.setParameter("xPeriod", 2));
        assertSame(pl, pl.setParameter("yPeriod", 2));
        assertEquals(2, pl.getIntParameter("xPeriod"));
        assertEquals(2, pl.getIntParameter("yPeriod"));
        assertEquals("Setting 'xPeriod' on ParameterList should have no effect on ParameterValue.",
                     2.3, p.doubleValue(), 1E-6);
        assertEquals("'yPeriod' should still backed by the ParameterList.",
                     2, rip.parameter("yPeriod").intValue());
    }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

     */
    private ParameterValueGroup getParameterValues(final ParameterDescriptorGroup descriptor) {
        final ParameterValue[] parameters = new ParameterValue[hasHeight ? 2 : 3];
        int index = 0;
        if (!hasHeight) {
            final ParameterValue p = new org.geotools.parameter.Parameter(Provider.DIM);
            p.setValue(2);
            parameters[index++] = p;
        }
        parameters[index++] = new FloatParameter(Provider.SEMI_MAJOR, a);
        parameters[index++] = new FloatParameter(Provider.SEMI_MINOR, b);
        return new org.geotools.parameter.ParameterGroup(descriptor, parameters);
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

            } else {
                reference = null;
                final String unitCode = result.getString(4);
                unit = (unitCode!=null) ? createUnit(unitCode) : null;
            }
            final ParameterValue param;
            try {
                param = parameters.parameter(name);
            } catch (ParameterNotFoundException exception) {
                /*
                 * Wraps the unchecked ParameterNotFoundException into the checked
                 * NoSuchIdentifierException, which is a FactoryException subclass.
                 * Note that in theory, NoSuchIdentifierException is for MathTransforms rather
                 * than parameters.  However, we are close in spirit here since we are setting
                 * up MathTransform's parameters. Using NoSuchIdentifierException allows users
                 * (including CoordinateOperationSet) to know that the failure is probably
                 * caused by a MathTransform not yet supported in Geotools (or only partially
                 * supported) rather than some more serious failure in the database side.
                 * CoordinateOperationSet uses this information in order to determine if it
                 * should try the next coordinate operation or propagate the exception.
                 */
                final NoSuchIdentifierException e = new NoSuchIdentifierException(
                        Errors.format(ErrorKeys.CANT_SET_PARAMETER_VALUE_$1, name), name);
                e.initCause(exception);
                throw e;
            }
            try {
                if (reference != null) {
                    param.setValue(reference);
                } else if (unit != null) {
                    param.setValue(value, unit);
                } else {
                    param.setValue(value);
                }
            } catch (InvalidParameterValueException exception) {
                throw new FactoryException(
                          Errors.format(ErrorKeys.CANT_SET_PARAMETER_VALUE_$1, name), exception);
            }
View Full Code Here

Examples of org.opengis.parameter.ParameterValue

    // ///////////////////////////////////////////////////////////////////



    // source coverage
        final ParameterValue sourceParameter = parameters.parameter("Source");
        if (sourceParameter == null
                || !(sourceParameter.getValue() instanceof GridCoverage2D)) {
            throw new CannotCropException(Errors.format(ErrorKeys.NULL_PARAMETER_$2, "Source", GridCoverage2D.class.toString()));
        }
        source = (GridCoverage2D) sourceParameter.getValue();

        // Check Envelope and ROI existence - we need at least one of them
        final ParameterValue envelopeParameter = parameters.parameter(PARAMNAME_ENVELOPE);
        final ParameterValue roiParameter = parameters.parameter(PARAMNAME_ROI);

        if ( (envelopeParameter == null || envelopeParameter.getValue() == null) &&
             (roiParameter == null || roiParameter.getValue() ==null)                )
            throw new CannotCropException(Errors.format(ErrorKeys.NULL_PARAMETER_$2, PARAMNAME_ENVELOPE, GeneralEnvelope.class.toString()));

        Object envelope = envelopeParameter.getValue();
        if (envelope != null){
            if (envelope instanceof GeneralEnvelope){
                cropEnvelope = (GeneralEnvelope) envelope;
            } else if (envelope instanceof Envelope){
                cropEnvelope = new GeneralEnvelope((Envelope)envelope);
            }
        }
        // may be null

        // Check crop ROI
        try {
            cropRoi = IntersectUtils.unrollGeometries((Geometry) roiParameter.getValue()); // may throw if format not correct
        } catch (IllegalArgumentException ex) {
            throw new CannotCropException(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, PARAMNAME_ROI, ex.getMessage()), ex);
        }

        // Setting a GeneralEnvelope from ROI if needed
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.