Package mil.nga.giat.geowave.index.sfc

Examples of mil.nga.giat.geowave.index.sfc.RangeDecomposition


        query.getDimensionCount());
    final byte[] maxZorder = ZOrderUtils.encode(
        normalizedMaxes,
        cardinalityPerDimension,
        query.getDimensionCount());
    return new RangeDecomposition(
        new ByteArrayRange[] {
          new ByteArrayRange(
              new ByteArrayId(
                  minZorder),
              new ByteArrayId(
View Full Code Here


        new NumericData[] {
          rangeX,
          rangeY
        });

    RangeDecomposition rangeDecomposition = hilbertSFC.decomposeQuery(
        spatialQuery,
        1);

    Assert.assertEquals(
        1,
        rangeDecomposition.getRanges().length);

  }
View Full Code Here

        new NumericData[] {
          rangeX,
          rangeY
        });

    RangeDecomposition rangeDecomposition = hilbertSFC.decomposeQuery(
        spatialQuery,
        20);

    Assert.assertEquals(
        20,
        rangeDecomposition.getRanges().length);

  }
View Full Code Here

        0);

    final NumericRange rangeLatitude4 = new NumericRange(
        0,
        Double.MIN_VALUE);
    final RangeDecomposition expectedResult1 = expectedResultOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude1,
          rangeLatitude1
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    final RangeDecomposition testResult1 = testOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude1,
          rangeLatitude1
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    Assert.assertTrue(expectedResult1.getRanges().length == testResult1.getRanges().length);
    for (int i = 0; i < expectedResult1.getRanges().length; i++) {
      Assert.assertTrue(expectedResult1.getRanges()[i].equals(testResult1.getRanges()[i]));
    }
    final RangeDecomposition expectedResult2 = expectedResultOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude2,
          rangeLatitude2
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    final RangeDecomposition testResult2 = testOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude2,
          rangeLatitude2
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    Assert.assertTrue(expectedResult2.getRanges().length == testResult2.getRanges().length);
    for (int i = 0; i < expectedResult2.getRanges().length; i++) {
      Assert.assertTrue(expectedResult2.getRanges()[i].equals(testResult2.getRanges()[i]));
    }
    final RangeDecomposition expectedResult3 = expectedResultOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude3,
          rangeLatitude3
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    final RangeDecomposition testResult3 = testOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude3,
          rangeLatitude3
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    Assert.assertTrue(expectedResult3.getRanges().length == testResult3.getRanges().length);
    for (int i = 0; i < expectedResult3.getRanges().length; i++) {
      Assert.assertTrue(expectedResult3.getRanges()[i].equals(testResult3.getRanges()[i]));
    }
    final RangeDecomposition expectedResult4 = expectedResultOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude4,
          rangeLatitude4
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    final RangeDecomposition testResult4 = testOperations.decomposeRange(
        new NumericData[] {
          rangeLongitude4,
          rangeLatitude4
        },
        compactHilbertCurve,
        sfcDimensions,
        totalPrecision,
        Integer.MAX_VALUE,
        true);
    Assert.assertTrue(expectedResult4.getRanges().length == testResult4.getRanges().length);
    for (int i = 0; i < expectedResult4.getRanges().length; i++) {
      Assert.assertTrue(expectedResult4.getRanges()[i].equals(testResult4.getRanges()[i]));
    }
  }
View Full Code Here

    final ByteArrayRange[] sfcRanges = new ByteArrayRange[hilbertRanges.size()];
    final int expectedByteCount = (int) Math.ceil(totalPrecision / 8.0);
    if (expectedByteCount <= 0) {
      // special case for no precision
      return new RangeDecomposition(
          new ByteArrayRange[] {
            new ByteArrayRange(
                new ByteArrayId(
                    new byte[] {}),
                new ByteArrayId(
                    new byte[] {}))
          });
    }
    for (int i = 0; i < hilbertRanges.size(); i++) {
      final FilteredIndexRange<BigIntegerRange, BigIntegerRange> range = hilbertRanges.get(i);
      // sanity check that values fit within the expected range
      // it seems that uzaygezen can produce a value at 2^totalPrecision
      // rather than 2^totalPrecision - 1
      final BigInteger startValue = clamp(
          minHilbertValue,
          maxHilbertValue,
          range.getIndexRange().getStart());
      final BigInteger endValue = clamp(
          minHilbertValue,
          maxHilbertValue,
          range.getIndexRange().getEnd().subtract(BigInteger.ONE));
      // make sure its padded if necessary
      final byte[] start = HilbertSFC.fitExpectedByteCount(
          expectedByteCount,
          startValue.toByteArray());

      // make sure its padded if necessary
      final byte[] end = HilbertSFC.fitExpectedByteCount(
          expectedByteCount,
          endValue.toByteArray());
      sfcRanges[i] = new ByteArrayRange(
          new ByteArrayId(
              start),
          new ByteArrayId(
              end));
    }

    final RangeDecomposition rangeDecomposition = new RangeDecomposition(
        sfcRanges);

    return rangeDecomposition;
  }
