public void setRGBChannels( org.opengis.style.SelectedChannelType red, org.opengis.style.SelectedChannelType green, org.opengis.style.SelectedChannelType blue) { this.red = new SelectedChannelTypeImpl(red); this.green = new SelectedChannelTypeImpl(green); this.blue = new SelectedChannelTypeImpl(blue); }
public SelectedChannelTypeImpl(FilterFactory factory) { filterFactory = factory; contrastEnhancement = contrastEnhancement(filterFactory.literal(1.0)); }
public SelectedChannelTypeImpl selectedChannelType( String channelName, org.opengis.style.ContrastEnhancement contrastEnhancement) { SelectedChannelTypeImpl selectedChannelType = new SelectedChannelTypeImpl(filterFactory); selectedChannelType.setChannelName(channelName); selectedChannelType.setContrastEnhancement(contrastEnhancement); return selectedChannelType; }
public void setChannelName(String name) { this.name = name; fireChanged(); }
public void setGrayChannel(org.opengis.style.SelectedChannelType gray) { this.gray = new SelectedChannelTypeImpl(gray); }
public SelectedChannelTypeImpl selectedChannelType( Expression channelName, org.opengis.style.ContrastEnhancement contrastEnhancement) { SelectedChannelTypeImpl selectedChannelType = new SelectedChannelTypeImpl(filterFactory); selectedChannelType.setChannelName(channelName); selectedChannelType.setContrastEnhancement(contrastEnhancement); return selectedChannelType; }
public SelectedChannelTypeImpl(FilterFactory factory) { filterFactory = factory; contrastEnhancement = contrastEnhancement(filterFactory .literal(1.0)); } public SelectedChannelTypeImpl(FilterFactory factory, ContrastEnhancement contrast ) {
public SelectedChannelType createSelectedChannelType( Expression name, ContrastEnhancement enhancement) { SelectedChannelType sct = new SelectedChannelTypeImpl(filterFactory); sct.setChannelName(name); sct.setContrastEnhancement(enhancement); return sct; }
/** * Takes into account that the band selection has been delegated down to the reader by producing * a new channel selection * * @param symbolizer * @return */ public static RasterSymbolizer setupSymbolizerForBandsSelection(RasterSymbolizer symbolizer) { ChannelSelection selection = symbolizer.getChannelSelection(); final SelectedChannelType[] originalChannels = selection.getSelectedChannels(); if (originalChannels != null) { int i = 0; SelectedChannelType[] channels = new SelectedChannelType[originalChannels.length]; for (SelectedChannelType originalChannel : originalChannels) { // Remember, channel indices start from 1 SelectedChannelTypeImpl channel = new SelectedChannelTypeImpl(); channel.setChannelName(Integer.toString(i + 1)); channel.setContrastEnhancement(originalChannel.getContrastEnhancement()); channels[i] = channel; i++; } ChannelSelectionUpdateStyleVisitor channelsUpdateVisitor = new ChannelSelectionUpdateStyleVisitor(channels); symbolizer.accept(channelsUpdateVisitor); return (RasterSymbolizer) channelsUpdateVisitor.getCopy(); } return symbolizer; }
public SelectedChannelTypeImpl(FilterFactory factory) { filterFactory = factory; contrastEnhancement = contrastEnhancement(filterFactory .literal(1.0)); }
/** Internal parse method - made protected for unit testing */ protected SelectedChannelType parseSelectedChannel(Node root) { SelectedChannelType symbol = new SelectedChannelTypeImpl(); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } else if (childName.equalsIgnoreCase("SourceChannelName")) { if (child.getFirstChild() != null) { symbol.setChannelName(parseParameterValueExpression(child, true)); } } else if (childName.equalsIgnoreCase("ContrastEnhancement")) { symbol.setContrastEnhancement(parseContrastEnhancement(child)); /* * try { if (child.getFirstChild() != null && child.getFirstChild().getNodeType() == Node.TEXT_NODE) * symbol.setContrastEnhancement((Expression) ExpressionBuilder .parse(child.getFirstChild().getNodeValue())); } catch (Exception e) { * // TODO: handle exception } */ } } return symbol; }
public SelectedChannelTypeImpl selectedChannelType(String channelName, org.opengis.style.ContrastEnhancement contrastEnhancement) { SelectedChannelTypeImpl selectedChannelType = new SelectedChannelTypeImpl( filterFactory ); selectedChannelType.setChannelName(channelName); selectedChannelType.setContrastEnhancement( contrastEnhancement ); return selectedChannelType; }
public SelectedChannelType createSelectedChannelType(Expression name, Expression gammaValue) { SelectedChannelType sct = new SelectedChannelTypeImpl(filterFactory); sct.setChannelName(name); sct.setContrastEnhancement(createContrastEnhancement(gammaValue)); return sct; }
public SelectedChannelType createSelectedChannelType(String name, Expression gammaValue) { SelectedChannelType sct = new SelectedChannelTypeImpl(filterFactory); sct.setChannelName(name); sct.setContrastEnhancement(createContrastEnhancement(gammaValue)); return sct; }
/** * getValue ... * * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map) * @param element * @param value * @param attrs1 * @param hints * @throws OperationNotSupportedException */ public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints) { org.geotools.styling.SelectedChannelType symbol = new org.geotools.styling.SelectedChannelTypeImpl(); for (int i = 0; i < value.length; i++) { if ((value[i] == null) || value[i].getElement() == null) { continue; } Element e = value[i].getElement(); if (elems[SOURCECHANNELNAME].getName().equals(e.getName())) symbol.setChannelName((String) value[i].getValue()); if (elems[CONTRASTENHANCEMENT].getName().equals(e.getName())) symbol.setContrastEnhancement((Expression) value[i].getValue()); } return symbol; } }
public void setRGBChannels(org.opengis.style.SelectedChannelType red, org.opengis.style.SelectedChannelType green, org.opengis.style.SelectedChannelType blue ){ this.red = new SelectedChannelTypeImpl( red ); this.green = new SelectedChannelTypeImpl( green ); this.blue = new SelectedChannelTypeImpl( blue ); }
public void setGrayChannel(org.opengis.style.SelectedChannelType gray ){ this.gray = new SelectedChannelTypeImpl( gray ); }
final SelectedChannelType chTypeRed = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeBlue = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeGreen = new SelectedChannelTypeImpl();
private RasterSymbolizer createClippingChannelSelectionSymbolizer(int min, int max) { StyleBuilder sldBuilder = new StyleBuilder(); RasterSymbolizer symbolizer = sldBuilder.createRasterSymbolizer(); final ChannelSelection chSel = new ChannelSelectionImpl(); final SelectedChannelType chTypeRed = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeBlue = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeGreen = new SelectedChannelTypeImpl(); SelectedChannelType[] channels = new SelectedChannelType[] {chTypeRed, chTypeGreen, chTypeBlue}; // Assign a different contrast method for each channel // by offsetting min and max of 20 on each channel // and assigning channels number with increments of 2 for (int i = 0; i < 3; i++) { final ContrastEnhancement cntEnh = new ContrastEnhancementImpl(); final ContrastMethodStrategy method = new NormalizeContrastMethodStrategy(); method.addOption( "algorithm", sldBuilder.literalExpression( ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method.addOption("minValue", sldBuilder.literalExpression(min + (20 * i))); method.addOption("maxValue", sldBuilder.literalExpression(max + (20 * i))); cntEnh.setMethod(method); channels[i].setChannelName(Integer.toString((i * 2) + 1)); channels[i].setContrastEnhancement(cntEnh); } chSel.setRGBChannels(chTypeRed, chTypeGreen, chTypeBlue); symbolizer.setChannelSelection(chSel); symbolizer.setOpacity(sldBuilder.literalExpression(1.0)); return symbolizer; }
public SelectedChannelType getEdited() { if (channel == null) { channel = new SelectedChannelTypeImpl(); } apply(); return channel; }