org.geotools.styling.RasterSymbolizer Java Examples
The following examples show how to use
org.geotools.styling.RasterSymbolizer.
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: RasterReader.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the rgb style. * * @param reader the reader * @param raster the raster * @return the style */ private Style createRGBStyle(AbstractGridCoverage2DReader reader, WritableRaster raster) { RasterSymbolizer sym = sf.getDefaultRasterSymbolizer(); GridCoverage2D cov = null; try { cov = reader.read(null); } catch (IOException giveUp) { throw new RuntimeException(giveUp); } // We need at least three bands to create an RGB style int numBands = cov.getNumSampleDimensions(); if (numBands < 3) { createRGBImageSymbol(sym, cov, raster); } else { createRGBChannelSymbol(sym, cov, numBands); } return SLD.wrapSymbolizers(sym); }
Example #2
Source File: RasterSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Populate shaded relief. * * @param rasterSymbolizer the raster symbolizer */ private void populateShadedRelief(RasterSymbolizer rasterSymbolizer) { GroupConfigInterface group; ShadedRelief shadedRelief = rasterSymbolizer.getShadedRelief(); group = getGroup(GroupIdEnum.RASTER_SHADEDRELIEF); if (group != null) { group.enable(shadedRelief != null); } if (shadedRelief != null) { fieldConfigVisitor.populateBooleanField( FieldIdEnum.RASTER_SHADEDRELIEF_BRIGHTNESS, shadedRelief.isBrightnessOnly()); fieldConfigVisitor.populateField( FieldIdEnum.RASTER_SHADEDRELIEF_FACTOR, shadedRelief.getReliefFactor()); } }
Example #3
Source File: RuleWrapper.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
/** * Returns the type of geometry/raster that the {@link SymbolizerWrapper} represents. * * @return the symbolizer type. */ public EGeometryType getType() { SymbolizerWrapper geometrySymbolizersWrapper = getGeometrySymbolizersWrapper(); if (geometrySymbolizersWrapper == null) { return null; } Symbolizer symbolizer = geometrySymbolizersWrapper.getSymbolizer(); if (symbolizer instanceof PointSymbolizer) { return EGeometryType.POINT; } else if (symbolizer instanceof LineSymbolizer) { return EGeometryType.LINESTRING; } else if (symbolizer instanceof PolygonSymbolizer) { return EGeometryType.POLYGON; } else if (symbolizer instanceof RasterSymbolizer) { throw new RuntimeException("Not implemented yet!"); } return null; }
Example #4
Source File: VOGeoServerContrastEnhancementNormalize.java From sldeditor with GNU General Public License v3.0 | 6 votes |
@Override public void populate(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { ContrastEnhancement contrastEnhancement = getContrastEnhancement(rasterSymbolizer); if (contrastEnhancement != null) { Map<String, Expression> options = contrastEnhancement.getOptions(); if ((options != null) && !options.isEmpty()) { if (contrastEnhancement.getMethod().equals(ContrastMethod.NORMALIZE)) { String algorithm = options.get(ALGORITHM_OPTION).toString(); fieldConfigVisitor.populateComboBoxField(algorithmFieldId, algorithm); populateMinValue(options); populateMaxValue(options); } } } } }
Example #5
Source File: RuleWrapper.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private SymbolizerWrapper getWrapper( Symbolizer symbolizer ) { SymbolizerWrapper symbolizerWrapper = null; if (symbolizer instanceof PointSymbolizer) { symbolizerWrapper = new PointSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof LineSymbolizer) { symbolizerWrapper = new LineSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof PolygonSymbolizer) { symbolizerWrapper = new PolygonSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof TextSymbolizer) { symbolizerWrapper = new TextSymbolizerWrapper(symbolizer, this, getType()); } else if (symbolizer instanceof RasterSymbolizer) { symbolizerWrapper = new RasterSymbolizerWrapper(symbolizer, this); } return symbolizerWrapper; }
Example #6
Source File: VOGeoServerContrastEnhancementNormalize.java From sldeditor with GNU General Public License v3.0 | 6 votes |
@Override public void updateSymbol(RasterSymbolizer rasterSymbolizer) { if (parentRasterPanel != null) { GroupConfigInterface group = parentRasterPanel.getGroup(GroupIdEnum.RASTER_CHANNELSELECTION); if ((group != null) && group.isPanelEnabled()) { MultiOptionGroup contrastEnhancementGroup = (MultiOptionGroup) group; ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection(); OptionGroup selectedOption = contrastEnhancementGroup.getSelectedOptionGroup(); ContrastEnhancement contrastEnhancement = getContrastEnhancement(selectedOption.getId(), channelSelection); if (contrastEnhancement != null) { extractNormalizeVendorOption(contrastEnhancement); } } } }
Example #7
Source File: GridCoverageNwwLayer.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private static GTRenderer getRenderer( File rasterFile ) { AbstractGridFormat format = GridFormatFinder.findFormat(rasterFile); AbstractGridCoverage2DReader coverageReader = format.getReader(rasterFile); MapContent mapContent = new MapContent(); try { Style rasterStyle = SldUtilities.getStyleFromFile(rasterFile); if (rasterStyle == null) { RasterSymbolizer sym = SldUtilities.sf.getDefaultRasterSymbolizer(); rasterStyle = SLD.wrapSymbolizers(sym); } GridReaderLayer layer = new GridReaderLayer(coverageReader, rasterStyle); mapContent.addLayer(layer); mapContent.getViewport().setCoordinateReferenceSystem(CrsUtilities.WGS84); } catch (Exception e) { e.printStackTrace(); } GTRenderer renderer = new StreamingRenderer(); renderer.setMapContent(mapContent); return renderer; }
Example #8
Source File: DistributedRenderCallback.java From geowave with Apache License 2.0 | 6 votes |
private static FeatureTypeStyle getDirectRasterStyle( final String geometryPropertyName, final Expression transformation) { final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(); final FeatureTypeStyle style = styleFactory.createFeatureTypeStyle(); final Rule rule = styleFactory.createRule(); rule.setName("distributed render - direct raster"); rule.setTitle("Distributed Render - Direct Raster"); final RasterSymbolizer symbolizer = styleFactory.createRasterSymbolizer(); symbolizer.setGeometryPropertyName(geometryPropertyName); rule.symbolizers().add(symbolizer); style.rules().add(rule); style.setTransformation(transformation); return style; }
Example #9
Source File: SLDTree.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Populate symbolizer. * * @param ruleTreeNode the rule tree node * @param symbolizer the symbolizer */ private void populateSymbolizer(DefaultMutableTreeNode ruleTreeNode, Symbolizer symbolizer) { DefaultMutableTreeNode symbolizerTreeNode = addObject(ruleTreeNode, symbolizer, true); if ((symbolizer instanceof PointSymbolizer) || (symbolizer instanceof PolygonSymbolizer)) { addObject( symbolizerTreeNode, SLDTreeLeafFactory.getInstance().getFill(symbolizer), true); } if ((symbolizer instanceof PolygonSymbolizer) || (symbolizer instanceof LineSymbolizer)) { addObject( symbolizerTreeNode, SLDTreeLeafFactory.getInstance().getStroke(symbolizer), true); } if (symbolizer instanceof RasterSymbolizer) { handleRasterSymbolizer(symbolizer, symbolizerTreeNode); } }
Example #10
Source File: SymbolizerTreeItem.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Default string. * * @param symbol the symbol * @return the string */ private String defaultString(Symbolizer symbol) { String name = ""; if (symbol instanceof PointSymbolizer) { name = DEFAULT_MARKER_NAME; } else if (symbol instanceof TextSymbolizer) { name = DEFAULT_TEXT_NAME; } else if (symbol instanceof LineSymbolizer) { name = DEFAULT_LINE_NAME; } else if (symbol instanceof PolygonSymbolizer) { name = DEFAULT_POLYGON_NAME; } else if (symbol instanceof RasterSymbolizer) { name = DEFAULT_RASTER_NAME; } return name; }
Example #11
Source File: SelectedSymbol.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Checks if the selected Style contains a raster symbol. * * @return true, if is raster symbol */ public boolean isRasterSymbol() { Style style = getStyle(); if (style != null) { for (FeatureTypeStyle fts : style.featureTypeStyles()) { for (Rule rule : fts.rules()) { for (Symbolizer symbolizer : rule.symbolizers()) { if (symbolizer instanceof RasterSymbolizer) { return true; } } } } } return false; }
Example #12
Source File: RuleRenderVisitor.java From sldeditor with GNU General Public License v3.0 | 6 votes |
public void visit(RasterSymbolizer raster) { // CHECKSTYLE:ON RasterSymbolizer copy = sf.createRasterSymbolizer(); copy.setChannelSelection(copy(raster.getChannelSelection())); copy.setColorMap(copy(raster.getColorMap())); copy.setContrastEnhancement(copy(raster.getContrastEnhancement())); copy.setGeometry(copy(raster.getGeometry())); copy.setUnitOfMeasure(raster.getUnitOfMeasure()); copy.setImageOutline(copy(raster.getImageOutline())); copy.setOpacity(copy(raster.getOpacity())); copy.setOverlap(copy(raster.getOverlap())); copy.setShadedRelief(copy(raster.getShadedRelief())); if (STRICT && !copy.equals(raster)) { throw new IllegalStateException("Was unable to duplicate provided raster:" + raster); } pages.push(copy); }
Example #13
Source File: NewRasterSLDTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** Test new point sld. */ @Test public void testNewRasterSLD() { NewRasterSLD newData = new NewRasterSLD(); StyledLayerDescriptor sld = newData.create(); assertTrue(sld.layers().size() == 1); StyledLayer styledLayer = sld.layers().get(0); NamedLayer namedLayer = (NamedLayer) styledLayer; Symbolizer symbolizer = namedLayer .styles() .get(0) .featureTypeStyles() .get(0) .rules() .get(0) .symbolizers() .get(0); assertTrue(symbolizer instanceof RasterSymbolizer); }
Example #14
Source File: RasterSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Populate colour map. * * @param rasterSymbolizer the raster symbolizer */ private void populateColourMap(RasterSymbolizer rasterSymbolizer) { ColorMap colourMap = rasterSymbolizer.getColorMap(); fieldConfigVisitor.populateComboBoxField( FieldIdEnum.RASTER_COLOURMAP_TYPE, Integer.toString(colourMap.getType())); fieldConfigVisitor.populateColourMapField(FieldIdEnum.RASTER_COLOURMAP, colourMap); }
Example #15
Source File: RasterSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Populate contrast enhancement. * * @param rasterSymbolizer the raster symbolizer */ private void populateContrastEnhancement(RasterSymbolizer rasterSymbolizer) { ContrastEnhancement contrast = rasterSymbolizer.getContrastEnhancement(); GroupConfigInterface group = getGroup(GroupIdEnum.RASTER_CONTRAST); if (group != null) { group.enable(contrast != null); } if (contrast != null) { Expression gammaValue = contrast.getGammaValue(); fieldConfigVisitor.populateField(FieldIdEnum.RASTER_CONTRAST_GAMMAVALUE, gammaValue); populateContrastMethod(contrast, GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD); } }
Example #16
Source File: SymbolizerTreeItem.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Check to see if symbolizer is an image outline. * * @param node the node * @return true, if successful */ private boolean imageOutline(DefaultMutableTreeNode node) { boolean isOutline = false; if (node != null) { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent(); if ((parentNode != null) && (parentNode.getUserObject() instanceof RasterSymbolizer)) { isOutline = true; } } return isOutline; }
Example #17
Source File: RasterSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Populate overlap behavior. * * @param rasterSymbolizer the raster symbolizer */ private void populateOverlapBehavior(RasterSymbolizer rasterSymbolizer) { OverlapBehavior overlapBehaviour = rasterSymbolizer.getOverlapBehavior(); GroupConfigInterface group = getGroup(GroupIdEnum.RASTER_OVERLAP); if (group != null) { group.enable(overlapBehaviour != null); } if (overlapBehaviour != null) { fieldConfigVisitor.populateComboBoxField( FieldIdEnum.RASTER_OVERLAP_BEHAVIOUR, overlapBehaviour.name()); } }
Example #18
Source File: VOGeoServerContrastEnhancementNormalizeGrey.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override protected ContrastEnhancement getContrastEnhancement(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection(); if (channelSelection != null) { SelectedChannelType greyChannel = channelSelection.getGrayChannel(); if (greyChannel != null) { return greyChannel.getContrastEnhancement(); } } } return null; }
Example #19
Source File: VOGeoServerTextSymbolizer2Test.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerTextSymbolizer2#populate(org.geotools.styling.RasterSymbolizer)}. */ @Test public void testPopulateRasterSymbolizer() { TextSymbolizerDetails panel = new TextSymbolizerDetails(); VOGeoServerTextSymbolizer2 testObj = new VOGeoServerTextSymbolizer2(panel.getClass()); RasterSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); }
Example #20
Source File: VOGeoServerLabellingUnderlineTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerLabellingUnderline#updateSymbol(org.geotools.styling.RasterSymbolizer)}. */ @Test void testUpdateSymbolRasterSymbolizer() { VOGeoServerLabellingUnderline testObj = new VOGeoServerLabellingUnderline(TextSymbolizerDetails.class); RasterSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); }
Example #21
Source File: VOGeoServerContrastEnhancementNormalizeBlue.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override protected ContrastEnhancement getContrastEnhancement(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection(); if (channelSelection != null) { SelectedChannelType[] rgbChannels = channelSelection.getRGBChannels(); if (rgbChannels != null) { if (rgbChannels[2] != null) { return rgbChannels[2].getContrastEnhancement(); } } } } return null; }
Example #22
Source File: VOGeoServerContrastEnhancementNormalizeOverall.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override protected ContrastEnhancement getContrastEnhancement(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { return rasterSymbolizer.getContrastEnhancement(); } return null; }
Example #23
Source File: VOGeoServerRandomFillTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.fill.VOGeoServerRandomFill#populate(org.geotools.styling.RasterSymbolizer)}. */ @Test void testPopulateRasterSymbolizer() { VOGeoServerRandomFill testObj = new VOGeoServerRandomFill(PointFillDetails.class); RasterSymbolizer symbolizer = null; testObj.populate(symbolizer); }
Example #24
Source File: VOGeoServerContrastEnhancementNormalizeRed.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override protected ContrastEnhancement getContrastEnhancement(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection(); if (channelSelection != null) { SelectedChannelType[] rgbChannels = channelSelection.getRGBChannels(); if (rgbChannels != null) { if (rgbChannels[0] != null) { return rgbChannels[0].getContrastEnhancement(); } } } } return null; }
Example #25
Source File: VOGeoServerContrastEnhancementNormalizeGreen.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override protected ContrastEnhancement getContrastEnhancement(RasterSymbolizer rasterSymbolizer) { if (rasterSymbolizer != null) { ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection(); if (channelSelection != null) { SelectedChannelType[] rgbChannels = channelSelection.getRGBChannels(); if (rgbChannels != null) { if (rgbChannels[1] != null) { return rgbChannels[1].getContrastEnhancement(); } } } } return null; }
Example #26
Source File: VOGeoServerTextSymbolizer2Test.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerTextSymbolizer2#updateSymbol(org.geotools.styling.RasterSymbolizer)}. */ @Test public void testUpdateSymbolRasterSymbolizer() { TextSymbolizerDetails panel = new TextSymbolizerDetails(); VOGeoServerTextSymbolizer2 testObj = new VOGeoServerTextSymbolizer2(panel.getClass()); RasterSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); }
Example #27
Source File: SelectedSymbolTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Test public void testRemoveRasterImageOutline() { SelectedSymbol.destroyInstance(); SelectedSymbol instance = SelectedSymbol.getInstance(); instance.removeRasterImageOutline(null); RasterSymbolizer rasterSymbol = DefaultSymbols.createDefaultRasterSymbolizer(); rasterSymbol.setImageOutline(DefaultSymbols.createDefaultLineSymbolizer()); instance.removeRasterImageOutline(rasterSymbol); assertNull(rasterSymbol.getImageOutline()); }
Example #28
Source File: SLDUtils.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Process symbolizer. * * @param symbolizer the symbolizer * @param traverseSymbolizersInterface the traverse symbolizers interface */ private static void processSymbolizer( org.opengis.style.Symbolizer symbolizer, TraverseSymbolizersInterface traverseSymbolizersInterface) { if (symbolizer instanceof PointSymbolizer) { traverseSymbolizersInterface.pointSymbolizerCallback((PointSymbolizer) symbolizer); } else if (symbolizer instanceof LineSymbolizer) { traverseSymbolizersInterface.lineSymbolizerCallback((LineSymbolizer) symbolizer); } else if (symbolizer instanceof PolygonSymbolizer) { traverseSymbolizersInterface.polygonSymbolizerCallback((PolygonSymbolizer) symbolizer); } else if (symbolizer instanceof RasterSymbolizer) { traverseSymbolizersInterface.rasterSymbolizerCallback((RasterSymbolizer) symbolizer); } }
Example #29
Source File: SelectedSymbol.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Adds the symbolizer to raster. * * @param symbolizer the symbolizer */ public void addImageOutlineSymbolizerToRaster(Symbolizer symbolizer) { Symbolizer selectedSymbolizer = this.symbolData.getSymbolizer(); if (selectedSymbolizer == null) { ConsoleManager.getInstance().error(this, "symbolizer == null"); } else { if (selectedSymbolizer instanceof RasterSymbolizer) { RasterSymbolizer rasterSymbolizer = (RasterSymbolizer) selectedSymbolizer; rasterSymbolizer.setImageOutline(symbolizer); } } }
Example #30
Source File: SLDTreeSymbolizerButtonStateTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#setGeometryType(com.sldeditor.datasource.impl.GeometryTypeEnum)}. * Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isMarkerVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isLineVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isPolygonVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isRasterVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isTextVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isImageOutlineLineVisible(java.lang.Object, * java.lang.Object)}. Test method for {@link * com.sldeditor.ui.tree.SLDTreeSymbolizerButtonState#isImageOutlinePolygonVisible(java.lang.Object, * java.lang.Object)}. */ @Test public void testRaster() { SLDTreeSymbolizerButtonState obj = new SLDTreeSymbolizerButtonState(); obj.setGeometryType(GeometryTypeEnum.RASTER); obj.showSymbolizerButtons(); assertFalse(obj.isLineVisible(null, null)); assertFalse(obj.isMarkerVisible(null, null)); assertFalse(obj.isPolygonVisible(null, null)); assertFalse(obj.isRasterVisible(null, null)); assertFalse(obj.isTextVisible(null, null)); assertFalse(obj.isImageOutlineLineVisible(null, null)); assertFalse(obj.isImageOutlinePolygonVisible(null, null)); Rule rule = DefaultSymbols.createNewRule(); assertTrue(obj.isRasterVisible(null, rule)); assertTrue(obj.isTextVisible(null, rule)); RasterSymbolizer raster = DefaultSymbols.createDefaultRasterSymbolizer(); assertTrue(obj.isImageOutlineLineVisible(null, raster)); assertTrue(obj.isImageOutlinePolygonVisible(null, raster)); raster.setImageOutline(DefaultSymbols.createDefaultLineSymbolizer()); assertFalse(obj.isImageOutlineLineVisible(null, raster)); assertFalse(obj.isImageOutlinePolygonVisible(null, raster)); raster.setImageOutline(DefaultSymbols.createDefaultPolygonSymbolizer()); assertFalse(obj.isImageOutlineLineVisible(null, raster)); assertFalse(obj.isImageOutlinePolygonVisible(null, raster)); }