View Full Code Here

      final SpaceFillingCurve sfc,
      final int maxRanges,
      final byte tier ) {
    final List<ByteArrayRange> queryRanges = new ArrayList<ByteArrayRange>();
    for (final BinnedNumericDataset binnedQuery : binnedQueries) {
      final RangeDecomposition rangeDecomp = sfc.decomposeQuery(
          binnedQuery,
          maxRanges);
      final byte[] tierAndBinId = ByteArrayUtils.combineArrays(
          new byte[] {
            tier
          // we're assuming tiers only go to 127 (the max byte
          // value)
          },
          binnedQuery.getBinId());
      for (final ByteArrayRange range : rangeDecomp.getRanges()) {
        queryRanges.add(new ByteArrayRange(
            new ByteArrayId(
                ByteArrayUtils.combineArrays(
                    tierAndBinId,
                    range.getStart().getBytes())),
View Full Code Here

    final byte[] tierAndBinId = ByteArrayUtils.combineArrays(
        new byte[] {
          (byte) tier
        },
        index.getBinId());
    final RangeDecomposition rangeDecomp = sfc.decomposeQuery(
        index,
        DEFAULT_MAX_RANGES);
    // this range does not fit into a single row ID at the lowest
    // tier, decompose it
    for (final ByteArrayRange range : rangeDecomp.getRanges()) {
      final byte[] currentRowId = Arrays.copyOf(
          range.getStart().getBytes(),
          range.getStart().getBytes().length);
      retVal.add(new ByteArrayId(
          ByteArrayUtils.combineArrays(
View Full Code Here

    final ByteArrayRange[] sfcRanges = new ByteArrayRange[hilbertRanges.size()];
    final int expectedByteCount = (int) Math.ceil(totalPrecision / 8.0);
    if (expectedByteCount <= 0) {
      // special case for no precision
      return new RangeDecomposition(
          new ByteArrayRange[] {
            new ByteArrayRange(
                new ByteArrayId(
                    new byte[] {}),
                new ByteArrayId(
                    new byte[] {}))
          });
    }
    for (int i = 0; i < hilbertRanges.size(); i++) {
      final FilteredIndexRange<LongRange, LongRange> range = hilbertRanges.get(i);
      // sanity check that values fit within the expected range
      // it seems that uzaygezen can produce a value at 2^totalPrecision
      // rather than 2^totalPrecision - 1
      final long startValue = clamp(
          minHilbertValue,
          maxHilbertValue,
          range.getIndexRange().getStart());
      final long endValue = clamp(
          minHilbertValue,
          maxHilbertValue,
          range.getIndexRange().getEnd() - 1);
      // make sure its padded if necessary
      final byte[] start = HilbertSFC.fitExpectedByteCount(
          expectedByteCount,
          ByteBuffer.allocate(
              8).putLong(
              startValue).array());

      // make sure its padded if necessary
      final byte[] end = HilbertSFC.fitExpectedByteCount(
          expectedByteCount,
          ByteBuffer.allocate(
              8).putLong(
              endValue).array());
      sfcRanges[i] = new ByteArrayRange(
          new ByteArrayId(
              start),
          new ByteArrayId(
              end));
    }

    final RangeDecomposition rangeDecomposition = new RangeDecomposition(
        sfcRanges);

    return rangeDecomposition;
  }
View Full Code Here

TOP

Related Classes of mil.nga.giat.geowave.index.sfc.RangeDecomposition

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.