Package org.timepedia.chronoscope.client.data

Examples of org.timepedia.chronoscope.client.data.MipMap


          .getWidth() : getMaxDrawableDataPoints(drawableDataset);
      MipMapRegion bestMipMapRegion = dataSet
          .getBestMipMapForInterval(plotDomain, overviewMode ? 2000 : maxDrawableDataPoints,
              overviewMode ? 0 : ((DefaultXYPlot)plot).isAnimating() ? -1 : 0);

      MipMap bestMipMap = bestMipMapRegion.getMipMap();
    
      if (drawableDataset.currMipMap.getLevel() != bestMipMap.getLevel()) {
        drawableDataset.currMipMap = bestMipMap;
        plot.getHoverPoints()[datasetIdx] = DefaultXYPlot.NO_SELECTION;
      }

      int domainStartIdx = bestMipMapRegion.getStartIndex();
View Full Code Here


      focusSeries = focus.getDatasetIndex();
      focusPoint = focus.getPointIndex();
      focusDomainX = focus.getDomainX();
    }

    MipMap currMipMap = dds.currMipMap;
    final int domainStartIdx = dds.visDomainStartIndex;
    final int domainEndIdx = dds.visDomainEndIndex;

    RangeAxis rangeAxis = plot.getRangeAxis(datasetIndex);
    final boolean calcRangeAsPercent = rangeAxis.isCalcRangeAsPercent();

    // Render the curve

    double refY = calcReferenceY(rangeAxis, dds);

    int[] passOrder = renderer.getPassOrder(dataSet);
    for (int pass : passOrder) {
      renderState.setDisabled((focusSeries != -1) && (focusSeries != datasetIndex));
      renderState.setPassNumber(pass);

      Iterator<Tuple2D> tupleItr = currMipMap.getTupleIterator(domainStartIdx);

      renderer.beginCurve(layer, renderState);
      int methodCallCount = 0;
      for (int i = domainStartIdx; i <= domainEndIdx; i++) {
         if (tupleItr.hasNext()){
            Tuple2D dataPt = tupleItr.next();
            renderState.setFocused(focusSeries == datasetIndex && focusDomainX == dataPt.getDomain());

            if (calcRangeAsPercent) {
              LocalTuple tmpTuple = new LocalTuple();
              Interval rangeExtrema = dds.currMipMap.getRangeExtrema(pass);
              double pctY = rangeExtrema.getPercentChange(refY, dataPt.getRange0());
              tmpTuple.setXY(dataPt.getDomain(), pctY);
              dataPt = tmpTuple;
            }
            // FIXME: refactor to remove cast
            renderer.drawCurvePart(datasetIndex, i, layer, (T) dataPt, methodCallCount++, renderState);
         } else {
             break;
         }
      }
      renderer.endCurve(layer, renderState);

      if (!overviewMode) {
        // Render the focus points on the curve
        renderer.beginPoints(layer, renderState);
        //startIdx = Math.max(0, domainStartIdx - 2);
        tupleItr = currMipMap.getTupleIterator(domainStartIdx);
        for (int i = domainStartIdx; i <= domainEndIdx; i++) {
          Tuple2D dataPt = tupleItr.next();
          renderState.setFocused(focusSeries == datasetIndex && focusPoint == i && focusDomainX == dataPt.getDomain() && renderState.getPassNumber() == pass);

          if (calcRangeAsPercent) {
View Full Code Here

    Interval widestPlotDomain = null;
    for (DrawableDataset<T> dds : drawableDatasets) {
      Dataset<T> ds = dds.dataset;
      final int maxDrawableDataPoints = getMaxDrawableDataPoints(dds);
      MipMap mm = ds.getMipMapChain()
          .findHighestResolution(maxDrawableDataPoints);

      Interval drawableDomain = dds.getRenderer()
          .getDrawableDomain(mm.getDomain());
      if (widestPlotDomain == null) {
        widestPlotDomain = drawableDomain;
      } else {
        widestPlotDomain.expand(drawableDomain);
      }
View Full Code Here

   * object.
   */
  public void adjustAbsRange(Dataset ds) {
    if (!rangeOveriddenLow || !rangeOveriddenHigh) {
      DatasetRenderer dr = plot.getDatasetRenderer(plot.getDatasets().indexOf(ds));
      MipMap m = ds.getMipMapChain().getMipMap(0);

      while (m != null) {
        if (m.getLevel() > 1 && m.size() < plot.getMaxDrawableDataPoints()) {
          break;
        }
        Interval rangeExtrema = dr.getRangeExtrema(m);
        double rangeMin = rangeExtrema.getStart();
        double rangeMax = rangeExtrema.getEnd();
        // rangeLength = rangeExtrema.length();
        setAbsLength(rangeMin, rangeMax);

        if (calcRangeAsPercent) {
          final double refY = dr.getRange(ds.getFlyweightTuple(0));
          double rmin = rangeOveriddenLow ? absRangeMin : rangeMin;
          double rmax = rangeOveriddenHigh ? absRangeMax : rangeMax;
          double normalizedMin = rangeExtrema.getPercentChange(refY, rmin);
          double normalizedMax = rangeExtrema.getPercentChange(refY, rmax);
          setAbsRange( normalizedMin, normalizedMax);
        } else {
          setAbsRange(
            Math.min(absRangeMin, rangeOveriddenLow ? absRangeMin : rangeMin),
            Math.max(absRangeMax, rangeOveriddenHigh ? absRangeMax : rangeMax));
        }
        m = m.next();
      }
    }
  }
View Full Code Here

    double end = Double.MIN_VALUE;

    for (Dataset<T> ds : dataSets) {
      // find the lowest mip level whose # of data points is not greater
      // than maxDrawableDataPoints
      MipMap mipMap = ds.getMipMapChain()
          .findHighestResolution(maxDrawableDataPoints);
      end = Math.max(end, mipMap.getDomain().getLast());
    }
    return end;
  }
View Full Code Here

   *                     (dataX, dataY).
   */
  private void findNearestPt(double dataX, double dataY, int datasetIndex,
      DistanceFormula df, NearestPoint np) {

    MipMap currMipMap = plotRenderer
        .getDrawableDataset(datasetIndex).currMipMap;

    // Find index of data point closest to the right of dataX at the current MIP level
    int closestPtToRight = Util.binarySearch(currMipMap.getDomain(), dataX);

    double sx = domainToScreenX(dataX, datasetIndex);
    double sy = rangeToScreenY(dataY, datasetIndex);
    Tuple2D tupleRight = currMipMap.getTuple(closestPtToRight);
    double rx = domainToScreenX(tupleRight.getDomain(), datasetIndex);
    double ry = rangeToScreenY(tupleRight, datasetIndex, 0);

    int nearestHoverPt;
    if (closestPtToRight == 0) {
      nearestHoverPt = closestPtToRight;
      np.dist = df.dist(sx, sy, rx, ry);
      np.dim = 0;
      for (int d = 1; d < currMipMap.getRangeTupleSize(); d++) {
        double dist2 = df.dist(sx, sy, rx,
            rangeToScreenY(tupleRight, datasetIndex, d));
        if (dist2 < np.dist) {
          np.dist = dist2;
          np.dim = d;
        }
      }
    } else {
      int closestPtToLeft = closestPtToRight - 1;
      Tuple2D tupleLeft = currMipMap.getTuple(closestPtToLeft);
      double lx = domainToScreenX(tupleLeft.getDomain(), datasetIndex);
      double ly = rangeToScreenY(tupleLeft, datasetIndex, 0);
      double lDist = df.dist(sx, sy, lx, ly);
      double rDist = df.dist(sx, sy, rx, ry);
      np.dim = 0;
      if (lDist <= rDist) {
        nearestHoverPt = closestPtToLeft;
        np.dist = lDist;
      } else {
        nearestHoverPt = closestPtToRight;
        np.dist = rDist;
      }
      for (int d = 1; d < currMipMap.getRangeTupleSize(); d++) {
        lDist = df.dist(sx, sy, lx,
            rangeToScreenY(tupleLeft, datasetIndex, d));
        rDist = df.dist(sx, sy, rx,
            rangeToScreenY(tupleRight, datasetIndex, d));
        if (lDist <= rDist && lDist <= np.dist) {
View Full Code Here

    if (focus == null) {
      // If no data point currently has the focus, then set the focus point to
      // the point on dataset [0] that's closest to the center of the screen.
      focusDatasetIdx = 0;
      ds = datasets.get(focusDatasetIdx);
      MipMap mipMap = plotRenderer
          .getDrawableDataset(focusDatasetIdx).currMipMap;
      double domainCenter = visDomain.midpoint();
      focusPointIdx = Util.binarySearch(mipMap.getDomain(), domainCenter);
    } else {
      // some data point currently has the focus.
      focusDatasetIdx = focus.getDatasetIndex();
      focusPointIdx = focus.getPointIndex();
      focusDim = focus.getDimensionIndex();
      MipMap mipMap = plotRenderer
          .getDrawableDataset(focusDatasetIdx).currMipMap;
      focusPointIdx += n;

      if (focusPointIdx >= mipMap.size()) {
        focusDim++;
        if (focus.getDimensionIndex() < mipMap.getRangeTupleSize()) {
          focusPointIdx = 0;
        } else {
          focusDim = 0;
          ++focusDatasetIdx;
          if (focusDatasetIdx >= datasets.size()) {
            focusDatasetIdx = 0;
          }
        }
        focusPointIdx = 0;
      } else if (focusPointIdx < 0) {
        focusDim--;
        if (focusDim >= 0) {
          focusPointIdx =
              plotRenderer.getDrawableDataset(focusDatasetIdx).currMipMap.size()
                  - 1;
        } else {
          focusDim = 0;
          --focusDatasetIdx;
          if (focusDatasetIdx < 0) {
            focusDatasetIdx = datasets.size() - 1;
          }
          focusPointIdx =
              plotRenderer.getDrawableDataset(focusDatasetIdx).currMipMap.size()
                  - 1;
        }
      }

      ds = datasets.get(focusDatasetIdx);
    }

    MipMap currMipMap = plotRenderer
        .getDrawableDataset(focusDatasetIdx).currMipMap;
    Tuple2D dataPt = currMipMap.getTuple(focusPointIdx);
    double dataX = dataPt.getDomain();
    double dataY = dataPt.getRange0();
    ensureVisible(dataX, dataY, null);
    setFocusAndNotifyView(focusDatasetIdx, focusPointIdx, focusDim);
    redraw();
View Full Code Here

TOP

Related Classes of org.timepedia.chronoscope.client.data.MipMap

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.