Package org.geotools.referencing.piecewise

Examples of org.geotools.referencing.piecewise.DefaultLinearPiecewiseTransform1DElement


    final int num =
      domainElementsToPreserve != null ?
        domainElements.length + domainElementsToPreserve.length
        : domainElements.length;
    for (int i = 0; i < num; i++) {
      final DefaultLinearPiecewiseTransform1DElement c0 =
        i >= domainElements.length ?
            (DefaultLinearPiecewiseTransform1DElement) domainElementsToPreserve[i- domainElements.length]:
              (DefaultLinearPiecewiseTransform1DElement) domainElements[i];
      final ColorMapTransformElement v0 = (ColorMapTransformElement) c0;
      final NumberRange<? extends Number> outRange0 = c0.getOutputRange();
      final Color[] colors0 = v0.getColors();
      final int minimum0 = (int) outRange0.getMinimum();
      final int maximum0 = (int) outRange0.getMaximum();
      // ////////////////////////////////////////////////////////////////
      //
      // Check the c0 categories with all the others
      //
      // ////////////////////////////////////////////////////////////////
      for (int j = 0; j < num; j++) {
        // don't check a category with itself.
        if (j == i)
          continue;
        // //
        //
        // We allow two LinearColorMapElement output ranges to overlap only if they
        // map to a single value and they use the same color for it.
        // Every other case is marked as an error either because it is
        // an error or because it was too hard to support.
        //
        // //
        final DefaultLinearPiecewiseTransform1DElement c1 =
          j >= domainElements.length ? (
              DefaultLinearPiecewiseTransform1DElement) domainElementsToPreserve[j- domainElements.length]:
                (DefaultLinearPiecewiseTransform1DElement) domainElements[j];
        final ColorMapTransformElement v1 = (ColorMapTransformElement) c1;
        final NumberRange<? extends Number> outRange1 = c1.getOutputRange();
        if (outRange1.intersects(outRange0)) {
         
          // do they intersect?
          if(!outRange0.intersects(outRange1))
            continue;
View Full Code Here


      BigInteger bits = new BigInteger("0");   
      final boolean preFilteringValuesPresent=preFilteringColor!=null;
      int elementsCount = standardElements.length+(preFilteringValuesPresent?1:0);
      int max=-1;
      for (int i = 0; i < elementsCount; i++) {
        final DefaultLinearPiecewiseTransform1DElement element =
          i<standardElements.length?
              (DefaultLinearPiecewiseTransform1DElement) standardElements[i]:
              preFilteringElements[0];
        final int elementMin=(int) element.getOutputMinimum();
        final int elementMax=(int) element.getOutputMaximum();
        for (int k = elementMin; k <= elementMax; k++)
          bits = bits.setBit(k);
        max = (int) Math.max(max, elementMax);
      }
      //zero based indexing
      max++;
     
      // /////////////////////////////////////////////////////////////////////
      //
      // Interpolate the colors in the color palette for standard values
      //
      // /////////////////////////////////////////////////////////////////////
      int[] ARGB = new int[max];
      int outMax=0,outMin=0;
      for (int i = 0; i < elementsCount; i++) {
        // I know that all the categories here are both
        // ColorMapTransformElement and DefaultLinearPiecewiseTransform1DElement. The
        // eventual NoDtaCategory as well.
        final LinearColorMapElement element = i<standardElements.length? standardElements[i]:preFilteringElements[0];
        // //
        //
        // Check if this category overlap with another one as far as
        // the output value but with the same color. We already
        // checked that they had the same color. If this happens we
        // prevent the code from creating a new entry at the same
        // place with the same color, no rocket science going on
        // here!
        //
        // //
        outMin = (int) element.getOutputMinimum();
        outMax = (int) (element.getOutputMaximum());
        //NOTE the second element is exclusive!!!
        ColorUtilities.expand(element.getColors(), ARGB, outMin, outMax+1);
      }

      //create the prefiltering piecewise
      this.preFilteringPiecewise=preFilteringElements==null?null:new DefaultPiecewiseTransform1D<LinearColorMapElement>(preFilteringElements);
     
View Full Code Here

TOP

Related Classes of org.geotools.referencing.piecewise.DefaultLinearPiecewiseTransform1DElement

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.