Package org.geotools.coverage

Examples of org.geotools.coverage.Category


            final List<Category> categories = sd[i].getCategories();
            if (categories != null && categories.size() >= 1) {
        writer.write("<nullValues>\n");
        for (Iterator<Category> it = sd[i].getCategories().iterator(); it
            .hasNext();) {
          Category cat = (Category) it.next();
          if ((cat != null)
              && cat.getName().toString().equalsIgnoreCase(
                  "no data")) {
            double min = cat.getRange().getMinimum();
            double max = cat.getRange().getMaximum();
            writer.write("<value>" + min + "</value>\n");
            if (min != max)
              writer.write("<value>" + max + "</value>\n");
          }
        }
View Full Code Here


            final Color[] colorRange = null;

            final boolean geophysics = isGeoPhysics();

            Category valuesCat = new Category("values", colorRange, sampleValueRange,
                    LinearTransform1D.IDENTITY).geophysics(geophysics);

            Category[] categories;
            if (geophysics) {
                double noDataValue = band.getNoDataValue().doubleValue();
                // same as Category.NODATA but for the actual nodata value instead of hardcoded to
                // zero
                Category nodataCat = new Category(
                        Vocabulary.formatInternational(VocabularyKeys.NODATA), transparent,
                        noDataValue);
                categories = new Category[] { valuesCat, nodataCat };
            } else {
                // do not build a nodata category. A nodata value that doesn't overlap the value
View Full Code Here

        NumberRange sourceRange = TypeMap.getRange(sourceType);
        for (int b=0; b<numBands; b++) {
            final Color[] c = colors!=null ? colors[b] : null;
            if (needScaling) {
                sourceRange = NumberRange.create(min[b], max[b]).castTo(sourceRange.getElementClass());
                categories[0] = new Category(n, c, targetRange, sourceRange);
            } else {
                categories[0] = new Category(n, c, targetRange, LinearTransform1D.IDENTITY);
            }
            dst[b] = new GridSampleDimension(name,categories, units).geophysics(true);
        }
    }
View Full Code Here

                float[]    targetBreakpoints = null;
                double        expectedSource = Double.NaN;
                double        expectedTarget = Double.NaN;
                int jbp = 0; // Break point index (vary with j)
                for (int j=0; j<numCategories; j++) {
                    final Category sourceCategory = sources.get(j);
                    final Category packedCategory = sourceCategory.geophysics(false);
                    MathTransform1D transform = packedCategory.getSampleToGeophysics();
                    final double offset, scale;
                    if (transform == null) {
                        /*
                         * A qualitative category was found. Those categories maps NaN values,
                         * which need the special processing performed by our "SampleTranscode"
                         * operation. However there is a few special cases where JAI operations
                         * could still fit:
                         *
                         * - In "packed to geophysics" transform, we can still use "Piecewise"
                         *   if the minimum and maximum target value are equals (usually NaN).
                         *
                         * - In "geophysics to packed" transform, we can still use "Rescale"
                         *   if the NaN value maps to 0.
                         */
                        if (toGeo) {
                            canRescale = false;
                            final NumberRange target = sourceCategory.geophysics(true).getRange();
                            offset = target.getMinimum();
                            if (Double.doubleToRawLongBits(offset) != Double.doubleToRawLongBits(target.getMaximum())) {
                                canPiecewise = false;
                                break testLinear;
                            }
                            scale = 0;
                        } else {
                            canPiecewise = false;
                            assert !packedCategory.equals(sourceCategory) : packedCategory;
                            final NumberRange range = packedCategory.getRange();
                            if (range.getMinimum(true) == 0 && range.getMaximum(true) == 0) {
                                assert isNaN(sourceCategory.getRange().getMinimum()) : sourceCategory;
                                conditional = true;
                                continue;
                            }
View Full Code Here

            PlanarImage.wrapRenderedImage(RasterSymbolizerTest
                .getSynthetic(Double.NaN)),
            new GeneralEnvelope(new double[] { -90, -180 },
                new double[] { 90, 180 }),
            new GridSampleDimension[] { new GridSampleDimension(
                "sd", new Category[] { new Category("",
                    Color.BLACK, 0) }, null) }, null, null);
      }
    };
    this.testedObject2 = new BaseCoverageProcessingNode(1,
        SimpleInternationalString.wrap("fake node"),
        SimpleInternationalString.wrap("fake node")) {

      protected GridCoverage2D execute() {
        return CoverageFactoryFinder.getGridCoverageFactory(null).create(
            "name",
            PlanarImage.wrapRenderedImage(RasterSymbolizerTest
                .getSynthetic(Double.NaN)),
            new GeneralEnvelope(new double[] { -90, -180 },
                new double[] { 90, 180 }),
            new GridSampleDimension[] { new GridSampleDimension(
                "sd", new Category[] { new Category("",
                    Color.BLACK, 0) }, null) }, null, null);
      }
    };
  }
