Class PieSliceView

java.lang.Object
hec.gfx2d.swing.charts.pie.PieSliceView

public class PieSliceView extends Object
Copyright (C) 2017 Hydrologic Engineering Center, United States Army Corps of Engineers, All Rights Reserved

HEC-Java NEXGEN

  • Constructor Details

    • PieSliceView

      public PieSliceView(RmaDataId id)
  • Method Details

    • getId

      public RmaDataId getId()
    • contains

      public boolean contains(Point2D point)
    • setSelected

      public void setSelected(boolean selected)
    • isSelected

      public boolean isSelected()
    • drawSliceMask

      public void drawSliceMask(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
      This slice mask renders black over a portion of the slice that we want to render color. if this isn't done with the same variables as the drawSliceColor function, the behavior is not guaranteed. This also requires that the background is either transparent, or white, so that the color can properly be applied to the black portions.
      Parameters:
      g2d -
      center -
      maxRadius -
      startAngle -
      arcAngle -
      controller -
    • drawSlice

      public void drawSlice(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
      Because the slices require two render passes, this allows us to do that all in one go, but it may not be efficient this way at times. Allowing the user to render the mask and color separately is very important.
      Parameters:
      g2d -
      center -
      maxRadius -
      startAngle -
      arcAngle -
      controller -
    • drawSliceLabel

      public void drawSliceLabel(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
      Draws the labels related to the slice.
      Parameters:
      g2d -
      center -
      maxRadius -
      startAngle -
      arcAngle -
      controller -
    • drawSliceColor

      public void drawSliceColor(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
      This renders the color portion of the slice. This is primarily used to render a full slice given the max radius, and it requires an underlying black mask for the color portions that should be rendered. This allows us to avoid dealing with the Gradient garbledegook while also rendering the correct portion.
      Parameters:
      g2d -
      center -
      maxRadius -
      startAngle -
      arcAngle -
      controller -
    • drawRadialMarksAndLabels

      public void drawRadialMarksAndLabels(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
    • drawValueMarksAndLabels

      public void drawValueMarksAndLabels(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller)
    • drawThreshold

      public void drawThreshold(Graphics2D g2d, Threshold threshold, Point2D center, double maxRadius, double startAngle, double arcAngle, Arc2D markArc)
    • drawSelected

      public void drawSelected(Graphics2D g2d, PieChartPanel controller)
    • computePercentFull

      protected double computePercentFull(double valueRadius, double maxRadius, PieChartPanel controller)
    • establishContour

      protected void establishContour(Graphics2D g2d, Point2D center, double fillRadius, double maxRadius, PieChartPanel controller)
    • buildAlphaColor

      protected Color buildAlphaColor(Color color, ColorContourRecord record)
    • buildSingleColorFromContour

      protected Color buildSingleColorFromContour(double percentFull, ColorContour contour, ColorContourRecord contourRecord)
    • buildGradientFromContour

      protected RadialGradientPaint buildGradientFromContour(Point2D center, int percentFull, double maxRadius, ColorContour contour, ColorContourRecord record)