Exemple #1
0
 protected void drawRect(
     PoGraSS g, int rX, int rY, int rW, int rH, Color fillColor, Color borderColor) {
   if (filled && fillColor != null) {
     g.setColor(fillColor);
     g.fillRect(rX, rY, rW, rH);
   }
   if (borderColor != null) {
     g.setColor(borderColor);
     g.drawRect(rX, rY, rW, rH);
   }
 }
Exemple #2
0
  public void paintSelected(final PoGraSS g, int orientation, final SMarkerInterface m) {
    if (r == null) return;
    // TODO: this is really ugly and should be done better
    // so orientation has to be moved to plotprimitives
    if (!useCanvasOrientation) orientation = this.orientation;

    final double sa = getMarkedProportion(m, -1);
    if (sa > 0d) {
      boolean hasAny = false;
      if (!allowColorBrushing || !isBrushed(m)) { // no color brushing
        int rX = r.x, rY = r.y, rW = r.width - 1, rH = r.height - 1;

        hasAny = true;
        switch (orientation) {
          case 0:
            rH = getPropSize(rH, sa);
            rY += r.height - rH;
            rX++;
            break;
          case 1:
            rW = getPropSize(rW, sa);
            rX++;
            rY++;
            break;
          case 2:
            rH = getPropSize(rH, sa);
            rX++;
            rY++;
            break;
          case 3:
            rW = getPropSize(rW, sa);
            rX += r.width - rW;
            rY++;
            break;
        }

        drawRect(g, rX, rY, rW, rH, fillColorSel, null);
      } else { // color brushing
        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;

        if (pieces != null) {
          /* old code for "zebra hiliting"
          for(int i=0; i<=m.getMaxMark(); i++){
              if (pieces[i]>0) {
                  double rmp = getRelativeMarkedProportion(m,i);
                  if (rmp>0d){
                      hasAny=true;
                      if (orientation==0) { // bottom-up
                          rH=getPropSize(pieces[i],rmp);
                          rY=r.y+r.height-shift-rH;
                      } else if (orientation==2) { // top-down
                          rH=getPropSize(pieces[i],rmp);
                          rY=r.y+shift;
                      } else if (orientation==1) { // left-right
                          rW=getPropSize(pieces[i],rmp);
                          rX=r.x+shift;
                      } else if (orientation==3) { // right-left
                          rW=getPropSize(pieces[i],rmp);
                          rX=r.x+r.width-shift-rW;
                      }
                      g.setColor(fillColorSel);
                      g.fillRect(rX,rY,rW,rH);
                  }
                  shift+=pieces[i];
              }
          }
           */
        }
      }
      if (hasAny) {
        g.setColor(borderColorSel);
        g.drawRect(r.x, r.y, r.width, r.height);
      }
    }
  }