示例#1
0
  protected void brushRect(
      PoGraSS g, SMarkerInterface m, int orientation, Rectangle r, Color borderColor) {
    int rX = r.x, rY = r.y, rW = r.width, rH = r.height;
    final double totW = rW;
    final double totH = rH;
    int mark = -1;
    int shift = 0;
    boolean hasAny = false;

    double totalProp = 0;
    double[] props = new double[m.getMaxMark() + 2];
    for (int i = -1; i <= m.getMaxMark(); i++) {
      props[i + 1] = getMarkedProportion(m, i, true);
      totalProp += props[i + 1];
    }
    if (totalProp >= 0.0000001) {
      final int hw = (((orientation & 1) == 0) ? rH : rW);

      pieces = roundProportions(props, totalProp, hw);
      for (int i = -1; i <= m.getMaxMark(); i++) {
        if (props[i + 1] > 0d) {
          hasAny = true;
          if (orientation == 0) { // bottom-up
            rH = pieces[i + 1];
            rY = r.y + r.height - shift - pieces[i + 1];
          } else if (orientation == 2) { // top-down
            rH = pieces[i + 1];
            rY = r.y + shift;
          } else if (orientation == 1) { // left-right
            rW = pieces[i + 1];
            rX = r.x + shift;
          } else if (orientation == 3) { // right-left
            rW = pieces[i + 1];
            rX = r.x + r.width - shift - pieces[i + 1];
          }
          shift += pieces[i + 1];
          g.setColor((i == -1) ? fillColorSel : ColorBridge.getMain().getColor(i));
          g.fillRect(rX, rY, rW, rH);
        }
      }
    }

    if (hasAny) drawRect(g, r, null, borderColor);
  }
示例#2
0
 protected boolean isBrushed(final SMarkerInterface m) {
   return m.getSecCount() >= 1;
 }