Package org.geotools.styling

Examples of org.geotools.styling.ContrastEnhancement


            channelNum[GREEN] = 2;
            channelNum[BLUE] = 3;
        }
        // Now we create a RasterSymbolizer using the selected channels
        SelectedChannelType[] sct = new SelectedChannelType[cov.getNumSampleDimensions()];
        ContrastEnhancement ce = styleFactory.contrastEnhancement(filterFactory.literal(1.0), ContrastMethod.NORMALIZE);
        for( int i = 0; i < 3; i++ ) {
            sct[i] = styleFactory.createSelectedChannelType(String.valueOf(channelNum[i]), ce);
        }
        RasterSymbolizer sym = styleFactory.getDefaultRasterSymbolizer();
        ChannelSelection sel = styleFactory.channelSelection(sct[RED], sct[GREEN], sct[BLUE]);
View Full Code Here


         * @param hints
         * @throws OperationNotSupportedException
         */
        public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints )
                throws OperationNotSupportedException, SAXException {
            ContrastEnhancement symbol = new ContrastEnhancementImpl();

            for (int i = 0; i < value.length; i++) {
                if ((value[i] == null) || value[i].getElement() == null) {
                    continue;
                }

                Element e = value[i].getElement();
                if(elems[NORMALIZE].getName().equals(e.getName()))
                    symbol.setNormalize(); // (Graphic)value[i].getValue()

                if(elems[HISTORGRAM].getName().equals(e.getName()))
                    symbol.setHistogram(); // (Graphic)value[i].getValue()

                if(elems[GAMMAVALUE].getName().equals(e.getName())){
                    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
                    symbol.setGammaValue(ff.literal( ((Double)value[i].getValue()).doubleValue()));
                }
            }
           
            return symbol;
        }
View Full Code Here

    return dap;
  }

  /** Internal parse method - made protected for unit testing */
  protected ContrastEnhancement parseContrastEnhancement(Node root) {
    ContrastEnhancement symbol = new ContrastEnhancementImpl();

    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();
      }

      if (childName.equalsIgnoreCase("Normalize")) {
        symbol.setNormalize();
      } else if (childName.equalsIgnoreCase("Histogram")) {
        symbol.setHistogram();
      } else if (childName.equalsIgnoreCase("Logarithmic")) {
        symbol.setLogarithmic();
      } else if (childName.equalsIgnoreCase("Exponential")) {
        symbol.setExponential();
      } else if (childName.equalsIgnoreCase("GammaValue")) {
        try {
          final String gammaString = getFirstChildValue(child);
          symbol.setGammaValue(ff.literal(Double
              .parseDouble(gammaString)));
        } catch (Exception e) {
          if (LOGGER.isLoggable(Level.WARNING))
            LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
        }
View Full Code Here

TOP

Related Classes of org.geotools.styling.ContrastEnhancement

Copyright © 2018 www.massapicom. 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.