Example #1
0
  private void renderMarkers(Graphics2D g2d) {
    BaikalCore core = BaikalCore.getInstance();
    Insets insets = getInsets();
    int margin = ((Number) core.getEntry(PrefConst.MARKER_MARGIN)).intValue();
    int radius = ((Number) core.getEntry(PrefConst.MARKER_RADIUS)).intValue();
    int diameter = 2 * radius;

    int left = insets.left + margin;
    int right = getWidth() - insets.right - margin - diameter;
    int top = insets.top + margin;
    int bottom = getHeight() - insets.bottom - margin - diameter;
    int center_x = (left + right) / 2;
    int center_y = (top + bottom) / 2;

    g2d.setColor(MARKER_COLOR);
    g2d.fillOval(left, center_y, diameter, diameter);
    g2d.fillOval(center_x, top, diameter, diameter);
    g2d.fillOval(center_x, center_y, diameter, diameter);
    g2d.fillOval(center_x, bottom, diameter, diameter);
    g2d.fillOval(right, center_y, diameter, diameter);
    g2d.fillOval(left, top, diameter, diameter);
    g2d.fillOval(right, top, diameter, diameter);
    g2d.fillOval(left, bottom, diameter, diameter);
    g2d.fillOval(right, bottom, diameter, diameter);
  }
Example #2
0
  private void renderGridLines(Graphics2D g2d) {
    BaikalCore core = BaikalCore.getInstance();
    int densityX = ((Number) core.getEntry(PrefConst.HORZ_DENSITY)).intValue();
    int densityY = ((Number) core.getEntry(PrefConst.VERT_DENSITY)).intValue();
    int margin = ((Number) core.getEntry(PrefConst.MARKER_MARGIN)).intValue();
    int segCount = ((Number) core.getEntry(PrefConst.SEGMENT_COUNT)).intValue();
    int radius = ((Number) core.getEntry(PrefConst.MARKER_RADIUS)).intValue();

    int originalVertOffset = vertOffset_;
    int originalHorzOffset = horzOffset_;
    if (displayFullGrids_) {
      segCount = 1;
      vertOffset_ = 0;
      horzOffset_ = 0;
    }
    Insets insets = getInsets();

    double dx =
        (getWidth() - 2 * radius - 2 * margin - insets.left - insets.right)
            / (double) (densityX - 1);
    double dy =
        (getHeight() - 2 * radius - 2 * margin - insets.top - insets.bottom)
            / (double) (densityY - 1);
    g2d.setColor(GRID_LINE_COLOR);
    if (drawVertGridLines_) {
      for (int i = 0; i < densityX / segCount; i++) {
        int x = (int) Math.round(margin + radius + (i * segCount + vertOffset_) * dx);
        g2d.drawLine(x, margin + radius, x, getHeight() - margin - radius);
      }
    }
    if (drawHorzGridLines_) {
      for (int i = 0; i < densityY / segCount; i++) {
        int y = (int) Math.round(margin + radius + (i * segCount + horzOffset_) * dy);
        g2d.drawLine(margin + radius, y, getWidth() - margin - radius, y);
      }
    }
    vertOffset_ = originalVertOffset;
    horzOffset_ = originalHorzOffset;
  }