it.geosolutions.jaiext.range.Range Java Examples
The following examples show how to use
it.geosolutions.jaiext.range.Range.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WarpOpImage.java From geowave with Apache License 2.0 | 6 votes |
public WarpOpImage( final RenderedImage source, final ImageLayout layout, final Map<?, ?> configuration, final boolean cobbleSources, final BorderExtender extender, final Interpolation interp, final Warp warp, final double[] backgroundValues, final ROI roi, final Range noData) { super( source, layout, configuration, cobbleSources, extender, interp, warp, backgroundValues, roi, noData); }
Example #2
Source File: JAIExtRangeValues.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override public void setValue(Object aValue) { this.value = null; this.expression = null; if (aValue instanceof Range) { this.value = (Range) aValue; } else if ((aValue instanceof AttributeExpressionImpl) || (aValue instanceof LiteralExpressionImpl) || (aValue instanceof FunctionExpressionImpl) || (aValue instanceof MathExpressionImpl)) { this.expression = (Expression) aValue; } }
Example #3
Source File: WarpRIF.java From geowave with Apache License 2.0 | 5 votes |
/** * Creates a new instance of warp operator according to the warp object and interpolation method. * * @param paramBlock The warp and interpolation objects. */ @Override public RenderedImage create(final ParameterBlock paramBlock, final RenderingHints renderHints) { final Interpolation interp = (Interpolation) paramBlock.getObjectParameter(1); if ((interp instanceof InterpolationNearest) || (interp instanceof javax.media.jai.InterpolationNearest)) { // Get ImageLayout from renderHints if any. final ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints); RenderedImage source = paramBlock.getRenderedSource(0); final Warp warp = (Warp) paramBlock.getObjectParameter(0); final double[] backgroundValues = (double[]) paramBlock.getObjectParameter(2); ROI roi = null; final Object roi_ = paramBlock.getObjectParameter(3); if (roi_ instanceof ROI) { roi = (ROI) roi_; final PlanarImage temp = PlanarImage.wrapRenderedImage(source); temp.setProperty("ROI", roi); source = temp; } Range noData = (Range) paramBlock.getObjectParameter(4); noData = RangeFactory.convert(noData, source.getSampleModel().getDataType()); return new WarpNearestOpImage( source, renderHints, layout, warp, interp, roi, noData, backgroundValues); } return super.create(paramBlock, renderHints); }
Example #4
Source File: JAIExtRangeValues.java From sldeditor with GNU General Public License v3.0 | 4 votes |
@Override public void setDefaultValue(Object defaultValue) { this.value = (Range) defaultValue; }
Example #5
Source File: JAIExtRangeValues.java From sldeditor with GNU General Public License v3.0 | 4 votes |
@Override public List<Class<?>> getType() { return Arrays.asList(Range.class); }
Example #6
Source File: JAIExtRangeValues.java From sldeditor with GNU General Public License v3.0 | 4 votes |
@Override public FieldConfigBase getField(FieldConfigCommonData commonData) { // TODO return new FieldConfigRange(commonData, it.geosolutions.jaiext.range.Range.class); }
Example #7
Source File: JAIExtRangeValuesTest.java From sldeditor with GNU General Public License v3.0 | 4 votes |
/** * Test method for {@link * com.sldeditor.rendertransformation.types.JAIExtRangeValues#JAIExtRangeValues()}. */ @Test void testJAIExtRangeValues() { JAIExtRangeValues testObj = new JAIExtRangeValues(); testObj.createInstance(); assertEquals(Arrays.asList(Range.class), testObj.getType()); Range range = RangeFactory.create(0.0, true, 50.0, true, false); testObj.setDefaultValue(range); assertNull(testObj.getExpression()); // Range value testObj.setValue(range); assertNull(testObj.getExpression()); // Literal expression Expression expectedExpression = ff.literal(range); testObj.setValue(expectedExpression); assertEquals(expectedExpression, testObj.getExpression()); // Attribute expression expectedExpression = ff.property("test"); testObj.setValue(expectedExpression); assertEquals(expectedExpression, testObj.getExpression()); // Not set testObj.setValue(""); assertNull(testObj.getExpression()); FieldConfigBase field = testObj.getField( new FieldConfigCommonData( JAIExtRangeValues.class, FieldIdEnum.INITIAL_GAP, "label", true, false, false)); assertEquals(FieldConfigRange.class, field.getClass()); // Increase code coverage TestJAIExtRangeValues testObj2 = new TestJAIExtRangeValues(); testObj2.populateSymbolType(null); }
Example #8
Source File: WarpNearestOpImage.java From geowave with Apache License 2.0 | 4 votes |
/** * Constructs a WarpNearestOpImage. * * @param source The source image. * @param config RenderingHints used in calculations. * @param layout The destination image layout. * @param warp An object defining the warp algorithm. * @param interp An object describing the interpolation method. * @param roi input ROI object used. * @param noData NoData Range object used for checking if NoData are present. */ public WarpNearestOpImage( final RenderedImage source, final Map<?, ?> config, final ImageLayout layout, final Warp warp, final Interpolation interp, final ROI sourceROI, final Range noData, final double[] bkg) { super( source, layout, config, false, null, // extender not needed in // nearest-neighbor // interpolation interp, warp, bkg, sourceROI, noData); /* * If the source has IndexColorModel, override the default setting in OpImage. The dest shall * have exactly the same SampleModel and ColorModel as the source. Note, in this case, the * source should have an integral data type. */ final ColorModel srcColorModel = source.getColorModel(); if (srcColorModel instanceof IndexColorModel) { sampleModel = source.getSampleModel().createCompatibleSampleModel(tileWidth, tileHeight); colorModel = srcColorModel; } /* * Selection of a destinationNoData value for each datatype */ final SampleModel sm = source.getSampleModel(); // Source image data Type final int srcDataType = sm.getDataType(); // Creation of a lookuptable containing the values to use for no data if ((srcDataType == DataBuffer.TYPE_BYTE) && hasNoData) { final int numBands = getNumBands(); byteLookupTable = new byte[numBands][256]; for (int b = 0; b < numBands; b++) { for (int i = 0; i < byteLookupTable[0].length; i++) { final byte value = (byte) i; if (noDataRange.contains(value)) { byteLookupTable[b][i] = (byte) backgroundValues[b]; } else { byteLookupTable[b][i] = value; } } } } }