Class PiecewisePolylineVisualSet
java.lang.Object
com.amalgamasimulation.visualsets.VisualSet<Pair<Double,Double>>
com.amalgamasimulation.visualsets.AbstractLineVisualSet<Pair<Double,Double>>
com.amalgamasimulation.visualsets.AbstractPolylineVisualSet<Pair<Double,Double>>
com.amalgamasimulation.visualsets.PolylineVisualSet<Pair<Double,Double>>
com.amalgamasimulation.visualsets.PiecewisePolylineVisualSet
- All Implemented Interfaces:
IClipboardTextPropertyOwner<Double>,ILegendNodePropertiesOwner,IMinMaxValuePropertyOwner,IPiecewiseVisualSet,IUpdatePolicyPropertyOwner,IAbstractChartVisualSet,ILineChartVisualSet
public class PiecewisePolylineVisualSet
extends PolylineVisualSet<Pair<Double,Double>>
implements IPiecewiseVisualSet
Visual set for drawing line plots with points based on PiecewiseFunction.
Uses a discretization method to reduce the amount of data displayed on the chart to improve drawing performance.
The current arguments range displayed on the chart is always used to determine the sampling factor.
Only UpdatePolicy.DYNAMIC is supported.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested classes/interfaces inherited from class com.amalgamasimulation.visualsets.PolylineVisualSet
PolylineVisualSet.PolylineVisualElementNested classes/interfaces inherited from class com.amalgamasimulation.visualsets.AbstractPolylineVisualSet
AbstractPolylineVisualSet.AbstractPolylineVisualElementNested classes/interfaces inherited from class com.amalgamasimulation.visualsets.AbstractLineVisualSet
AbstractLineVisualSet.AbstractLineVisualElement, AbstractLineVisualSet.Extrapolation, AbstractLineVisualSet.PointsAndLinesStyleNested classes/interfaces inherited from class com.amalgamasimulation.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Supplier<PiecewiseFunction> protected PiecewiseFunction.InterpolationTypeprotected PiecewiseVisualSetRangePolicyFields inherited from class com.amalgamasimulation.visualsets.AbstractPolylineVisualSet
clipboardTextExtractorFields inherited from class com.amalgamasimulation.visualsets.AbstractLineVisualSet
extrapolation, legendTextProvider, lineColor, lineStyle, lineWidth, maxValueProvider, pointsAndLinesStyle, pointSize, valueExtractorFields inherited from class com.amalgamasimulation.visualsets.VisualSet
argumentExtractor, contentsToBeginArguments, contentsToEndArguments, contentsToVisualElements, contextMenuHandlers, dataElementsProvider, listeners, maxArgument, maxValueCache, minArgument, minValueCache, mouseEnterHandlers, mouseExitHandlers, mousePressedHandlers, mouseTransparent, name, needsUpdate, oldContentsList, tooltipTextExtractor, updatePolicy, visibilityChangeHandlers, visualElementsList -
Constructor Summary
ConstructorsConstructorDescriptionPiecewisePolylineVisualSet(String name, Supplier<PiecewiseFunction> piecewiseFunctionExtractor, Supplier<Pair<Double, Double>> displayedRangeExtractor, Supplier<Double> axisLengthInPixelsExtractor) Constructs a PiecewiseLineVisualSet with given name, piecewiseFunction extractor and discretization rule extractors. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns an actual plot X-axis length in pixels.doubleReturns a current argument shown on plot.Returns a current displayed range on plot.intReturns the minimum pixels per plot point for discretization.Returns data elements list provider.Returns the InterpolationType e.g.Returns the PiecewiseVisualSetRangePolicy for discretization.Return the currentVisualSet.UpdatePolicy.booleanReturns the necessity rule for discretization.setAxisLengthInPixelsExtractor(Supplier<Double> axisLengthInPixelsExtractor) Sets a function that specifies the rule for extracting an actual plot X-axis length in pixels.setCurrentArgumentExtractor(Supplier<Double> currentArgumentExtractor) Sets a function that specifies the rule for extracting a current argument shown on plot.setDiscretizeIfNecessaryExtractor(Supplier<Boolean> discretizeIfNecessaryExtractor) Sets a function that specifies the necessity rule for discretization.setDisplayedRangeExtractor(Supplier<Pair<Double, Double>> displayedRangeExtractor) Sets a function that specifies the rule for extracting a current displayed range on plot.voidsetMaxArgument(double maxArgument) voidsetMinArgument(double minArgument) setMinPixelsPerPlotPointExtractor(Supplier<Integer> minPixelsPerPlotPointExtractor) Sets a function that specifies the minimum pixels per plot point for discretization.setPiecewiseFunctionExtractor(Supplier<PiecewiseFunction> piecewiseFunctionExtractor) Sets data elements list provider.setPiecewiseFunctionInterpolationType(PiecewiseFunction.InterpolationType piecewiseFunctionInterpolationType) Sets the InterpolationType e.g.setPiecewiseVisualSetRangePolicy(PiecewiseVisualSetRangePolicy piecewiseVisualSetRangePolicy) Sets anPiecewiseVisualSetRangePolicyfor the IPiecewiseVisualSet displayed on the chart.setUpdatePolicy(VisualSet.UpdatePolicy updatePolicy) Sets the newVisualSet.UpdatePolicyi.e.protected voidMethods inherited from class com.amalgamasimulation.visualsets.PolylineVisualSet
addContextMenuHandler, addMouseEnterHandler, addMouseExitHandler, addMousePressedHandler, addVisibilityChangeHandler, createVisualElement, getInjectionIndex, getVisualElements, setClipboardText, setExtrapolation, setLegendText, setLineColor, setLineStyle, setLineWidth, setMaxValue, setMouseTransparent, setPointsAndLinesStyle, setPointSize, setTooltipTextMethods inherited from class com.amalgamasimulation.visualsets.AbstractPolylineVisualSet
getClipboardText, getValueMethods inherited from class com.amalgamasimulation.visualsets.AbstractLineVisualSet
getExtrapolation, getLegendColor, getLegendText, getLineColor, getLineStyle, getLineWidth, getMaxValue, getMinValue, getPointsAndLinesStyle, getPointSize, getValueMethods inherited from class com.amalgamasimulation.visualsets.VisualSet
addVisualElement, addVisualElement, addVisualSetChangeHandler, clearDependencies, getArgument, getContents, getContextMenuHandlers, getDataElements, getMaxArgument, getMinArgument, getMouseEnterHandlers, getMouseExitHandlers, getMousePressedHandlers, getName, getTooltipText, getVisibilityChangeHandlers, getVisibleVisualElementIndex, getVisibleVisualElementsCount, isMouseTransparent, isNeedsUpdate, recalculateVisualElements, removeContextMenuHandler, removeMouseEnterHandler, removeMouseExitHandler, removeMousePressedHandler, removeVisibilityChangeHandler, removeVisualElement, removeVisualSetChangeHandler, sortVisualElements, toString, update, updateMinMaxArgumentsValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.amalgamasimulation.visualsets.types.IAbstractChartVisualSet
addVisualSetChangeHandler, getContents, getMaxArgument, getMinArgument, getName, getVisibilityChangeHandlers, getVisibleVisualElementsCount, isMouseTransparent, removeVisibilityChangeHandler, removeVisualSetChangeHandlerMethods inherited from interface com.amalgamasimulation.visualsets.IPiecewiseVisualSet
getDiscretizationFactor, getDiscretizedDataElements, getMaxArgument, invalidatePiecewiseMinMaxArguments
-
Field Details
-
piecewiseVisualSetRangePolicy
-
piecewiseFunctionInterpolationType
-
piecewiseFunctionExtractor
-
displayedRangeExtractor
-
axisLengthInPixelsExtractor
-
discretizeIfNecessaryExtractor
-
minPixelsPerPlotPointExtractor
-
currentArgumentExtractor
-
-
Constructor Details
-
PiecewisePolylineVisualSet
public PiecewisePolylineVisualSet(String name, Supplier<PiecewiseFunction> piecewiseFunctionExtractor, Supplier<Pair<Double, Double>> displayedRangeExtractor, Supplier<Double> axisLengthInPixelsExtractor) Constructs a PiecewiseLineVisualSet with given name, piecewiseFunction extractor and discretization rule extractors.- Parameters:
name- visual set name is used to sort and name the visual sets on the chartpiecewiseFunctionExtractor- data elements list provider. The provider is invalidated every time the chart is being redrawndisplayedRangeExtractor- a function that specifies the rule for extracting a current displayed range on plotaxisLengthInPixelsExtractor- a function that specifies the rule for extracting an actual plot X-axis length in pixels
-
-
Method Details
-
setPiecewiseFunctionExtractor
public PiecewisePolylineVisualSet setPiecewiseFunctionExtractor(Supplier<PiecewiseFunction> piecewiseFunctionExtractor) Description copied from interface:IPiecewiseVisualSetSets data elements list provider. The provider is invalidated every time the chart is being redrawn.- Specified by:
setPiecewiseFunctionExtractorin interfaceIPiecewiseVisualSet- Parameters:
piecewiseFunctionExtractor- data elements list provider- Returns:
- reference to this object
-
setPiecewiseVisualSetRangePolicy
public PiecewisePolylineVisualSet setPiecewiseVisualSetRangePolicy(PiecewiseVisualSetRangePolicy piecewiseVisualSetRangePolicy) Description copied from interface:IPiecewiseVisualSetSets anPiecewiseVisualSetRangePolicyfor the IPiecewiseVisualSet displayed on the chart.- Specified by:
setPiecewiseVisualSetRangePolicyin interfaceIPiecewiseVisualSet- Parameters:
piecewiseVisualSetRangePolicy- anPiecewiseVisualSetRangePolicyfor the IPiecewiseVisualSet displayed on the chart.- Returns:
- reference to this object
-
setDiscretizeIfNecessaryExtractor
public PiecewisePolylineVisualSet setDiscretizeIfNecessaryExtractor(Supplier<Boolean> discretizeIfNecessaryExtractor) Description copied from interface:IPiecewiseVisualSetSets a function that specifies the necessity rule for discretization.- Specified by:
setDiscretizeIfNecessaryExtractorin interfaceIPiecewiseVisualSet- Parameters:
discretizeIfNecessaryExtractor- a function that specifies the necessity rule for discretization- Returns:
- reference to this object
-
setMinPixelsPerPlotPointExtractor
public PiecewisePolylineVisualSet setMinPixelsPerPlotPointExtractor(Supplier<Integer> minPixelsPerPlotPointExtractor) Description copied from interface:IPiecewiseVisualSetSets a function that specifies the minimum pixels per plot point for discretization.- Specified by:
setMinPixelsPerPlotPointExtractorin interfaceIPiecewiseVisualSet- Parameters:
minPixelsPerPlotPointExtractor- a function that specifies the minimum pixels per plot point for discretization- Returns:
- reference to this object
-
setDisplayedRangeExtractor
public PiecewisePolylineVisualSet setDisplayedRangeExtractor(Supplier<Pair<Double, Double>> displayedRangeExtractor) Description copied from interface:IPiecewiseVisualSetSets a function that specifies the rule for extracting a current displayed range on plot.- Specified by:
setDisplayedRangeExtractorin interfaceIPiecewiseVisualSet- Parameters:
displayedRangeExtractor- a function that specifies the rule for extracting a current displayed range on plot- Returns:
- reference to this object
-
setAxisLengthInPixelsExtractor
public PiecewisePolylineVisualSet setAxisLengthInPixelsExtractor(Supplier<Double> axisLengthInPixelsExtractor) Description copied from interface:IPiecewiseVisualSetSets a function that specifies the rule for extracting an actual plot X-axis length in pixels.- Specified by:
setAxisLengthInPixelsExtractorin interfaceIPiecewiseVisualSet- Parameters:
axisLengthInPixelsExtractor- a function that specifies the rule for extracting an actual plot X-axis length in pixels- Returns:
- reference to this object
-
setPiecewiseFunctionInterpolationType
public PiecewisePolylineVisualSet setPiecewiseFunctionInterpolationType(PiecewiseFunction.InterpolationType piecewiseFunctionInterpolationType) Description copied from interface:IPiecewiseVisualSetSets the InterpolationType e.g. the interpolation method between PiecewiseFunction grid points. InterpolationType.PEAK used by default.- Specified by:
setPiecewiseFunctionInterpolationTypein interfaceIPiecewiseVisualSet- Parameters:
piecewiseFunctionInterpolationType- the interpolation method between PiecewiseFunction grid points.- Returns:
- reference to this object
-
setCurrentArgumentExtractor
public PiecewisePolylineVisualSet setCurrentArgumentExtractor(Supplier<Double> currentArgumentExtractor) Description copied from interface:IPiecewiseVisualSetSets a function that specifies the rule for extracting a current argument shown on plot.- Specified by:
setCurrentArgumentExtractorin interfaceIPiecewiseVisualSet- Parameters:
currentArgumentExtractor- a function that specifies the rule for extracting a current argument shown on plot- Returns:
- reference to this object
-
getCurrentArgument
public double getCurrentArgument()Description copied from interface:IPiecewiseVisualSetReturns a current argument shown on plot.- Specified by:
getCurrentArgumentin interfaceIPiecewiseVisualSet- Returns:
- a current argument shown on plot
-
getPiecewiseFunction
Description copied from interface:IPiecewiseVisualSetReturns data elements list provider.- Specified by:
getPiecewiseFunctionin interfaceIPiecewiseVisualSet- Returns:
- data elements list provider.
-
getPiecewiseVisualSetRangePolicy
Description copied from interface:IPiecewiseVisualSetReturns the PiecewiseVisualSetRangePolicy for discretization.- Specified by:
getPiecewiseVisualSetRangePolicyin interfaceIPiecewiseVisualSet- Returns:
- the PiecewiseVisualSetRangePolicy for discretization
-
isDiscretizeIfNecessary
public boolean isDiscretizeIfNecessary()Description copied from interface:IPiecewiseVisualSetReturns the necessity rule for discretization.- Specified by:
isDiscretizeIfNecessaryin interfaceIPiecewiseVisualSet- Returns:
- the necessity rule for discretization
-
getMinPixelsPerPlotPoint
public int getMinPixelsPerPlotPoint()Description copied from interface:IPiecewiseVisualSetReturns the minimum pixels per plot point for discretization.- Specified by:
getMinPixelsPerPlotPointin interfaceIPiecewiseVisualSet- Returns:
- the minimum pixels per plot point for discretization
-
getDisplayedRange
Description copied from interface:IPiecewiseVisualSetReturns a current displayed range on plot.- Specified by:
getDisplayedRangein interfaceIPiecewiseVisualSet- Returns:
- a current displayed range on plot
-
getAxisLengthInPixels
public double getAxisLengthInPixels()Description copied from interface:IPiecewiseVisualSetReturns an actual plot X-axis length in pixels.- Specified by:
getAxisLengthInPixelsin interfaceIPiecewiseVisualSet- Returns:
- an actual plot X-axis length in pixels
-
getPiecewiseFunctionInterpolationType
Description copied from interface:IPiecewiseVisualSetReturns the InterpolationType e.g. the interpolation method between PiecewiseFunction grid points.- Specified by:
getPiecewiseFunctionInterpolationTypein interfaceIPiecewiseVisualSet- Returns:
- the InterpolationType e.g. the interpolation method between PiecewiseFunction grid points.
-
updateMinMaxArguments
protected void updateMinMaxArguments()- Overrides:
updateMinMaxArgumentsin classVisualSet<Pair<Double,Double>>
-
setMinArgument
public void setMinArgument(double minArgument) - Specified by:
setMinArgumentin interfaceIPiecewiseVisualSet
-
setMaxArgument
public void setMaxArgument(double maxArgument) - Specified by:
setMaxArgumentin interfaceIPiecewiseVisualSet
-
setUpdatePolicy
Description copied from interface:IAbstractChartVisualSetSets the newVisualSet.UpdatePolicyi.e. the VisualSet update control rule.- Specified by:
setUpdatePolicyin interfaceIAbstractChartVisualSet- Specified by:
setUpdatePolicyin interfaceIUpdatePolicyPropertyOwner- Overrides:
setUpdatePolicyin classPolylineVisualSet<Pair<Double,Double>> - Parameters:
updatePolicy- newVisualSet.UpdatePolicyi.e. the VisualSet update control rule- Returns:
- reference to this object
-
getUpdatePolicy
Description copied from interface:IAbstractChartVisualSetReturn the currentVisualSet.UpdatePolicy.- Specified by:
getUpdatePolicyin interfaceIAbstractChartVisualSet- Specified by:
getUpdatePolicyin interfaceIUpdatePolicyPropertyOwner- Overrides:
getUpdatePolicyin classVisualSet<Pair<Double,Double>> - Returns:
- the current
VisualSet.UpdatePolicy
-