Package org.opengis.coverage

Examples of org.opengis.coverage.SampleDimensionType


         * general case is handled as well. If the source (geophysics) raster uses floating point
         * numbers, then a "nodata" category may be added in order to handle NaN values. If the
         * source raster use integer numbers instead, then we will rescale samples only if they
         * would not fit in the target data type.
         */
        final SampleDimensionType sourceType = TypeMap.getSampleDimensionType(model, 0);
        final boolean          sourceIsFloat = TypeMap.isFloatingPoint(sourceType);
        SampleDimensionType targetType = null;
        if (hints != null) {
            targetType = (SampleDimensionType) hints.get(Hints.SAMPLE_DIMENSION_TYPE);
        }
        if (targetType == null) {
            // Default to TYPE_BYTE for floating point images only; otherwise keep unchanged.
View Full Code Here


        final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, i);
        if(colorInterpretation==null)
               throw new IOException("Unrecognized sample dimension type");
       
        // sample dimension type
        final SampleDimensionType st=TypeMap.getSampleDimensionType(sm, i);
           
        // set some no data values, as well as Min and Max values
        final double noData;
        double min=-Double.MAX_VALUE,max=Double.MAX_VALUE;
        if(backgroundValues!=null)
        {
                // sometimes background values are not specified as 1 per each band, therefore we need to be careful
                noData= backgroundValues[backgroundValues.length > i ? i:0];
        }
        else
        {
                if(st.compareTo(SampleDimensionType.REAL_32BITS)==0)
                        noData= Float.NaN;
                else
                        if(st.compareTo(SampleDimensionType.REAL_64BITS)==0)
                                noData= Double.NaN;
                        else
                                if(st.compareTo(SampleDimensionType.SIGNED_16BITS)==0)
                                {
                                        noData=Short.MIN_VALUE;
                                        min=Short.MIN_VALUE;
                                        max=Short.MAX_VALUE;
                                }
                                else
                                        if(st.compareTo(SampleDimensionType.SIGNED_32BITS)==0)
                                        {
                                                noData= Integer.MIN_VALUE;
   
                                                min=Integer.MIN_VALUE;
                                                max=Integer.MAX_VALUE;                                                 
                                        }
                                        else
                                                if(st.compareTo(SampleDimensionType.SIGNED_8BITS)==0)
                                                {
                                                        noData= -128;
                                                        min=-128;
                                                        max=127;
                                                }
                                                else
                                                {
                                                        //unsigned
                                                        noData= 0;
                                                        min=0;
                                                       
                                                       
                                                        // compute max
                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_1BIT)==0)
                                                                max=1;
                                                        else
                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_2BITS)==0)
                                                                        max=3;
                                                                else
                                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_4BITS)==0)
                                                                                max=7;
                                                                        else
                                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_8BITS)==0)
                                                                                        max=255;
                                                                                else
                                                                                        if(st.compareTo(SampleDimensionType.UNSIGNED_16BITS)==0)
                                                                                                max=65535;
                                                                                        else
                                                                                                if(st.compareTo(SampleDimensionType.UNSIGNED_32BITS)==0)
                                                                                                        max=Math.pow(2, 32)-1;
                                                                                                                       
                                                }
               
                                    
