Refine search
(Color) ImageMosaicJDBCFormat.OUTPUT_TRANSPARENT_COLOR.getDefaultValue(); Color backgroundColor = (Color) ImageMosaicJDBCFormat.BACKGROUND_COLOR.getDefaultValue(); Parameter<Object> param = (Parameter<Object>) generalParameterValue; if (param.getDescriptor() .getName() .getCode() .equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); state.setRequestedEnvelope((GeneralEnvelope) gg.getEnvelope()); dim = gg.getGridRange2D().getBounds(); } else if (param.getDescriptor() .getName() .getCode() .getName() .toString())) { outputTransparentColor = (Color) param.getValue(); } else if (param.getDescriptor() .getName() .getCode() .equals(ImageMosaicJDBCFormat.BACKGROUND_COLOR.getName().toString())) { backgroundColor = (Color) param.getValue();
/** Returns the parameters for this math transform. */ @Override public ParameterValueGroup getParameterValues() { return new ParameterGroup( getParameterDescriptors(), new ParameterValue[] {new Parameter(Provider.ORDER, nmax)}); }
private GeneralParameterValue[] applyBandsSelectionParameter( GridCoverageReader reader, GeneralParameterValue[] readParams, RasterSymbolizer symbolizer) { int[] bandIndices = ChannelSelectionUpdateStyleVisitor.getBandIndicesFromSelectionChannels(symbolizer); Parameter<int[]> bandIndicesParam = null; bandIndicesParam = (Parameter<int[]>) AbstractGridFormat.BANDS.createValue(); bandIndicesParam.setValue(bandIndices); List<GeneralParameterValue> paramList = new ArrayList<GeneralParameterValue>(); if (readParams != null) { paramList.addAll(Arrays.asList(readParams)); } paramList.add(bandIndicesParam); return paramList.toArray(new GeneralParameterValue[paramList.size()]); }
private void logRequestParams(GeneralParameterValue[] params) { LOGGER.info("----PARAMS START-------"); for (int i = 0; i < params.length; i++) { Parameter<Object> p = (Parameter<Object>) params[i]; LOGGER.info(p.getDescriptor().getName().toString() + ": " + p.getValue()); } LOGGER.info("----PARAMS END-------"); }
/** * Sets the parameter value as an integer. * * @param value The parameter value. * @throws InvalidParameterValueException if the integer type is inappropriate for this * parameter, or if the value is illegal for some other reason (for example a value out of * range). * @see #intValue */ public void setValue(final int value) throws InvalidParameterValueException { @SuppressWarnings("unchecked") // Checked by constructor. final ParameterDescriptor<T> descriptor = (ParameterDescriptor) this.descriptor; final Class<T> type = descriptor.getValueClass(); if (Double.class.equals(type) || Double.TYPE.equals(type)) { setValue((double) value); return; } final Integer check = value; this.value = ensureValidValue(descriptor, check); }
/** * Returns a clone of this parameter. Actually returns a different classes, since this parameter * is not really cloneable (it would requires a clone of {@link #parameters} first). */ @Override public Parameter<T> clone() { final Parameter<T> parameter = new Parameter<T>(getDescriptor()); parameter.setValue(getValue()); return parameter; } }
AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); readGG.setValue(new GridGeometry2D(new GridEnvelope2D(requestedRasterArea), envelope)); (Parameter<Interpolation>) ImageMosaicFormat.INTERPOLATION.createValue(); readInterpolation.setValue(interpolation); bgColorParam = (Parameter<Color>) AbstractGridFormat.BACKGROUND_COLOR.createValue(); bgColorParam.setValue(bgColor); } else { bgColorParam = null; bandIndicesParam = (Parameter<int[]>) AbstractGridFormat.BANDS.createValue(); bandIndicesParam.setValue(bandIndices); final String paramName = readParams[i].getDescriptor().getName().toString(); if (paramName.equalsIgnoreCase(readGGName) && readGG != null) { ((Parameter) readParams[i]).setValue(readGG); foundGG = true; } else if (paramName.equalsIgnoreCase(readInterpolationName)) { ((Parameter) readParams[i]).setValue(interpolation); foundInterpolation = true; } else if (paramName.equalsIgnoreCase(bgColorName) && bgColor != null) { ((Parameter) readParams[i]).setValue(bgColor); foundBgColor = true; } else if (paramName.equalsIgnoreCase(bandsListName) && bandIndices != null) { ((Parameter) readParams[i]).setValue(bandIndices); foundBandIndices = true;
parameter = Parameter.create("Test", 14); descriptor = parameter.getDescriptor(); assertNull("unit", parameter.getUnit()); assertEquals("intValue", 14, parameter.intValue()); assertEquals("doubleValue", 14, parameter.doubleValue(), 0); assertEquals("type", Integer.class, descriptor.getValueClass()); assertEquals("name", "Test", descriptor.getName().getCode()); assertEquals("defaultValue", 0, descriptor.getDefaultValue()); parameter.doubleValue(SI.METRE); fail("doubleValue(METER)"); } catch (IllegalStateException exception) { parameter.stringValue(); fail("stringValue()"); } catch (InvalidParameterTypeException exception) { parameter = Parameter.create("Test", 3, SI.METRE); descriptor = (ParameterDescriptor) parameter.getDescriptor(); assertEquals("intValue", 3, parameter.intValue()); assertEquals("doubleValue", 3, parameter.doubleValue(), 0); assertEquals("doubleValue", 300, parameter.doubleValue(MetricPrefix.CENTI(SI.METRE)), 0); parameter.stringValue(); fail("stringValue()"); } catch (InvalidParameterTypeException exception) { parameter = Parameter.create("Test", AxisDirection.class, AxisDirection.NORTH); descriptor = (ParameterDescriptor) parameter.getDescriptor();
param = (Parameter) params[i]; if (param.getDescriptor().getName().getCode().equals( AbstractGridFormat.READ_GRIDGEOMETRY2D.getName() .toString())) { final GridGeometry2D gg = (GridGeometry2D) param .getValue(); requestedEnvelope = new GeneralEnvelope((Envelope) gg .getEnvelope2D());
ReferenceIdentifier name = parameter.getDescriptor().getName(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName())) { parameter.setValue( new GridGeometry2D( new GridEnvelope2D(integerRasterArea), } else if (propertyNames != null && propertyNames.length > 0 && name.equals(AbstractGridFormat.BANDS.getName())) { int[] bands = new int[propertyNames.length]; Set<String> requestedNames = new HashSet<>(Arrays.asList(propertyNames)); "PropertyName"); parameter.setValue(bands);
GridCoverage2D readCoverage(final AbstractGridCoverage2DReader reader, final Object params, GridGeometry2D readGG) throws IOException { GridCoverage2D coverage; final Parameter<GridGeometry2D> readGGParam = new Parameter<GridGeometry2D>( AbstractGridFormat.READ_GRIDGEOMETRY2D); readGGParam.setValue(readGG); final String name = AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(); int i = 0; for (; i < length; i++) ((Parameter) readParams[i]).setValue(readGGParam); coverage = (GridCoverage2D) reader.read(readParams); } else {
(Parameter<GridGeometry2D>) AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); readGGParam.setValue(new GridGeometry2D(gg)); final String name = AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(); int i = 0; for (; i < length; i++) {
v1 = new Parameter<Integer>(p1); v1.setValue(10); v2 = new Parameter<Integer>(p2); v2.setValue(20); v3 = new Parameter<Integer>(p3); v3.setValue(30); v4 = new Parameter<Integer>(p4); v4.setValue(40); v1b = new Parameter<Integer>(p1); v1b.setValue(-10); v2b = new Parameter<Integer>(p2); v2b.setValue(-20); v3b = new Parameter<Integer>(p3); v3b.setValue(-30); v4b = new Parameter<Integer>(p4); v4b.setValue(-40); descriptor = group.getDescriptor(); content = group.values(); automatic = (Parameter) v3.getDescriptor().createValue(); descriptor = group.getDescriptor(); content = group.values(); automatic = (Parameter) v3.getDescriptor().createValue();
public void testCodeList() { Parameter<AxisDirection> param = Parameter.create("Test", AxisDirection.class, AxisDirection.DISPLAY_UP); ParameterDescriptor op = param.getDescriptor(); assertEquals( "Set<AxisDirection>", new HashSet<AxisDirection>(Arrays.asList(AxisDirection.values())), op.getValidValues()); assertNull("defaultValue", op.getDefaultValue()); param.setValue(AxisDirection.DOWN); try { param.setValue(VerticalDatumType.ELLIPSOIDAL); fail("setValue(VerticalDatumType)"); } catch (InvalidParameterValueException exception) { param.setValue(dummy); fail("setValue(AxisDirection)"); } catch (InvalidParameterValueException exception) { param = Parameter.create("Test", AxisDirection.class, AxisDirection.DISPLAY_UP); param.setValue(dummy); // Should not fails. assertEquals("equals(clone)", param, param.clone());
public void testRangeIntegers() { Parameter<Integer> param; param = new Parameter(DefaultParameterDescriptor.create("Range", 15, -30, +40)); assertEquals("intValue", 15, param.intValue()); assertEquals("doubleValue", 15, param.doubleValue(), 0.0); param.setValue(12); assertEquals("intValue", 12, param.intValue()); assertEquals("doubleValue", 12, param.doubleValue(), 0.0); try { param.setValue(50); fail("setValue(> max)"); } catch (InvalidParameterValueException exception) { param.setValue(-40); fail("setValue(< min)"); } catch (InvalidParameterValueException exception) { param.setValue(10.0); fail("setValue(double)"); } catch (InvalidParameterValueException exception) { assertEquals("Clone not equals: ", param, param.clone());
final double [] bgValues; if (bgValueParam != null && bgValueParam instanceof Parameter<?>){ bgValues = ((Parameter<double[]>)bgValueParam).getValue(); } else { bgValues = null; (hints instanceof Hints) ? hints : new Hints(hints), bgValues); } catch (FactoryException exception) { throw new CannotReprojectException(Errors.format( ErrorKeys.CANT_REPROJECT_$1, source.getName()), exception); } catch (TransformException exception) { throw new CannotReprojectException(Errors.format( ErrorKeys.CANT_REPROJECT_$1, source.getName()), exception);
/** * Constructs a parameter from the specified name and value. This convenience constructor * creates a {@link DefaultParameterDescriptor} object. But if such an object is available, then * the preferred way to get a {@code ParameterValue} is to invoke {@link * ParameterDescriptor#createValue}. * * @param name The parameter name. * @param value The parameter value. * @return A new parameter instance for the given name and value. * @since 2.5 */ public static Parameter<Integer> create(final String name, final int value) { final ParameterDescriptor<Integer> descriptor = DefaultParameterDescriptor.create(name, 0, Integer.MIN_VALUE, Integer.MAX_VALUE); final Parameter<Integer> parameter = new Parameter<Integer>(descriptor); parameter.value = value; return parameter; }
/** * Constructs a parameter value from the specified descriptor and value. * * @param descriptor The abstract definition of this parameter. * @param value The parameter value. * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this * parameter, or if the value is illegal for some other reason (for example the value is * numeric and out of range). */ public Parameter(final ParameterDescriptor<T> descriptor, final T value) throws InvalidParameterValueException { super(descriptor); unit = descriptor.getUnit(); setValue(value); }
+ parameter.getDescriptor().getName().getCode(); styles = styles + (String) parameter.getValue();
final double[] bgValues; if (bgValueParam != null && bgValueParam instanceof Parameter<?>) { bgValues = ((Parameter<double[]>) bgValueParam).getValue(); } else { bgValues = null;