Package hec.gfx2d.swing.charts.pie
Class PieSliceView
java.lang.Object
hec.gfx2d.swing.charts.pie.PieSliceView
Copyright (C) 2017 Hydrologic Engineering Center,
United States Army Corps of Engineers, All Rights Reserved
HEC-Java NEXGEN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Color
buildAlphaColor
(Color color, ColorContourRecord record) protected RadialGradientPaint
buildGradientFromContour
(Point2D center, int percentFull, double maxRadius, ColorContour contour, ColorContourRecord record) protected Color
buildSingleColorFromContour
(double percentFull, ColorContour contour, ColorContourRecord contourRecord) protected double
computePercentFull
(double valueRadius, double maxRadius, PieChartPanel controller) boolean
void
drawRadialMarksAndLabels
(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller) void
drawSelected
(Graphics2D g2d, PieChartPanel controller) 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.void
drawSliceColor
(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller) This renders the color portion of the slice.void
drawSliceLabel
(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller) Draws the labels related to the slice.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.void
drawThreshold
(Graphics2D g2d, Threshold threshold, Point2D center, double maxRadius, double startAngle, double arcAngle, Arc2D markArc) void
drawValueMarksAndLabels
(Graphics2D g2d, Point2D center, double maxRadius, double startAngle, double arcAngle, PieChartPanel controller) protected void
establishContour
(Graphics2D g2d, Point2D center, double fillRadius, double maxRadius, PieChartPanel controller) getId()
boolean
void
setSelected
(boolean selected)
-
Constructor Details
-
PieSliceView
-
-
Method Details
-
getId
-
contains
-
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
-
computePercentFull
-
establishContour
protected void establishContour(Graphics2D g2d, Point2D center, double fillRadius, double maxRadius, PieChartPanel controller) -
buildAlphaColor
-
buildSingleColorFromContour
protected Color buildSingleColorFromContour(double percentFull, ColorContour contour, ColorContourRecord contourRecord) -
buildGradientFromContour
protected RadialGradientPaint buildGradientFromContour(Point2D center, int percentFull, double maxRadius, ColorContour contour, ColorContourRecord record)
-