View Full Code Here

        .create(
            "name",
            PlanarImage.wrapRenderedImage(getSynthetic(Double.NaN)),
            envelope,
            new GridSampleDimension[] { new GridSampleDimension(
                "sd", new Category[] { new Category("",
                    Color.BLACK, 0) }, null) }, null, null);


    RasterSymbolizer rs = extractRasterSymbolizer(sld);
View Full Code Here

                                                "name",
                                                PlanarImage.wrapRenderedImage(getSynthetic(Double.NaN)),
                                                new GeneralEnvelope(new double[] { -90, -180 },
                                                                new double[] { 90, 180 }),
                                                new GridSampleDimension[] { new GridSampleDimension(
                                                                "sd", new Category[] { new Category("",
                                                                                Color.BLACK, 0) }, null) }, null, null);

       
                SubchainStyleVisitorCoverageProcessingAdapter rsh = new RasterSymbolizerHelper(gc, null);
                RasterSymbolizer rs = extractRasterSymbolizer(sld);

                // visit the RasterSymbolizer
                rsh.visit(rs);
                IndexColorModel icm1 = (IndexColorModel) ((GridCoverage2D)rsh.getOutput()).getRenderedImage().getColorModel();
                testRasterSymbolizerHelper(rsh);
               
               
                ////
                //
                // Test using StyleBuilder
                //
                ////
                // get a coverage
                gc = CoverageFactoryFinder
                                .getGridCoverageFactory(null)
                                .create(
                                                "name",
                                                PlanarImage.wrapRenderedImage(getSynthetic(Double.NaN)),
                                                new GeneralEnvelope(new double[] { -90, -180 },
                                                                new double[] { 90, 180 }),
                                                new GridSampleDimension[] { new GridSampleDimension(
                                                                "sd", new Category[] { new Category("",
                                                                                Color.BLACK, 0) }, null) }, null, null);

                // build the RasterSymbolizer
                StyleBuilder sldBuilder = new StyleBuilder();
                rsh = new RasterSymbolizerHelper(gc, null);
View Full Code Here

    // no data management
    final GridSampleDimension sd = (GridSampleDimension) gc
        .getSampleDimension(0);
    final List<Category> categories = sd.getCategories();
    final Iterator<Category> it = categories.iterator();
    Category candidate;
    double inNoData = Double.NaN;
    final String noDataName = Vocabulary.format(VocabularyKeys.NODATA);
    while (it.hasNext()) {
      candidate = (Category) it.next();
      final String name = candidate.getName().toString();
      if (name.equalsIgnoreCase("No Data")
          || name.equalsIgnoreCase(noDataName)) {
        inNoData = candidate.getRange().getMaximum();
      }
    }

    return inNoData;
  }
View Full Code Here

    final GridCoverage2D gc = CoverageFactoryFinder.getGridCoverageFactory(null)
        .create(
            "name",
            PlanarImage.wrapRenderedImage(RasterSymbolizerTest.getSynthetic(Double.NaN)),
            new GeneralEnvelope(new double[] { -90, -180 },new double[] { 90, 180 }),
            new GridSampleDimension[] { new GridSampleDimension("sd", new Category[] { new Category("",Color.BLACK, 0) }, null) },
            null,
            null);

    root1 = new RootNode(gc);
    root2 = new RootNode(gc);
View Full Code Here

      // Categories
      //
      //
      // //
      Unit<?> uom = null;
      final Category nan;
      if (Double.isNaN(inNoData)) {
        nan = new Category(Vocabulary
            .formatInternational(VocabularyKeys.NODATA), new Color(
            0, 0, 0, 0), 0);

      } else {
        nan = new Category(Vocabulary
            .formatInternational(VocabularyKeys.NODATA),
            new Color[] { new Color(0, 0, 0, 0) },
            NumberRange.create(0, 0),
            NumberRange.create(inNoData, inNoData));
 
View Full Code Here

TOP

Related Classes of org.geotools.coverage.Category

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.