コード例 #1
0
ファイル: MeterPlot.java プロジェクト: nologic/nabs
  /**
   * Draws the arc to represent an interval.
   *
   * @param g2 the graphics device.
   * @param meterArea the drawing area.
   * @param interval the interval.
   */
  protected void drawArcForInterval(Graphics2D g2, Rectangle2D meterArea, MeterInterval interval) {

    double minValue = interval.getRange().getLowerBound();
    double maxValue = interval.getRange().getUpperBound();
    Paint outlinePaint = interval.getOutlinePaint();
    Stroke outlineStroke = interval.getOutlineStroke();
    Paint backgroundPaint = interval.getBackgroundPaint();

    if (backgroundPaint != null) {
      fillArc(g2, meterArea, minValue, maxValue, backgroundPaint, false);
    }
    if (outlinePaint != null) {
      if (outlineStroke != null) {
        drawArc(g2, meterArea, minValue, maxValue, outlinePaint, outlineStroke);
      }
      drawTick(g2, meterArea, minValue, true);
      drawTick(g2, meterArea, maxValue, true);
    }
  }
コード例 #2
0
ファイル: MeterPlot.java プロジェクト: nologic/nabs
 /**
  * Returns an item for each interval.
  *
  * @return A collection of legend items.
  */
 public LegendItemCollection getLegendItems() {
   LegendItemCollection result = new LegendItemCollection();
   Iterator iterator = this.intervals.iterator();
   while (iterator.hasNext()) {
     MeterInterval mi = (MeterInterval) iterator.next();
     Paint color = mi.getBackgroundPaint();
     if (color == null) {
       color = mi.getOutlinePaint();
     }
     LegendItem item =
         new LegendItem(
             mi.getLabel(),
             mi.getLabel(),
             null,
             null,
             new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0),
             color);
     result.add(item);
   }
   return result;
 }