Exemplo n.º 1
0
  public double[] isSelected(int[] screenCoordTest, AbstractDrawer draw) {
    for (int i = 0; i < XY.length; i++) {
      int[] screenCoord = draw.project(XY[i]);

      if ((screenCoord[0] + note_precision > screenCoordTest[0])
          && (screenCoord[0] - note_precision < screenCoordTest[0])
          && (screenCoord[1] + note_precision > screenCoordTest[1])
          && (screenCoord[1] - note_precision < screenCoordTest[1])) return XY[i];
    }
    return null;
  }
Exemplo n.º 2
0
  public void plot(AbstractDrawer draw, Color c) {
    if (!visible) return;

    draw.canvas.includeInBounds(bottomLeft[0]);
    draw.canvas.includeInBounds(topRight[XY.length - 1]);

    draw.setColor(c);
    draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
    int xyl = XY.length;
    if (xyl < PlotGlobals.limitPlotPoints || PlotGlobals.skipPointsOnPlot == false) {
      for (int i = 0; i < XY.length; i++) {
        draw.drawLine(bottomLeft[i], topLeft[i]);
        draw.drawLine(topLeft[i], topRight[i]);
        draw.drawLine(topRight[i], bottomRight[i]);
        draw.drawLine(bottomRight[i], bottomLeft[i]);

        if (fill_shape)
          draw.fillPolygon(0.2f, bottomLeft[i], topLeft[i], topRight[i], bottomRight[i]);
      }
    } else {
      int skipPoints = ((int) (xyl / PlotGlobals.limitPlotPoints)) + 1;
      for (int i = 0; i < XY.length - skipPoints - 1; i += skipPoints) {
        draw.drawLine(bottomLeft[i], topLeft[i]);
        draw.drawLine(topLeft[i], topRight[i]);
        draw.drawLine(topRight[i], bottomRight[i]);
        draw.drawLine(bottomRight[i], bottomLeft[i]);

        if (fill_shape)
          draw.fillPolygon(0.2f, bottomLeft[i], topLeft[i], topRight[i], bottomRight[i]);
      }
    }
  }