View Full Code Here

        // if no nodata categories are ready we'll add a fictitious one
        // @todo TODO make this code configurable
        if (candidateNoDataValues == null)
        {
            candidateNoDataValues= new double[1];
            final SampleDimensionType sdType = candidateSD.getSampleDimensionType();
            final int dataBufferType=TypeMap.getDataBufferType(sdType);
            switch(dataBufferType){
            case DataBuffer.TYPE_SHORT:
                candidateNoDataValues[0]=Short.MIN_VALUE;
                break;
View Full Code Here

    }else{

      // get sample type on bands
      final GridSampleDimension[] sampleDimensions = gc2d.getSampleDimensions();
      for(GridSampleDimension sd:sampleDimensions){
        final SampleDimensionType sdType=sd.getSampleDimensionType();
        final int dataBuffType =TypeMap.getDataBufferType(sdType);
       
        // TODO I think this should be a public utility inside the FeatureUtilities class
        @SuppressWarnings("rawtypes")
        final Class bandClass;
View Full Code Here

                      colorInterpretation=ColorInterpretation.UNDEFINED;
                  }
          
         
          // sample dimension type
          final SampleDimensionType st=TypeMap.getSampleDimensionType(sm, i);
       
          // set some no data values, as well as Min and Max values
          final double noData;
          double min=-Double.MAX_VALUE,max=Double.MAX_VALUE;
          if(backgroundValues!=null)
          {
            // sometimes background values are not specified as 1 per each band, therefore we need to be careful
            noData= backgroundValues[backgroundValues.length > i ? i:0];
          }
          else
          {
            if(st.compareTo(SampleDimensionType.REAL_32BITS)==0)
              noData= Float.NaN;
            else
              if(st.compareTo(SampleDimensionType.REAL_64BITS)==0)
                noData= Double.NaN;
              else
                if(st.compareTo(SampleDimensionType.SIGNED_16BITS)==0)
                {
                  noData=Short.MIN_VALUE;
                  min=Short.MIN_VALUE;
                  max=Short.MAX_VALUE;
                }
                else
                  if(st.compareTo(SampleDimensionType.SIGNED_32BITS)==0)
                  {
                    noData= Integer.MIN_VALUE;

                    min=Integer.MIN_VALUE;
                    max=Integer.MAX_VALUE;                   
                  }
                  else
                    if(st.compareTo(SampleDimensionType.SIGNED_8BITS)==0)
                    {
                      noData= -128;
                      min=-128;
                      max=127;
                    }
                    else
                    {
                      //unsigned
                      noData= 0;
                      min=0;
                     
                     
                      // compute max
                      if(st.compareTo(SampleDimensionType.UNSIGNED_1BIT)==0)
                        max=1;
                      else
                        if(st.compareTo(SampleDimensionType.UNSIGNED_2BITS)==0)
                          max=3;
                        else
                          if(st.compareTo(SampleDimensionType.UNSIGNED_4BITS)==0)
                            max=7;
                          else
                            if(st.compareTo(SampleDimensionType.UNSIGNED_8BITS)==0)
                              max=255;
                            else
                              if(st.compareTo(SampleDimensionType.UNSIGNED_16BITS)==0)
                                max=65535;
                              else
                                if(st.compareTo(SampleDimensionType.UNSIGNED_32BITS)==0)
                                  max=Math.pow(2, 32)-1;
                                           
                    }
           
                    
View Full Code Here

    }else{

      // get sample type on bands
      final GridSampleDimension[] sampleDimensions = gc2d.getSampleDimensions();
      for(GridSampleDimension sd:sampleDimensions){
        final SampleDimensionType sdType=sd.getSampleDimensionType();
        final int dataBuffType =TypeMap.getDataBufferType(sdType);
       
        // TODO I think this should be a public utility inside the FeatureUtilities class
        @SuppressWarnings("rawtypes")
        final Class bandClass;
View Full Code Here

        bandName = "Band" + (i + 1);
        colorInterpretation = ColorInterpretation.UNDEFINED;
      }

      // sample dimension type
      final SampleDimensionType st = TypeMap.getSampleDimensionType(
          sm,
          i);

      // set some no data values, as well as Min and Max values
      double noData;
      double min = -Double.MAX_VALUE, max = Double.MAX_VALUE;
      if (st.compareTo(SampleDimensionType.REAL_32BITS) == 0) {
        noData = Float.NaN;
      }
      else if (st.compareTo(SampleDimensionType.REAL_64BITS) == 0) {
        noData = Double.NaN;
      }
      else if (st.compareTo(SampleDimensionType.SIGNED_16BITS) == 0) {
        noData = Short.MIN_VALUE;
        min = Short.MIN_VALUE;
        max = Short.MAX_VALUE;
      }
      else if (st.compareTo(SampleDimensionType.SIGNED_32BITS) == 0) {
        noData = Integer.MIN_VALUE;

        min = Integer.MIN_VALUE;
        max = Integer.MAX_VALUE;
      }
      else if (st.compareTo(SampleDimensionType.SIGNED_8BITS) == 0) {
        noData = -128;
        min = -128;
        max = 127;
      }
      else {
        // unsigned
        noData = 0;
        min = 0;

        // compute max
        if (st.compareTo(SampleDimensionType.UNSIGNED_1BIT) == 0) {
          max = 1;
        }
        else if (st.compareTo(SampleDimensionType.UNSIGNED_2BITS) == 0) {
          max = 3;
        }
        else if (st.compareTo(SampleDimensionType.UNSIGNED_4BITS) == 0) {
          max = 7;
        }
        else if (st.compareTo(SampleDimensionType.UNSIGNED_8BITS) == 0) {
          max = 255;
        }
        else if (st.compareTo(SampleDimensionType.UNSIGNED_16BITS) == 0) {
          max = 65535;
        }
        else if (st.compareTo(SampleDimensionType.UNSIGNED_32BITS) == 0) {
          max = Math.pow(
              2,
              32) - 1;
        }
View Full Code Here

            result.add(new BeanProperty<CoverageDimensionInfo>("band", "name"));
            result.add(new AbstractProperty<CoverageDimensionInfo>("dimensionType") {

                @Override
                public Object getPropertyValue(CoverageDimensionInfo item) {
                    SampleDimensionType type = item.getDimensionType();
                    if (type == null) {
                        return "-";
                    } else {
                        String name = type.name();
                        try {
                            String key = BandsPanel.class.getSimpleName() + "." +  name;
                            ParamResourceModel rm = new ParamResourceModel(key, null);
                            return rm.getString();
                        } catch(Exception e) {
View Full Code Here

         *
         * @param sd the {@link CoverageDimensionInfo} to encode a meaningful range for.
         */
        public void handleSampleDimensionRange(CoverageDimensionInfo sd) {
            if (!setRange(sd.getRange())) {
                SampleDimensionType sdType = sd.getDimensionType();
                handleSampleDimensionType(sdType);
            }
        }
View Full Code Here

                GridSampleDimension gridSd = ((GridSampleDimension) sd);
                setRange = setRange(gridSd.getRange());
            }
            if (!setRange) {
                // fallback on sampleDimensionType
                SampleDimensionType sdType = sd.getSampleDimensionType();
                handleSampleDimensionType(sdType);
            }
        }
View Full Code Here

TOP

Related Classes of org.opengis.coverage.SampleDimensionType

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.